Packages

Model and solve LP/MILP/QP/QCP/SOCP with in-process solver bindings: HiGHS built in (precompiled), Gurobi, CPLEX, and COPT optional. Native indicators, abs, piecewise-linear, min/max, SOS, duals, IIS, and live solve streaming.

Current section

Files

Jump to
optex native optex_copt build.rs
Raw

native/optex_copt/build.rs

//! Locate and link the installed COPT (Cardinal Optimizer) library. Unlike
//! Gurobi's, the import library name is unversioned (copt.lib / libcopt.so),
//! so COPT_HOME/lib is used directly. This crate is only compiled when the
//! Elixir side detects COPT_HOME.
use std::{env, path::PathBuf};
fn main() {
println!("cargo:rerun-if-env-changed=COPT_HOME");
let home = env::var("COPT_HOME")
.expect("COPT_HOME must be set to the COPT install dir to build optex_copt");
let lib_dir = PathBuf::from(&home).join("lib");
println!("cargo:rustc-link-search=native={}", lib_dir.display());
println!("cargo:rustc-link-lib=dylib=copt");
}