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/aliased_headerunit/src | |
| parent | cda48025005f9aa23bdd582e29bb0f1f1ca24d27 (diff) | |
| parent | bc1a30db6041c2c14ca79ccf0aa35b2d550e64e5 (diff) | |
Merge pull request #4673 from xmake-io/modules
Refactor modules support
Diffstat (limited to 'tests/projects/c++/modules/aliased_headerunit/src')
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/aliased_headerunit/src/foo/hello.mpp b/tests/projects/c++/modules/aliased_headerunit/src/foo/hello.mpp new file mode 100644 index 000000000..0a8de6291 --- /dev/null +++ b/tests/projects/c++/modules/aliased_headerunit/src/foo/hello.mpp @@ -0,0 +1,12 @@ +module; +#include <cstdio> + +export module hello; + +import "../header.hpp"; + +export namespace hello { + void say(const char *arg) { + printf("%s: %s\n", FOO, arg); + } +} diff --git a/tests/projects/c++/modules/aliased_headerunit/src/header.hpp b/tests/projects/c++/modules/aliased_headerunit/src/header.hpp new file mode 100644 index 000000000..ab02a6792 --- /dev/null +++ b/tests/projects/c++/modules/aliased_headerunit/src/header.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace hello { + inline constexpr auto FOO = "Hello"; +} diff --git a/tests/projects/c++/modules/aliased_headerunit/src/main.cpp b/tests/projects/c++/modules/aliased_headerunit/src/main.cpp new file mode 100644 index 000000000..ad786367e --- /dev/null +++ b/tests/projects/c++/modules/aliased_headerunit/src/main.cpp @@ -0,0 +1,7 @@ +import hello; +import "header.hpp"; + +int main() { + hello::say(hello::FOO); + return 0; +} |
