diff options
| author | ruki <[email protected]> | 2016-02-22 09:51:35 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-02-22 09:51:35 +0800 |
| commit | c50639da01bb4e03f933e68eb308910a67974632 (patch) | |
| tree | f08581d822ca555fd760fd5eb378d6f8e041b1d9 | |
| parent | 8ae6432163f52e43eae5efc9a0e4c45d1f692b80 (diff) | |
add merge static library test
| -rwxr-xr-x | tests/merge_static_library/src/interface.c | 6 | ||||
| -rwxr-xr-x | tests/merge_static_library/src/interface.h | 8 | ||||
| -rwxr-xr-x | tests/merge_static_library/src/test.c | 8 | ||||
| -rwxr-xr-x | tests/merge_static_library/xmake.lua | 50 | ||||
| -rwxr-xr-x | tests/tests | 7 |
5 files changed, 79 insertions, 0 deletions
diff --git a/tests/merge_static_library/src/interface.c b/tests/merge_static_library/src/interface.c new file mode 100755 index 000000000..598d07560 --- /dev/null +++ b/tests/merge_static_library/src/interface.c @@ -0,0 +1,6 @@ +#include "interface.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/tests/merge_static_library/src/interface.h b/tests/merge_static_library/src/interface.h new file mode 100755 index 000000000..10ec0f856 --- /dev/null +++ b/tests/merge_static_library/src/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/merge_static_library/src/test.c b/tests/merge_static_library/src/test.c new file mode 100755 index 000000000..9505a2f75 --- /dev/null +++ b/tests/merge_static_library/src/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/merge_static_library/xmake.lua b/tests/merge_static_library/xmake.lua new file mode 100755 index 000000000..88ecdd304 --- /dev/null +++ b/tests/merge_static_library/xmake.lua @@ -0,0 +1,50 @@ +-- 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("merge_static_library") + + -- set kind + set_kind("static") + + -- add files + add_files("../static_library_c/build/*.a") + +-- add target +target("test") + + -- set kind + set_kind("binary") + + -- add deps + add_deps("merge_static_library") + + -- add files + add_files("src/test.c") + + -- add links + add_links("merge_static_library") + + -- add link directory + add_linkdirs("$(buildir)") + diff --git a/tests/tests b/tests/tests index 086d72a6d..48d826fd3 100755 --- a/tests/tests +++ b/tests/tests @@ -46,17 +46,24 @@ function build() cd - } +# build for c build "./tests/console_c" build "./tests/static_library_c" build "./tests/shared_library_c" +# build for c++ build "./tests/console_c++" build "./tests/static_library_c++" build "./tests/shared_library_c++" +# merge static library +#build "./tests/merge_static_library" + +# build for macosx if [ $host = "macosx" ]; then build "./tests/console_objc" build "./tests/console_objc++" build "./tests/console_swift" fi + |
