diff options
| author | ruki <[email protected]> | 2023-02-03 23:11:49 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-02-03 23:11:49 +0800 |
| commit | ccb0ede6e755b0f736a7dd1f6b00b871df5221d0 (patch) | |
| tree | 0c727f2bae1693b9a240d4f7f584f62abab36120 | |
| parent | b51bae040adafebac74eca5a640e21e2fe2c5478 (diff) | |
| parent | 419db506cc13289febf5143577b43be672d3db3d (diff) | |
Merge pull request #3330 from xmake-io/module
improve module without cpp
| -rw-r--r-- | tests/projects/c++/modules/staticlib/xmake.lua | 2 | ||||
| -rw-r--r-- | tests/projects/c++/modules/staticlib_without_cpp/src/mod.mpp | 2 | ||||
| -rw-r--r-- | tests/projects/c++/modules/staticlib_without_cpp/test.lua | 1 | ||||
| -rw-r--r-- | tests/projects/c++/modules/staticlib_without_cpp/xmake.lua | 6 | ||||
| -rw-r--r-- | xmake/languages/c++/xmake.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/c++/modules/xmake.lua | 3 |
6 files changed, 14 insertions, 2 deletions
diff --git a/tests/projects/c++/modules/staticlib/xmake.lua b/tests/projects/c++/modules/staticlib/xmake.lua index 5a3a9f4c6..ca0e9e343 100644 --- a/tests/projects/c++/modules/staticlib/xmake.lua +++ b/tests/projects/c++/modules/staticlib/xmake.lua @@ -5,7 +5,7 @@ target("mod") set_kind("static") add_files("src/mod.mpp", "src/mod.cpp") -target("staticlib") +target("hello") set_kind("binary") add_deps("mod") add_files("src/main.cpp") diff --git a/tests/projects/c++/modules/staticlib_without_cpp/src/mod.mpp b/tests/projects/c++/modules/staticlib_without_cpp/src/mod.mpp new file mode 100644 index 000000000..b7dd3883c --- /dev/null +++ b/tests/projects/c++/modules/staticlib_without_cpp/src/mod.mpp @@ -0,0 +1,2 @@ +export module hello; +export int foo() { return 0; } diff --git a/tests/projects/c++/modules/staticlib_without_cpp/test.lua b/tests/projects/c++/modules/staticlib_without_cpp/test.lua new file mode 100644 index 000000000..7717f8049 --- /dev/null +++ b/tests/projects/c++/modules/staticlib_without_cpp/test.lua @@ -0,0 +1 @@ +inherit(".test_base") diff --git a/tests/projects/c++/modules/staticlib_without_cpp/xmake.lua b/tests/projects/c++/modules/staticlib_without_cpp/xmake.lua new file mode 100644 index 000000000..a06091414 --- /dev/null +++ b/tests/projects/c++/modules/staticlib_without_cpp/xmake.lua @@ -0,0 +1,6 @@ +add_rules("mode.release", "mode.debug") +set_languages("c++20") + +target("mod") + set_kind("static") + add_files("src/mod.mpp") diff --git a/xmake/languages/c++/xmake.lua b/xmake/languages/c++/xmake.lua index e28bb2733..4109ab50b 100644 --- a/xmake/languages/c++/xmake.lua +++ b/xmake/languages/c++/xmake.lua @@ -20,7 +20,7 @@ language("c++") add_rules("c++") - set_sourcekinds {cc = ".c", cxx = {".cpp", ".cc", ".cxx"}} + set_sourcekinds {cc = ".c", cxx = {".cpp", ".cc", ".cxx", ".mpp", ".mxx", ".cppm", ".ixx"}} set_sourceflags {cc = {"cflags", "cxflags"}, cxx = {"cxxflags", "cxflags"}} set_targetkinds {binary = "ld", static = "ar", shared = "sh"} set_targetflags {binary = "ldflags", static = "arflags", shared = "shflags"} diff --git a/xmake/rules/c++/modules/xmake.lua b/xmake/rules/c++/modules/xmake.lua index b62ec0f36..2f9b207bf 100644 --- a/xmake/rules/c++/modules/xmake.lua +++ b/xmake/rules/c++/modules/xmake.lua @@ -20,7 +20,10 @@ -- define rule: c++.build.modules rule("c++.build.modules") + + -- @note common.contains_modules() need it set_extensions(".mpp", ".mxx", ".cppm", ".ixx") + add_deps("c++.build.modules.builder") add_deps("c++.build.modules.install") |
