-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow cross compilation under builtin flag v2 #185
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,12 @@ | ||
const LIB_DIR: &str = "lib"; | ||
const INCLUDE_DIR: &str = "include"; | ||
use std::{env::var, path::Path}; | ||
|
||
fn main() { | ||
let current_dir = std::env::current_dir().expect("Should have a 'current' directory"); | ||
let patch_dir = current_dir.join("patch"); | ||
|
||
let dst = cmake::Config::new("OCCT") | ||
.define("BUILD_PATCH", patch_dir) | ||
.define("BUILD_LIBRARY_TYPE", "Static") | ||
.define("BUILD_MODULE_ApplicationFramework", "FALSE") | ||
.define("BUILD_MODULE_Draw", "FALSE") | ||
.define("USE_D3D", "FALSE") | ||
.define("USE_DRACO", "FALSE") | ||
.define("USE_EIGEN", "FALSE") | ||
.define("USE_FFMPEG", "FALSE") | ||
.define("USE_FREEIMAGE", "FALSE") | ||
.define("USE_FREETYPE", "FALSE") | ||
.define("USE_GLES2", "FALSE") | ||
.define("USE_OPENGL", "FALSE") | ||
.define("USE_OPENVR", "FALSE") | ||
.define("USE_RAPIDJSON", "FALSE") | ||
.define("USE_TBB", "FALSE") | ||
.define("USE_TCL", "FALSE") | ||
.define("USE_TK", "FALSE") | ||
.define("USE_VTK", "FALSE") | ||
.define("USE_XLIB", "FALSE") | ||
.define("INSTALL_DIR_LIB", LIB_DIR) | ||
.define("INSTALL_DIR_INCLUDE", INCLUDE_DIR) | ||
.build(); | ||
|
||
println!("cargo:rustc-env=OCCT_PATH={}", dst.to_str().expect("path is valid Unicode")); | ||
println!( | ||
"cargo:rustc-env=OCCT_SRC_DIR={}", | ||
Path::new(&var("CARGO_MANIFEST_DIR").unwrap()).join("OCCT").to_string_lossy() | ||
); | ||
println!( | ||
"cargo:rustc-env=OCCT_PATCH_DIR={}", | ||
Path::new(&var("CARGO_MANIFEST_DIR").unwrap()).join("patch").to_string_lossy() | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,46 @@ | ||
use std::path::Path; | ||
use std::{ | ||
env::var, | ||
path::{Path, PathBuf}, | ||
}; | ||
|
||
const LIB_DIR: &str = "lib"; | ||
const INCLUDE_DIR: &str = "include"; | ||
|
||
/// Get the path to the OCCT library installation directory to be | ||
/// used in build scripts. | ||
/// | ||
/// Only valid during build (`cargo clean` removes these files). | ||
pub fn occt_path() -> &'static Path { | ||
Path::new(env!("OCCT_PATH")) | ||
pub fn occt_path() -> PathBuf { | ||
// moves the output into target/TARGET/OCCT | ||
// this way its less likely to be rebuilt without a cargo clean | ||
Path::new(&var("OUT_DIR").expect("missing OUT_DIR")).join("../../../../OCCT") | ||
} | ||
|
||
/// Build the OCCT library. | ||
pub fn build_occt() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nobody calls this (as of this PR), is that intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe there's a part 2 coming for this PR. We first wanted to merge this to publish the next version of occt-sys since it is not included in the workspace. |
||
cmake::Config::new(Path::new(env!("OCCT_SRC_DIR"))) | ||
.define("BUILD_PATCH", Path::new(env!("OCCT_PATCH_DIR"))) | ||
.define("BUILD_LIBRARY_TYPE", "Static") | ||
.define("BUILD_MODULE_ApplicationFramework", "FALSE") | ||
.define("BUILD_MODULE_Draw", "FALSE") | ||
.define("USE_D3D", "FALSE") | ||
.define("USE_DRACO", "FALSE") | ||
.define("USE_EIGEN", "FALSE") | ||
.define("USE_FFMPEG", "FALSE") | ||
.define("USE_FREEIMAGE", "FALSE") | ||
.define("USE_FREETYPE", "FALSE") | ||
.define("USE_GLES2", "FALSE") | ||
.define("USE_OPENGL", "FALSE") | ||
.define("USE_OPENVR", "FALSE") | ||
.define("USE_RAPIDJSON", "FALSE") | ||
.define("USE_TBB", "FALSE") | ||
.define("USE_TCL", "FALSE") | ||
.define("USE_TK", "FALSE") | ||
.define("USE_VTK", "FALSE") | ||
.define("USE_XLIB", "FALSE") | ||
.define("INSTALL_DIR_LIB", LIB_DIR) | ||
.define("INSTALL_DIR_INCLUDE", INCLUDE_DIR) | ||
.profile("Release") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
.out_dir(occt_path()) | ||
.build(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a silly question, but do these variables even have to be set here? I.e.
lib.rs
may be able to derive them in the same way, sobuild.rs
may not even have to exist?