diff options
| author | ruki <[email protected]> | 2020-04-04 13:01:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-04 13:04:06 +0800 |
| commit | dadee422f340ce6e96a7adbd64aa3941a2d31707 (patch) | |
| tree | 899503fb7a2625eaaf12945259d809c3af684735 /tests/projects/objc/bundle | |
| parent | cc80eac1312bc54f4d6564f2a517a86aeccf5e8d (diff) | |
improve objc/objc++ build rules
Diffstat (limited to 'tests/projects/objc/bundle')
| -rw-r--r-- | tests/projects/objc/bundle/src/main.m | 11 | ||||
| -rw-r--r-- | tests/projects/objc/bundle/src/test.h | 3 | ||||
| -rw-r--r-- | tests/projects/objc/bundle/src/test.m | 6 | ||||
| -rw-r--r-- | tests/projects/objc/bundle/xmake.lua | 22 |
4 files changed, 42 insertions, 0 deletions
diff --git a/tests/projects/objc/bundle/src/main.m b/tests/projects/objc/bundle/src/main.m new file mode 100644 index 000000000..e3fa72dbf --- /dev/null +++ b/tests/projects/objc/bundle/src/main.m @@ -0,0 +1,11 @@ +#import <Foundation/Foundation.h> +#import <test/test.h> + +int main(int argc, char** argv) +{ + @autoreleasepool + { + NSLog(@"add(1, 2): %d", add(1, 2)); + } + return 0; +} diff --git a/tests/projects/objc/bundle/src/test.h b/tests/projects/objc/bundle/src/test.h new file mode 100644 index 000000000..d882546d1 --- /dev/null +++ b/tests/projects/objc/bundle/src/test.h @@ -0,0 +1,3 @@ +#import <Foundation/Foundation.h> + +FOUNDATION_EXPORT int add(int a, int b); diff --git a/tests/projects/objc/bundle/src/test.m b/tests/projects/objc/bundle/src/test.m new file mode 100644 index 000000000..84422f6a7 --- /dev/null +++ b/tests/projects/objc/bundle/src/test.m @@ -0,0 +1,6 @@ +#include "test.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/tests/projects/objc/bundle/xmake.lua b/tests/projects/objc/bundle/xmake.lua new file mode 100644 index 000000000..5073b3b0f --- /dev/null +++ b/tests/projects/objc/bundle/xmake.lua @@ -0,0 +1,22 @@ +-- add rules +add_rules("mode.debug", "mode.release") + +-- add frameworks +add_frameworks("Foundation", "CoreFoundation") + +-- for macosx or ios +if is_os("macosx", "ios") then + + -- enable arc? + add_mxflags("-fobjc-arc") +end + +-- add target +target("console_objc") + + -- set kind + set_kind("binary") + + -- add files + add_files("src/*.m") + |
