blob: 3804bdd87fd55b445b763b5a9e6b0a034536416c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
find_package(Python2 REQUIRED COMPONENTS Development)
find_package(Python3 REQUIRED COMPONENTS Development)
unset(CMAKE_SWIG_FLAGS)
set (CMAKE_INCLUDE_CURRENT_DIR ON)
set_property(SOURCE example.i PROPERTY CPLUSPLUS ON)
set_property(SOURCE example.i PROPERTY COMPILE_OPTIONS -includeall)
swig_add_library(example1
LANGUAGE python
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python2"
SOURCES example.i example.cxx)
target_link_libraries(example1 PRIVATE Python2::Python)
# re-use sample interface file for another plugin
swig_add_library(example2
LANGUAGE python
OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/Python3"
SOURCES example.i example.cxx)
target_link_libraries(example2 PRIVATE Python3::Python)
|