Skip to content

Commit

Permalink
compile as module
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Feb 19, 2024
1 parent 4282a30 commit 5faa0b4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions xmake/plugins/project/vstudio/impl/vs201x_vcxproj.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5faa0b4

Please sign in to comment.