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

Use Sleipnir backend in TrajoptLib #84

Closed
wants to merge 17 commits into from
23 changes: 14 additions & 9 deletions rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ fn main() -> miette::Result<()> {

cmake_config
.profile("RelWithDebInfo")
.define("OPTIMIZER_BACKEND", "casadi");
.define("OPTIMIZER_BACKEND", "sleipnir");

if cfg!(target_os = "windows") {
cmake_config
.generator("MinGW Makefiles")
.define("CMAKE_CXX_COMPILER", "x86_64-w64-mingw32-g++")
.define("CMAKE_C_COMPILER", "x86_64-w64-mingw32-gcc")
.define(
"CMAKE_SHARED_LINKER_FLAGS",
"-static-libgcc -static-libstdc++",
)
.define("CMAKE_EXE_LINKER_FLAGS", "-static-libgcc -static-libstdc++");
.cxxflag("/EHsc")

.generator("Visual Studio 17 2022")
.define("CMAKE_GENERATOR_PLATFORM", "x64")
.cxxflag("-std=c++20");
// .define("CMAKE_CXX_COMPILER", "x86_64-w64-mingw32-g++")
// .define("CMAKE_C_COMPILER", "x86_64-w64-mingw32-gcc")
// .define(
// "CMAKE_SHARED_LINKER_FLAGS",
// "-static-libgcc -static-libstdc++",
// )
// .define("CMAKE_EXE_LINKER_FLAGS", "-static-libgcc -static-libstdc++");
}

if cfg!(target_os = "linux") {
Expand All @@ -36,6 +40,7 @@ fn main() -> miette::Result<()> {
.include("include")
.include(format!("{}/include", dst.display()))
.flag_if_supported("-std=c++20")
.flag_if_supported("/std:c++20")
.compile("trajoptlib-rust");

println!("cargo:rerun-if-changed=include/trajoptlib.h");
Expand Down
Loading