forked from juliettepera/3DMetricTools
-
Notifications
You must be signed in to change notification settings - Fork 9
/
3DMetricTools.cmake
111 lines (99 loc) · 4.22 KB
/
3DMetricTools.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
# Extension meta-information
set(EXTENSION_HOMEPAGE "https://www.nitrc.org/projects/meshmetric3d/")
set(EXTENSION_CATEGORY "Quantification")
set(EXTENSION_CONTRIBUTORS "Francois Budin (UNC), Juliette Pera (UNC), Beatriz Paniagua (UNC)")
set(EXTENSION_DESCRIPTION "This extension computes the distance between two 3D models")
set(EXTENSION_ICONURL "https://slicer.org/slicerWiki/images/4/43/Slicer4ExtensionModelToModelDistance.png")
set(EXTENSION_SCREENSHOTURLS "https://www.slicer.org/slicerWiki/images/thumb/7/7a/Slicer4Extensions-ModelToModelDistanceOriginalShapes.png/800px-Slicer4Extensions-ModelToModelDistanceOriginalShapes.png")
set(EXTENSION_STATUS "")
set(EXTENSION_DEPENDS "NA") # Specified as a space separated list or 'NA' if any
set(EXTENSION_BUILD_SUBDIRECTORY .)
#-----------------------------------------------------------------------------
# Prequisites
#-----------------------------------------------------------------------------
find_package(SlicerExecutionModel REQUIRED)
include(${SlicerExecutionModel_USE_FILE})
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
if(3DMetricTools_QT_VERSION VERSION_EQUAL "4")
find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})
set(3DMetricTools_VTK_USE_QVTKOPENGLWIDGET 0)
set(3DMetricTools_VTK_USE_QVTKOPENGLNATIVEWIDGET 0)
else()
set(qt_components Core Widgets)
if(UNIX AND NOT APPLE)
list(APPEND qt_components X11Extras)
endif()
find_package(Qt5 COMPONENTS ${qt_components} REQUIRED)
if (VTK_VERSION VERSION_GREATER "7" AND VTK_RENDERING_BACKEND STREQUAL "OpenGL2")
set(3DMetricTools_VTK_USE_QVTKOPENGLWIDGET 1)
set(3DMetricTools_VTK_USE_QVTKOPENGLNATIVEWIDGET 0)
# Detect if QVTKOpenGLNativeWidget.h is available (adapted from https://github.com/commontk/CTK)
if(3DMetricTools_VTK_USE_QVTKOPENGLWIDGET)
set(_msg "Checking if QVTKOpenGLNativeWidget.h exists")
message(STATUS "${_msg}")
foreach(include_dir IN ITEMS ${vtkGUISupportQt_INCLUDE_DIRS})
if(EXISTS "${include_dir}/QVTKOpenGLNativeWidget.h")
set(3DMetricTools_VTK_USE_QVTKOPENGLNATIVEWIDGET 1)
break()
endif()
endforeach()
if(3DMetricTools_VTK_USE_QVTKOPENGLNATIVEWIDGET)
message(STATUS "${_msg} - found")
else()
message(STATUS "${_msg} - not found")
endif()
endif()
endif()
set(QT_LIBRARIES)
foreach(lib IN LISTS qt_components)
list(APPEND QT_LIBRARIES Qt5::${lib})
endforeach()
endif()
#-----------------------------------------------------------------------------
if( NOT ${EXTENSION_NAME}_BUILD_SLICER_EXTENSION )
# set RPATH
if( UNIX )
if(NOT APPLE)
SET( CMAKE_INSTALL_RPATH "$ORIGIN/lib" )
endif()
endif()
SETIFEMPTY( INSTALL_ARCHIVE_DESTINATION 3DMetricTools-static_lib )
SETIFEMPTY( INSTALL_RUNTIME_DESTINATION 3DMetricTools-package )
SETIFEMPTY( INSTALL_LIBRARY_DESTINATION ${INSTALL_RUNTIME_DESTINATION}/lib )
endif()
#-----------------------------------------------------------------------------
if( Build_ModelToModelDistance )
add_subdirectory( ModelToModelDistance )
endif()
if( Build_3DMeshMetric )
find_package( Qt4 REQUIRED )
include( ${QT_USE_FILE} )
set( MeshValmetLib_SOURCE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Libraries )
if( Build_Static )
set( MeshValmetLib_LIBRARY_TYPE STATIC )
set( MeshValmetLib_BINARY_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} )
else()
set( MeshValmetLib_LIBRARY_TYPE SHARED )
set( MeshValmetLib_BINARY_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} )
endif()
add_subdirectory( Libraries )
add_subdirectory( 3DMeshMetric )
endif()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if(3DMetricTools_BUILD_TESTING)
include(CTest)
include(ExternalData)
ADD_SUBDIRECTORY(Testing)
endif()
#-----------------------------------------------------------------------------
# Packaging
#-----------------------------------------------------------------------------
if( ${EXTENSION_NAME}_BUILD_SLICER_EXTENSION )
set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_INSTALL_CMAKE_PROJECTS};${CMAKE_BINARY_DIR};${EXTENSION_NAME};ALL;/")
include(${Slicer_EXTENSION_GENERATE_CONFIG})
include(${Slicer_EXTENSION_CPACK})
endif()