Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
97 lines (84 loc) · 3.16 KB
/
Copy pathCMakeLists.txt
File metadata and controls
97 lines (84 loc) · 3.16 KB
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
# Copyright 2018 Oregon State University
# Copyright 2018 United Kingdom Research and Innovation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# Author(s): Edoardo Pasca (UKRI-STFC),
# Gemma Fardell (UKRI-STFC),
# Brian Bay (OSU)
if(APPLE)
cmake_minimum_required(VERSION 3.16...4.1)
else()
cmake_minimum_required(VERSION 3.1.3...4.1)
endif()
# get the current version and date
execute_process(COMMAND git describe
RESULT_VARIABLE worked
OUTPUT_VARIABLE dvc_version
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT worked EQUAL 0)
message(FATAL_ERROR "git describe returned ${worked}")
endif()
execute_process(COMMAND git show -s --format=%cd --date=short
RESULT_VARIABLE worked
OUTPUT_VARIABLE rev_date
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE)
if (NOT worked EQUAL 0)
message(FATAL_ERROR "git describe returned ${worked}")
endif()
project(cildvc LANGUAGES CXX)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_CXX_EXTENSIONS OFF)
set (CMAKE_BUILD_TYPE "Release")
option(BUILD_TEST "Build tests" ON)
option(ENABLE_COVERAGE "Enable code coverage" OFF)
set(COVERAGE_TYPE "AUTO" CACHE STRING "Coverage type: AUTO, SOURCE_BASED (Clang), or GCOV")
if (ENABLE_COVERAGE)
message(STATUS "Code coverage enabled")
if (COVERAGE_TYPE STREQUAL "GCOV" OR (COVERAGE_TYPE STREQUAL "AUTO" AND CMAKE_COMPILER_IS_GNUCXX))
message(STATUS "Using GCOV code coverage flags")
add_compile_options(--coverage -O0 -g)
add_link_options(--coverage)
else()
message(STATUS "Using Clang source-based code coverage flags")
add_compile_options(-fprofile-instr-generate -fcoverage-mapping -O0 -g)
add_link_options(-fprofile-instr-generate)
endif()
endif()
set(INSTALL_DIR "" CACHE PATH "Install Directory")
if (INSTALL_DIR)
set(INSTALL_BIN_DIR "${INSTALL_DIR}")
else()
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}")
endif()
message(STATUS "DVC will be installed in " ${INSTALL_BIN_DIR})
# downloads Eigen 3.4
include(ExternalProject)
ExternalProject_Add(eigen
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
GIT_TAG 3.4.1
# GIT_REPOSITORY https://github.com/vais-ral/Eigen3.git
# GIT_TAG master
SOURCE_DIR ${CMAKE_SOURCE_DIR}/Core/eigen
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
enable_testing()
add_subdirectory(Core)