1 cmake_minimum_required(VERSION 2.8)
2 cmake_policy(VERSION 2.8)
4 # set a default build type if it is undefined, then make sure it goes in the cache
5 if(NOT CMAKE_BUILD_TYPE)
6 set(CMAKE_BUILD_TYPE Release)
8 set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Build configuration type" FORCE)
9 set(build_type ${CMAKE_BUILD_TYPE})
11 #=========================================================
13 message(${in}=${${in}})
15 #=========================================================
17 project(SuperBuild_VV)
20 set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE)
21 set(CMAKE_C_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG" CACHE STRING "" FORCE)
22 set(CMAKE_C_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG" CACHE STRING "" FORCE)
23 set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG" CACHE STRING "" FORCE)
25 set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1" CACHE STRING "" FORCE)
26 set(CMAKE_CXX_FLAGS_MINSIZEREL "/MT /O1 /Ob1 /D NDEBUG" CACHE STRING "" FORCE)
27 set(CMAKE_CXX_FLAGS_RELEASE "/MT /O2 /Ob2 /D NDEBUG" CACHE STRING "" FORCE)
28 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /Zi /O2 /Ob1 /D NDEBUG" CACHE STRING "" FORCE)
31 include(ExternalProject)
33 set(base "${CMAKE_BINARY_DIR}")
34 set_property(DIRECTORY PROPERTY EP_BASE ${base})
35 set(source_prefix ${base}/Source)
36 set(build_prefix ${base}/Build)
37 set(install_prefix ${base}/Install)
39 find_package(Git REQUIRED)
42 #=========================================================
45 set(QtWinSpecFiles "${source_prefix}/qt/mkspecs/win32-msvc2003/qmake.conf;${source_prefix}/qt/mkspecs/win32-msvc2005/qmake.conf;${source_prefix}/qt/mkspecs/win32-msvc2008/qmake.conf;${source_prefix}/qt/mkspecs/win32-msvc2010/qmake.conf")
46 set(WINPATCH "sed -i \"s/\\-MD/-MT/g\" ${QtWinSpecFiles}")
52 SOURCE_DIR ${source_prefix}/qt
53 GIT_REPOSITORY git://code.qt.io/qt/qt.git
55 PATCH_COMMAND ${WINPATCH}
56 CONFIGURE_COMMAND ${source_prefix}/qt/configure -confirm-license
61 -prefix ${build_prefix}/QT
71 set(qmake_executable "${build_prefix}/QT/bin/qmake")
75 find_package(qt4 REQUIRED)
78 #=========================================================
80 #=========================================================
82 set(VTK_CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES}")
84 set(VTK_CMAKE_CXX_STANDARD_LIBRARIES "${VTK_CMAKE_CXX_STANDARD_LIBRARIES} Imm32.lib Winmm.lib Ws2_32.lib")
88 DEPENDS ${VTK_DEPEND_QT}
89 SOURCE_DIR ${source_prefix}/vtk
90 GIT_REPOSITORY git://vtk.org/VTK.git
94 -DQT_QMAKE_EXECUTABLE:FILEPATH=${qmake_executable}
95 -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
96 -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL}
97 -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
98 -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
99 -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
100 -DCMAKE_CXX_FLAGS_MINSIZEREL:STRING=${CMAKE_CXX_FLAGS_MINSIZEREL}
101 -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
102 -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
103 -DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
104 -DCMAKE_BUILD_TYPE:STRING=${build_type}
105 -DBUILD_SHARED_LIBS:BOOL=OFF
106 -DBUILD_EXAMPLES:BOOL=OFF
107 -DBUILD_TESTING:BOOL=OFF
109 -DVTK_USE_QVTK_QTOPENGL:BOOL=ON
110 -DCMAKE_CXX_STANDARD_LIBRARIES:STRING=${VTK_CMAKE_CXX_STANDARD_LIBRARIES}
112 set(VTK_DIR ${build_prefix}/VTK)
113 #=========================================================
115 #=========================================================
119 SOURCE_DIR ${source_prefix}/gdcm
120 GIT_REPOSITORY git://git.code.sf.net/p/gdcm/gdcm
124 -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
125 -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL}
126 -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
127 -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
128 -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
129 -DCMAKE_CXX_FLAGS_MINSIZEREL:STRING=${CMAKE_CXX_FLAGS_MINSIZEREL}
130 -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
131 -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
132 -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PREFIX}
133 -DCMAKE_BUILD_TYPE:STRING=${build_type}
135 set(GDCM_DIR ${build_prefix}/GDCM)
136 #=========================================================
138 #=========================================================
142 SOURCE_DIR ${source_prefix}/itk
143 GIT_REPOSITORY git://itk.org/ITK.git
147 -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
148 -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL}
149 -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
150 -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
151 -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
152 -DCMAKE_CXX_FLAGS_MINSIZEREL:STRING=${CMAKE_CXX_FLAGS_MINSIZEREL}
153 -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
154 -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
155 -DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
156 -DCMAKE_BUILD_TYPE:STRING=${build_type}
157 -DBUILD_SHARED_LIBS:BOOL=OFF
158 -DBUILD_EXAMPLES:BOOL=OFF
159 -DBUILD_TESTING:BOOL=OFF
161 set(ITK_DIR ${build_prefix}/ITK)
162 #=========================================================
164 #=========================================================
166 set(VV_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
168 set(VV_CMAKE_CXX_FLAGS "${VV_CMAKE_CXX_FLAGS} /bigobj")
171 set(VV_CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
172 if(CMAKE_COMPILER_IS_GNUCXX)
173 set(VV_CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
174 endif(CMAKE_COMPILER_IS_GNUCXX)
176 set(MAKE_COMMAND "make")
178 set(MAKE_COMMAND "nmake")
183 DEPENDS ${VTK_DEPEND_QT} VTK ITK GDCM
184 SOURCE_DIR ${source_prefix}/vv
185 GIT_REPOSITORY git://git.creatis.insa-lyon.fr/clitk
186 INSTALL_DIR ${install_prefix}
187 INSTALL_COMMAND make install
189 -DQT_QMAKE_EXECUTABLE:FILEPATH=${qmake_executable}
190 -DGDCM_DIR:PATH=${GDCM_DIR}
191 -DITK_DIR:PATH=${ITK_DIR}
192 -DVTK_DIR:PATH=${VTK_DIR}
193 -DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
194 -DCMAKE_C_FLAGS_MINSIZEREL:STRING=${CMAKE_C_FLAGS_MINSIZEREL}
195 -DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
196 -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
197 -DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
198 -DCMAKE_CXX_FLAGS_MINSIZEREL:STRING=${CMAKE_CXX_FLAGS_MINSIZEREL}
199 -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
200 -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
201 -DCMAKE_CXX_FLAGS:STRING=${VV_CMAKE_CXX_FLAGS}
202 -DCMAKE_EXE_LINKER_FLAGS:STRING=${VV_CMAKE_EXE_LINKER_FLAGS}
203 -DCMAKE_INSTALL_PREFIX:PATH=${install_prefix}/${proj}
204 -DCMAKE_BUILD_TYPE:STRING=${build_type}
205 -DBUILD_SHARED_LIBS:BOOL=OFF
206 -DBUILD_TESTING:BOOL=OFF
208 #=========================================================