forked from JetBrains-Research/boost.simd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
129 lines (110 loc) · 4.37 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
## -------------------------------------------------------------------------------------------------
## Copyright 2016 NumScale SAS
##
## Distributed under the Boost Software License, Version 1.0.
## See accompanying file LICENSE.txt or copy at
## http://www.boost.org/LICENSE_1_0.txt
## -------------------------------------------------------------------------------------------------
cmake_minimum_required(VERSION 2.8.7)
## Setup project
## -------------------------------------------------------------------------------------------------
project(Boost.SIMD)
set(PROJECT_VERSION 4.16.12.0) # TODO: Find a way to update this automatically
set(PROJECT_DOC_DIR ${PROJECT_SOURCE_DIR}/doc)
## Requirements for ns.cmake:
## -------------------------------------------------------------------------------------------------
set(NS_CMAKE_GIT_TAG master)
include(cmake/ns.cmake.install.cmake)
if (NOT NS_CMAKE_INSTALLED)
return()
endif()
include(cmake/ns/ns.cmake)
## -------------------------------------------------------------------------------------------------
## Potential warnings fixup
## -------------------------------------------------------------------------------------------------
NS_ignore(${DEV})
NS_ignore(${IS_TRAVIS_CI})
NS_ignore(${USE_SELF_BOOST})
## Search for packages
## -------------------------------------------------------------------------------------------------
if (DEFINED IS_TRAVIS_CI)
# We do not want to find boost here, as we're gonna use the one on NumScale/boost-header-only
set(GIT_EXECUTABLE git)
set(USE_SELF_BOOST TRUE)
set(DEV TRUE)
else()
NS_find_package(Git QUIET)
if (NOT DEFINED USE_SELF_BOOST)
NS_find_package(Boost 1.60 REQUIRED)
endif()
endif()
##
NS_prevent_in_source_build()
## External projects
## -------------------------------------------------------------------------------------------------
set(STF_STANDALONE_DESTINATION ${PROJECT_SOURCE_DIR}/test)
set(NS_CMAKE_PROJECT_OPTIONS
CMAKE_ARGS "-DBOOST_ROOT=${BOOST_HEADER_ONLY_DESTINATION}/include"
)
if (DEFINED USE_SELF_BOOST)
set(BOOST_HEADER_ONLY_GIT_TAG develop)
NS_project_include(boost-header-only)
set(Boost_INCLUDE_DIRS ${BOOST_HEADER_ONLY_DESTINATION}/include)
endif()
# Use the same BOOST_ROOT for every projects
set(NS_CMAKE_PROJECT_OPTIONS
CMAKE_ARGS "-DBOOST_ROOT=${Boost_INCLUDE_DIRS}"
)
if (DEFINED DEV)
NS_project_include(stf.standalone)
endif()
## Extension point for CMake
## -------------------------------------------------------------------------------------------------
include(${PROJECT_SOURCE_DIR}/cmake/extend.cmake)
## Compute version string and mode + Documentation
## -------------------------------------------------------------------------------------------------
if (DEFINED DEV AND NOT DEFINED IS_TRAVIS_CI)
add_subdirectory(${PROJECT_SOURCE_DIR}/doc)
endif()
## Install target
## -------------------------------------------------------------------------------------------------
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include DESTINATION .)
if (DEFINED USE_SELF_BOOST)
install(DIRECTORY ${NS_CMAKE_EXTERNAL_PROJECTS_DESTINATION}/include DESTINATION .)
endif()
## Add include directories
## -------------------------------------------------------------------------------------------------
include_directories(
${PROJECT_SOURCE_DIR}/include
${PROJECT_SOURCE_DIR}/test
${PROJECT_SOURCE_DIR}/bench
${PROJECT_SOURCE_DIR}/exhaustive
${Boost_INCLUDE_DIRS}
)
## Setup Unit/Bench & Coverage Test
## -------------------------------------------------------------------------------------------------
if (DEFINED DEV)
include(${PROJECT_SOURCE_DIR}/setup.cmake) # Import compiler specific setup
include(CTest)
add_custom_target(tests)
add_custom_target(unit)
add_dependencies(tests unit)
add_subdirectory(test)
add_custom_target(bench)
add_subdirectory(bench)
add_custom_target(exhaustive)
add_subdirectory(exhaustive)
if (NOT DEFINED IS_TRAVIS_CI)
NS_include(coverage)
enable_coverage(boost.simd)
endif()
else()
add_custom_target(tests
COMMENT "Target tests requires 'cmake -DDEV=1 ..'")
add_custom_target(unit
COMMENT "Target unit requires 'cmake -DDEV=1 ..'")
add_custom_target(bench
COMMENT "Target bench requires 'cmake -DDEV=1 ..'")
add_custom_target(exhaustive
COMMENT "Target exhaustive requires 'cmake -DDEV=1 ..'")
endif()