From 85c0aadf226cc65e6f3ebd78fea6f8f94fa5403b Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Mon, 19 Feb 2024 11:24:10 -0800 Subject: [PATCH] Remove explicit Rust setup and CMake flags (#104) --- .github/workflows/build-rust.yml | 23 ++++++++--------------- .github/workflows/build.yml | 6 +++--- cmake/modules/FetchCasADi.cmake | 10 ++-------- cmake/modules/InstallJavaLibs.cmake | 4 ++-- node/CMakeLists.txt | 1 - 5 files changed, 15 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build-rust.yml b/.github/workflows/build-rust.yml index 8621a569..c8c0f33f 100644 --- a/.github/workflows/build-rust.yml +++ b/.github/workflows/build-rust.yml @@ -15,35 +15,27 @@ jobs: - artifact-name: Rust Native - Windows x86_64 (CasADi) optimizer_backend: casadi os: windows-2022 - rust-target: x86_64-pc-windows-gnu - artifact-name: Rust Native - macOS x86_64 (CasADi) optimizer_backend: casadi os: macOS-13 - rust-target: x86_64-apple-darwin - artifact-name: Rust Native - macOS arm64 (CasADi) optimizer_backend: casadi os: macOS-14 - rust-target: aarch64-apple-darwin - artifact-name: Rust Native - Linux x86_64 (CasADi) optimizer_backend: casadi os: ubuntu-latest - rust-target: x86_64-unknown-linux-gnu - artifact-name: Rust Native - Windows x86_64 (Sleipnir) optimizer_backend: sleipnir os: windows-2022 - rust-target: x86_64-pc-windows-msvc - artifact-name: Rust Native - macOS x86_64 (Sleipnir) optimizer_backend: sleipnir os: macOS-13 - rust-target: x86_64-apple-darwin - artifact-name: Rust Native - macOS arm64 (Sleipnir) optimizer_backend: sleipnir os: macOS-14 - rust-target: aarch64-apple-darwin - artifact-name: Rust Native - Linux x86_64 (Sleipnir) optimizer_backend: sleipnir os: ubuntu-latest - rust-target: x86_64-unknown-linux-gnu name: "${{ matrix.artifact-name }}" runs-on: ${{ matrix.os }} @@ -51,21 +43,22 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Set to Windows GNU Rust Toolchain + if: matrix.os == 'windows-2022' && matrix.optimizer_backend == 'casadi' + run: | + rustup install 1.69-gnu + rustup default 1.69-gnu + - name: Set up MinGW if: matrix.os == 'windows-2022' && matrix.optimizer_backend == 'casadi' run: | choco upgrade mingw --version=11.2.0 -y --no-progress --allow-downgrade echo C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin >> $env:GITHUB_PATH - - name: Set up Rust - uses: hecrj/setup-rust-action@v1 - with: - targets: ${{matrix.rust-target}} - - name: Build Rust working-directory: rust - run: cargo build --target ${{ matrix.rust-target }} --features ${{ matrix.optimizer_backend }} + run: cargo build --features ${{ matrix.optimizer_backend }} - name: Run Rust working-directory: rust - run: cargo run --example swerve --target ${{ matrix.rust-target }} --features ${{ matrix.optimizer_backend }} + run: cargo run --example swerve --features ${{ matrix.optimizer_backend }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 483c5647..99359862 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,15 +15,15 @@ jobs: include: - artifact-name: Native - Windows (CasADi) # FIXME: Tests give "Exit code 0xc0000135" for missing DLLs - cmake-flags: "-G \"MinGW Makefiles\" -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ -DBUILD_TESTING=OFF" + cmake-flags: "-G \"MinGW Makefiles\" -DBUILD_TESTING=OFF" optimizer_backend: casadi os: windows-2022 - artifact-name: Native - macOS x86_64 (CasADi) - cmake-flags: "-DCMAKE_APPLE_SILICON_PROCESSOR=x86_64" + cmake-flags: optimizer_backend: casadi os: macOS-13 - artifact-name: Native - macOS arm64 (CasADi) - cmake-flags: "-DCMAKE_APPLE_SILICON_PROCESSOR=arm64" + cmake-flags: optimizer_backend: casadi os: macOS-14 - artifact-name: Native - Linux (CasADi) diff --git a/cmake/modules/FetchCasADi.cmake b/cmake/modules/FetchCasADi.cmake index 17e05b15..2a84ca96 100644 --- a/cmake/modules/FetchCasADi.cmake +++ b/cmake/modules/FetchCasADi.cmake @@ -26,10 +26,7 @@ macro(fetch_casadi) ) set(CASADI_INSTALL_DEST "bin") elseif(APPLE) - if( - CMAKE_APPLE_SILICON_PROCESSOR MATCHES "arm64" - OR CMAKE_OSX_ARCHITECTURES MATCHES "arm64" - ) + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") message(STATUS "Building for macOS arm64") set(CASADI_URL https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-osx_arm64-py311.zip @@ -45,10 +42,7 @@ macro(fetch_casadi) ${CASADI_LIBDIR}/libquadmath.0.dylib ${CASADI_LIBDIR}/libgcc_s.1.1.dylib ) - elseif( - CMAKE_APPLE_SILICON_PROCESSOR MATCHES "x86_64" - OR CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" - ) + elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64") message(STATUS "Building for macOS x86_64") set(CASADI_URL https://github.com/casadi/casadi/releases/download/3.6.4/casadi-3.6.4-osx64-py311.zip diff --git a/cmake/modules/InstallJavaLibs.cmake b/cmake/modules/InstallJavaLibs.cmake index c8f9a8f8..6e53601f 100644 --- a/cmake/modules/InstallJavaLibs.cmake +++ b/cmake/modules/InstallJavaLibs.cmake @@ -13,9 +13,9 @@ macro(installjavalibs) set(JAVA_LIB_TARGET_PATH ${JAVA_LIB_TARGET_PATH}/windows/x86) endif() elseif(APPLE) - if(CMAKE_APPLE_SILICON_PROCESSOR MATCHES "arm64") + if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm64") set(JAVA_LIB_TARGET_PATH ${JAVA_LIB_TARGET_PATH}/osx/arm64) - elseif(CMAKE_APPLE_SILICON_PROCESSOR MATCHES "x86_64") + elseif(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64") set(JAVA_LIB_TARGET_PATH ${JAVA_LIB_TARGET_PATH}/osx/x86_64) endif() elseif(UNIX) diff --git a/node/CMakeLists.txt b/node/CMakeLists.txt index fcdc95f2..11c83141 100644 --- a/node/CMakeLists.txt +++ b/node/CMakeLists.txt @@ -28,7 +28,6 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_JS_INC}) target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB}) set(OPTIMIZER_BACKEND casadi) -set(CMAKE_APPLE_SILICON_PROCESSOR arm64) add_subdirectory( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../build