Skip to content

Commit 7cd63c7

Browse files
committed
fixing windows path
1 parent ec8c376 commit 7cd63c7

4 files changed

Lines changed: 28 additions & 8 deletions

File tree

.github/workflows/rust.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ jobs:
3333
mkdir C:\Cbc
3434
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"
3535
7z x C:\Cbc\Cbc-2.9.zip -o"C:\Cbc\"
36+
Get-ChildItem -Path "C:\Cbc"
37+
Get-ChildItem -Path "C:\Cbc\lib"
38+
echo "C:\Cbc\lib" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
39+
echo $env:GITHUB_PATH
40+
type $env:GITHUB_PATH
3641
- name: Build
37-
run: |
38-
echo "C:\Cbc\lib" >> $GITHUB_PATH
39-
cargo build --verbose --all
42+
run: cargo build --verbose --all
4043
- name: Run tests
41-
run: |
42-
echo "C:\Cbc\lib" >> $GITHUB_PATH
43-
cargo test --verbose --all
44+
run: cargo test --verbose --all

coin_cbc_sys/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ repository = "https://github.com/KardinalAI/coin_cbc"
99
keywords = ["MILP", "MIP", "linear programming"]
1010
categories = ["external-ffi-bindings", "mathematics", "science"]
1111
license = "MIT "
12+
build = "build.rs"
13+
links = "CbcSolver"

coin_cbc_sys/build.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
fn main() {
2+
use std::env;
3+
4+
let is_linux = env::var("CARGO_CFG_UNIX");
5+
if is_linux.is_ok() {
6+
println!("cargo:rustc-link-lib=CbcSolver");
7+
return;
8+
}
9+
10+
let is_win = env::var("CARGO_CFG_WINDOWS");
11+
if is_win.is_ok() {
12+
println!("cargo:rustc-link-lib=libCbcSolver");
13+
let path = env::var("PATH");
14+
if let Ok(ok_path) = path {
15+
println!("cargo:rustc-link-search={}", ok_path);
16+
}
17+
return;
18+
}
19+
}

coin_cbc_sys/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ pub type cbc_callback = Option<
2222
),
2323
>;
2424

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

0 commit comments

Comments
 (0)