diff options
| author | ruki <[email protected]> | 2024-09-06 16:33:34 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-09-06 16:33:34 +0800 |
| commit | c4249906946dcef8c8ada216b90c4ead28e56e3a (patch) | |
| tree | 9dcdb8feda99a8f066f46dd7fcc635823efb6abc /tests/projects | |
| parent | e9df84ad021c7c8ec020384e250ca5b95fe3e700 (diff) | |
| parent | 37c14c0ef5813b2fe2a768fe22a2710bc3ac987b (diff) | |
Merge pull request #5536 from ririyeye/swig_jar
add jar generate in swig mode
Diffstat (limited to 'tests/projects')
| -rw-r--r-- | tests/projects/swig/java_c/src/example.c | 4 | ||||
| -rw-r--r-- | tests/projects/swig/java_c/src/example.i | 2 | ||||
| -rw-r--r-- | tests/projects/swig/java_c/src/example2.i | 4 | ||||
| -rw-r--r-- | tests/projects/swig/java_c/src/test.h | 3 | ||||
| -rw-r--r-- | tests/projects/swig/java_c/xmake.lua | 3 |
5 files changed, 16 insertions, 0 deletions
diff --git a/tests/projects/swig/java_c/src/example.c b/tests/projects/swig/java_c/src/example.c index 06f76c542..a3f19629d 100644 --- a/tests/projects/swig/java_c/src/example.c +++ b/tests/projects/swig/java_c/src/example.c @@ -2,3 +2,7 @@ int fact(int n) { return n; } +int fact2(int n) { + return n; +} + diff --git a/tests/projects/swig/java_c/src/example.i b/tests/projects/swig/java_c/src/example.i index e952f6123..6bac9f7a3 100644 --- a/tests/projects/swig/java_c/src/example.i +++ b/tests/projects/swig/java_c/src/example.i @@ -3,3 +3,5 @@ extern int fact(int n); %} extern int fact(int n); + +%include "example2.i" diff --git a/tests/projects/swig/java_c/src/example2.i b/tests/projects/swig/java_c/src/example2.i new file mode 100644 index 000000000..794af702d --- /dev/null +++ b/tests/projects/swig/java_c/src/example2.i @@ -0,0 +1,4 @@ +%inline %{ +#include "test.h" +%} +%include "test.h" diff --git a/tests/projects/swig/java_c/src/test.h b/tests/projects/swig/java_c/src/test.h new file mode 100644 index 000000000..da669d859 --- /dev/null +++ b/tests/projects/swig/java_c/src/test.h @@ -0,0 +1,3 @@ +#pragma once + +int fact2(int n); diff --git a/tests/projects/swig/java_c/xmake.lua b/tests/projects/swig/java_c/xmake.lua index 65e871ce6..3108859a7 100644 --- a/tests/projects/swig/java_c/xmake.lua +++ b/tests/projects/swig/java_c/xmake.lua @@ -7,6 +7,8 @@ target("example") set_kind('shared') -- set moduletype to java add_rules("swig.c", {moduletype = "java"}) + -- test jar build + -- add_rules("swig.c", {moduletype = "java" , buildjar = true}) -- use swigflags to provider package name and output path of java files add_files("src/example.i", {swigflags = { "-package", @@ -15,6 +17,7 @@ target("example") "build/java/com/example/" }}) add_files("src/example.c") + add_includedirs("src") before_build(function() -- ensure output path exists before running swig os.mkdir("build/java/com/example/") |
