forked from UCL/SuPReMo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
112 lines (97 loc) · 4.75 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
# ====================================================================================================
#
# SuPReMo: Surrogate Parameterised Respiratory Motion Model
# An implementation of the generalised motion modelling and image registration framework
#
# Copyright (c) University College London (UCL). All rights reserved.
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE.
#
# See LICENSE.txt in the top level directory for details.
#
# ====================================================================================================
######################################################################
# Set the minimum CMake version.
######################################################################
set(CMAKE_CXX_STANDARD 11)
cmake_minimum_required(VERSION 3.3)
##################################################################################
# Set some CMake Policies.
# See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details
##################################################################################
set(project_policies
CMP0057 # Support new ``if()`` IN_LIST operator.
CMP0063 # Honor visibility properties for all target types.
)
foreach(policy ${project_policies})
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
######################################################################
# Define the project
######################################################################
project(Supremo)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/CMake
${CMAKE_MODULE_PATH} )
######################################################################
# Define the build add_compile_options
######################################################################
OPTION(USE_OPENMP "To use openMP for multi-CPU processing" ON)
OPTION(BUILD_TESTING "To build the unit tests" OFF)
######################################################################
# Include core dependencies
######################################################################
# OpenMP include
if(USE_OPENMP)
find_package(OpenMP)
if(NOT OPENMP_FOUND)
set(USE_OPENMP OFF CACHE BOOL "To use openMP for multi-CPU processing" FORCE)
message(WARNING "OpenMP does not appear to be supported by your compiler, forcing USE_OPENMP to OFF")
else(NOT OPENMP_FOUND)
message(STATUS "Found OpenMP")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif(NOT OPENMP_FOUND)
endif(USE_OPENMP)
# find the nifti-reg installed libraries
find_package(NiftyReg REQUIRED)
if(NiftyReg_FOUND)
include_directories( ${NiftyReg_INCLUDE_DIR} )
message("Found NiftyReg")
else()
message("Didn't find NiftyReg")
endif()
include(GetGitRevisionDescription)
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
# Build the core libraries
add_subdirectory(motion-lib)
# Build the extentions if required
add_subdirectory(motion-ext)
# Build the executables
add_subdirectory(motion-apps)
# Build testing if required
if (BUILD_TESTING)
enable_testing()
add_subdirectory(motion-test)
endif (BUILD_TESTING)
# Allow generating a Windows installer if required
if(MSVC)
set(CPACK_GENERATOR NSIS)
set(CPACK_PACKAGE_NAME "SuPReMo")
set(CPACK_PACKAGE_VENDOR "Radiotherapy Image Computing Group")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "SuPReMo - Surrogate Parametrised Respiratory Motion Modelling")
set(CPACK_PACKAGE_VERSION "0.1.2")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "1")
set(CPACK_PACKAGE_VERSION_PATCH "2")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "SuPReMo")
set(CPACK_NSIS_MODIFY_PATH ON)
set(CPACK_NSIS_URL_INFO_ABOUT https://github.com/UCL/SuPReMo)
set(CPACK_PACKAGE_HOMEPAGE_URL https://github.com/UCL/SuPReMo)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt)
INCLUDE(CPack)
endif(MSVC)