diff options
author | Brad King <brad.king@kitware.com> | 2020-09-01 13:08:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-09-01 13:08:06 (GMT) |
commit | ec0d621e36de4b00fa4d8fe1bbcf21be2079fd73 (patch) | |
tree | 04d57c2bcb73b7ed5439299f36f89884b337e5d4 /Tests/UseSWIG | |
parent | 8c833ff0e17e63d9cbf17622abcb70a5fab240b8 (diff) | |
parent | d264685bee6a0d0598d46f5bc3e81f7231aa0c53 (diff) | |
download | CMake-ec0d621e36de4b00fa4d8fe1bbcf21be2079fd73.zip CMake-ec0d621e36de4b00fa4d8fe1bbcf21be2079fd73.tar.gz CMake-ec0d621e36de4b00fa4d8fe1bbcf21be2079fd73.tar.bz2 |
Merge topic 'UseSWIG-interface-option'
d264685bee UseSWIG: Update option -interface usage
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5172
Diffstat (limited to 'Tests/UseSWIG')
-rw-r--r-- | Tests/UseSWIG/CMakeLists.txt | 9 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleFiles/CMakeLists.txt | 30 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleFiles/add.cxx | 6 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleFiles/add.h | 1 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleFiles/add.i | 4 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleFiles/sub.cxx | 6 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleFiles/sub.h | 1 | ||||
-rw-r--r-- | Tests/UseSWIG/MultipleFiles/sub.i | 5 |
8 files changed, 62 insertions, 0 deletions
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt index 7046fab..aee3338 100644 --- a/Tests/UseSWIG/CMakeLists.txt +++ b/Tests/UseSWIG/CMakeLists.txt @@ -101,6 +101,15 @@ add_test(NAME UseSWIG.MultiplePython COMMAND --build-options ${build_options} --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) +add_test(NAME UseSWIG.MultipleFiles COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultipleFiles" + "${CMake_BINARY_DIR}/Tests/UseSWIG/MultipleFiles" + ${build_generator_args} + --build-project TestMultipleFiles + --build-options ${build_options} + ) add_test(NAME UseSWIG.ModuleVersion2 COMMAND diff --git a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt new file mode 100644 index 0000000..bf3d946 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.18) + +project(TestMultipleFiles CXX) + +find_package(SWIG REQUIRED) +include(UseSWIG) + +unset(SWIG_LANG_TYPE) +unset(SWIG_LANG_INCLUDE_DIRECTORIES) +unset(SWIG_LANG_DEFINITIONS) +unset(SWIG_LANG_OPTIONS) +unset(SWIG_LANG_LIBRARIES) + +find_package(Python3 REQUIRED COMPONENTS Development) + +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON) +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY SWIG_MODULE_NAME _add) +set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY SWIG_MODULE_NAME _sub) + + +swig_add_library(example + LANGUAGE python + TYPE MODULE + SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/add.i" + "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" + "${CMAKE_CURRENT_SOURCE_DIR}/add.cxx" + "${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx") +target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") +target_link_libraries(example PRIVATE Python3::Module) diff --git a/Tests/UseSWIG/MultipleFiles/add.cxx b/Tests/UseSWIG/MultipleFiles/add.cxx new file mode 100644 index 0000000..a4dcca3 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/add.cxx @@ -0,0 +1,6 @@ +#include "add.h" + +int add(int a, int b) +{ + return a + b; +} diff --git a/Tests/UseSWIG/MultipleFiles/add.h b/Tests/UseSWIG/MultipleFiles/add.h new file mode 100644 index 0000000..6295ab9 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/add.h @@ -0,0 +1 @@ +int add(int a, int b); diff --git a/Tests/UseSWIG/MultipleFiles/add.i b/Tests/UseSWIG/MultipleFiles/add.i new file mode 100644 index 0000000..2046397 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/add.i @@ -0,0 +1,4 @@ +%{ +#include "add.h" +%} +%include "add.h" diff --git a/Tests/UseSWIG/MultipleFiles/sub.cxx b/Tests/UseSWIG/MultipleFiles/sub.cxx new file mode 100644 index 0000000..d6874ef --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/sub.cxx @@ -0,0 +1,6 @@ +#include "sub.h" + +int sub(int a, int b) +{ + return a - b; +} diff --git a/Tests/UseSWIG/MultipleFiles/sub.h b/Tests/UseSWIG/MultipleFiles/sub.h new file mode 100644 index 0000000..de77111 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/sub.h @@ -0,0 +1 @@ +int sub(int a, int b); diff --git a/Tests/UseSWIG/MultipleFiles/sub.i b/Tests/UseSWIG/MultipleFiles/sub.i new file mode 100644 index 0000000..fc70f10 --- /dev/null +++ b/Tests/UseSWIG/MultipleFiles/sub.i @@ -0,0 +1,5 @@ +%{ +#include "sub.h" +%} + +%include "sub.h" |