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

Add vcpkg support and corresponding CI. #251

Merged
merged 24 commits into from
Oct 22, 2023

Conversation

TheVeryDarkness
Copy link
Contributor

@TheVeryDarkness TheVeryDarkness commented Oct 13, 2023

Support using vcpkg-rs to manage z3 library.

Added a non-default feature vcpkg.

However, vcpkg-rs does not support wasm32 target currently. I created a pull request there at mcgoo/vcpkg-rs#53.

Use vcpkg-rs to manage z3 instead. A non-default feature vcpkg is added.

However, vcpkg-rs does not support wasm32 target currently. I created a pull request there at mcgoo/vcpkg-rs#53
Make emscripten visible to wasm32-unknown-unknown if emscripten is installed.
Z3_HEADER_VAR will disappear when the feature vcpkg is enabled.
Use is_err instead of pattern matching.
Copy link
Contributor

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

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

We'll also want to do something to add CI coverage of this to make sure it works ... like adding a vcpkg build on Windows in CI.

z3-sys/build.rs Outdated Show resolved Hide resolved
z3/tests/lib.rs Outdated Show resolved Hide resolved
z3-sys/build.rs Outdated Show resolved Hide resolved
z3-sys/build.rs Show resolved Hide resolved
@waywardmonkeys
Copy link
Contributor

Despite all of the above, I do want to say that I'm very happy to see this and thanks so much for starting us down this path!

@TheVeryDarkness
Copy link
Contributor Author

Okay, but I'm afraid that I need some time for it. I may be busy for several days as I'm attending a game.

z3-sys/build.rs Outdated
let wasm32 = target.starts_with("wasm32-unknown");
let wasm32_emscripten = target == "wasm32-unknown-emscripten";
if wasm32 {
let sysroot = env::var("EMSDK")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems that sometimes the cache may be missing for fresh emscripten installation. So I'm not sure whether we should add some notices here.

build_with_vcpkg_installed_z3:
strategy:
matrix:
build: [linux, macos, windows]
Copy link
Contributor

Choose a reason for hiding this comment

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

For now, let's just do this on Windows since that's where GitHub has it installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I see. Thanks. And sorry, I just copied some codes from previous CI.
And it's weird that CI failed on Windows, as I've built z3 that way on Windows several times.

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw it failing on Linux and that caused the macOS and Windows builds to get cancelled. (At least in the run that I looked at.)

Copy link
Contributor Author

@TheVeryDarkness TheVeryDarkness Oct 18, 2023

Choose a reason for hiding this comment

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

I've added an option to disable fail-fast in my branch. Here's the result.
Oops, it's caused because the runner run out of space. I didn't notice that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may be fixed by cleaning the vcpkg build tree.

Copy link
Contributor

@waywardmonkeys waywardmonkeys left a comment

Choose a reason for hiding this comment

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

I'll have more comments later ... but wanted to at least flag this for now.

const Z3_HEADER_VAR: &str = "Z3_SYS_Z3_HEADER";

fn main() {
// Feature `vcpkg` is prior to `static-link-z3` as vcpkg-installed z3 is also statically linked.

#[cfg(not(feature = "vcpkg"))]
#[cfg(feature = "static-link-z3")]
Copy link
Contributor

Choose a reason for hiding this comment

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

I want to rename static-link-z3 to bundled as the static linking isn't what's actually getting handled here. Either vcpkg or static-link-z3 should be set, but not both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I see. I may do that tomorrow as it's midnight here. Thanks.

@TheVeryDarkness TheVeryDarkness changed the title Add vcpkg support and improve wasm32-unknown-unknown support Add vcpkg support and corresponding CI. Oct 18, 2023
So that rust can continue to build.
By this, we can check whether the toolchain matches the vcpkg triplet.
@waywardmonkeys
Copy link
Contributor

I'm going to merge this and then see about further / subsequent changes!

@waywardmonkeys
Copy link
Contributor

Thank you again for working on this!

@waywardmonkeys waywardmonkeys merged commit 815a6c4 into prove-rs:master Oct 22, 2023
8 checks passed
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.

2 participants