RsBundle  Check-in [b1977a1148]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:build: check for gurobi library name dynamically.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b1977a1148962f0d0358adbf4c1632ac712f32d6
User & Date: fifr 2017-02-03 21:16:12.591
Context
2017-02-13
07:56
Fix Gurobi detection in build script. check-in: 3866119d92 user: fifr tags: trunk
2017-02-03
21:16
build: check for gurobi library name dynamically. check-in: b1977a1148 user: fifr tags: trunk
2017-01-20
20:34
problem: refactor some loops using iterators. check-in: 358bb8efe2 user: fifr tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to Cargo.toml.
8
9
10
11
12
13
14



[dependencies]
libc = "^0.2.6"
quick-error = "^1.1.0"
log = "^0.3.6"

[dev-dependencies]
env_logger = "^0.3.5"










>
>
>
8
9
10
11
12
13
14
15
16
17
[dependencies]
libc = "^0.2.6"
quick-error = "^1.1.0"
log = "^0.3.6"

[dev-dependencies]
env_logger = "^0.3.5"

[build-dependencies]
regex = "^0.2"
Changes to build.rs.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18



19
20
21
22




23
24




25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 2016 Frank Fischer <frank-fischer@shadow-soft.de>
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

use std::env;




fn main() {
    match env::var("GUROBI_HOME") {
        Ok(grb) => {




            println!("cargo:rustc-link-search={}/lib", grb);
            println!("cargo:rustc-link-lib=gurobi65");




        },
        Err(_) => panic!("GUROBI_HOME environment variable not set"),
    }

    match env::var("CPLEX_HOME") {
        Ok(cpx) => {
            println!("cargo:rustc-link-search={}/lib/x86-64_sles10_4.1/static_pic", cpx);
            println!("cargo:rustc-link-lib=cplex");
        },
        Err(_) => panic!("CPLEX_HOME environment variable not set"),
    }
}

|
















>
>
>




>
>
>
>
|
|
>
>
>
>












1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright (c) 2016, 2017 Frank Fischer <frank-fischer@shadow-soft.de>
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see  <http://www.gnu.org/licenses/>
 */

use std::env;
use std::fs;

extern crate regex;

fn main() {
    match env::var("GUROBI_HOME") {
        Ok(grb) => {
            let re = regex::Regex::new("^lib(gurobi\\d+).so$").unwrap();
            if let Ok(dir) = fs::read_dir(&grb) {
                for entry in dir {
                    if let Some(m) = re.captures(entry.unwrap().file_name().to_str().unwrap()) {
                        println!("cargo:rustc-link-search={}/lib", grb);
                        println!("cargo:rustc-link-lib={}", &m[1]);
                        break;
                    }
                }
            }
        },
        Err(_) => panic!("GUROBI_HOME environment variable not set"),
    }

    match env::var("CPLEX_HOME") {
        Ok(cpx) => {
            println!("cargo:rustc-link-search={}/lib/x86-64_sles10_4.1/static_pic", cpx);
            println!("cargo:rustc-link-lib=cplex");
        },
        Err(_) => panic!("CPLEX_HOME environment variable not set"),
    }
}