summaryrefslogtreecommitdiff
path: root/tests/projects/c++
diff options
context:
space:
mode:
authorruki <[email protected]>2025-04-06 23:02:59 +0800
committerruki <[email protected]>2025-04-08 15:31:58 +0800
commitb2d2727fdcc1d955b4095c57b6d02ff665bcbfd9 (patch)
treeee82ef18a8ca8e0e3680bceb106f99f5cc636806 /tests/projects/c++
parent162f55410e2a1ed2a81dddfc4189bb85158f2525 (diff)
disable module and pch for gcc
Diffstat (limited to 'tests/projects/c++')
-rw-r--r--tests/projects/c++/modules/hello_with_pch/test.lua2
-rw-r--r--tests/projects/c++/modules/test_pch.lua31
2 files changed, 32 insertions, 1 deletions
diff --git a/tests/projects/c++/modules/hello_with_pch/test.lua b/tests/projects/c++/modules/hello_with_pch/test.lua
index 7717f8049..16ef46834 100644
--- a/tests/projects/c++/modules/hello_with_pch/test.lua
+++ b/tests/projects/c++/modules/hello_with_pch/test.lua
@@ -1 +1 @@
-inherit(".test_base")
+inherit(".test_pch")
diff --git a/tests/projects/c++/modules/test_pch.lua b/tests/projects/c++/modules/test_pch.lua
new file mode 100644
index 000000000..98286c229
--- /dev/null
+++ b/tests/projects/c++/modules/test_pch.lua
@@ -0,0 +1,31 @@
+import("lib.detect.find_tool")
+import("core.base.semver")
+import("detect.sdks.find_vstudio")
+import("utils.ci.is_running", {alias = "ci_is_running"})
+
+function _build()
+ if ci_is_running() then
+ os.run("xmake -rvD")
+ else
+ os.run("xmake -r")
+ end
+ local outdata = os.iorun("xmake")
+ if outdata then
+ if outdata:find("compiling") or outdata:find("linking") or outdata:find("generating") then
+ raise("Modules incremental compilation does not work\n%s", outdata)
+ end
+ end
+end
+
+function main(t)
+ -- TODO c++ modules with pch does not work for gcc now.
+ if is_host("linux") then
+ local clang = find_tool("clang", {version = true})
+ if clang then
+ os.exec("xmake f --toolchain=clang -c --yes --policies=build.c++.modules.std:n,build.c++.clang.fallbackscanner")
+ _build()
+ end
+ else
+ _build()
+ end
+end