diff options
| author | ruki <[email protected]> | 2022-08-16 12:33:47 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-08-16 12:33:47 +0800 |
| commit | 81aca6fbe9149b377cdd88e8ee4b8f045d5a46da (patch) | |
| tree | 0f138f960ab9fd95265ecbffca7c6ae27d65f4a3 /tests/projects/c++/modules/user_headerunit/src | |
| parent | d46b16f8c40493bfc78764931bf7c3209442696b (diff) | |
| parent | d9f82e1bba29adc8b11dc1f7b3887717f03137d6 (diff) | |
Merge pull request #2641 from xmake-io/cxxmodules
Improve C++20 modules support
Diffstat (limited to 'tests/projects/c++/modules/user_headerunit/src')
3 files changed, 22 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/user_headerunit/src/header.hpp b/tests/projects/c++/modules/user_headerunit/src/header.hpp new file mode 100644 index 000000000..840c3da80 --- /dev/null +++ b/tests/projects/c++/modules/user_headerunit/src/header.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace hello { + constexpr auto FOO = "Hello"; +} diff --git a/tests/projects/c++/modules/user_headerunit/src/hello.mpp b/tests/projects/c++/modules/user_headerunit/src/hello.mpp new file mode 100644 index 000000000..5b2f434ad --- /dev/null +++ b/tests/projects/c++/modules/user_headerunit/src/hello.mpp @@ -0,0 +1,10 @@ +module; +#include <cstdio> + +export module hello; + +export namespace hello { + void say(const char *arg) { + printf("%s\n", arg); + } +} diff --git a/tests/projects/c++/modules/user_headerunit/src/main.cpp b/tests/projects/c++/modules/user_headerunit/src/main.cpp new file mode 100644 index 000000000..ad786367e --- /dev/null +++ b/tests/projects/c++/modules/user_headerunit/src/main.cpp @@ -0,0 +1,7 @@ +import hello; +import "header.hpp"; + +int main() { + hello::say(hello::FOO); + return 0; +} |
