From e0ab053bd8f5ee2c4097c40a42fad569910e0564 Mon Sep 17 00:00:00 2001 From: Ghabry Date: Tue, 27 Aug 2024 00:50:44 +0200 Subject: [PATCH 1/2] CMake: Set arm/arm64 explicitly, use Android configuration Required for libpng. Otherwise gives linker errors for missing neon functions. --- 3ds/2_build_toolchain.sh | 1 + android/2_build_toolchain.sh | 13 +++++++++---- ios/2_build_toolchain.sh | 6 ++++-- macos/2_build_toolchain.sh | 5 +++-- switch/2_build_toolchain.sh | 1 + vita/2_build_toolchain.sh | 1 + 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/3ds/2_build_toolchain.sh b/3ds/2_build_toolchain.sh index d3f23522..0b0c8020 100755 --- a/3ds/2_build_toolchain.sh +++ b/3ds/2_build_toolchain.sh @@ -84,6 +84,7 @@ function set_build_flags { export LDFLAGS="$ARCH_FLAGS -L$PLATFORM_PREFIX/lib -L$DEVKITPRO/libctru/lib" export LIBS="-lctru" export CMAKE_SYSTEM_NAME="Generic" + export CMAKE_EXTRA_ARGS="-DCMAKE_SYSTEM_PROCESSOR=arm" make_meson_cross 3ds > meson-cross.txt } diff --git a/android/2_build_toolchain.sh b/android/2_build_toolchain.sh index f9654952..6180aa95 100755 --- a/android/2_build_toolchain.sh +++ b/android/2_build_toolchain.sh @@ -86,7 +86,7 @@ function build() { export CFLAGS="-no-integrated-as -g0 -O2 -fPIC $5" export CXXFLAGS="$CFLAGS" - export CPPFLAGS="-I$PLATFORM_PREFIX/include -I$NDK_ROOT/sources/android/cpufeatures" + export CPPFLAGS="-I$PLATFORM_PREFIX/include -I$ANDROID_NDK/sources/android/cpufeatures" export LDFLAGS="-L$PLATFORM_PREFIX/lib" unset PKG_CONFIG_PATH export PKG_CONFIG_LIBDIR=$PLATFORM_PREFIX/lib/pkgconfig @@ -94,6 +94,8 @@ function build() { export CC="clang -target ${TARGET_HOST}${TARGET_API}" export CXX="clang++ -target ${TARGET_HOST}${TARGET_API}" + export CMAKE_EXTRA_ARGS="-DCMAKE_ANDROID_ARCH_ABI=$2 -DCMAKE_ANDROID_API=$TARGET_API" + mkdir -p $PLATFORM_PREFIX make_meson_cross "${TARGET_HOST}${TARGET_API}" > $PLATFORM_PREFIX/meson-cross.txt @@ -123,7 +125,7 @@ function build() { } export SDK_ROOT=$WORKSPACE/android-sdk -export NDK_ROOT=$SDK_ROOT/ndk/21.4.7075529 +export ANDROID_NDK=$SDK_ROOT/ndk/21.4.7075529 export MAKEFLAGS="-j${nproc:-2}" @@ -133,14 +135,17 @@ cd $WORKSPACE install_lib_icu_native # Setup PATH -NDK_PATH=$NDK_ROOT/toolchains/llvm/prebuilt/$NDK_ARCH/bin -PATH=$NDK_ROOT:$NDK_PATH:$SDK_ROOT/tools:$PATH +NDK_PATH=$ANDROID_NDK/toolchains/llvm/prebuilt/$NDK_ARCH/bin +PATH=$ANDROID_NDK:$NDK_PATH:$SDK_ROOT/tools:$PATH export OLD_PATH=$PATH # Correctly detected mmap support in mpg123 export ac_cv_func_mmap_fixed_mapped=yes +# Target Android with CMake +export CMAKE_SYSTEM_NAME=Android + # ARMeabi-v7a build "ARMeabi-v7a" "armeabi-v7a" "arm" "armv7a-linux-androideabi" "-march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3" diff --git a/ios/2_build_toolchain.sh b/ios/2_build_toolchain.sh index dfa065af..ff821d66 100755 --- a/ios/2_build_toolchain.sh +++ b/ios/2_build_toolchain.sh @@ -29,8 +29,8 @@ function set_build_flags { # $1: Arch (either armv7 or arm64) # $2: host for configure # $3: additional cpp flags - CLANG="xcrun --sdk iphoneos clang" - CLANGXX="xcrun --sdk iphoneos clang++" + CLANG=`xcrun -f --sdk iphoneos clang` + CLANGXX=`xcrun -f --sdk iphoneos clang++` ARCH="-arch $1" SDKPATH=`xcrun -sdk iphoneos --show-sdk-path` PLATFORM_PREFIX="$WORKSPACE/$1" @@ -47,6 +47,8 @@ function set_build_flags { export CPPFLAGS="-I$PLATFORM_PREFIX/include -I$WORKSPACE/icu/source/common" export LDFLAGS="-L$PLATFORM_PREFIX/lib $ARCH -miphoneos-version-min=9.0 -isysroot $SDKPATH" + export CMAKE_EXTRA_ARGS="-DCMAKE_OSX_ARCHITECTURES=$1" + export PKG_CONFIG_PATH=$PLATFORM_PREFIX/lib/pkgconfig export PKG_CONFIG_LIBDIR=$PKG_CONFIG_PATH export TARGET_HOST="$2" diff --git a/macos/2_build_toolchain.sh b/macos/2_build_toolchain.sh index 1d3293af..2edfdee0 100755 --- a/macos/2_build_toolchain.sh +++ b/macos/2_build_toolchain.sh @@ -29,8 +29,8 @@ function set_build_flags() { # $1: Arch (either x86_64 or arm64) # $2: host for configure # $3: additional cpp flags - CLANG="xcrun --sdk macosx clang" - CLANGXX="xcrun --sdk macosx clang++" + CLANG=`xcrun -f --sdk macosx clang` + CLANGXX=`xcrun -f --sdk macosx clang++` ARCH="-arch $1" SDKPATH=`xcrun -sdk macosx --show-sdk-path` PLATFORM_PREFIX="$WORKSPACE/$1" @@ -47,6 +47,7 @@ function set_build_flags() { export LDFLAGS="-L$PLATFORM_PREFIX/lib $ARCH -mmacosx-version-min=10.9 -isysroot $SDKPATH" export MACOSX_DEPLOYMENT_TARGET=10.9 + export CMAKE_EXTRA_ARGS="-DCMAKE_OSX_ARCHITECTURES=$1" export PKG_CONFIG_PATH=$PLATFORM_PREFIX/lib/pkgconfig export PKG_CONFIG_LIBDIR=$PKG_CONFIG_PATH diff --git a/switch/2_build_toolchain.sh b/switch/2_build_toolchain.sh index 28743f50..e29f50e5 100755 --- a/switch/2_build_toolchain.sh +++ b/switch/2_build_toolchain.sh @@ -73,6 +73,7 @@ function set_build_flags { export LDFLAGS="$ARCH_FLAGS -L$PLATFORM_PREFIX/lib -L$DEVKITPRO/libnx/lib" export LIBS="-lnx" export CMAKE_SYSTEM_NAME="Generic" + export CMAKE_EXTRA_ARGS="-DCMAKE_SYSTEM_PROCESSOR=arm64" make_meson_cross switch > meson-cross.txt } diff --git a/vita/2_build_toolchain.sh b/vita/2_build_toolchain.sh index c4d2bd25..4bb800dc 100755 --- a/vita/2_build_toolchain.sh +++ b/vita/2_build_toolchain.sh @@ -62,6 +62,7 @@ function set_build_flags { export CXXFLAGS="$CFLAGS" export CPPFLAGS="-DPSP2" export CMAKE_SYSTEM_NAME="Generic" + export CMAKE_EXTRA_ARGS="-DCMAKE_SYSTEM_PROCESSOR=arm64" make_meson_cross vita > $PLATFORM_PREFIX/meson-cross.txt } From 68b646e5c278be55a4341f4adfbf2c60c9ea31ef Mon Sep 17 00:00:00 2001 From: Ghabry Date: Tue, 27 Aug 2024 11:39:57 +0200 Subject: [PATCH 2/2] Emscripten: Bump to 3.1.65 --- emscripten/1_download_library.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emscripten/1_download_library.sh b/emscripten/1_download_library.sh index de8c5086..7edf7a71 100755 --- a/emscripten/1_download_library.sh +++ b/emscripten/1_download_library.sh @@ -43,8 +43,8 @@ else touch .emscripten # Download and install the latest SDK tools and set up the compiler configuration to point to it. - ./emsdk install 3.1.49 - ./emsdk activate 3.1.49 + ./emsdk install 3.1.65 + ./emsdk activate 3.1.65 # Set the current Emscripten path source ./emsdk_env.sh