From 1712046e9d18941726bc2a75ab0f3823eebf0fca Mon Sep 17 00:00:00 2001 From: coco875 <59367621+coco875@users.noreply.github.com> Date: Wed, 6 Aug 2025 16:06:03 +0200 Subject: [PATCH] same for linux --- .github/workflows/linux_build.yml | 5 +++-- .github/workflows/mac_build.yml | 4 ++-- cmake/toolchain/linux-clang.cmake | 3 +++ cmake/toolchain/linux-gnu.cmake | 3 +++ 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 cmake/toolchain/linux-clang.cmake create mode 100644 cmake/toolchain/linux-gnu.cmake diff --git a/.github/workflows/linux_build.yml b/.github/workflows/linux_build.yml index fc88c9a..2e11e8c 100644 --- a/.github/workflows/linux_build.yml +++ b/.github/workflows/linux_build.yml @@ -13,13 +13,14 @@ jobs: matrix: config: [Release, Debug] standalone: [OFF, ON] + toolchain: [cmake/toolchain/linux-gnu.cmake, cmake/toolchain/linux-clang.cmake] steps: - uses: actions/checkout@v4 - name: Install dependencies run: sudo apt-get install cmake ninja-build libbz2-dev - name: Build run: | - cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DUSE_STANDALONE=${{ matrix.standalone }} + cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DUSE_STANDALONE=${{ matrix.standalone }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} cmake --build build-cmake -j - name: Create Package if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' }} @@ -31,5 +32,5 @@ jobs: if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' }} uses: actions/upload-artifact@v4 with: - name: torch-linux-x64 + name: torch-linux-x64-${{ matrix.toolchain }} path: torch-release \ No newline at end of file diff --git a/.github/workflows/mac_build.yml b/.github/workflows/mac_build.yml index 1e00533..bf453ec 100644 --- a/.github/workflows/mac_build.yml +++ b/.github/workflows/mac_build.yml @@ -30,7 +30,7 @@ jobs: echo "/opt/homebrew/opt/gcc/bin" >> $GITHUB_PATH - name: Build run: | - cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DUSE_STANDALONE=${{ matrix.standalone }} + cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DUSE_STANDALONE=${{ matrix.standalone }} -DCMAKE_TOOLCHAIN_FILE=${{ matrix.toolchain }} cmake --build build-cmake -j - name: Create Package if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' }} @@ -41,5 +41,5 @@ jobs: if: ${{ matrix.config == 'Release' && matrix.standalone == 'ON' }} uses: actions/upload-artifact@v4 with: - name: torch-mac-bin + name: torch-mac-bin-${{ matrix.toolchain }} path: torch-release diff --git a/cmake/toolchain/linux-clang.cmake b/cmake/toolchain/linux-clang.cmake new file mode 100644 index 0000000..e958f30 --- /dev/null +++ b/cmake/toolchain/linux-clang.cmake @@ -0,0 +1,3 @@ +set(CMAKE_C_COMPILER /usr/bin/clang) +set(CMAKE_CXX_COMPILER /usr/bin/clang++) +set(CMAKE_LINKER /usr/bin/ld) diff --git a/cmake/toolchain/linux-gnu.cmake b/cmake/toolchain/linux-gnu.cmake new file mode 100644 index 0000000..74ca215 --- /dev/null +++ b/cmake/toolchain/linux-gnu.cmake @@ -0,0 +1,3 @@ +set(CMAKE_C_COMPILER /usr/bin/gcc) +set(CMAKE_CXX_COMPILER /usr/bin/g++) +set(CMAKE_LINKER /usr/bin/ld) \ No newline at end of file