summaryrefslogtreecommitdiff
path: root/xmake/plugins
diff options
context:
space:
mode:
authorruki <[email protected]>2024-02-20 00:42:17 +0800
committerruki <[email protected]>2024-02-20 00:42:17 +0800
commit5faa0b4adbdc647073bb5d6cf3471b2ca2feb47d (patch)
tree4f338e08c5efa8f037ab83435c9b5b3170a15f36 /xmake/plugins
parent4282a30bdc7cb03f531d4a3df94544c6bfff2887 (diff)
compile as module
Diffstat (limited to 'xmake/plugins')
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
index ee21e88b1..0ae5e78be 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
@@ -138,6 +138,12 @@ function _split_gpucodes(flag)
return flag:split(",")
end
+-- is module file?
+function _is_modulefile(sourcefile)
+ local extension = path.extension(sourcefile)
+ return extension == ".mpp" or extension == ".mxx" or extension == ".cppm" or extension == ".ixx"
+end
+
-- make compiling command
function _make_compcmd(compargv, sourcefile, objectfile, vcxprojdir)
local argv = {}
@@ -1131,6 +1137,11 @@ function _make_source_file_forall(vcxprojfile, vsinfo, target, sourcefile, sourc
-- for *.c/cpp/cu files
else
+ -- compile as c++ modules
+ if _is_modulefile(sourcefile) then
+ vcxprojfile:print("<CompileAs>CompileAsCppModule</CompileAs>")
+ end
+
-- we need to use different object directory and allow parallel building
--
-- @see https://github.com/xmake-io/xmake/issues/2016
@@ -1263,6 +1274,11 @@ function _make_source_file_forspec(vcxprojfile, vsinfo, target, sourcefile, sour
-- for *.c/cpp/cu files
else
+ -- compile as c++ modules
+ if _is_modulefile(sourcefile) then
+ vcxprojfile:print("<CompileAs>CompileAsCppModule</CompileAs>")
+ end
+
-- we need to use different object directory and allow parallel building
--
-- @see https://github.com/xmake-io/xmake/issues/2016