-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract occt-sys to its own crate (same repository/workspace)
Also use Swatinem/rust-cache action to do Rust dependency caching (that exludes occt-sys).
- Loading branch information
Showing
11 changed files
with
121 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "crates/opencascade-sys/OCCT"] | ||
path = crates/opencascade-sys/OCCT | ||
path = crates/occt-sys/OCCT | ||
url = https://github.com/Open-Cascade-SAS/OCCT.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
[package] | ||
name = "occt-sys" | ||
description = "Static build of the C++ OpenCascade CAD Kernel for use as a Rust dependency" | ||
authors = ["Brian Schwind <[email protected]>", "Matěj Laitl <[email protected]>"] | ||
license = "LGPL-2.1" | ||
version = "0.1.0" | ||
edition = "2021" | ||
repository = "https://github.com/bschwind/opencascade-rs" | ||
|
||
# Desperately trying to reduce the crate size here... | ||
exclude = [ | ||
"OCCT/adm/*", | ||
"OCCT/data/*", | ||
"OCCT/dox/*", | ||
"OCCT/samples/*", | ||
"OCCT/src/AdvApp2Var/*", | ||
"OCCT/src/AIS/*", | ||
"OCCT/src/AppCont/*", | ||
"OCCT/src/BRepTest/*", | ||
"OCCT/src/Draw/*", | ||
"OCCT/src/Graphic3d/*", | ||
"OCCT/src/HLRBRep/*", | ||
"OCCT/src/IFSelect/*", | ||
"OCCT/src/IGESAppli/*", | ||
"OCCT/src/IGESData/*", | ||
"OCCT/src/IGESDimen/*", | ||
"OCCT/src/IGESDraw/*", | ||
"OCCT/src/IGESGeom/*", | ||
"OCCT/src/IGESSolid/*", | ||
"OCCT/src/MeshVS/*", | ||
"OCCT/src/OpenGl/*", | ||
"OCCT/src/PrsDim/*", | ||
"OCCT/src/QABugs/*", | ||
"OCCT/src/Resource/*", | ||
"OCCT/src/SelectMgr/*", | ||
"OCCT/src/Shaders/*", | ||
"OCCT/src/StepVisual/*", | ||
"OCCT/src/TDataStd/*", | ||
"OCCT/src/Textures/*", | ||
"OCCT/src/ViewerTest/*", | ||
"OCCT/src/Vrml/*", | ||
"OCCT/src/VrmlData/*", | ||
"OCCT/src/XCAFDoc/*", | ||
"OCCT/src/XDEDRAW/*", | ||
"OCCT/tests/*", | ||
"OCCT/tools/*", | ||
] | ||
|
||
[dependencies] | ||
|
||
[build-dependencies] | ||
cmake = "0.1" |
Submodule OCCT
updated
from 000000 to b079fb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const LIB_DIR: &str = "lib"; | ||
const INCLUDE_DIR: &str = "include"; | ||
|
||
fn main() { | ||
let dst = cmake::Config::new("OCCT") | ||
.define("BUILD_LIBRARY_TYPE", "Static") | ||
.define("BUILD_MODULE_Draw", "FALSE") | ||
.define("USE_OPENGL", "FALSE") | ||
.define("USE_GLES2", "FALSE") | ||
.define("USE_D3D", "FALSE") | ||
.define("USE_VTK", "FALSE") | ||
.define("USE_TCL", "FALSE") | ||
.define("USE_XLIB", "FALSE") | ||
.define("USE_FREETYPE", "FALSE") | ||
.define("USE_FREEIMAGE", "FALSE") | ||
.define("USE_OPENVR", "FALSE") | ||
.define("USE_FFMPEG", "FALSE") | ||
.define("INSTALL_DIR_LIB", LIB_DIR) | ||
.define("INSTALL_DIR_INCLUDE", INCLUDE_DIR) | ||
.build(); | ||
|
||
println!( | ||
"cargo:rustc-env=OCCT_LIB_PATH={}", | ||
dst.join(LIB_DIR).to_str().expect("path is valid Unicode") | ||
); | ||
println!( | ||
"cargo:rustc-env=OCCT_INCLUDE_PATH={}", | ||
dst.join(INCLUDE_DIR) | ||
.to_str() | ||
.expect("path is valid Unicode") | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use occt_sys::{occt_include_path, occt_lib_path}; | ||
|
||
fn main() { | ||
println!("occt_lib_path: {}", occt_lib_path().to_str().unwrap()); | ||
println!( | ||
"occt_include_path: {}", | ||
occt_include_path().to_str().unwrap() | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use std::path::Path; | ||
|
||
/// Get path to OCCT library directory with built static libraries. To be used in build scripts | ||
/// with the `cargo:rustc-link-search` command. | ||
/// | ||
/// Only valid during build (`cargo clean` removes these files). | ||
pub fn occt_lib_path() -> &'static Path { | ||
Path::new(env!("OCCT_LIB_PATH")) | ||
} | ||
|
||
/// Get path to OCCT header files. | ||
/// | ||
/// Only valid during build (`cargo clean` removes these files). | ||
pub fn occt_include_path() -> &'static Path { | ||
Path::new(env!("OCCT_INCLUDE_PATH")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters