mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-17 21:48:19 +00:00
Split compile_source
function for readability
Split the `compile_source` function into `compile_source_android` and `compile_source_webasm` instead of using a parameter to switch between the functionality.
This commit is contained in:
parent
45f619722b
commit
930836f349
|
@ -15,73 +15,73 @@ fi
|
||||||
COMPILEFLAGS=$3
|
COMPILEFLAGS=$3
|
||||||
LINKFLAGS=$4
|
LINKFLAGS=$4
|
||||||
|
|
||||||
function compile_source() {
|
function compile_source_android() {
|
||||||
if [[ "${4}" == "android" ]]; then
|
cmake \
|
||||||
cmake \
|
-H. \
|
||||||
-H. \
|
-G "Unix Makefiles" \
|
||||||
-G "Unix Makefiles" \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DANDROID_PLATFORM="android-$1" \
|
||||||
-DANDROID_PLATFORM="android-$1" \
|
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
|
||||||
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake" \
|
-DANDROID_NDK="$ANDROID_NDK_HOME" \
|
||||||
-DANDROID_NDK="$ANDROID_NDK_HOME" \
|
-DANDROID_ABI="${3}" \
|
||||||
-DANDROID_ABI="${3}" \
|
-DANDROID_ARM_NEON=TRUE \
|
||||||
-DANDROID_ARM_NEON=TRUE \
|
-DCMAKE_ANDROID_NDK="$ANDROID_NDK_HOME" \
|
||||||
-DCMAKE_ANDROID_NDK="$ANDROID_NDK_HOME" \
|
-DCMAKE_SYSTEM_NAME=Android \
|
||||||
-DCMAKE_SYSTEM_NAME=Android \
|
-DCMAKE_SYSTEM_VERSION="$1" \
|
||||||
-DCMAKE_SYSTEM_VERSION="$1" \
|
-DCMAKE_ANDROID_ARCH_ABI="${3}" \
|
||||||
-DCMAKE_ANDROID_ARCH_ABI="${3}" \
|
-B"$2" \
|
||||||
-B"$2" \
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
-DBUILD_SHARED_LIBS=OFF \
|
-DHIDAPI_SKIP_LIBUSB=TRUE \
|
||||||
-DHIDAPI_SKIP_LIBUSB=TRUE \
|
-DCURL_USE_OPENSSL=ON \
|
||||||
-DCURL_USE_OPENSSL=ON \
|
-DSDL_HIDAPI=OFF \
|
||||||
-DSDL_HIDAPI=OFF \
|
-DOP_DISABLE_HTTP=ON \
|
||||||
-DOP_DISABLE_HTTP=ON \
|
-DOP_DISABLE_EXAMPLES=ON \
|
||||||
-DOP_DISABLE_EXAMPLES=ON \
|
-DOP_DISABLE_DOCS=ON \
|
||||||
-DOP_DISABLE_DOCS=ON \
|
-DOPENSSL_ROOT_DIR="$PWD"/../openssl/"$2" \
|
||||||
-DOPENSSL_ROOT_DIR="$PWD"/../openssl/"$2" \
|
-DOPENSSL_CRYPTO_LIBRARY="$PWD"/../openssl/"$2"/libcrypto.a \
|
||||||
-DOPENSSL_CRYPTO_LIBRARY="$PWD"/../openssl/"$2"/libcrypto.a \
|
-DOPENSSL_SSL_LIBRARY="$PWD"/../openssl/"$2"/libssl.a \
|
||||||
-DOPENSSL_SSL_LIBRARY="$PWD"/../openssl/"$2"/libssl.a \
|
-DOPENSSL_INCLUDE_DIR="${PWD}/../openssl/include;${PWD}/../openssl/${2}/include"
|
||||||
-DOPENSSL_INCLUDE_DIR="${PWD}/../openssl/include;${PWD}/../openssl/${2}/include"
|
(
|
||||||
(
|
cd "$2" || exit 1
|
||||||
cd "$2" || exit 1
|
cmake --build .
|
||||||
cmake --build .
|
)
|
||||||
)
|
}
|
||||||
else
|
|
||||||
${5} cmake \
|
function compile_source_webasm() {
|
||||||
-H. \
|
emcmake cmake \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-H. \
|
||||||
-B"$2" \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DSDL_STATIC=TRUE \
|
-B"$2" \
|
||||||
-DFT_DISABLE_HARFBUZZ=ON \
|
-DSDL_STATIC=TRUE \
|
||||||
-DFT_DISABLE_BZIP2=ON \
|
-DFT_DISABLE_HARFBUZZ=ON \
|
||||||
-DFT_DISABLE_BROTLI=ON \
|
-DFT_DISABLE_BZIP2=ON \
|
||||||
-DFT_REQUIRE_ZLIB=TRUE \
|
-DFT_DISABLE_BROTLI=ON \
|
||||||
-DCMAKE_C_FLAGS="$COMPILEFLAGS -DGLEW_STATIC" -DCMAKE_CXX_FLAGS="$COMPILEFLAGS" -DCMAKE_CXX_FLAGS_RELEASE="$COMPILEFLAGS" -DCMAKE_C_FLAGS_RELEASE="$COMPILEFLAGS" \
|
-DFT_REQUIRE_ZLIB=TRUE \
|
||||||
-DCMAKE_SHARED_LINKER_FLAGS="$LINKFLAGS" -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$LINKFLAGS" \
|
-DCMAKE_C_FLAGS="$COMPILEFLAGS -DGLEW_STATIC" -DCMAKE_CXX_FLAGS="$COMPILEFLAGS" -DCMAKE_CXX_FLAGS_RELEASE="$COMPILEFLAGS" -DCMAKE_C_FLAGS_RELEASE="$COMPILEFLAGS" \
|
||||||
-DSDL_PTHREADS=ON -DSDL_THREADS=ON \
|
-DCMAKE_SHARED_LINKER_FLAGS="$LINKFLAGS" -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$LINKFLAGS" \
|
||||||
-DCURL_USE_OPENSSL=ON \
|
-DSDL_PTHREADS=ON -DSDL_THREADS=ON \
|
||||||
-DOPUS_HARDENING=OFF \
|
-DCURL_USE_OPENSSL=ON \
|
||||||
-DOPUS_STACK_PROTECTOR=OFF \
|
-DOPUS_HARDENING=OFF \
|
||||||
-DOPENSSL_ROOT_DIR="$PWD"/../openssl/"$2" \
|
-DOPUS_STACK_PROTECTOR=OFF \
|
||||||
-DOPENSSL_CRYPTO_LIBRARY="$PWD"/../openssl/"$2"/libcrypto.a \
|
-DOPENSSL_ROOT_DIR="$PWD"/../openssl/"$2" \
|
||||||
-DOPENSSL_SSL_LIBRARY="$PWD"/../openssl/"$2"/libssl.a \
|
-DOPENSSL_CRYPTO_LIBRARY="$PWD"/../openssl/"$2"/libcrypto.a \
|
||||||
-DOPENSSL_INCLUDE_DIR="${PWD}/../openssl/include;${PWD}/../openssl/${2}/include" \
|
-DOPENSSL_SSL_LIBRARY="$PWD"/../openssl/"$2"/libssl.a \
|
||||||
-DZLIB_LIBRARY="${PWD}/../zlib/${2}/libz.a" -DZLIB_INCLUDE_DIR="${PWD}/../zlib;${PWD}/../zlib/${2}"
|
-DOPENSSL_INCLUDE_DIR="${PWD}/../openssl/include;${PWD}/../openssl/${2}/include" \
|
||||||
(
|
-DZLIB_LIBRARY="${PWD}/../zlib/${2}/libz.a" -DZLIB_INCLUDE_DIR="${PWD}/../zlib;${PWD}/../zlib/${2}"
|
||||||
cd "$2" || exit 1
|
(
|
||||||
cmake --build .
|
cd "$2" || exit 1
|
||||||
)
|
cmake --build .
|
||||||
fi
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "${2}" == "android" ]]; then
|
if [[ "${2}" == "android" ]]; then
|
||||||
compile_source "$1" build_"$2"_arm armeabi-v7a "$2" "" &
|
compile_source_android "$1" build_android_arm armeabi-v7a &
|
||||||
compile_source "$1" build_"$2"_arm64 arm64-v8a "$2" "" &
|
compile_source_android "$1" build_android_arm64 arm64-v8a &
|
||||||
compile_source "$1" build_"$2"_x86 x86 "$2" "" &
|
compile_source_android "$1" build_android_x86 x86 &
|
||||||
compile_source "$1" build_"$2"_x86_64 x86_64 "$2" "" &
|
compile_source_android "$1" build_android_x86_64 x86_64 &
|
||||||
elif [[ "${2}" == "webasm" ]]; then
|
elif [[ "${2}" == "webasm" ]]; then
|
||||||
sed -i "s/include(CheckSizes)//g" CMakeLists.txt
|
sed -i "s/include(CheckSizes)//g" CMakeLists.txt
|
||||||
compile_source "$1" build_"$2"_wasm wasm "$2" emcmake &
|
compile_source_webasm "$1" build_webasm_wasm wasm &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wait
|
wait
|
||||||
|
|
Loading…
Reference in a new issue