Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
macos-13,
macos-14, # macOS arm runner
windows-latest,
ubuntu-24.04-arm
]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
11 changes: 9 additions & 2 deletions bundled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions examples/create.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::ffi::CString;
use scip_sys::*;
use std::mem::MaybeUninit;

Expand All @@ -9,15 +10,15 @@ 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();
unsafe {
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,
Expand All @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -22,15 +23,16 @@ 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();
unsafe {
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,
Expand All @@ -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,
Expand Down
Loading