Skip to content

Commit 68366f6

Browse files
[+] support harmony (#434)
* [+] support harmony * Update docs/Platforms.md * Update docs/Platforms.md * Update docs/Platforms.md --------- Co-authored-by: Yanmei Liu <[email protected]>
1 parent 07b1838 commit 68366f6

File tree

3 files changed

+55
-14
lines changed

3 files changed

+55
-14
lines changed

cmake/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ if (XQC_ENABLE_EVENT_LOG)
7575
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DXQC_ENABLE_EVENT_LOG ")
7676
endif()
7777

78+
if (DISABLE_WARNINGS)
79+
add_compile_options("-Wno-error")
80+
endif ()
81+
7882
if(ANDROID)
7983
set(DYMAMIC_LINK_OPTION
8084
${DYMAMIC_LINK_OPTION}

docs/Platforms.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
# Platforms docs
22

3-
XQUIC currently supports `Android` , `iOS` , `Linux` and `macOS` .
3+
XQUIC currently supports `Android` , `iOS` , `HarmonyOS` , `Linux` , `macOS` and `Windows` .
44

5-
## Android/iOS Compile Script
5+
## Android/iOS/HarmonyOS Compile Script
66

7-
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.
7+
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.
88

99
```bash
10-
sh xqc_build.sh ios/android <build_dir> <artifact_dir> <ssl_path>
10+
sh xqc_build.sh ios/android/harmony <build_dir> <artifact_dir> <ssl_path>
1111
```
1212
specially, `<ssl_path> can be ${PWD}/third_party/boringssl or ${PWD}/third_party/babassl`
1313

14-
> 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` .
14+
> 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` .
1515
1616
## Linux Release
1717

xqc_build.sh

+46-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
android_archs=(armeabi-v7a arm64-v8a)
55
ios_archs=(armv7 arm64 x86_64)
6+
hmos_archs=(arm64-v8a)
7+
CMAKE_CMD="cmake"
68
cur_dir=$(cd "$(dirname "$0")";pwd)
79

810
cp -f $cur_dir/cmake/CMakeLists.txt $cur_dir/CMakeLists.txt
@@ -57,14 +59,16 @@ if [ x"$platform" == xios ] ; then
5759
-DXQC_BUILD_SAMPLE=OFF
5860
-DGCOV=OFF
5961
-DCMAKE_TOOLCHAIN_FILE=${IOS_CMAKE_TOOLCHAIN}
60-
-DENABLE_BITCODE=0
61-
-DXQC_NO_SHARED=1
62-
-DXQC_COMPAT_GENERATE_SR_PKT=1
63-
-DXQC_ENABLE_RENO=1
64-
-DXQC_ENABLE_BBR2=1
65-
-DXQC_ENABLE_COPA=1
66-
-DXQC_ENABLE_UNLIMITED=0
67-
-DXQC_ENABLE_MP_INTEROP=0"
62+
-DENABLE_BITCODE=OFF
63+
-DXQC_NO_SHARED=ON
64+
-DXQC_ENABLE_RENO=OFF
65+
-DXQC_ENABLE_BBR2=ON
66+
-DXQC_ENABLE_COPA=OFF
67+
-DXQC_ENABLE_UNLIMITED=OFF
68+
-DXQC_ENABLE_MP_INTEROP=OFF
69+
-DXQC_DISABLE_LOG=OFF
70+
-DXQC_ONLY_ERROR_LOG=ON
71+
-DXQC_COMPAT_GENERATE_SR_PKT=ON"
6872

6973
elif [ x"$platform" == xandroid ] ; then
7074
if [ x"$ANDROID_NDK" == x ] ; then
@@ -90,6 +94,37 @@ elif [ x"$platform" == xandroid ] ; then
9094
-DXQC_DISABLE_LOG=OFF
9195
-DXQC_ONLY_ERROR_LOG=ON
9296
-DXQC_COMPAT_GENERATE_SR_PKT=ON"
97+
elif [ x"$platform" == xharmony ] ; then
98+
if [ x"$HMOS_CMAKE_TOOLCHAIN" == x ] ; then
99+
echo "HMOS_CMAKE_TOOLCHAIN MUST be defined"
100+
exit 0
101+
fi
102+
echo "HMOS_CMAKE_TOOLCHAIN: ${HMOS_CMAKE_TOOLCHAIN}"
103+
104+
if [ x"$HMOS_CMAKE_PATH" == x ] ; then
105+
echo "HMOS_CMAKE_PATH MUST be defined"
106+
exit 0
107+
fi
108+
echo "HMOS_CMAKE_PATH: ${HMOS_CMAKE_PATH}"
109+
CMAKE_CMD=${HMOS_CMAKE_PATH}
110+
111+
archs=${hmos_archs[@]}
112+
configures="-DSSL_TYPE=${ssl_type}
113+
-DSSL_PATH=${ssl_path}
114+
-DCMAKE_BUILD_TYPE=Release
115+
-DXQC_ENABLE_TESTING=OFF
116+
-DXQC_BUILD_SAMPLE=OFF
117+
-DGCOV=OFF
118+
-DCMAKE_TOOLCHAIN_FILE=${HMOS_CMAKE_TOOLCHAIN}
119+
-DXQC_ENABLE_RENO=OFF
120+
-DXQC_ENABLE_BBR2=ON
121+
-DXQC_ENABLE_COPA=OFF
122+
-DXQC_ENABLE_UNLIMITED=OFF
123+
-DXQC_ENABLE_MP_INTEROP=OFF
124+
-DXQC_DISABLE_LOG=OFF
125+
-DXQC_ONLY_ERROR_LOG=ON
126+
-DXQC_COMPAT_GENERATE_SR_PKT=ON
127+
-DDISABLE_WARNINGS=ON"
93128
else
94129
echo "no support platform"
95130
exit 0
@@ -105,6 +140,8 @@ generate_plat_spec() {
105140
elif [ x"$1" == xi386 ] ; then
106141
plat_spec="$plat_spec -DPLATFORM=SIMULATOR"
107142
fi
143+
elif [ x"$platform" == xharmony ] ; then
144+
plat_spec="-DOHOS_ARCH=$1"
108145
else
109146
plat_spec="-DANDROID_ABI=$1"
110147
fi
@@ -131,7 +168,7 @@ do
131168
rm -rf third_party
132169

133170
echo "compiling xquic on $i arch"
134-
cmake $configures $(generate_plat_spec $i ) -DLIBRARY_OUTPUT_PATH=`pwd`/outputs/ ..
171+
"${CMAKE_CMD}" $configures $(generate_plat_spec $i ) -DLIBRARY_OUTPUT_PATH=`pwd`/outputs/ ..
135172
make -j 4
136173
if [ $? != 0 ] ; then
137174
exit 0

0 commit comments

Comments
 (0)