Skip to content

Commit

Permalink
fixing windows path
Browse files Browse the repository at this point in the history
  • Loading branch information
EdorianDark committed Oct 25, 2020
1 parent ec8c376 commit a5f4e96
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ jobs:
mkdir C:\Cbc
Invoke-WebRequest "https://bintray.com/coin-or/download/download_file?file_path=Cbc-2.9-win32-msvc14.zip" -OutFile "C:\Cbc\Cbc-2.9.zip"
7z x C:\Cbc\Cbc-2.9.zip -o"C:\Cbc\"
Get-ChildItem -Path "C:\Cbc"
Get-ChildItem -Path "C:\Cbc\lib"
echo "C:\Cbc\lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo $env:GITHUB_PATH
type $env:GITHUB_PATH
- name: Build
run: |
echo "C:\Cbc\lib" >> $GITHUB_PATH
cargo build --verbose --all
run: cargo build --verbose --all
- name: Run tests
run: |
echo "C:\Cbc\lib" >> $GITHUB_PATH
cargo test --verbose --all
run: cargo test --verbose --all
1 change: 1 addition & 0 deletions coin_cbc_sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ repository = "https://github.com/KardinalAI/coin_cbc"
keywords = ["MILP", "MIP", "linear programming"]
categories = ["external-ffi-bindings", "mathematics", "science"]
license = "MIT "
build = "build.rs"
19 changes: 19 additions & 0 deletions coin_cbc_sys/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
fn main() {
use std::env;

let is_linux = env::var("CARGO_CFG_UNIX");
if is_linux.is_ok() {
println!("cargo:rustc-link-lib=CbcSolver");
return;
}

let is_win = env::var("CARGO_CFG_WINDOWS");
if is_win.is_ok() {
println!("cargo:rustc-link-lib=libCbcSolver");
let path = env::var("PATH");
if let Ok(ok_path) = path {
println!("cargo:rustc-link-search={}", ok_path);
}
return;
}
}
2 changes: 0 additions & 2 deletions coin_cbc_sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ pub type cbc_callback = Option<
),
>;

#[cfg_attr(unix, link(name = "CbcSolver"))]
#[cfg_attr(windows, link(name = "libCbcSolver"))]
extern "C" {
pub fn Cbc_newModel() -> *mut Cbc_Model;
pub fn Cbc_deleteModel(model: *mut Cbc_Model);
Expand Down

0 comments on commit a5f4e96

Please sign in to comment.