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

fix: allow cross compilation under builtin flag v2 #185

Merged
merged 2 commits into from
Nov 30, 2024

Conversation

fidoriel
Copy link
Contributor

Supersedes #163 while closing #160

@@ -13,7 +13,7 @@ cxx = "1"
[build-dependencies]
cmake = "0.1"
cxx-build = "1"
occt-sys = { version = "0.5.1", optional = true }
occt-sys = { path = "../occt-sys", optional = true }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bschwind not sure about this one here

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, I think we intentionally don't use the local dependency in order for our CI setup to cache it properly. See this comment.

Though we should revisit if that assumption still holds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so I use the 0.5.1 version?

Copy link
Owner

Choose a reason for hiding this comment

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

I think we'll have to do it in two parts:

  • I'll review the occt-sys changes and once we agree on those we can publish 0.5.2 or 0.6 depending on if it's a breaking change or not
  • We can then make the (somewhat trivial) opencascade-sys change separately

Sorry for the trouble on that, it's mostly trying to optimize for caching and faster CI build times. I'm also working on getting a windows dev machine set up to more easily be able to test this.

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 reasonable.

Copy link
Contributor Author

@fidoriel fidoriel Nov 17, 2024

Choose a reason for hiding this comment

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

done. Then there will be a follow-up once if released. Will do a squash on approve.

@fidoriel fidoriel changed the title fix: allow cross compilation under builtin flag fix: allow cross compilation under builtin flag v2 Nov 17, 2024
@fidoriel
Copy link
Contributor Author

Am using my feature branch within https://github.com/fidoriel/MeshVault/actions/runs/11877885906/job/33097958333. THis is a ci run of a cross compiled x64/aarch64 target, while compiling aarch within a x64 environment. So it works :)

@fidoriel fidoriel requested a review from bschwind November 17, 2024 14:09
@fidoriel
Copy link
Contributor Author

@bschwind ping

@bschwind
Copy link
Owner

bschwind commented Nov 30, 2024

Hi @fidoriel, sorry for the delay. I haven't yet been able to get a windows machine up and running and I'll be traveling fairly soon so it might take me some time.

At the very least I'll test this on MacOS and Linux first and we can merge it if that goes well, and then I'll check the windows stuff later.

Edit - actually, I forgot this is a pretty small change now and we need to publish the next occt-sys, so I'll try to get that done soon.

Copy link
Owner

@bschwind bschwind left a comment

Choose a reason for hiding this comment

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

LGTM! I'll publish this as occt-sys 0.6

@bschwind bschwind merged commit c754f4f into bschwind:main Nov 30, 2024
4 checks passed
@bschwind
Copy link
Owner

bschwind commented Nov 30, 2024

@fidoriel I published your changes to occt-sys under version 0.6

There are some unrelated CI issues I'll sort out later.

Copy link
Collaborator

@strohel strohel left a comment

Choose a reason for hiding this comment

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

Alright, this makes some sense, the OCCT is built for the "target", not to run as part of the build system. At the same time, I see that other -sys crates in the ecosystem usually perform the cmake build in build.rs.

I'm looking at #160 and I wonder (and this may be a silly question): wouldn't it be the solution that occt-sys is a runtime dependency of opencascade-sys?

For context @fidoriel: I briefly worked on these crates with @bschwind in the past, and he asked me to take a quick look.

.define("USE_XLIB", "FALSE")
.define("INSTALL_DIR_LIB", LIB_DIR)
.define("INSTALL_DIR_INCLUDE", INCLUDE_DIR)
.profile("Release")
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think cmake crate itself derives the "cmake profile" from the "Rust profile" being used, so explicitly passing it should not be in theory advantageous. Though I'm not sure if the new occt_path() includes the "Rust profile" (I'd say it would be better if it did).

Comment on lines +4 to +11
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()
);
Copy link
Collaborator

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, so build.rs may not even have to exist?

}

/// Build the OCCT library.
pub fn build_occt() {
Copy link
Collaborator

@strohel strohel Dec 1, 2024

Choose a reason for hiding this comment

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

Nobody calls this (as of this PR), is that intended?

Copy link
Owner

Choose a reason for hiding this comment

The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants