forked from commontk/CTK
/
CMakeLists.txt
133 lines (110 loc) · 3.39 KB
/
CMakeLists.txt
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
project(ctkSimplePythonShell)
#
# 3rd party dependencies
#
include(${VTK_USE_FILE})
#
# See CTK/CMake/ctkMacroBuildApp.cmake for details
#
set(KIT_SRCS
${CMAKE_CURRENT_BINARY_DIR}/ctkSimplePythonManager.cpp
ctkSimplePythonManager.h
ctkSimplePythonQtDecorators.h
ctkSimplePythonShellMain.cpp
ctkTestWrappedQProperty.h
ctkTestWrappedQInvokable.h
ctkTestWrappedSlot.h
)
if(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
list(APPEND KIT_SRCS
ctkTestWrappedQListOfVTKObject.h
ctkTestWrappedVTKSlot.h
ctkTestWrappedVTKQInvokable.h
)
endif()
# Headers that should run through moc
set(KIT_MOC_SRCS
ctkSimplePythonManager.h
ctkSimplePythonQtDecorators.h
ctkTestWrappedQProperty.h
ctkTestWrappedQInvokable.h
ctkTestWrappedSlot.h
)
if(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
list(APPEND KIT_MOC_SRCS
ctkTestWrappedQListOfVTKObject.h
ctkTestWrappedVTKSlot.h
ctkTestWrappedVTKQInvokable.h
)
endif()
# UI files
set(KIT_UI_FORMS
)
# Resources
set(KIT_resources
)
# Set VTK_LIBRARIES variable
set(VTK_LIBRARIES
vtkCommon
vtkFiltering
)
# Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
# The following macro will read the target libraries from the file 'target_libraries.cmake'
ctkFunctionGetTargetLibraries(KIT_target_libraries)
# Configure file will be configured using CTK_WRAP_PYTHONQT_{LIGHT, FULL} and
# CTK_BUILD_SHARED_LIBS variables
configure_file(
ctkSimplePythonShellConfigure.h.in
${CMAKE_CURRENT_BINARY_DIR}/ctkSimplePythonShellConfigure.h
)
# The following block generate the code required to initialize the wrapper
# when CTK is statically built.
if(NOT CTK_BUILD_SHARED_LIBS
AND (CTK_WRAP_PYTHONQT_LIGHT OR CTK_WRAP_PYTHONQT_FULL))
# Update list of target libraries with the list of available PythonQt libraries
# and set variables holding list of pythonqt initialization method
set(CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION)
set(CTK_PYTHONQT_INITIALIZATION_METHOD_CALL)
# To avoid the complex process of resolving the dependencies associated with each
# external project required by each decorator. For now, let's just include the decorator
# associated with CTKCore and CTKWidgets.
set(MY_CTK_WRAPPED_LIBRARIES_PYTHONQT)
if(CTK_LIB_Core)
list(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKCore)
endif()
if(CTK_LIB_Widgets)
list(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKWidgets)
endif()
if(CTK_LIB_DICOM/Core)
list(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKDICOMCore)
endif()
if(CTK_LIB_DICOM/Widgets)
list(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKDICOMWidgets)
endif()
foreach(lib_name ${MY_CTK_WRAPPED_LIBRARIES_PYTHONQT})
list(APPEND KIT_target_libraries ${lib_name}PythonQt)
set(CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION
"${CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION}
extern \"C\"{ void init${lib_name}PythonQt(); }")
set(CTK_PYTHONQT_INITIALIZATION_METHOD_CALL
"${CTK_PYTHONQT_INITIALIZATION_METHOD_CALL}
init${lib_name}PythonQt();")
endforeach()
endif()
configure_file(
ctkSimplePythonManager.cpp.in
${CMAKE_CURRENT_BINARY_DIR}/ctkSimplePythonManager.cpp
)
ctkMacroBuildApp(
NAME ${PROJECT_NAME}
SRCS ${KIT_SRCS}
MOC_SRCS ${KIT_MOC_SRCS}
UI_FORMS ${KIT_UI_FORMS}
TARGET_LIBRARIES ${KIT_target_libraries}
RESOURCES ${KIT_resources}
)
add_subdirectory(Python)
# Testing
if(BUILD_TESTING)
add_subdirectory(Testing)
endif()