summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2025-08-14 21:00:23 +0200
committerArthur LAURENT <[email protected]>2025-08-14 21:00:23 +0200
commitde2dd38726f49b8bdedd17641486a3d3a39907aa (patch)
treee301452350975a3f634b0ec84023a5ee9091e437 /tests/projects/c++/modules
parent84fcc1fd63aec5b6126f35806305326e4ecb936f (diff)
fix(c++ modules) fix disabled target getting configured for module compilation
Diffstat (limited to 'tests/projects/c++/modules')
-rw-r--r--tests/projects/c++/modules/install_with_false_default/src/foo.mpp5
-rw-r--r--tests/projects/c++/modules/install_with_false_default/src/main.cpp6
-rw-r--r--tests/projects/c++/modules/install_with_false_default/test.lua23
-rw-r--r--tests/projects/c++/modules/install_with_false_default/xmake.lua12
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")