diff options
| author | ruki <[email protected]> | 2025-08-19 10:59:05 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-19 10:59:05 +0800 |
| commit | c31cd67e1815e37620a1b8b252240d5dbbc1ed85 (patch) | |
| tree | 08b139dda7dbdc9095d2c77e66704ffa5833db79 /tests/projects/c++/modules | |
| parent | 56eaa5721cb8408013ebde1d95b84a3b3872d9d7 (diff) | |
| parent | de2dd38726f49b8bdedd17641486a3d3a39907aa (diff) | |
Merge pull request #6712 from Arthapz/fix-moduleonly-installation
fix(c++ modules) fix disabled target getting configured for module compilation
Diffstat (limited to 'tests/projects/c++/modules')
4 files changed, 46 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/install_with_false_default/src/foo.mpp b/tests/projects/c++/modules/install_with_false_default/src/foo.mpp new file mode 100644 index 000000000..1945fd300 --- /dev/null +++ b/tests/projects/c++/modules/install_with_false_default/src/foo.mpp @@ -0,0 +1,5 @@ +export module foo; + +export namespace foo { + void foo() {} +} diff --git a/tests/projects/c++/modules/install_with_false_default/src/main.cpp b/tests/projects/c++/modules/install_with_false_default/src/main.cpp new file mode 100644 index 000000000..d201aa1a2 --- /dev/null +++ b/tests/projects/c++/modules/install_with_false_default/src/main.cpp @@ -0,0 +1,6 @@ +import foo; + +int main() { + foo::foo(); + return 0; +} diff --git a/tests/projects/c++/modules/install_with_false_default/test.lua b/tests/projects/c++/modules/install_with_false_default/test.lua new file mode 100644 index 000000000..14ef968af --- /dev/null +++ b/tests/projects/c++/modules/install_with_false_default/test.lua @@ -0,0 +1,23 @@ +inherit(".test_base") +import("utils.ci.is_running", {alias = "ci_is_running"}) + +CLANG_MIN_VER = is_subhost("windows") and "19" or "17" +GCC_MIN_VER = "11" +MSVC_MIN_VER = "14.29" + +function _build(check_outdata) + local flags = "" + if ci_is_running() then + flags = "-vD" + end + os.run("xmake -r " .. flags) + os.run("xmake b -r " .. flags .. " module_test1") + os.run("xmake install " .. flags .. " --installdir=out") +end + +function main(_) + local clang_options = {compiler = "clang", version = CLANG_MIN_VER, build = _build} + local gcc_options = {compiler = "gcc", version = GCC_MIN_VER, build = _build} + local msvc_options = {version = MSVC_MIN_VER, build = _build} + run_tests(clang_options, gcc_options, msvc_options) +end diff --git a/tests/projects/c++/modules/install_with_false_default/xmake.lua b/tests/projects/c++/modules/install_with_false_default/xmake.lua new file mode 100644 index 000000000..6274cda01 --- /dev/null +++ b/tests/projects/c++/modules/install_with_false_default/xmake.lua @@ -0,0 +1,12 @@ +add_rules("mode.release", "mode.debug") +set_languages("c++20") + +target("module_test") + set_kind("moduleonly") + add_files("src/*.mpp") + +target("module_test1") + set_kind("binary") + set_default(false) + add_deps("module_test") + add_files("src/*.cpp") |
