File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -9,3 +9,5 @@ repository = "https://github.com/KardinalAI/coin_cbc"
99keywords = [" MILP" , " MIP" , " linear programming" ]
1010categories = [" external-ffi-bindings" , " mathematics" , " science" ]
1111license = " MIT "
12+ build = " build.rs"
13+ links = " CbcSolver"
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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" ) ) ]
2725extern "C" {
2826 pub fn Cbc_newModel ( ) -> * mut Cbc_Model ;
2927 pub fn Cbc_deleteModel ( model : * mut Cbc_Model ) ;
You can’t perform that action at this time.
0 commit comments