diff options
| author | Arthur LAURENT <[email protected]> | 2024-02-05 18:22:44 +0100 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-02-05 18:22:44 +0100 |
| commit | 3a7d68de17f19afadc2f7eec698d54861ecd729d (patch) | |
| tree | 78fec7d5b63d564b6b03603ea56662b856253ee8 | |
| parent | 6739478d0bf6a4aaf0d1a1caf1c6b60532fa07f8 (diff) | |
update relevent tests to use moduleonly target rule
| -rw-r--r-- | tests/projects/c++/modules/link_order/xmake.lua | 10 | ||||
| -rw-r--r-- | tests/projects/c++/modules/moduleonly/src/mod.mpp | 2 | ||||
| -rw-r--r-- | tests/projects/c++/modules/moduleonly/test.lua (renamed from tests/projects/c++/modules/staticlib_without_cpp/test.lua) | 0 | ||||
| -rw-r--r-- | tests/projects/c++/modules/moduleonly/xmake.lua | 7 | ||||
| -rw-r--r-- | tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/bar.mpp | 8 | ||||
| -rw-r--r-- | tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/xmake.lua | 7 | ||||
| -rw-r--r-- | tests/projects/c++/modules/packages/my-repo/packages/b/bar2/xmake.lua | 7 | ||||
| -rw-r--r-- | tests/projects/c++/modules/packages/src/main.cpp | 2 | ||||
| -rw-r--r-- | tests/projects/c++/modules/packages/xmake.lua | 4 | ||||
| -rw-r--r-- | tests/projects/c++/modules/staticlib_without_cpp/xmake.lua | 6 | ||||
| -rw-r--r-- | tests/projects/c++/modules/test_base.lua | 2 | ||||
| -rw-r--r-- | tests/projects/c++/modules/test_stdmodules.lua | 2 | ||||
| -rw-r--r-- | tests/projects/c++/modules/user_headerunit2/a/xmake.lua | 6 | ||||
| -rw-r--r-- | tests/projects/c++/modules/user_headerunit2/b/xmake.lua | 5 |
14 files changed, 50 insertions, 18 deletions
diff --git a/tests/projects/c++/modules/link_order/xmake.lua b/tests/projects/c++/modules/link_order/xmake.lua index b062dbe66..1ae6639bb 100644 --- a/tests/projects/c++/modules/link_order/xmake.lua +++ b/tests/projects/c++/modules/link_order/xmake.lua @@ -3,13 +3,15 @@ set_languages("c++20") target("foo") add_rules("c++") - set_kind("static") - add_files("src/foo.mpp", {public = true}) + set_kind("headeronly") + add_rules("c++.moduleonly") + add_files("src/foo.mpp") target("bar") add_rules("c++") - set_kind("static") - add_files("src/bar.mpp", {public = true}) + set_kind("headeronly") + add_rules("c++.moduleonly") + add_files("src/bar.mpp") target("link_order_1") set_kind("binary") diff --git a/tests/projects/c++/modules/moduleonly/src/mod.mpp b/tests/projects/c++/modules/moduleonly/src/mod.mpp new file mode 100644 index 000000000..b7dd3883c --- /dev/null +++ b/tests/projects/c++/modules/moduleonly/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/moduleonly/test.lua index 7717f8049..7717f8049 100644 --- a/tests/projects/c++/modules/staticlib_without_cpp/test.lua +++ b/tests/projects/c++/modules/moduleonly/test.lua diff --git a/tests/projects/c++/modules/moduleonly/xmake.lua b/tests/projects/c++/modules/moduleonly/xmake.lua new file mode 100644 index 000000000..c6cb7cef4 --- /dev/null +++ b/tests/projects/c++/modules/moduleonly/xmake.lua @@ -0,0 +1,7 @@ +add_rules("mode.release", "mode.debug") +set_languages("c++20") + +target("mod") + set_kind("headeronly") + add_rules("c++.moduleonly") + add_files("src/mod.mpp") diff --git a/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/bar.mpp b/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/bar.mpp new file mode 100644 index 000000000..2aaf4432e --- /dev/null +++ b/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/bar.mpp @@ -0,0 +1,8 @@ +export module bar2; + +export namespace bar { +const char *hello2() { + return "Hello world"; +} +} + diff --git a/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/xmake.lua b/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/xmake.lua new file mode 100644 index 000000000..ddc3ae311 --- /dev/null +++ b/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/src/xmake.lua @@ -0,0 +1,7 @@ +add_rules("mode.release", "mode.debug") +set_languages("c++20") + +target("bar") + set_kind("headeonly") + add_rules("moduleonly") + add_files("*.mpp") diff --git a/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/xmake.lua b/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/xmake.lua new file mode 100644 index 000000000..1f0d5af82 --- /dev/null +++ b/tests/projects/c++/modules/packages/my-repo/packages/b/bar2/xmake.lua @@ -0,0 +1,7 @@ +package("bar") + set_kind("headeronly") + set_sourcedir(path.join(os.scriptdir(), "src")) + + on_install(function(package) + import("package.tools.xmake").install(package, {}) + end) diff --git a/tests/projects/c++/modules/packages/src/main.cpp b/tests/projects/c++/modules/packages/src/main.cpp index d12361c45..d6f2218c0 100644 --- a/tests/projects/c++/modules/packages/src/main.cpp +++ b/tests/projects/c++/modules/packages/src/main.cpp @@ -1,7 +1,9 @@ import foo; import bar; +import bar2; int main() { foo::say(bar::hello()); + foo::say(bar::hello2()); return 0; } diff --git a/tests/projects/c++/modules/packages/xmake.lua b/tests/projects/c++/modules/packages/xmake.lua index f772d6668..62dba119b 100644 --- a/tests/projects/c++/modules/packages/xmake.lua +++ b/tests/projects/c++/modules/packages/xmake.lua @@ -2,10 +2,10 @@ add_rules("mode.release", "mode.debug") set_languages("c++2b") add_repositories("my-repo my-repo") -add_requires("foo", "bar") +add_requires("foo", "bar", "bar2") target("packages") set_kind("binary") add_files("src/*.cpp") - add_packages("foo", "bar") + add_packages("foo", "bar", "bar2") set_policy("build.c++.modules", true) diff --git a/tests/projects/c++/modules/staticlib_without_cpp/xmake.lua b/tests/projects/c++/modules/staticlib_without_cpp/xmake.lua deleted file mode 100644 index bff9c5d13..000000000 --- a/tests/projects/c++/modules/staticlib_without_cpp/xmake.lua +++ /dev/null @@ -1,6 +0,0 @@ -add_rules("mode.release", "mode.debug") -set_languages("c++20") - -target("mod") - set_kind("static") - add_files("src/mod.mpp", {public = true}) diff --git a/tests/projects/c++/modules/test_base.lua b/tests/projects/c++/modules/test_base.lua index 092fbd72f..f39c31b75 100644 --- a/tests/projects/c++/modules/test_base.lua +++ b/tests/projects/c++/modules/test_base.lua @@ -56,7 +56,7 @@ function main(t) os.exec("xmake f --toolchain=clang -c --yes") _build() os.exec("xmake clean -a") - os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes") + os.exec("xmake f --toolchain=clang --runtimes=c++_shared --sdk='/opt/llvm-git/usr/' -c --yes") _build() end end diff --git a/tests/projects/c++/modules/test_stdmodules.lua b/tests/projects/c++/modules/test_stdmodules.lua index 68a5922ef..c29457364 100644 --- a/tests/projects/c++/modules/test_stdmodules.lua +++ b/tests/projects/c++/modules/test_stdmodules.lua @@ -51,7 +51,7 @@ function main(t) -- os.exec("xmake f --toolchain=clang -c --yes") -- _build() os.exec("xmake clean -a") - os.exec("xmake f --toolchain=clang --runtimes=c++_shared -c --yes") + os.exec("xmake f --toolchain=clang --runtimes=c++_shared --sdk='/opt/llvm-git/usr/' -c --yes") _build() end end diff --git a/tests/projects/c++/modules/user_headerunit2/a/xmake.lua b/tests/projects/c++/modules/user_headerunit2/a/xmake.lua index 3225b2814..261428921 100644 --- a/tests/projects/c++/modules/user_headerunit2/a/xmake.lua +++ b/tests/projects/c++/modules/user_headerunit2/a/xmake.lua @@ -1,4 +1,6 @@ target("a")
set_languages("cxxlatest")
- set_kind("object")
- add_files("a.mpp", {public = true})
+ set_kind("headeronly")
+ add_rules("c++.moduleonly")
+ add_headerfiles("*.hpp")
+ add_files("a.mpp")
diff --git a/tests/projects/c++/modules/user_headerunit2/b/xmake.lua b/tests/projects/c++/modules/user_headerunit2/b/xmake.lua index 24f9c9b1f..9821fcd6d 100644 --- a/tests/projects/c++/modules/user_headerunit2/b/xmake.lua +++ b/tests/projects/c++/modules/user_headerunit2/b/xmake.lua @@ -1,5 +1,6 @@ target("b")
add_deps("a")
set_languages("cxxlatest")
- set_kind("object")
- add_files("b.mpp", {public = true})
+ set_kind("headeronly")
+ add_rules("c++.moduleonly")
+ add_files("b.mpp")
|
