-
-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3016 from xmake-io/module
Improve clang/gcc/msvc to better support std modules
- Loading branch information
Showing
8 changed files
with
149 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Xmake cache | ||
.xmake/ | ||
build/ | ||
|
||
# MacOS Cache | ||
.DS_Store | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module my_module; | ||
|
||
#ifdef _MSC_VER | ||
import std.core; | ||
#else | ||
import std; | ||
#endif | ||
|
||
auto my_sum(size_t a, size_t b) -> size_t { return a + b; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export module my_module; | ||
|
||
#ifdef _MSC_VER | ||
import std.core; | ||
#else | ||
import std; | ||
#endif | ||
|
||
export auto my_sum(size_t a, size_t b) -> size_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#ifdef _MSC_VER | ||
import std.core; | ||
#else | ||
import std; | ||
#endif | ||
|
||
import my_module; | ||
|
||
using namespace std; | ||
|
||
int main(int argc, char** argv) { | ||
cout << my_sum(1, 1) << endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
add_rules("mode.debug", "mode.release") | ||
set_languages("c++20") | ||
|
||
add_cxxflags("clang::-stdlib=libc++") | ||
set_values("msvc.modules.stdifcdir", true) | ||
target("mod") | ||
set_kind("shared") | ||
add_files("src/*.cpp", "src/*.mpp") | ||
|
||
target("test") | ||
set_kind("binary") | ||
add_files("test/*.cpp") | ||
add_deps("mod") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters