diff options
| author | ruki <[email protected]> | 2017-09-28 23:44:36 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-09-28 16:27:39 +0800 |
| commit | b0c6c6c058dfe7fe21f42da4da8c8f03fbdb8951 (patch) | |
| tree | 158a4a65af66c79a3c550393eeb4d12ee3aed206 /tests | |
| parent | 603ecaeb969342384e55b1fe92ed6d55d8ea970c (diff) | |
fix compile error with space path
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/projects/static library c/s r c/interface.c | 6 | ||||
| -rw-r--r-- | tests/projects/static library c/s r c/interface.h | 8 | ||||
| -rw-r--r-- | tests/projects/static library c/s r c/test.c | 8 | ||||
| -rw-r--r-- | tests/projects/static library c/test.lua | 9 | ||||
| -rw-r--r-- | tests/projects/static library c/xmake.lua | 45 |
5 files changed, 76 insertions, 0 deletions
diff --git a/tests/projects/static library c/s r c/interface.c b/tests/projects/static library c/s r c/interface.c new file mode 100644 index 000000000..598d07560 --- /dev/null +++ b/tests/projects/static library c/s r c/interface.c @@ -0,0 +1,6 @@ +#include "interface.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/tests/projects/static library c/s r c/interface.h b/tests/projects/static library c/s r c/interface.h new file mode 100644 index 000000000..10ec0f856 --- /dev/null +++ b/tests/projects/static library c/s r c/interface.h @@ -0,0 +1,8 @@ +/*! calculate add(a, b) + * + * @param a the first argument + * @param b the second argument + * + * @return the result + */ +int add(int a, int b); diff --git a/tests/projects/static library c/s r c/test.c b/tests/projects/static library c/s r c/test.c new file mode 100644 index 000000000..9505a2f75 --- /dev/null +++ b/tests/projects/static library c/s r c/test.c @@ -0,0 +1,8 @@ +#include "interface.h" +#include <stdio.h> + +int main(int argc, char** argv) +{ + printf("add(1, 2) = %d\n", add(1, 2)); + return 0; +} diff --git a/tests/projects/static library c/test.lua b/tests/projects/static library c/test.lua new file mode 100644 index 000000000..1ff9219ba --- /dev/null +++ b/tests/projects/static library c/test.lua @@ -0,0 +1,9 @@ +-- imports +import("..build") + +-- main entry +function main() + + -- build project + build() +end diff --git a/tests/projects/static library c/xmake.lua b/tests/projects/static library c/xmake.lua new file mode 100644 index 000000000..318c286ee --- /dev/null +++ b/tests/projects/static library c/xmake.lua @@ -0,0 +1,45 @@ +-- 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("static_library_c") + + -- set kind + set_kind("static") + + -- add files + add_files("s r c/interface.c") + +-- add target +target("test") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("static_library_c") + + -- add files + add_files("s r c/test.c") + + |
