-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
170 lines (138 loc) · 5.8 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
project(OpenIGTLinkSimulator)
cmake_minimum_required(VERSION 2.8.6)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
find_package(OpenIGTLink REQUIRED)
find_package(Qt4 REQUIRED)
set(PROJECT_VERSION_MAJOR "0")
set(PROJECT_VERSION_MINOR "5")
set(PROJECT_VERSION_PATCH "0")
set(PROJECT_VERSION_COUNT 1)
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
set(PROJECT_VENDOR "Junichi Tokuda")
set(PROJECT_COPYRIGHT_YEAR "2010-2011")
set(PROJECT_DOMAIN_FIRST "bwh.harvard")
set(PROJECT_DOMAIN_SECOND "edu")
set(PROJECT_DOMAIN "${PROJECT_DOMAIN_FIRST}.${PROJECT_DOMAIN_SECOND}")
if(APPLE AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
set(CMAKE_INSTALL_PREFIX "/Applications")
endif()
if(UNIX AND NOT APPLE)
string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWERCASE)
set(BIN_INSTALL_DIR "bin")
set(DOC_INSTALL_DIR "share/doc/${PROJECT_NAME_LOWERCASE}/")
else()
set(BIN_INSTALL_DIR ".")
set(DOC_INSTALL_DIR ".")
endif()
set(ICONS_DIR "${${PROJECT_NAME}_SOURCE_DIR}/icons")
if(CMAKE_COMPILER_IS_GNUCXX OR APPLE)
add_definitions(-Wall -Wextra)
if(CMAKE_BUILD_RELEASE)
add_definitions(-Werror)
endif()
endif()
set(OpenIGTLinkSimulator_SOURCES
main.cpp
OpenIGTLinkSimulatorApp.cpp
qDataGeneratorBase.cpp
qDataGeneratorTracking.cpp
igtlTCPConnectorBase.cxx
igtlTCPConnectorServer.cxx
igtlTCPConnectorClient.cxx
igtlTCPConnectorServerOIGTL.cxx
)
set(OpenIGTLinkSimulator_HEADERS OpenIGTLinkSimulatorApp.h qDataGeneratorBase.h qDataGeneratorTracking.h)
set(OpenIGTLinkSimulator_FORMS OpenIGTLinkSimulatorWindow.ui)
#set(OpenIGTLinkSimulator_RESOURCES images.qrc)
qt4_wrap_cpp(OpenIGTLinkSimulator_HEADERS_MOC ${OpenIGTLinkSimulator_HEADERS})
qt4_wrap_ui(OpenIGTLinkSimulator_FORMS_HEADERS ${OpenIGTLinkSimulator_FORMS})
#qt4_add_resources(OpenIGTLinkSimulator_RESOURCES_RCC ${OpenIGTLinkSimulator_RESOURCES})
if(APPLE)
set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_NAME} ${PROJECT_VERSION}")
set(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}")
set(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}")
set(MACOSX_BUNDLE_ICON_FILE "OpenIGTLinkSimulator.icns")
set(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN}")
set(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}")
set(MACOSX_BUNDLE_RESOURCES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.app/Contents/Resources")
set(MACOSX_BUNDLE_ICON "${ICONS_DIR}/${MACOSX_BUNDLE_ICON_FILE}")
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${MACOSX_BUNDLE_RESOURCES})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${MACOSX_BUNDLE_ICON} ${MACOSX_BUNDLE_RESOURCES})
endif()
include(${QT_USE_FILE})
include(${OpenIGTLink_USE_FILE})
add_definitions(${QT_DEFINITIONS})
add_executable(OpenIGTLinkSimulator WIN32 MACOSX_BUNDLE
${OpenIGTLinkSimulator_SOURCES}
${OpenIGTLinkSimulator_HEADERS_MOC}
${OpenIGTLinkSimulator_FORMS_HEADERS}
${OpenIGTLinkSimulator_RESOURCES_RCC})
target_link_libraries(OpenIGTLinkSimulator
${QT_LIBRARIES}
OpenIGTLink
)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
#set(QT_USE_QTOPENGL TRUE)
#set(QT_USE_QTNETWORK TRUE)
#set(QT_USE_QTOPENGL TRUE)
#set(QT_USE_QTSQL TRUE)
#set(QT_USE_QTXML TRUE)
#set(QT_USE_QTSVG TRUE)
#set(QT_USE_QTTEST TRUE)
#set(QT_USE_QTDBUS TRUE)
#set(QT_USE_QTSCRIPT TRUE)
#set(QT_USE_QTWEBKIT TRUE)
#set(QT_USE_QTXMLPATTERNS TRUE)
#set(QT_USE_PHONON TRUE)
#INCLUDE(InstallRequiredSystemLibraries)
install(TARGETS ${PROJECT_NAME} DESTINATION ${BIN_INSTALL_DIR})
set(CPACK_GENERATOR "TBZ2")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_VENDOR "${PROJECT_VENDOR}")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/${README_FILE}")
if(WIN32)
set(CPACK_GENERATOR "NSIS")
set(CPACK_PACKAGE_EXECUTABLES "${PROJECT_NAME}" "${PROJECT_NAME}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME} ${PROJECT_VERSION}")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/${LICENSE_FILE}")
set(CPACK_NSIS_EXECUTABLES_DIRECTORY "${BIN_INSTALL_DIR}")
#set(CPACK_NSIS_MUI_ICON "${PROJECT_ICONS_DIRECTORY}/NSIS.ico")
#set(CPACK_PACKAGE_ICON "${PROJECT_ICONS_DIRECTORY}\\\\NSISHeader.bmp")
set(CPACK_NSIS_URL_INFO_ABOUT "http://${PROJECT_DOMAIN}")
set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
set(CPACK_NSIS_MENU_LINKS "${LICENSE_FILE}" "LICENSE.txt" "${README_FILE}" "README.txt")
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "${CPACK_NSIS_INSTALLED_ICON_NAME}")
endif()
if(APPLE)
set(CMAKE_INSTALL_PREFIX "/Applications")
set(CPACK_GENERATOR "DragNDrop")
set(CPACK_DMG_FORMAT "UDBZ")
set(CPACK_DMG_VOLUME_NAME "${PROJECT_NAME}")
set(CPACK_SYSTEM_NAME "OSX")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
set(CPACK_PACKAGE_ICON "${ICONS_DIR}/OpenIGTLinkSimulator.icns")
#set(CPACK_DMG_DS_STORE "${ICONS_DIR}/DMGDSStore")
#set(CPACK_DMG_BACKGROUND_IMAGE "${ICONS_DIR}/DMGBackground.png")
endif()
include(CPack)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "${BIN_INSTALL_DIR}")
include(InstallRequiredSystemLibraries)
if(APPLE)
set(EXECUTABLE "${PROJECT_NAME}.app")
elseif(WIN32)
set(EXECUTABLE "${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
else()
set(EXECUTABLE "${BIN_INSTALL_DIR}/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
endif()
if(APPLE OR WIN32)
include(DeployQt4)
install_qt4_executable("${EXECUTABLE}" qsqlite)
endif()