diff options
| author | ruki <[email protected]> | 2017-02-21 17:05:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-21 17:05:03 +0800 |
| commit | 1d192697c6464f2b9509050f01f89ed18f651046 (patch) | |
| tree | b742e1834cc65fa9f01564ea65ffaca9cc49a61a /tests | |
| parent | 60bce69c3f3be74e0de627d337b9b39e24aa45b8 (diff) | |
add static library test for dlang
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/static_library_dlang/src/interfaces.d | 9 | ||||
| -rw-r--r-- | tests/static_library_dlang/src/main.d | 8 | ||||
| -rwxr-xr-x | tests/static_library_dlang/xmake.lua | 53 |
3 files changed, 70 insertions, 0 deletions
diff --git a/tests/static_library_dlang/src/interfaces.d b/tests/static_library_dlang/src/interfaces.d new file mode 100644 index 000000000..3386c9124 --- /dev/null +++ b/tests/static_library_dlang/src/interfaces.d @@ -0,0 +1,9 @@ +extern(C) int add(int a, int b) +{ + return a + b; +} + +extern(C) int sub(int a, int b) +{ + return a - b; +} diff --git a/tests/static_library_dlang/src/main.d b/tests/static_library_dlang/src/main.d new file mode 100644 index 000000000..3137de217 --- /dev/null +++ b/tests/static_library_dlang/src/main.d @@ -0,0 +1,8 @@ +import std.stdio; +import interfaces; + +void main() +{ + printf("add: %d\n", interfaces.add(1, 1)); + printf("sub: %d\n", interfaces.sub(2, 1)); +} diff --git a/tests/static_library_dlang/xmake.lua b/tests/static_library_dlang/xmake.lua new file mode 100755 index 000000000..1fd0d1ee9 --- /dev/null +++ b/tests/static_library_dlang/xmake.lua @@ -0,0 +1,53 @@ +-- the debug mode +if is_mode("debug") then + + -- enable the debug symbols + set_symbols("debug") + + -- disable optimization + set_optimize("none") +end + +-- the release mode +if is_mode("release") then + + -- set the symbols visibility: hidden + set_symbols("hidden") + + -- enable fastest optimization + set_optimize("fastest") + + -- strip all symbols + set_strip("all") +end + +-- add target +target("interfaces") + + -- set kind + set_kind("static") + + -- add files + add_files("src/interfaces.d") + +-- add target +target("test") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("interfaces") + + -- add files + add_files("src/main.d") + + -- add links + add_links("interfaces") + + -- add link directory + add_linkdirs("$(buildir)") + + -- add include directory + add_includedirs("$(projectdir)/src") + |
