diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5a9dea7d..26e34711 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -251,6 +251,28 @@ jobs: working-directory: build run: ctest --output-on-failure --build-config Debug -j 3 + ninja_multi_config_cross_config: + name: Test Ninja Multi-Config Cross-Configs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install CMake + uses: corrosion-rs/install-cmake@v2 + with: + cmake: 3.22.6 + ninja: 1.10.0 + # Install cbindgen before Rust to use recent default Rust version. + - name: Install cbindgen + run: cargo install cbindgen + - name: Install Rust + id: install_rust + uses: dtolnay/rust-toolchain@stable + - name: Configure + run: cmake -S. -Bbuild -G "Ninja Multi-Config" -DCMAKE_CROSS_CONFIGS="Debug;Release" -DCMAKE_DEFAULT_CONFIGS="Debug;Release" + - name: Run Tests + working-directory: build + run: ctest --output-on-failure -j 3 --build-config Debug + test_cxxbridge: name: Test cxxbridge integration diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1a42ba4d..eb08deb7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -112,6 +112,12 @@ function(corrosion_tests_add_test test_name bin_names) if(CMAKE_TOOLCHAIN_FILE) list(APPEND configure_cmake_args TOOLCHAIN_FILE "${CMAKE_TOOLCHAIN_FILE}") endif() + if(CMAKE_CROSS_CONFIGS) + list(APPEND configure_cmake_args CMAKE_CROSS_CONFIGS "${CMAKE_CROSS_CONFIGS}") + endif() + if(CMAKE_DEFAULT_CONFIGS) + list(APPEND configure_cmake_args CMAKE_DEFAULT_CONFIGS "${CMAKE_DEFAULT_CONFIGS}") + endif() add_test(NAME "${test_name}_build" COMMAND diff --git a/test/ConfigureAndBuild.cmake b/test/ConfigureAndBuild.cmake index c3017074..4845731c 100644 --- a/test/ConfigureAndBuild.cmake +++ b/test/ConfigureAndBuild.cmake @@ -23,6 +23,8 @@ set(oneValueArgs CARGO_PROFILE OSX_ARCHITECTURES TOOLCHAIN_FILE + CMAKE_CROSS_CONFIGS + CMAKE_DEFAULT_CONFIGS ) set(multiValueArgs "PASS_THROUGH_ARGS") cmake_parse_arguments(TEST "${options}" "${oneValueArgs}" @@ -59,6 +61,12 @@ endif() if(TEST_TOOLCHAIN_FILE) list(APPEND configure_args "-DCMAKE_TOOLCHAIN_FILE=${TEST_TOOLCHAIN_FILE}") endif() +if(TEST_CMAKE_CROSS_CONFIGS) + list(APPEND configure_args "-DCMAKE_CROSS_CONFIGS=${TEST_CMAKE_CROSS_CONFIGS}") +endif() +if(TEST_CMAKE_DEFAULT_CONFIGS) + list(APPEND configure_args "-DCMAKE_DEFAULT_CONFIGS=${TEST_CMAKE_DEFAULT_CONFIGS}") +endif() if(TEST_CARGO_PROFILE) list(APPEND configure_args "-DCARGO_PROFILE=${TEST_CARGO_PROFILE}") endif()