summaryrefslogtreecommitdiff
path: root/tests/projects
diff options
context:
space:
mode:
authortokomine <[email protected]>2023-12-11 15:47:39 +0800
committertokomine <[email protected]>2023-12-12 13:41:19 +0800
commitb69f77d19a8eae5251968bad1703d21ea9b39f9b (patch)
tree9a421024f486cf5c48b14a66e685308550e3f5b8 /tests/projects
parent4262122871733078442170e9d9d656d30e2801fa (diff)
add includedirs for swig
Diffstat (limited to 'tests/projects')
-rw-r--r--tests/projects/swig/auto_include/src/example.cpp14
-rw-r--r--tests/projects/swig/auto_include/src/example.i13
-rw-r--r--tests/projects/swig/auto_include/xmake.lua10
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