diff options
| author | ruki <[email protected]> | 2024-02-18 21:41:52 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-02-18 21:41:52 +0800 |
| commit | 3c1163b36e0817dbd5b62ec1ff495dc2e830d6ac (patch) | |
| tree | 16f6cb664c031d80b1841e6978fc1d8753eb6761 /tests/projects/c++/modules/circular_dependency | |
| parent | cda48025005f9aa23bdd582e29bb0f1f1ca24d27 (diff) | |
| parent | bc1a30db6041c2c14ca79ccf0aa35b2d550e64e5 (diff) | |
Merge pull request #4673 from xmake-io/modules
Refactor modules support
Diffstat (limited to 'tests/projects/c++/modules/circular_dependency')
6 files changed, 41 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/circular_dependency/src/hello.mpp b/tests/projects/c++/modules/circular_dependency/src/hello.mpp new file mode 100644 index 000000000..50f0f2c8f --- /dev/null +++ b/tests/projects/c++/modules/circular_dependency/src/hello.mpp @@ -0,0 +1,13 @@ +export module hello; + +import hello3; + +export namespace hello { + class say { + public: + say(int data); + void hello(); + private: + int data_; + }; +} diff --git a/tests/projects/c++/modules/circular_dependency/src/hello2.mpp b/tests/projects/c++/modules/circular_dependency/src/hello2.mpp new file mode 100644 index 000000000..1b6258af1 --- /dev/null +++ b/tests/projects/c++/modules/circular_dependency/src/hello2.mpp @@ -0,0 +1,3 @@ +export module hello2; + +import hello; diff --git a/tests/projects/c++/modules/circular_dependency/src/hello3.mpp b/tests/projects/c++/modules/circular_dependency/src/hello3.mpp new file mode 100644 index 000000000..4966cf0c0 --- /dev/null +++ b/tests/projects/c++/modules/circular_dependency/src/hello3.mpp @@ -0,0 +1,3 @@ +export module hello3; + +import hello2; diff --git a/tests/projects/c++/modules/circular_dependency/src/main.cpp b/tests/projects/c++/modules/circular_dependency/src/main.cpp new file mode 100644 index 000000000..6f80b6c7d --- /dev/null +++ b/tests/projects/c++/modules/circular_dependency/src/main.cpp @@ -0,0 +1,7 @@ +import hello; + +int main() { + hello::say s(sizeof(hello::say)); + s.hello(); + return 0; +}
\ No newline at end of file diff --git a/tests/projects/c++/modules/circular_dependency/test.lua b/tests/projects/c++/modules/circular_dependency/test.lua new file mode 100644 index 000000000..727e9187e --- /dev/null +++ b/tests/projects/c++/modules/circular_dependency/test.lua @@ -0,0 +1,7 @@ +import(".test_base", {alias = "test_build"}) + +function main(t) + if test_build.can_build() then + t:will_raise(test_build, "circular modules dependency detected") + end +end diff --git a/tests/projects/c++/modules/circular_dependency/xmake.lua b/tests/projects/c++/modules/circular_dependency/xmake.lua new file mode 100644 index 000000000..73254924e --- /dev/null +++ b/tests/projects/c++/modules/circular_dependency/xmake.lua @@ -0,0 +1,8 @@ +add_rules("mode.release", "mode.debug") +set_languages("c++20") + +target("circular_dependency") + set_kind("binary") + add_files("src/*.cpp", "src/*.mpp") + + |
