From 24438fd6f5903c65bdc438e5dd392131e2b66e15 Mon Sep 17 00:00:00 2001 From: Be Wilson Date: Fri, 1 Dec 2023 02:30:51 -0600 Subject: [PATCH 1/5] meta_project: use `extern crate` rather than `pub use` No need to change the privacy of these; just need to have the symbols referenced within the staticlib crate. --- examples/meta_project/rust/main/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/meta_project/rust/main/src/lib.rs b/examples/meta_project/rust/main/src/lib.rs index 73b514826..9133ec875 100644 --- a/examples/meta_project/rust/main/src/lib.rs +++ b/examples/meta_project/rust/main/src/lib.rs @@ -7,6 +7,6 @@ mod main_object; // Ensure the symbols from the rlib dependencies end up // in the staticlib (if you use Rust symbols from these -// crates in this crate, you can skip these `pub use` statements). -pub use sub1; -pub use sub2; +// crates in this crate, you can skip these `extern crate` statements). +extern crate sub1; +extern crate sub2; From 9cfc9978716e49c541ed2f30e617cbcf5a58b7d7 Mon Sep 17 00:00:00 2001 From: Be Wilson Date: Fri, 1 Dec 2023 02:49:20 -0600 Subject: [PATCH 2/5] CMake: exclude qml-meta-project from `cargo test` to avoid linking failures as described in comment --- CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b33d2d2dd..4ece66d99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,10 +202,13 @@ endif() set(CARGO_TARGET_DIR "${CMAKE_BINARY_DIR}/${BUILD_DIR}/cargo/build") # Add CMake tests for `cargo test/clippy/fmt/doc`. -add_test(NAME cargo_tests COMMAND cargo test --features link_qt_object_files --all-targets --target-dir - ${CARGO_TARGET_DIR}) -add_test(NAME cargo_doc_tests COMMAND cargo test --features link_qt_object_files --doc --target-dir - ${CARGO_TARGET_DIR}) + +# qml-meta-project has issues linking with Qt 5 on Windows, as well as with GNU ld.gold. +# There are no Cargo tests for that example anyway, so skip building it with `cargo test`. +add_test(NAME cargo_tests COMMAND cargo test --features link_qt_object_files --workspace --exclude qml-meta-project + --target-dir ${CARGO_TARGET_DIR}) +add_test(NAME cargo_doc_tests COMMAND cargo test --features link_qt_object_files --doc + --target-dir ${CARGO_TARGET_DIR}) add_test(NAME cargo_doc COMMAND cargo doc --workspace --target-dir ${CARGO_TARGET_DIR}) add_test(NAME cargo_clippy COMMAND cargo clippy --all-targets --target-dir ${CARGO_TARGET_DIR} -- -D warnings) From 61120c263ce6b5d76e425eb417ca3ba580fd261e Mon Sep 17 00:00:00 2001 From: Be Wilson Date: Fri, 1 Dec 2023 13:37:43 -0600 Subject: [PATCH 3/5] GH Actions: try not building in parallel --- .github/workflows/github-cxx-qt-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-cxx-qt-tests.yml b/.github/workflows/github-cxx-qt-tests.yml index a5056aaec..de7644436 100644 --- a/.github/workflows/github-cxx-qt-tests.yml +++ b/.github/workflows/github-cxx-qt-tests.yml @@ -213,7 +213,7 @@ jobs: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} - name: "Build" - run: cmake --build build --config Release --parallel 2 + run: cmake --build build --config Release working-directory: ${{ matrix.workspace }} env: RUSTC_WRAPPER: sccache From 8388ad0567aa23bf63316ab3c354e762cb61927a Mon Sep 17 00:00:00 2001 From: Be Wilson Date: Fri, 1 Dec 2023 14:03:52 -0600 Subject: [PATCH 4/5] meta_project: do not parallelize build --- examples/meta_project/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/meta_project/CMakeLists.txt b/examples/meta_project/CMakeLists.txt index 00b09b06f..c8269dba7 100644 --- a/examples/meta_project/CMakeLists.txt +++ b/examples/meta_project/CMakeLists.txt @@ -34,7 +34,7 @@ if(NOT Corrosion_FOUND) endif() set(CRATE qml-meta-project) -corrosion_import_crate(MANIFEST_PATH rust/main/Cargo.toml CRATES ${CRATE}) +corrosion_import_crate(MANIFEST_PATH rust/main/Cargo.toml CRATES ${CRATE} FLAGS -j1) set(CXXQT_EXPORT_DIR "${CMAKE_CURRENT_BINARY_DIR}/cxxqt") corrosion_set_env_vars(${CRATE} "CXXQT_EXPORT_DIR=${CXXQT_EXPORT_DIR}" From 4a33449984e9f14e51843f3e6decd429123034eb Mon Sep 17 00:00:00 2001 From: Be Wilson Date: Fri, 1 Dec 2023 14:19:31 -0600 Subject: [PATCH 5/5] GH Actions: explicitly use --parallel 1 for CMake build --- .github/workflows/github-cxx-qt-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/github-cxx-qt-tests.yml b/.github/workflows/github-cxx-qt-tests.yml index de7644436..f02e66305 100644 --- a/.github/workflows/github-cxx-qt-tests.yml +++ b/.github/workflows/github-cxx-qt-tests.yml @@ -213,7 +213,7 @@ jobs: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} - name: "Build" - run: cmake --build build --config Release + run: cmake --build build --config Release --parallel 1 working-directory: ${{ matrix.workspace }} env: RUSTC_WRAPPER: sccache