summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2023-01-07 17:44:36 +0100
committerArthur LAURENT <[email protected]>2023-01-07 17:44:36 +0100
commit3755a6f67399b8e42df9f39ec7c506918dbb433a (patch)
tree6fdf938868f75790e828c86e64319d0c558885d1
parent887d301d4117d9fcb36077441fa75fb704e322fc (diff)
reenable old clang modules by default and fix tests
-rw-r--r--tests/projects/c++/modules/class/xmake.lua4
-rw-r--r--tests/projects/c++/modules/cpp_with_moduledeps/xmake.lua3
-rw-r--r--tests/projects/c++/modules/dependence/xmake.lua6
-rw-r--r--tests/projects/c++/modules/dependence2/xmake.lua4
-rw-r--r--tests/projects/c++/modules/headerunits_person/xmake.lua6
-rw-r--r--tests/projects/c++/modules/hello with spaces/xmake.lua3
-rw-r--r--tests/projects/c++/modules/hello/xmake.lua1
-rw-r--r--tests/projects/c++/modules/ifdef_module/xmake.lua1
-rw-r--r--tests/projects/c++/modules/impl_unit/xmake.lua4
-rw-r--r--tests/projects/c++/modules/inline_and_template/xmake.lua4
-rw-r--r--tests/projects/c++/modules/internal_partition/xmake.lua1
-rw-r--r--tests/projects/c++/modules/link_order/xmake.lua5
-rw-r--r--tests/projects/c++/modules/partitions/test.lua2
-rw-r--r--tests/projects/c++/modules/partitions/xmake.lua6
-rw-r--r--tests/projects/c++/modules/partitions2/test.lua2
-rw-r--r--tests/projects/c++/modules/partitions2/xmake.lua6
-rw-r--r--tests/projects/c++/modules/private_module/xmake.lua1
-rw-r--r--tests/projects/c++/modules/staticlib/xmake.lua3
-rw-r--r--tests/projects/c++/modules/stdmodules/test.lua2
-rw-r--r--tests/projects/c++/modules/stdmodules/xmake.lua5
-rw-r--r--tests/projects/c++/modules/stdmodules_multiple_targets/test.lua2
-rw-r--r--tests/projects/c++/modules/stdmodules_multiple_targets/xmake.lua3
-rw-r--r--tests/projects/c++/modules/stl_headerunit/xmake.lua4
-rw-r--r--tests/projects/c++/modules/stl_headerunit_cpp_only/xmake.lua75
-rw-r--r--tests/projects/c++/modules/submodules/xmake.lua6
-rw-r--r--tests/projects/c++/modules/submodules2/xmake.lua4
-rw-r--r--tests/projects/c++/modules/test_base.lua10
-rw-r--r--tests/projects/c++/modules/test_headerunits.lua11
-rw-r--r--tests/projects/c++/modules/test_stdmodules.lua (renamed from tests/projects/c++/modules/test_msvc.lua)19
-rw-r--r--tests/projects/c++/modules/user_headerunit/xmake.lua2
-rw-r--r--xmake/rules/c++/modules/modules_support/clang.lua10
31 files changed, 115 insertions, 100 deletions
diff --git a/tests/projects/c++/modules/class/xmake.lua b/tests/projects/c++/modules/class/xmake.lua
index 6d6eaddee..2dfca344c 100644
--- a/tests/projects/c++/modules/class/xmake.lua
+++ b/tests/projects/c++/modules/class/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("class")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it when using libc++
diff --git a/tests/projects/c++/modules/cpp_with_moduledeps/xmake.lua b/tests/projects/c++/modules/cpp_with_moduledeps/xmake.lua
index 5c7a8a6f7..6a9b3538f 100644
--- a/tests/projects/c++/modules/cpp_with_moduledeps/xmake.lua
+++ b/tests/projects/c++/modules/cpp_with_moduledeps/xmake.lua
@@ -1,10 +1,11 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
target("mod")
set_kind("static")
add_files("src/mod.mpp", "src/mod.cpp")
-target("main")
+target("cpp_with_moduledeps")
set_kind("binary")
add_deps("mod")
add_files("src/main.cpp")
diff --git a/tests/projects/c++/modules/dependence/xmake.lua b/tests/projects/c++/modules/dependence/xmake.lua
index 6d64b49b1..b4ecdb1b9 100644
--- a/tests/projects/c++/modules/dependence/xmake.lua
+++ b/tests/projects/c++/modules/dependence/xmake.lua
@@ -1,4 +1,10 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("dependence")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ if has_config("libc++") then
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it when using libc++
+ end \ No newline at end of file
diff --git a/tests/projects/c++/modules/dependence2/xmake.lua b/tests/projects/c++/modules/dependence2/xmake.lua
index 6d64b49b1..4f2905fe9 100644
--- a/tests/projects/c++/modules/dependence2/xmake.lua
+++ b/tests/projects/c++/modules/dependence2/xmake.lua
@@ -1,4 +1,6 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
-target("dependence")
+
+target("dependence2")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
diff --git a/tests/projects/c++/modules/headerunits_person/xmake.lua b/tests/projects/c++/modules/headerunits_person/xmake.lua
index c9290833b..93b635988 100644
--- a/tests/projects/c++/modules/headerunits_person/xmake.lua
+++ b/tests/projects/c++/modules/headerunits_person/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
-target("hello")
+
+target("headerunits_person")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it \ No newline at end of file
diff --git a/tests/projects/c++/modules/hello with spaces/xmake.lua b/tests/projects/c++/modules/hello with spaces/xmake.lua
index 4f46b699d..4369a892f 100644
--- a/tests/projects/c++/modules/hello with spaces/xmake.lua
+++ b/tests/projects/c++/modules/hello with spaces/xmake.lua
@@ -1,5 +1,6 @@
add_rules("mode.release", "mode.debug")
set_languages("c++20")
-target("A hello")
+
+target("hello with spaces")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
diff --git a/tests/projects/c++/modules/hello/xmake.lua b/tests/projects/c++/modules/hello/xmake.lua
index de13fc409..4f6fdab98 100644
--- a/tests/projects/c++/modules/hello/xmake.lua
+++ b/tests/projects/c++/modules/hello/xmake.lua
@@ -1,5 +1,6 @@
add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("hello")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
diff --git a/tests/projects/c++/modules/ifdef_module/xmake.lua b/tests/projects/c++/modules/ifdef_module/xmake.lua
index ee931a801..25933a35f 100644
--- a/tests/projects/c++/modules/ifdef_module/xmake.lua
+++ b/tests/projects/c++/modules/ifdef_module/xmake.lua
@@ -1,5 +1,6 @@
add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("ifdef_module")
set_kind("binary")
add_files("src/*.cpp")
diff --git a/tests/projects/c++/modules/impl_unit/xmake.lua b/tests/projects/c++/modules/impl_unit/xmake.lua
index abe41d20a..64db3cf8c 100644
--- a/tests/projects/c++/modules/impl_unit/xmake.lua
+++ b/tests/projects/c++/modules/impl_unit/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("impl_unit")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it when using libc++ \ No newline at end of file
diff --git a/tests/projects/c++/modules/inline_and_template/xmake.lua b/tests/projects/c++/modules/inline_and_template/xmake.lua
index 4810edb85..57635eff3 100644
--- a/tests/projects/c++/modules/inline_and_template/xmake.lua
+++ b/tests/projects/c++/modules/inline_and_template/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("inline_and_template")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it when using libc++ \ No newline at end of file
diff --git a/tests/projects/c++/modules/internal_partition/xmake.lua b/tests/projects/c++/modules/internal_partition/xmake.lua
index f7ca6f7cf..422292295 100644
--- a/tests/projects/c++/modules/internal_partition/xmake.lua
+++ b/tests/projects/c++/modules/internal_partition/xmake.lua
@@ -1,5 +1,6 @@
add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("internal_partition")
set_kind("binary")
add_files("src/*.cpp", "src/hello.mpp")
diff --git a/tests/projects/c++/modules/link_order/xmake.lua b/tests/projects/c++/modules/link_order/xmake.lua
index 6a11418ac..c6310055c 100644
--- a/tests/projects/c++/modules/link_order/xmake.lua
+++ b/tests/projects/c++/modules/link_order/xmake.lua
@@ -1,3 +1,8 @@
+option("libc++")
+ set_default(false)
+ set_showmenu(true)
+option_end()
+
add_rules("mode.release", "mode.debug")
set_languages("c++20")
diff --git a/tests/projects/c++/modules/partitions/test.lua b/tests/projects/c++/modules/partitions/test.lua
index c18e5a1d0..e77adc4ae 100644
--- a/tests/projects/c++/modules/partitions/test.lua
+++ b/tests/projects/c++/modules/partitions/test.lua
@@ -1 +1 @@
-inherit(".test_headerunits")
+inherit(".test_stdmodules")
diff --git a/tests/projects/c++/modules/partitions/xmake.lua b/tests/projects/c++/modules/partitions/xmake.lua
index 672034947..68602dce4 100644
--- a/tests/projects/c++/modules/partitions/xmake.lua
+++ b/tests/projects/c++/modules/partitions/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
-target("math")
+
+target("partition")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it when using libc++ \ No newline at end of file
diff --git a/tests/projects/c++/modules/partitions2/test.lua b/tests/projects/c++/modules/partitions2/test.lua
index c18e5a1d0..e77adc4ae 100644
--- a/tests/projects/c++/modules/partitions2/test.lua
+++ b/tests/projects/c++/modules/partitions2/test.lua
@@ -1 +1 @@
-inherit(".test_headerunits")
+inherit(".test_stdmodules")
diff --git a/tests/projects/c++/modules/partitions2/xmake.lua b/tests/projects/c++/modules/partitions2/xmake.lua
index c9290833b..1dfd2321b 100644
--- a/tests/projects/c++/modules/partitions2/xmake.lua
+++ b/tests/projects/c++/modules/partitions2/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
-target("hello")
+
+target("partition2")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it when using libc++
diff --git a/tests/projects/c++/modules/private_module/xmake.lua b/tests/projects/c++/modules/private_module/xmake.lua
index 1930f1188..57ede6993 100644
--- a/tests/projects/c++/modules/private_module/xmake.lua
+++ b/tests/projects/c++/modules/private_module/xmake.lua
@@ -1,5 +1,6 @@
add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("private_module")
add_rules("c++")
set_kind("$(kind)")
diff --git a/tests/projects/c++/modules/staticlib/xmake.lua b/tests/projects/c++/modules/staticlib/xmake.lua
index 93045c18f..5a3a9f4c6 100644
--- a/tests/projects/c++/modules/staticlib/xmake.lua
+++ b/tests/projects/c++/modules/staticlib/xmake.lua
@@ -1,10 +1,11 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
target("mod")
set_kind("static")
add_files("src/mod.mpp", "src/mod.cpp")
-target("test")
+target("staticlib")
set_kind("binary")
add_deps("mod")
add_files("src/main.cpp")
diff --git a/tests/projects/c++/modules/stdmodules/test.lua b/tests/projects/c++/modules/stdmodules/test.lua
index 0657ead56..e77adc4ae 100644
--- a/tests/projects/c++/modules/stdmodules/test.lua
+++ b/tests/projects/c++/modules/stdmodules/test.lua
@@ -1 +1 @@
-inherit(".test_msvc")
+inherit(".test_stdmodules")
diff --git a/tests/projects/c++/modules/stdmodules/xmake.lua b/tests/projects/c++/modules/stdmodules/xmake.lua
index 85e738d14..134aee26c 100644
--- a/tests/projects/c++/modules/stdmodules/xmake.lua
+++ b/tests/projects/c++/modules/stdmodules/xmake.lua
@@ -1,14 +1,11 @@
add_rules("mode.debug", "mode.release")
-
-add_cxxflags("clang::-stdlib=libc++")
-
set_languages("c++latest")
target("mod")
set_kind("static")
add_files("src/*.cpp", "src/*.mpp")
-target("test")
+target("stdmodules")
set_kind("binary")
add_files("test/*.cpp")
add_deps("mod")
diff --git a/tests/projects/c++/modules/stdmodules_multiple_targets/test.lua b/tests/projects/c++/modules/stdmodules_multiple_targets/test.lua
index 0657ead56..e77adc4ae 100644
--- a/tests/projects/c++/modules/stdmodules_multiple_targets/test.lua
+++ b/tests/projects/c++/modules/stdmodules_multiple_targets/test.lua
@@ -1 +1 @@
-inherit(".test_msvc")
+inherit(".test_stdmodules")
diff --git a/tests/projects/c++/modules/stdmodules_multiple_targets/xmake.lua b/tests/projects/c++/modules/stdmodules_multiple_targets/xmake.lua
index 859dddc7c..61d451908 100644
--- a/tests/projects/c++/modules/stdmodules_multiple_targets/xmake.lua
+++ b/tests/projects/c++/modules/stdmodules_multiple_targets/xmake.lua
@@ -1,7 +1,4 @@
add_rules("mode.debug", "mode.release")
-
-add_cxxflags("clang::-stdlib=libc++")
-
set_languages("c++latest")
target("mod")
diff --git a/tests/projects/c++/modules/stl_headerunit/xmake.lua b/tests/projects/c++/modules/stl_headerunit/xmake.lua
index e85378c46..b73913a87 100644
--- a/tests/projects/c++/modules/stl_headerunit/xmake.lua
+++ b/tests/projects/c++/modules/stl_headerunit/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("stl_headerunit")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl header units or c++23 std module so we disable it \ No newline at end of file
diff --git a/tests/projects/c++/modules/stl_headerunit_cpp_only/xmake.lua b/tests/projects/c++/modules/stl_headerunit_cpp_only/xmake.lua
index 101a95fe7..03a6168b0 100644
--- a/tests/projects/c++/modules/stl_headerunit_cpp_only/xmake.lua
+++ b/tests/projects/c++/modules/stl_headerunit_cpp_only/xmake.lua
@@ -1,76 +1,9 @@
-add_rules("mode.debug", "mode.release")
+add_rules("mode.release", "mode.debug")
+ set_languages("c++20")
-target("test")
+target("stl_headerunit_cpp_only")
set_kind("binary")
add_files("src/*.cpp")
- set_languages("c++20")
set_policy("build.c++.modules", true)
---
--- If you want to known more usage about xmake, please see https://xmake.io
---
--- ## FAQ
---
--- You can enter the project directory firstly before building project.
---
--- $ cd projectdir
---
--- 1. How to build project?
---
--- $ xmake
---
--- 2. How to configure project?
---
--- $ xmake f -p [macosx|linux|iphoneos ..] -a [x86_64|i386|arm64 ..] -m [debug|release]
---
--- 3. Where is the build output directory?
---
--- The default output directory is `./build` and you can configure the output directory.
---
--- $ xmake f -o outputdir
--- $ xmake
---
--- 4. How to run and debug target after building project?
---
--- $ xmake run [targetname]
--- $ xmake run -d [targetname]
---
--- 5. How to install target to the system directory or other output directory?
---
--- $ xmake install
--- $ xmake install -o installdir
---
--- 6. Add some frequently-used compilation flags in xmake.lua
---
--- @code
--- -- add debug and release modes
--- add_rules("mode.debug", "mode.release")
---
--- -- add macro defination
--- add_defines("NDEBUG", "_GNU_SOURCE=1")
---
--- -- set warning all as error
--- set_warnings("all", "error")
---
--- -- set language: c99, c++11
--- set_languages("c99", "c++11")
---
--- -- set optimization: none, faster, fastest, smallest
--- set_optimize("fastest")
---
--- -- add include search directories
--- add_includedirs("/usr/include", "/usr/local/include")
---
--- -- add link libraries and search directories
--- add_links("tbox")
--- add_linkdirs("/usr/local/lib", "/usr/lib")
---
--- -- add system link libraries
--- add_syslinks("z", "pthread")
---
--- -- add compilation and link flags
--- add_cxflags("-stdnolib", "-fno-strict-aliasing")
--- add_ldflags("-L/usr/local/lib", "-lpthread", {force = true})
---
--- @endcode
---
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl header units or c++23 std module so we disable it
diff --git a/tests/projects/c++/modules/submodules/xmake.lua b/tests/projects/c++/modules/submodules/xmake.lua
index 672034947..5f2b4ca78 100644
--- a/tests/projects/c++/modules/submodules/xmake.lua
+++ b/tests/projects/c++/modules/submodules/xmake.lua
@@ -1,4 +1,8 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
-target("math")
+
+target("submodule")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
+
+ set_values("c++.clang.modules.strict", true) -- clang std module clash with stl headers, header units and c++23 std module so we disable it when using libc++
diff --git a/tests/projects/c++/modules/submodules2/xmake.lua b/tests/projects/c++/modules/submodules2/xmake.lua
index 672034947..9dc2ee320 100644
--- a/tests/projects/c++/modules/submodules2/xmake.lua
+++ b/tests/projects/c++/modules/submodules2/xmake.lua
@@ -1,4 +1,6 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
-target("math")
+
+target("submodules2")
set_kind("binary")
add_files("src/*.cpp", "src/*.mpp")
diff --git a/tests/projects/c++/modules/test_base.lua b/tests/projects/c++/modules/test_base.lua
index 580110cb6..6ac816d66 100644
--- a/tests/projects/c++/modules/test_base.lua
+++ b/tests/projects/c++/modules/test_base.lua
@@ -14,7 +14,7 @@ function main(t)
if is_subhost("windows") then
os.exec("xmake f -c")
_build()
- elseif is_host("linux") then
+ elseif is_host("linux") or is_host("macos") then
local gcc = find_tool("gcc", {version = true})
if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
os.exec("xmake f -c")
@@ -22,9 +22,11 @@ function main(t)
end
local clang = find_tool("clang", {version = true})
if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
- os.exec("xmake clean -a")
- os.exec("xmake f --toolchain=clang -c")
- _build()
+ if is_host("linux") then
+ os.exec("xmake clean -a")
+ os.exec("xmake f --toolchain=clang -c")
+ _build()
+ end
os.exec("xmake clean -a")
os.exec("xmake f --toolchain=clang --cxxflags=\"-stdlib=libc++\" -c")
_build()
diff --git a/tests/projects/c++/modules/test_headerunits.lua b/tests/projects/c++/modules/test_headerunits.lua
index 872defb35..747ec6535 100644
--- a/tests/projects/c++/modules/test_headerunits.lua
+++ b/tests/projects/c++/modules/test_headerunits.lua
@@ -26,10 +26,13 @@ function main(t)
end
local clang = find_tool("clang", {version = true})
if clang and clang.version and semver.compare(clang.version, "16.0") >= 0 then
- os.exec("xmake clean -a")
- os.exec("xmake f --toolchain=clang -c")
- _build()
- -- os.exec("xmake clean -a") there is currently a bug on llvm git that prevent to build STL header units https://github.com/llvm/llvm-project/issues/58540
+ if is_host("linux") then
+ os.exec("xmake clean -a")
+ os.exec("xmake f --toolchain=clang -c")
+ _build()
+ end
+ -- there is currently a bug on llvm git that prevent to build STL header units https://github.com/llvm/llvm-project/issues/58540
+ -- os.exec("xmake clean -a")
-- os.exec("xmake f --toolchain=clang --cxxflags=\"-stdlib=libc++\" -c")
-- _build()
end
diff --git a/tests/projects/c++/modules/test_msvc.lua b/tests/projects/c++/modules/test_stdmodules.lua
index a436b5814..2d8861d09 100644
--- a/tests/projects/c++/modules/test_msvc.lua
+++ b/tests/projects/c++/modules/test_stdmodules.lua
@@ -24,5 +24,24 @@ function main(t)
end
end
end
+ elseif is_host("linux") or is_host("macos") then
+ -- gcc don't support std modules atm
+ -- local gcc = find_tool("gcc", {version = true})
+ -- if gcc and gcc.version and semver.compare(gcc.version, "11.0") >= 0 then
+ -- os.exec("xmake f -c")
+ -- _build()
+ -- end
+ local clang = find_tool("clang", {version = true})
+ if clang and clang.version and semver.compare(clang.version, "14.0") >= 0 then
+ if is_host("linux") then
+ -- clang don't support libstdc++ std modules atm
+ -- os.exec("xmake clean -a")
+ -- os.exec("xmake f --toolchain=clang -c")
+ -- _build()
+ end
+ os.exec("xmake clean -a")
+ os.exec("xmake f --toolchain=clang --cxxflags=\"-stdlib=libc++\" -c")
+ _build()
+ end
end
end
diff --git a/tests/projects/c++/modules/user_headerunit/xmake.lua b/tests/projects/c++/modules/user_headerunit/xmake.lua
index dae91d11f..e305044b5 100644
--- a/tests/projects/c++/modules/user_headerunit/xmake.lua
+++ b/tests/projects/c++/modules/user_headerunit/xmake.lua
@@ -1,4 +1,6 @@
+add_rules("mode.release", "mode.debug")
set_languages("c++20")
+
target("user_headerunit")
set_kind("binary")
add_headerfiles("src/*.hpp")
diff --git a/xmake/rules/c++/modules/modules_support/clang.lua b/xmake/rules/c++/modules/modules_support/clang.lua
index 9cf7edcdf..7a63c027d 100644
--- a/xmake/rules/c++/modules/modules_support/clang.lua
+++ b/xmake/rules/c++/modules/modules_support/clang.lua
@@ -67,11 +67,19 @@ end
-- load module support for the current target
function load(target)
local modulesflag = get_modulesflag(target)
+ local builtinmodulemapflag = get_builtinmodulemapflag(target)
+ local implicitmodulesflag = get_implicitmodulesflag(target)
local noimplicitmodulemapsflag = get_noimplicitmodulemapsflag(target)
-- add module flags
target:add("cxxflags", modulesflag)
- target:add("cxxflags", noimplicitmodulemapsflag, {force = true})
+
+ if not target:values("c++.clang.modules.strict") then
+ target:add("cxxflags", builtinmodulemapflag, {force = true})
+ target:add("cxxflags", implicitmodulesflag, {force = true})
+ else
+ target:add("cxxflags", noimplicitmodulemapsflag, {force = true})
+ end
-- fix default visibility for functions and variables [-fvisibility] differs in PCH file vs. current file
-- module.pcm cannot be loaded due to a configuration mismatch with the current compilation.