diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 48d2d01..a0d5595 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -17,6 +17,7 @@ jobs: macos-13, macos-14, # macOS arm runner windows-latest, + ubuntu-24.04-arm ] runs-on: ${{ matrix.os }} steps: @@ -27,23 +28,23 @@ jobs: cargo t --features bundled --release create cargo t --features bundled --release --examples - bundled-debug-test: - strategy: - matrix: - os: [ - ubuntu-latest, - macos-13, - macos-14, # macOS arm runner - windows-latest, - ] - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - name: Test bundled - run: | - cargo b --features bundled - cargo t --features bundled create - cargo t --features bundled --examples +# bundled-debug-test: +# strategy: +# matrix: +# os: [ +# ubuntu-latest, +# macos-13, +# macos-14, # macOS arm runner +# windows-latest, +# ] +# runs-on: ${{ matrix.os }} +# steps: +# - uses: actions/checkout@v3 +# - name: Test bundled +# run: | +# cargo b --features bundled +# cargo t --features bundled create +# cargo t --features bundled --examples from-source-test: strategy: diff --git a/Cargo.toml b/Cargo.toml index da2d0f1..26ca335 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,7 @@ bundled = ["ureq", "zip", "tempfile", "zip-extract"] from-source = ["ureq", "zip", "tempfile", "zip-extract", "cmake"] [build-dependencies] -bindgen = "0.64" -cc = "1.0.73" +bindgen = "0.72.0" glob = "0.3.1" ureq = { version = "2.9.6", optional = true } zip = { version = "0.5", optional = true } diff --git a/bundled.rs b/bundled.rs index a9c552d..49fba13 100644 --- a/bundled.rs +++ b/bundled.rs @@ -26,7 +26,10 @@ pub fn download_scip() { let os_string = if os == "linux" && arch == "x86_64" { "linux" - } else if os == "macos" && arch == "x86_64" { + } else if os == "linux" && arch == "aarch64" { + "linux-arm" + } + else if os == "macos" && arch == "x86_64" { "macos-intel" } else if os == "macos" && arch == "aarch64" { "macos-arm" @@ -42,8 +45,12 @@ pub fn download_scip() { #[cfg(not(debug_assertions))] let debug_str = ""; + // TODO: enable this when debug builds are available + // let url = format!( + // "https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.8.0/libscip-{os_string}{debug_str}.zip", + // ); let url = format!( - "https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.7.0/libscip-{os_string}{debug_str}.zip", + "https://github.com/scipopt/scipoptsuite-deploy/releases/download/v0.8.0/libscip-{os_string}.zip", ); download_and_extract_zip(&url, &extract_path) diff --git a/examples/create.rs b/examples/create.rs index e0bb5df..b2988a4 100644 --- a/examples/create.rs +++ b/examples/create.rs @@ -1,3 +1,4 @@ +use std::ffi::CString; use scip_sys::*; use std::mem::MaybeUninit; @@ -9,7 +10,7 @@ fn main() { // include default plugins unsafe { SCIPincludeDefaultPlugins(scip_ptr) }; - unsafe { SCIPcreateProbBasic(scip_ptr, "test".as_ptr() as *const i8) }; + unsafe { SCIPcreateProbBasic(scip_ptr, CString::new("test").unwrap().as_ptr()) }; // add a variable let mut var_ptr = MaybeUninit::uninit(); @@ -17,7 +18,7 @@ fn main() { SCIPcreateVarBasic( scip_ptr, var_ptr.as_mut_ptr(), - "x".as_ptr() as *const i8, + CString::new("x").unwrap().as_ptr(), 0.0, 1.0, 1.0, @@ -33,7 +34,7 @@ fn main() { SCIPcreateConsBasicLinear( scip_ptr, cons_ptr.as_mut_ptr(), - "c".as_ptr() as *const i8, + CString::new("c").unwrap().as_ptr(), 1, &mut var_ptr, &mut 1.0, diff --git a/src/lib.rs b/src/lib.rs index aa78f3e..279db79 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,6 +10,7 @@ include!(concat!(env!("OUT_DIR"), "/bindings.rs")); #[cfg(test)] mod tests { + use std::ffi::CString; use super::*; use std::mem::MaybeUninit; @@ -22,7 +23,8 @@ mod tests { // include default plugins unsafe { SCIPincludeDefaultPlugins(scip_ptr) }; - unsafe { SCIPcreateProbBasic(scip_ptr, "test".as_ptr() as *const i8) }; + let name = CString::new("test").unwrap(); + unsafe { SCIPcreateProbBasic(scip_ptr, name.as_ptr()) }; // add a variable let mut var_ptr = MaybeUninit::uninit(); @@ -30,7 +32,7 @@ mod tests { SCIPcreateVarBasic( scip_ptr, var_ptr.as_mut_ptr(), - "x".as_ptr() as *const i8, + CString::new("x").unwrap().as_ptr(), 0.0, 1.0, 1.0, @@ -46,7 +48,7 @@ mod tests { SCIPcreateConsBasicLinear( scip_ptr, cons_ptr.as_mut_ptr(), - "c".as_ptr() as *const i8, + CString::new("c").unwrap().as_ptr(), 1, &mut var_ptr, &mut 1.0,