This repository has been archived by the owner on Nov 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
/
CMakeLists.txt
193 lines (140 loc) · 5.4 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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(BUILD_ALL)
SET( GINKGO_VERSION 3.8.8)
SET( USE_PATCHED_LIBS FALSE CACHE BOOL "Use patched libraries")
SET( BUILD_VISUALIZATION_EXT TRUE CACHE BOOL "Build Visualization extention")
SET( USE_SYSTEM_SQLITE TRUE CACHE BOOL "Build with system SQLite library")
SET( USE_CUSTOM_WX FALSE CACHE BOOL "Build with custom WX library")
SET( USE_CUSTOM_VTK FALSE CACHE BOOL "Build with custom VTK library")
SET( USE_CUSTOM_ITK FALSE CACHE BOOL "Build with custom ITK library")
SET( USE_CUSTOM_DCMTK FALSE CACHE BOOL "Build with custom DCMTK library")
SET( CUSTOM_PACKAGE FALSE CACHE BOOL "Custom package")
SET( FORCE_SSE FALSE CACHE BOOL "Force SSE Flag")
SET( INTERNET_DIST TRUE CACHE BOOL "Public distribution")
SET( CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "MacOSX Architectures" FORCE)
SET( GINKGO_VERSION_STR ${GINKGO_VERSION})
#############################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/CMake)
INCLUDE(SysDefs)
#############################################################################################
include(FindPkgConfig)
include(CheckCXXCompilerFlag)
set(CMAKE_CXX_STANDARD_DEFAULT "")
IF (((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND
(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3.0)) OR
((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") AND
(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.3.0)))
MESSAGE(STATUS "Compiler has full c++11 support")
# g++ >= 6.0 sets std=c++14 by default
IF (NOT ( ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") OR
(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0.0))
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
ENDIF()
ELSE()
CHECK_CXX_COMPILER_FLAG("-std=c++11" HAS_GNU_CXX11_FLAG)
IF(HAS_GNU_CXX11_FLAG)
SET(CXX_11_FLAG "-std=c++11")
ELSE(HAS_GNU_CXX11_FLAG)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" HAS_GNU_CXX0X_FLAG)
IF(HAS_GNU_CXX0X_FLAG)
SET(CXX_11_FLAG "-std=c++0x")
ELSE(HAS_GNU_CXX0X_FLAG)
MESSAGE(WARNING "Don't know how to enable C++11, if you are lucky, they are enabled by default")
ENDIF(HAS_GNU_CXX0X_FLAG)
ENDIF(HAS_GNU_CXX11_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_11_FLAG}")
ENDIF()
#doesn't work... using custom build
#IF(LINUX)
#FIND_PACKAGE(LIBCURL REQUIRED)
#ENDIF()
SET_CUSTOM_libcurl_PACKAGE()
IF(NOT USE_CUSTOM_WX)
FIND_PACKAGE(wxWidgets 3.0.2 COMPONENTS core base html gl net xml aui adv richtext xrc propgrid REQUIRED)
ELSE()
MESSAGE(STATUS "Using custom wxWidgets")
SET_CUSTOM_wxWidgets_PACKAGE()
ENDIF()
IF(NOT USE_CUSTOM_VTK)
FIND_PACKAGE(VTK 7.0.0)
IF (NOT VTK_FOUND)
FIND_PACKAGE(VTK 6.2.0 REQUIRED)
ENDIF()
ELSE()
MESSAGE(STATUS "Using custom VTK")
SET_CUSTOM_VTK_PACKAGE()
ENDIF()
IF(NOT USE_CUSTOM_ITK)
FIND_PACKAGE(ITK 4.8.0 REQUIRED COMPONENTS ITKCommon ITKGDCM ITKIOImageBase ITKIOVTK ITKVTK ITKIOGDCM)
ELSE()
MESSAGE(STATUS "Using custom ITK")
SET_CUSTOM_ITK_PACKAGE()
ENDIF()
IF(NOT USE_CUSTOM_DCMTK)
FIND_PACKAGE(DCMTK 3.6.4 REQUIRED)
ELSE()
MESSAGE(STATUS "Using custom DCMTK")
SET_CUSTOM_DCMTK_PACKAGE()
ENDIF()
SET(CMAKE_REQUIRED_INCLUDES ${DCMTK_INCLUDES})
SET(CMAKE_REQUIRED_LIBRARIES ${DCMTK_LIBRARIES})
CHECK_CXX_SOURCE_COMPILES(
"#include <dcmtk/dcmdata/dcitem.h>
#include <dcmtk/dcmdata/dcdeftag.h>
int main(int argc, char *args[])
{
DcmTagKey tag(DCM_StudyDate);
DcmElement *test = DcmItem::newDicomElement(tag);
return test == 0;
}
" DCMTK_newDicomElement_IS_STATIC_MEMBER_OF_DcmItem)
IF(DCMTK_newDicomElement_IS_STATIC_MEMBER_OF_DcmItem)
ADD_DEFINITIONS(-DDCMTK_POST_20170228)
ENDIF()
IF(NOT USE_SYSTEM_SQLITE)
MESSAGE(STATUS "Using builtin SQLite")
ELSE()
MESSAGE(STATUS "Using system SQLite")
#FIND_PACKAGE(sqlite REQUIRED)
ENDIF()
# require cairo includes
PKG_CHECK_MODULES(CAIRO REQUIRED cairo)
INCLUDE_DIRECTORIES(${CAIRO_INCLUDE_DIRS})
LINK_DIRECTORIES(${CAIRO_LIBRARY_DIRS})
IF(LINUX)
STRING(REGEX MATCH "gtk[23]" GTK_VERSION_SENTINEL "${wxWidgets_LIBRARIES}")
STRING(REGEX REPLACE "gtk([23])" "gtk+-\\1.0" GTK_PKG_CONFIG_PACKAGE "${GTK_VERSION_SENTINEL}")
PKG_CHECK_MODULES(GTK REQUIRED ${GTK_PKG_CONFIG_PACKAGE})
INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS})
LINK_DIRECTORIES(${GTK_LIBRARY_DIRS})
PKG_CHECK_MODULES(LIBCURL REQUIRED libcurl)
INCLUDE_DIRECTORIES(${LIBCURL_INCLUDE_DIRS})
LINK_DIRECTORIES(${LIBCURL_LIBRARY_DIRS})
ENDIF()
#############################################################################################
IF(MACOS)
SET(GINKGO_PROJECT "Ginkgo CADx" CACHE PARENT_SCOPE "")
ELSEIF(LINUX AND CUSTOM_PACKAGE)
SET(GINKGO_PROJECT "ginkgocadx-${ARCH}" CACHE PARENT_SCOPE "")
ELSE()
SET(GINKGO_PROJECT "ginkgocadx" CACHE PARENT_SCOPE "")
ENDIF()
SET(GINKGO_PLUGINS "" CACHE PARENT_SCOPE "")
ADD_SUBDIRECTORY(cadxcore)
ADD_SUBDIRECTORY(ginkgocadx)
IF(BUILD_VISUALIZATION_EXT)
ADD_SUBDIRECTORY(visualizator)
ENDIF()
ADD_CUSTOM_TARGET(${PROJECT_NAME} echo)
MESSAGE(STATUS "Building ${GINKGO_PROJECT} ${GINKGO_VERSION_STR}")
ADD_DEPENDENCIES(${PROJECT_NAME} "${GINKGO_PROJECT}")
IF(BUILD_VISUALIZATION_EXT)
ADD_DEPENDENCIES(${PROJECT_NAME} visualizator)
LIST(APPEND GINKGO_PLUGINS "visualizator")
ENDIF()
IF(CUSTOM_PACKAGE)
SET( DEST "${CMAKE_CURRENT_BINARY_DIR}/dist" )
PACKAGE_RULES( "${PROJECT_NAME}" "${ARCH}" "${DEST}" )
ENDIF()
MESSAGE(STATUS "Using CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")