aboutsummaryrefslogtreecommitdiff
path: root/tests/GenerateSipBindings
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2017-01-18 23:31:17 +0000
committerStephen Kelly <steveire@gmail.com>2017-01-18 23:31:17 +0000
commit3e6eb0562e5fd3831d66db4720c67cc950b3536c (patch)
tree22ebeec149025d73404f93998f1816301c093aa4 /tests/GenerateSipBindings
parent34fb39fe34461b8131f5863cd86127c02806c525 (diff)
downloadextra-cmake-modules-3e6eb0562e5fd3831d66db4720c67cc950b3536c.tar.gz
extra-cmake-modules-3e6eb0562e5fd3831d66db4720c67cc950b3536c.tar.bz2
Bindings: Test file in subdirectory.
Diffstat (limited to 'tests/GenerateSipBindings')
-rw-r--r--tests/GenerateSipBindings/CMakeLists.txt7
-rw-r--r--tests/GenerateSipBindings/subdir/subdirfile.cpp7
-rw-r--r--tests/GenerateSipBindings/subdir/subdirfile.h8
-rw-r--r--tests/GenerateSipBindings/testscript.py3
4 files changed, 24 insertions, 1 deletions
diff --git a/tests/GenerateSipBindings/CMakeLists.txt b/tests/GenerateSipBindings/CMakeLists.txt
index c223bcef..151db9fc 100644
--- a/tests/GenerateSipBindings/CMakeLists.txt
+++ b/tests/GenerateSipBindings/CMakeLists.txt
@@ -14,12 +14,16 @@ add_library(ExternalLib SHARED external_lib.cpp)
target_link_libraries(ExternalLib PUBLIC Qt5::Core)
target_compile_features(ExternalLib PUBLIC cxx_nullptr)
-add_library(CppLib SHARED cpplib.cpp)
+add_library(CppLib SHARED
+ cpplib.cpp
+ subdir/subdirfile.cpp
+)
target_link_libraries(CppLib
PUBLIC Qt5::Core
PRIVATE ExternalLib
)
target_compile_features(CppLib PUBLIC cxx_nullptr)
+target_include_directories(CppLib PUBLIC subdir)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../find-modules)
@@ -44,4 +48,5 @@ ecm_generate_python_binding(
QtCore/QtCoremod.sip
HEADERS
cpplib.h
+ subdir/subdirfile.h
)
diff --git a/tests/GenerateSipBindings/subdir/subdirfile.cpp b/tests/GenerateSipBindings/subdir/subdirfile.cpp
new file mode 100644
index 00000000..d874243b
--- /dev/null
+++ b/tests/GenerateSipBindings/subdir/subdirfile.cpp
@@ -0,0 +1,7 @@
+
+#include "subdirfile.h"
+
+int SubdirObject::mul(int a, int b)
+{
+ return a * b;
+}
diff --git a/tests/GenerateSipBindings/subdir/subdirfile.h b/tests/GenerateSipBindings/subdir/subdirfile.h
new file mode 100644
index 00000000..5fd18db4
--- /dev/null
+++ b/tests/GenerateSipBindings/subdir/subdirfile.h
@@ -0,0 +1,8 @@
+
+#pragma once
+
+class SubdirObject
+{
+public:
+ int mul(int a, int b);
+};
diff --git a/tests/GenerateSipBindings/testscript.py b/tests/GenerateSipBindings/testscript.py
index 9e12bd17..e79706bc 100644
--- a/tests/GenerateSipBindings/testscript.py
+++ b/tests/GenerateSipBindings/testscript.py
@@ -118,3 +118,6 @@ assert(PyTest.CppLib.SomeNS.useEnum(PyTest.CppLib.SomeNS.EnumValueTwo) == 2.0)
assert(PyTest.CppLib.SomeNS.customMethod([2, 3, 5]) == 10)
assert(PyTest.CppLib.anotherCustomMethod([2, 3, 5]) == 52)
+
+sdo = PyTest.CppLib.SubdirObject()
+assert(sdo.mul(5, 6) == 30)