Skip to content
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

Windows build support #7

Merged
merged 13 commits into from
Dec 19, 2022
3 changes: 3 additions & 0 deletions crates/opencascade-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn main() {
.build();

println!("cargo:rustc-link-search=native={}", dst.join("lib").display());
println!("cargo:rustc-link-search=native={}", dst.join("win64/gcc/lib").display());
println!("cargo:rustc-link-lib=static=TKMath");
println!("cargo:rustc-link-lib=static=TKernel");
println!("cargo:rustc-link-lib=static=TKGeomBase");
Expand All @@ -36,6 +37,8 @@ fn main() {
cxx_build::bridge("src/lib.rs")
.cpp(true)
.flag_if_supported("-std=c++11")
.define("_USE_MATH_DEFINES", "TRUE")
.include(format!("{}", dst.join("inc").display()))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is CMake generating this directory only for windows targets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be. The structure is different in subtle ways.

One option is to add conditionals to enable/disable these different paths. I opted not to do that yet. Once a pattern emerges it might be a good idea.

Im not sure what OCCT does for macos or webassembly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried for macos. It uses the lib directory.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, I should mention that I develop mainly on MacOS so that target should be well tested.

I'm currently not planning to target web assembly, though I may have plans in the future to have a model viewer that accepts web assembly blobs which generate instructions for generating an opencascade model.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I am primarily on Linux myself so that covers those two. I will probably need webassembly at some point but I am in no rush for it.

I'm working on a project similar to OpenSCAD. Last year I did the webassembly port of OpenSCAD and judging from the community reaction, I will probably need it for this project as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha I wanted fillets and chamfers as well. Got those in first thing.

I made an adapter for my cars cup holder so I can fit my favorite mug in it. So I can say its usable. However there is lots to do before its ready for real use. However I did get a little 3D editor in it so it really feels like working with OpenSCAD at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldnt have gotten so far if this crate didnt exist. I really appreciate the work you did here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to leave issues and suggestions for things if you want. Especially syntax for the language since that needs lots of inspiration.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really cool to get a usable, real-world object as a result of some Rust hacking :)

I did get a little 3D editor in it so it really feels like working with OpenSCAD at this point.

MacOS has a native STL viewer that I've been using as a crutch, otherwise I probably would have gotten frustrated and made a viewer as well.

I wouldnt have gotten so far if this crate didnt exist. I really appreciate the work you did here.

Thank the opencascade devs! And dtolnay for the cxx crate :) I'm just gluing things together here, though I did suffer through the initial work of getting build.rs working properly, I'll take credit for that haha

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll clone it and give it a spin!

.include(format!("{}", dst.join("include").join("opencascade").display()))
.include("include")
.file("cpp/wrapper.cpp")
Expand Down