-
Notifications
You must be signed in to change notification settings - Fork 3
/
FiberViewerLight.cmake
121 lines (98 loc) · 3.83 KB
/
FiberViewerLight.cmake
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
SETIFEMPTY( RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin )
SETIFEMPTY( LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
SETIFEMPTY( ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/static)
FIND_PACKAGE(VTK REQUIRED)
IF (VTK_FOUND)
INCLUDE(${VTK_USE_FILE})
ELSE(VTK_FOUND)
MESSAGE(FATAL_ERROR, "VTK not found. Please set VTK_DIR.")
ENDIF (VTK_FOUND)
find_package(SlicerExecutionModel REQUIRED)
include(${SlicerExecutionModel_USE_FILE})
FIND_PACKAGE(ITK REQUIRED)
IF(ITK_FOUND)
INCLUDE(${ITK_USE_FILE})
ELSE(ITK_FOUND)
MESSAGE(FATAL_ERROR "ITK not found. Please set ITK_DIR")
ENDIF(ITK_FOUND)
# Qwt include directory
if( NOT QWT_INCLUDE_DIR )
FIND_PATH(QWT_INCLUDE_DIR qwt.h
/usr/local/qwt/include
/usr/local/include
/usr/include/qwt
/usr/include
)
endif()
if(NOT QWT_INCLUDE_DIR)
message(FATAL_ERROR "QWT_INCLUDE_DIR not found. It should be set to a path containing qwt.h, like '/Projects/qwt-6.0.1-svn/include'")
endif()
# Qwt libraries
if( NOT QWT_LIBRARY OR QWT_LIBRARY_PATH )
if( BUILD_WITH_SUPERBUILD )
set(NO_ENV_PATH "NO_DEFAULT_PATH")
endif()
SET(QWT_NAMES ${QWT_NAMES} qwt libqwt)
FIND_LIBRARY(QWT_LIBRARY
NAMES ${QWT_NAMES}
PATHS ${QWT_LIBRARY_PATH} /usr/local/qwt/lib /usr/local/lib /usr/lib
${NO_ENV_PATH}
)
endif()
if(NOT QWT_LIBRARY)
message(FATAL_ERROR "QWT_LIBRARY not found. It should be set to a filepath like '/Projects/qwt-6.0.1-svn/lib/libqwt.a'")
endif()
set(QWT_LIBRARIES ${QWT_LIBRARY})
SETIFEMPTY(INSTALL_RUNTIME_DESTINATION bin)
SETIFEMPTY(INSTALL_LIBRARY_DESTINATION lib)
SETIFEMPTY(INSTALL_ARCHIVE_DESTINATION lib)
if( EXTENSION )
configure_file(
FiberViewerLight.xml
${CMAKE_CURRENT_BINARY_DIR}/FiberViewerLightLauncher.xml
COPYONLY
)
SEMMacroBuildCLI(
NAME FiberViewerLightLauncher
EXECUTABLE_ONLY
NO_INSTALL
)
install( TARGETS FiberViewerLightLauncher RUNTIME DESTINATION ${INSTALL_RUNTIME_DESTINATION} )
endif()
QT5_WRAP_CPP(MOC_FILES FiberViewerLightGUI.h FVLengthGUI.h FVDistributionGUI.h FVPanelGUI.h FVDisplayClassGUI.h FVCutterGUI.h FVNormalizedCutGUI.h PlanSetting.h FiberDisplay.h)
SET(FVLight_source FiberViewerLight.cxx FiberViewerLightGUI.cxx FiberDisplay.cxx FVLengthGUI.cxx FVDistributionGUI.cxx FVPanelGUI.cxx FVDisplayClassGUI.cxx FVNormalizedCutGUI.cxx PlanSetting.cxx FVCutterGUI.cxx ${MOC_FILES})
SET(FVLight_header FiberViewerLightGUI.h FiberDisplay.h FVLengthGUI.h FVDistributionGUI.h FVPanelGUI.h FVDisplayClassGUI.h FVNormalizedCutGUI.h PlanSetting.h FVCutterGUI.h)
set( FVL_LIBRARIES
${ITK_LIBRARIES}
${QT_LIBRARIES}
${QWT_LIBRARIES}
${VTK_LIBRARIES}
)
FILE(READ FiberViewerLight.xml var)
string(REGEX MATCH "<version>.*</version>" ext "${var}")
string(REPLACE "<version>" "" version ${ext})
string(REPLACE "</version>" "" version ${version})
message(STATUS ${version})
add_definitions(-DFVL_VERSION="${version}")
# string(REPLACE "." ";" VERSION_LIST ${version})
# list(GET VERSION_LIST 0 CPACK_PACKAGE_VERSION_MAJOR)
# list(GET VERSION_LIST 1 CPACK_PACKAGE_VERSION_MINOR)
# list(GET VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH)
SEMMacroBuildCLI(
NAME FiberViewerLight
EXECUTABLE_ONLY
ADDITIONAL_SRCS ${FVLight_source} ${FVLight_header} ${MOC_FILES}
RUNTIME_OUTPUT_DIRECTORY ${RUNTIME_OUTPUT_DIRECTORY}
LIBRARY_OUTPUT_DIRECTORY ${LIBRARY_OUTPUT_DIRECTORY}
ARCHIVE_OUTPUT_DIRECTORY ${ARCHIVE_OUTPUT_DIRECTORY}
TARGET_LIBRARIES ${FVL_LIBRARIES}
LINK_DIRECTORIES ${VTK_LIBRARY_DIRS}
INCLUDE_DIRECTORIES ${QT_INCLUDE_DIR} ${FiberViewerLight_BINARY_DIR} ${FiberViewerLight_SOURCE_DIR} ${QWT_INCLUDE_DIR} ${VTK_INCLUDE_DIRS}
INSTALL_RUNTIME_DESTINATION ${INSTALL_RUNTIME_DESTINATION}
INSTALL_LIBRARY_DESTINATION ${INSTALL_LIBRARY_DESTINATION}
INSTALL_ARCHIVE_DESTINATION ${INSTALL_ARCHIVE_DESTINATION}
)
IF(BUILD_TESTING)
include( CTest )
ADD_SUBDIRECTORY(Testing)
ENDIF(BUILD_TESTING)