diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/projects/swig/auto_include/src/example.cpp | 14 | ||||
| -rw-r--r-- | tests/projects/swig/auto_include/src/example.i | 13 | ||||
| -rw-r--r-- | tests/projects/swig/auto_include/xmake.lua | 10 |
3 files changed, 37 insertions, 0 deletions
diff --git a/tests/projects/swig/auto_include/src/example.cpp b/tests/projects/swig/auto_include/src/example.cpp new file mode 100644 index 000000000..b0ddc9c26 --- /dev/null +++ b/tests/projects/swig/auto_include/src/example.cpp @@ -0,0 +1,14 @@ +double My_variable = 3.0; + +/* Compute factorial of n */ +int fact(int n) { + if (n <= 1) + return 1; + else + return n*fact(n-1); +} + +/* Compute n mod m */ +int my_mod(int n, int m) { + return(n % m); +} diff --git a/tests/projects/swig/auto_include/src/example.i b/tests/projects/swig/auto_include/src/example.i new file mode 100644 index 000000000..945b77892 --- /dev/null +++ b/tests/projects/swig/auto_include/src/example.i @@ -0,0 +1,13 @@ +%module example + +%{ +/* Put headers and other declarations here */ +#include "nlohmann/json.hpp" +extern double My_variable; +extern int fact(int); +extern int my_mod(int n, int m); +%} + +extern double My_variable; +extern int fact(int); +extern int my_mod(int n, int m); diff --git a/tests/projects/swig/auto_include/xmake.lua b/tests/projects/swig/auto_include/xmake.lua new file mode 100644 index 000000000..63afe351a --- /dev/null +++ b/tests/projects/swig/auto_include/xmake.lua @@ -0,0 +1,10 @@ +add_rules("mode.release", "mode.debug") +add_requires("python 3.x") +add_requires("nlohmann_json") + +target("example") + add_rules("swig.cpp", {moduletype = "python"}) + add_files("src/example.i", {scriptdir = "share"}) + add_files("src/example.cpp") + add_packages("python") + add_packages("nlohmann_json")
\ No newline at end of file |
