Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
Remove explicit Rust setup and CMake flags (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
calcmogul authored Feb 19, 2024
1 parent 8ea32a2 commit 85c0aad
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 29 deletions.
23 changes: 8 additions & 15 deletions .github/workflows/build-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,57 +15,50 @@ 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 }}

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 }}
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 2 additions & 8 deletions cmake/modules/FetchCasADi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/InstallJavaLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion node/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 85c0aad

Please sign in to comment.