diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index b0ccef84..30a0b653 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -75,6 +75,10 @@ if (XQC_ENABLE_EVENT_LOG) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_ENABLE_EVENT_LOG ") endif() +if (DISABLE_WARNINGS) + add_compile_options("-Wno-error") +endif () + if(ANDROID) set(DYMAMIC_LINK_OPTION ${DYMAMIC_LINK_OPTION} diff --git a/docs/Platforms.md b/docs/Platforms.md index a347bfa3..2340eba1 100644 --- a/docs/Platforms.md +++ b/docs/Platforms.md @@ -1,17 +1,17 @@ # Platforms docs -XQUIC currently supports `Android` , `iOS` , `Linux` and `macOS` . +XQUIC currently supports `Android` , `iOS` , `HarmonyOS` , `Linux` , `macOS` and `Windows` . -## Android/iOS Compile Script +## Android/iOS/HarmonyOS Compile Script -The Android and iOS use `.so` files, there is a [ `xqc_build.sh` ](../xqc_build.sh) script in the XQUIC library directory, execute the script to compile to complete the corresponding compilation. +The Android, iOS and HarmonyOS use `.so` files, there is a [ `xqc_build.sh` ](../xqc_build.sh) script in the XQUIC library directory, execute the script to compile to complete the corresponding compilation. ```bash -sh xqc_build.sh ios/android +sh xqc_build.sh ios/android/harmony ``` specially, ` can be ${PWD}/third_party/boringssl or ${PWD}/third_party/babassl` -> Note: You need to specify the IOS/android build toolchain before compiling, download and set the environment variable IOS_CMAKE_TOOLCHAIN or ANDROID_NDK, or directly modify CMAKE_TOOLCHAIN_FILE in `xqc_build.sh` . +> Note: You need to specify the IOS/android/harmony build toolchain before compiling, download and set the environment variable IOS_CMAKE_TOOLCHAIN or ANDROID_NDK or HMOS_CMAKE_PATH and HMOS_CMAKE_TOOLCHAIN, or directly modify CMAKE_TOOLCHAIN_FILE and HMOS_CMAKE_TOOLCHAIN in `xqc_build.sh` . ## Linux Release diff --git a/xqc_build.sh b/xqc_build.sh index 8778d11b..fb58d8e8 100755 --- a/xqc_build.sh +++ b/xqc_build.sh @@ -3,6 +3,8 @@ android_archs=(armeabi-v7a arm64-v8a) ios_archs=(armv7 arm64 x86_64) +hmos_archs=(arm64-v8a) +CMAKE_CMD="cmake" cur_dir=$(cd "$(dirname "$0")";pwd) cp -f $cur_dir/cmake/CMakeLists.txt $cur_dir/CMakeLists.txt @@ -57,14 +59,16 @@ if [ x"$platform" == xios ] ; then -DXQC_BUILD_SAMPLE=OFF -DGCOV=OFF -DCMAKE_TOOLCHAIN_FILE=${IOS_CMAKE_TOOLCHAIN} - -DENABLE_BITCODE=0 - -DXQC_NO_SHARED=1 - -DXQC_COMPAT_GENERATE_SR_PKT=1 - -DXQC_ENABLE_RENO=1 - -DXQC_ENABLE_BBR2=1 - -DXQC_ENABLE_COPA=1 - -DXQC_ENABLE_UNLIMITED=0 - -DXQC_ENABLE_MP_INTEROP=0" + -DENABLE_BITCODE=OFF + -DXQC_NO_SHARED=ON + -DXQC_ENABLE_RENO=OFF + -DXQC_ENABLE_BBR2=ON + -DXQC_ENABLE_COPA=OFF + -DXQC_ENABLE_UNLIMITED=OFF + -DXQC_ENABLE_MP_INTEROP=OFF + -DXQC_DISABLE_LOG=OFF + -DXQC_ONLY_ERROR_LOG=ON + -DXQC_COMPAT_GENERATE_SR_PKT=ON" elif [ x"$platform" == xandroid ] ; then if [ x"$ANDROID_NDK" == x ] ; then @@ -90,6 +94,37 @@ elif [ x"$platform" == xandroid ] ; then -DXQC_DISABLE_LOG=OFF -DXQC_ONLY_ERROR_LOG=ON -DXQC_COMPAT_GENERATE_SR_PKT=ON" +elif [ x"$platform" == xharmony ] ; then + if [ x"$HMOS_CMAKE_TOOLCHAIN" == x ] ; then + echo "HMOS_CMAKE_TOOLCHAIN MUST be defined" + exit 0 + fi + echo "HMOS_CMAKE_TOOLCHAIN: ${HMOS_CMAKE_TOOLCHAIN}" + + if [ x"$HMOS_CMAKE_PATH" == x ] ; then + echo "HMOS_CMAKE_PATH MUST be defined" + exit 0 + fi + echo "HMOS_CMAKE_PATH: ${HMOS_CMAKE_PATH}" + CMAKE_CMD=${HMOS_CMAKE_PATH} + + archs=${hmos_archs[@]} + configures="-DSSL_TYPE=${ssl_type} + -DSSL_PATH=${ssl_path} + -DCMAKE_BUILD_TYPE=Release + -DXQC_ENABLE_TESTING=OFF + -DXQC_BUILD_SAMPLE=OFF + -DGCOV=OFF + -DCMAKE_TOOLCHAIN_FILE=${HMOS_CMAKE_TOOLCHAIN} + -DXQC_ENABLE_RENO=OFF + -DXQC_ENABLE_BBR2=ON + -DXQC_ENABLE_COPA=OFF + -DXQC_ENABLE_UNLIMITED=OFF + -DXQC_ENABLE_MP_INTEROP=OFF + -DXQC_DISABLE_LOG=OFF + -DXQC_ONLY_ERROR_LOG=ON + -DXQC_COMPAT_GENERATE_SR_PKT=ON + -DDISABLE_WARNINGS=ON" else echo "no support platform" exit 0 @@ -105,6 +140,8 @@ generate_plat_spec() { elif [ x"$1" == xi386 ] ; then plat_spec="$plat_spec -DPLATFORM=SIMULATOR" fi + elif [ x"$platform" == xharmony ] ; then + plat_spec="-DOHOS_ARCH=$1" else plat_spec="-DANDROID_ABI=$1" fi @@ -131,7 +168,7 @@ do rm -rf third_party echo "compiling xquic on $i arch" - cmake $configures $(generate_plat_spec $i ) -DLIBRARY_OUTPUT_PATH=`pwd`/outputs/ .. + "${CMAKE_CMD}" $configures $(generate_plat_spec $i ) -DLIBRARY_OUTPUT_PATH=`pwd`/outputs/ .. make -j 4 if [ $? != 0 ] ; then exit 0