From 51911fd15b564383e871927ae019959fd4125f7d Mon Sep 17 00:00:00 2001 From: Luke Bemish Date: Mon, 15 Jul 2024 16:27:12 -0500 Subject: [PATCH] Move bulk of logic to toolchains --- .github/workflows/commit.yml | 34 +------------------------------- toolchains/linux-aarch64.cmake | 5 +++++ toolchains/linux-arm.cmake | 5 +++++ toolchains/linux-i386.cmake | 5 +++++ toolchains/linux-x86_64.cmake | 5 +++++ toolchains/macos-aarch64.cmake | 4 ++++ toolchains/macos-x86_64.cmake | 4 ++++ toolchains/windows-aarch64.cmake | 4 ++++ toolchains/windows-i386.cmake | 4 ++++ toolchains/windows-x86_64.cmake | 4 ++++ 10 files changed, 41 insertions(+), 33 deletions(-) create mode 100644 toolchains/linux-aarch64.cmake create mode 100644 toolchains/linux-arm.cmake create mode 100644 toolchains/linux-i386.cmake create mode 100644 toolchains/linux-x86_64.cmake create mode 100644 toolchains/macos-aarch64.cmake create mode 100644 toolchains/macos-x86_64.cmake create mode 100644 toolchains/windows-aarch64.cmake create mode 100644 toolchains/windows-i386.cmake create mode 100644 toolchains/windows-x86_64.cmake diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 6bc9c93..f1fa8d9 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -13,56 +13,26 @@ jobs: build_type: [Release] include: - os: linux - c_compiler: gcc - cpp_compiler: g++ runner: ubuntu-latest libname: libopensesamenative.so java_home: "$JAVA_HOME_17_X64" - os: macos - c_compiler: clang - cpp_compiler: clang++ runner: macos-latest libname: libopensesamenative.dylib java_home: "$JAVA_HOME_17_arm64" - os: windows - c_compiler: cl - cpp_compiler: cl runner: windows-latest libname: opensesamenative.dll java_home: "$JAVA_HOME_17_X64" - os: linux arch: i386 compiler_package: g++-i686-linux-gnu - c_compiler: i686-linux-gnu-gcc - cpp_compiler: i686-linux-gnu-g++ - cmake_args: -DCMAKE_C_FLAGS="-march=i686" -DCMAKE_CXX_FLAGS="-march=i686" - os: linux arch: aarch64 compiler_package: g++-aarch64-linux-gnu - c_compiler: aarch64-linux-gnu-gcc - cpp_compiler: aarch64-linux-gnu-g++ - cmake_args: -DCMAKE_C_FLAGS="-march=armv8-a" -DCMAKE_CXX_FLAGS="-march=armv8-a" - os: linux arch: arm compiler_package: g++-arm-linux-gnueabi - c_compiler: arm-linux-gnueabi-gcc - cpp_compiler: arm-linux-gnueabi-g++ - cmake_args: -DCMAKE_C_FLAGS="-march=armv7-a" -DCMAKE_CXX_FLAGS="-march=armv7-a" - - os: macos - arch: aarch64 - cmake_args: -DCMAKE_OSX_ARCHITECTURES=arm64 - - os: macos - arch: x86_64 - cmake_args: -DCMAKE_OSX_ARCHITECTURES=x86_64 - - os: windows - arch: x86_64 - cmake_args: -DCMAKE_GENERATOR_PLATFORM=x64 - - os: windows - arch: i386 - cmake_args: -DCMAKE_GENERATOR_PLATFORM=Win32 - - os: windows - arch: aarch64 - cmake_args: -DCMAKE_GENERATOR_PLATFORM=ARM64 exclude: - os: macos arch: i386 @@ -79,11 +49,9 @@ jobs: - name: Configure CMake run: > cmake -B cmakebuild - -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} - -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_TOOLCHAIN_FILE=toolchains/${{ matrix.os }}-${{ matrix.arch }}.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DJAVA_HOME=${{ matrix.java_home }} - ${{ matrix.cmake_args }} -S ${{ github.workspace }} - name: Build run: cmake --build cmakebuild --config ${{ matrix.build_type }} diff --git a/toolchains/linux-aarch64.cmake b/toolchains/linux-aarch64.cmake new file mode 100644 index 0000000..2b98108 --- /dev/null +++ b/toolchains/linux-aarch64.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc) +set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++) +set(CMAKE_C_FLAGS "-m64 -march=armv8-a") +set(CMAKE_CXX_FLAGS "-m64 -march=armv8-a") \ No newline at end of file diff --git a/toolchains/linux-arm.cmake b/toolchains/linux-arm.cmake new file mode 100644 index 0000000..7ffd6dd --- /dev/null +++ b/toolchains/linux-arm.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_C_COMPILER arm-linux-gnueabi-gcc) +set(CMAKE_CXX_COMPILER arm-linux-gnueabi-g++) +set(CMAKE_C_FLAGS "-m32 -march=armv7-a") +set(CMAKE_CXX_FLAGS "-m32 -march=armv7-a") \ No newline at end of file diff --git a/toolchains/linux-i386.cmake b/toolchains/linux-i386.cmake new file mode 100644 index 0000000..579dae6 --- /dev/null +++ b/toolchains/linux-i386.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_C_COMPILER i686-linux-gnu-gcc) +set(CMAKE_CXX_COMPILER i686-linux-gnu-g++) +set(CMAKE_C_FLAGS "-m32 -march=i386") +set(CMAKE_CXX_FLAGS "-m32 -march=i386") \ No newline at end of file diff --git a/toolchains/linux-x86_64.cmake b/toolchains/linux-x86_64.cmake new file mode 100644 index 0000000..20efb78 --- /dev/null +++ b/toolchains/linux-x86_64.cmake @@ -0,0 +1,5 @@ +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_COMPILER g++) +set(CMAKE_C_FLAGS "-m64") +set(CMAKE_CXX_FLAGS "-m64") \ No newline at end of file diff --git a/toolchains/macos-aarch64.cmake b/toolchains/macos-aarch64.cmake new file mode 100644 index 0000000..ae6c3cc --- /dev/null +++ b/toolchains/macos-aarch64.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_OSX_ARCHITECTURES "arm64") \ No newline at end of file diff --git a/toolchains/macos-x86_64.cmake b/toolchains/macos-x86_64.cmake new file mode 100644 index 0000000..08b9c65 --- /dev/null +++ b/toolchains/macos-x86_64.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Darwin) +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) +set(CMAKE_OSX_ARCHITECTURES "x86_64") \ No newline at end of file diff --git a/toolchains/windows-aarch64.cmake b/toolchains/windows-aarch64.cmake new file mode 100644 index 0000000..a25d652 --- /dev/null +++ b/toolchains/windows-aarch64.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_C_COMPILER cl) +set(CMAKE_CXX_COMPILER cl) +set(CMAKE_GENERATOR_PLATFORM "ARM64") \ No newline at end of file diff --git a/toolchains/windows-i386.cmake b/toolchains/windows-i386.cmake new file mode 100644 index 0000000..d915497 --- /dev/null +++ b/toolchains/windows-i386.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_C_COMPILER cl) +set(CMAKE_CXX_COMPILER cl) +set(CMAKE_GENERATOR_PLATFORM "Win32") \ No newline at end of file diff --git a/toolchains/windows-x86_64.cmake b/toolchains/windows-x86_64.cmake new file mode 100644 index 0000000..d7cfa48 --- /dev/null +++ b/toolchains/windows-x86_64.cmake @@ -0,0 +1,4 @@ +set(CMAKE_SYSTEM_NAME Windows) +set(CMAKE_C_COMPILER cl) +set(CMAKE_CXX_COMPILER cl) +set(CMAKE_GENERATOR_PLATFORM "x64") \ No newline at end of file