diff --git a/.github/workflows/allInOne.yml b/.github/workflows/allInOne.yml index d6af0de68..2c4fa746e 100644 --- a/.github/workflows/allInOne.yml +++ b/.github/workflows/allInOne.yml @@ -4,6 +4,7 @@ on: [push] env: SWIG_VERSION: 4.0.2 + LLVM_MINGW_VERSION: 20260616 jobs: validate-gradle-wrapper: @@ -15,7 +16,7 @@ jobs: swig: strategy: matrix: - os: [ubuntu-20.04, macos-12, macos-14] + os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26-intel, macos-26] runs-on: ${{ matrix.os }} steps: - name: SWIG from cache @@ -24,11 +25,13 @@ jobs: with: path: ${{ github.workspace }}/swig key: ${{ runner.os }}-${{ runner.arch }}-swig-${{ env.SWIG_VERSION }} - - name: Install SWIG build dependencies - if: steps.cache-swig.outputs.cache-hit != 'true' + - name: Install SWIG dependencies + # Always install, even on a cache hit: this also provides the pcre runtime + # library the cached swig binary is linked against, which isn't persisted + # across runner VMs by the actions/cache step above. run: | if [ "${{ runner.os }}" == 'Linux' ]; then - sudo apt-get install -y autoconf automake libtool + sudo apt-get install -y autoconf automake libtool libpcre3-dev elif [ "${{ runner.os }}" == 'macOS' ]; then brew install autoconf automake libtool pcre else @@ -45,16 +48,12 @@ jobs: ./configure --prefix=$GITHUB_WORKSPACE/swig make make install - - name: Install SWIG runtime dependencies - if: runner.os == 'macOs' - run: | - brew install pcre - name: Check SWIG version run: $GITHUB_WORKSPACE/swig/bin/swig -version build: strategy: matrix: - os: [ubuntu-20.04, macos-12, macos-14] + os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26-intel, macos-26] runs-on: ${{ matrix.os }} needs: [validate-gradle-wrapper, swig] steps: @@ -69,9 +68,20 @@ jobs: fail-on-cache-miss: true - name: Add SWIG to $PATH run: echo "${{ github.workspace }}/swig/bin" >> $GITHUB_PATH + - name: Install libpcre3 + if: runner.os == 'Linux' + run: sudo apt-get install -y libpcre3-dev - name: Install MinGW-w64 if: runner.os == 'Linux' run: sudo apt-get install -y mingw-w64 + - name: Install llvm-mingw (Windows arm64 cross-compiler) + # Classic mingw-w64 (GCC) has no Windows/ARM64 target; only needed on the job + # that actually builds linux_windows_arm64_llvm_mingw32, see build.gradle. + if: runner.os == 'Linux' && runner.arch == 'X64' + run: | + curl -fL -o llvm-mingw.tar.xz "https://github.com/mstorsjo/llvm-mingw/releases/download/${{ env.LLVM_MINGW_VERSION }}/llvm-mingw-${{ env.LLVM_MINGW_VERSION }}-ucrt-ubuntu-22.04-x86_64.tar.xz" + tar xf llvm-mingw.tar.xz + echo "$PWD/llvm-mingw-${{ env.LLVM_MINGW_VERSION }}-ucrt-ubuntu-22.04-x86_64/bin" >> $GITHUB_PATH - name: Install pcre if: runner.os == 'macOS' run: brew install pcre @@ -80,7 +90,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 @@ -95,7 +105,7 @@ jobs: build/natives/*/*.dll build/natives/*/*.dylib publish: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: [validate-gradle-wrapper, swig, build] if: github.ref == 'refs/heads/master' steps: @@ -110,12 +120,14 @@ jobs: fail-on-cache-miss: true - name: Add SWIG to $PATH run: echo "${{ github.workspace }}/swig/bin" >> $GITHUB_PATH + - name: Install libpcre3 + run: sudo apt-get install -y libpcre3-dev - name: Check SWIG version run: swig -version - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: '11' + java-version: '17' distribution: 'temurin' - name: Setup Gradle uses: gradle/actions/setup-gradle@v3 diff --git a/build.gradle b/build.gradle index 8f0f82772..266da5c8c 100644 --- a/build.gradle +++ b/build.gradle @@ -14,15 +14,25 @@ ext { natives = ["macosx_amd64_clang"] } } else if (Os.isFamily(Os.FAMILY_UNIX)) { - // Cross-compilation with MinGW-w64 allows us to also build the Windows target on Linux - natives = ["linux_amd64_gcc","linux_windows_amd64_mingw32"] + if (Os.isArch("aarch64")) { + // No MinGW-w64 cross target here: the Windows amd64 build is unrelated to and + // not reliably available when cross-compiling from an aarch64 host. + natives = ["linux_aarch64_gcc"] + } else { + // Cross-compilation with MinGW-w64 allows us to also build the Windows amd64 target + // on Linux, and with llvm-mingw (must be on PATH, see toolchains/linux_windows_arm64_llvm_mingw32.cmake) + // the Windows arm64 target too. + natives = ["linux_amd64_gcc","linux_windows_amd64_mingw32","linux_windows_arm64_llvm_mingw32"] + } } else { throw new GradleException("This script only works on Linux or Mac") } allNatives = [ "linux_amd64_gcc", + "linux_aarch64_gcc", "linux_windows_amd64_mingw32", + "linux_windows_arm64_llvm_mingw32", "macosx_aarch64_clang", "macosx_amd64_clang" ] @@ -31,8 +41,8 @@ ext { } java { - sourceCompatibility(JavaVersion.VERSION_1_8) - targetCompatibility(JavaVersion.VERSION_1_8) + sourceCompatibility(JavaVersion.VERSION_17) + targetCompatibility(JavaVersion.VERSION_17) } // We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on @@ -108,9 +118,14 @@ natives.each { module -> mkdir "$rootDir/build/natives/${module}" } doLast { - exec { - workingDir "$rootDir/build/natives/${module}" - commandLine 'make', "-j${Runtime.runtime.availableProcessors()}" + def process = new ProcessBuilder('make', "-j${Runtime.runtime.availableProcessors()}") + .directory(file("$rootDir/build/natives/${module}")) + .redirectErrorStream(true) + .start() + process.inputStream.eachLine { println it } + def exitCode = process.waitFor() + if (exitCode != 0) { + throw new GradleException("make failed with exit code ${exitCode}") } } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9f4197d5f..a351597e6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/toolchains/android_armeabi_gcc.cmake b/toolchains/android_armeabi_gcc.cmake index d75f3f566..93d961234 100644 --- a/toolchains/android_armeabi_gcc.cmake +++ b/toolchains/android_armeabi_gcc.cmake @@ -14,7 +14,7 @@ # toolchain for linux: https://github.com/staticlibs/android-ndk-r9d-arm-linux-androideabi-4.8 -cmake_minimum_required ( VERSION 2.8.12 ) +cmake_minimum_required ( VERSION 3.5 ) # default to Debug set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" ) diff --git a/toolchains/linux_aarch64_gcc.cmake b/toolchains/linux_aarch64_gcc.cmake new file mode 100644 index 000000000..5a62b54b3 --- /dev/null +++ b/toolchains/linux_aarch64_gcc.cmake @@ -0,0 +1,26 @@ +# Copyright 2015, alex at staticlibs.net +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +cmake_minimum_required ( VERSION 3.5 ) + +# default to Debug +set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" ) + +set ( CMAKE_SYSTEM_NAME Linux ) +set ( CMAKE_SYSTEM_ARCH aarch64 ) + +set ( CMAKE_C_COMPILER gcc ) +set ( CMAKE_CXX_COMPILER g++ ) + +set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/toolchains/linux_amd64_gcc.cmake b/toolchains/linux_amd64_gcc.cmake index fe6a98bb1..682eaa66f 100644 --- a/toolchains/linux_amd64_gcc.cmake +++ b/toolchains/linux_amd64_gcc.cmake @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required ( VERSION 2.8.12 ) +cmake_minimum_required ( VERSION 3.5 ) # default to Debug set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" ) diff --git a/toolchains/linux_i686_gcc.cmake b/toolchains/linux_i686_gcc.cmake index fdb40a245..1216624f5 100644 --- a/toolchains/linux_i686_gcc.cmake +++ b/toolchains/linux_i686_gcc.cmake @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required ( VERSION 2.8.12 ) +cmake_minimum_required ( VERSION 3.5 ) set ( CMAKE_SYSTEM_NAME Linux ) set ( CMAKE_SYSTEM_ARCH i686) diff --git a/toolchains/linux_windows_arm64_llvm_mingw32.cmake b/toolchains/linux_windows_arm64_llvm_mingw32.cmake new file mode 100644 index 000000000..eac205a82 --- /dev/null +++ b/toolchains/linux_windows_arm64_llvm_mingw32.cmake @@ -0,0 +1,13 @@ +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Windows) +set ( CMAKE_SYSTEM_ARCH aarch64) + +# Classic mingw-w64 (GCC) has no Windows/ARM64 target; this uses the LLVM-based +# llvm-mingw toolchain instead (https://github.com/mstorsjo/llvm-mingw), which +# must be on PATH providing these compiler names. +set(COMPILER_PREFIX "aarch64-w64-mingw32") + +SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc) +SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++) + +set(CMAKE_CXX_FLAGS_RELEASE "-O3") diff --git a/toolchains/macosx_aarch64_clang.cmake b/toolchains/macosx_aarch64_clang.cmake index 29aa387ae..10762fe4f 100644 --- a/toolchains/macosx_aarch64_clang.cmake +++ b/toolchains/macosx_aarch64_clang.cmake @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required ( VERSION 2.8.12 ) +cmake_minimum_required ( VERSION 3.5 ) # default to Debug set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" ) diff --git a/toolchains/macosx_amd64_clang.cmake b/toolchains/macosx_amd64_clang.cmake index 5ed31f1e0..24800976c 100644 --- a/toolchains/macosx_amd64_clang.cmake +++ b/toolchains/macosx_amd64_clang.cmake @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required ( VERSION 2.8.12 ) +cmake_minimum_required ( VERSION 3.5 ) # default to Debug set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" ) diff --git a/toolchains/windows_amd64_msvc.cmake b/toolchains/windows_amd64_msvc.cmake index 76c31fa93..185fef31d 100644 --- a/toolchains/windows_amd64_msvc.cmake +++ b/toolchains/windows_amd64_msvc.cmake @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required ( VERSION 2.8.12 ) +cmake_minimum_required ( VERSION 3.5 ) # default to Debug set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" ) diff --git a/toolchains/windows_i686_msvc.cmake b/toolchains/windows_i686_msvc.cmake index 20fd554b4..2e870ec47 100644 --- a/toolchains/windows_i686_msvc.cmake +++ b/toolchains/windows_i686_msvc.cmake @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required ( VERSION 2.8.12 ) +cmake_minimum_required ( VERSION 3.5 ) # default to Debug set ( CMAKE_BUILD_TYPE "Debug" CACHE STRING "Default build type" )