-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
104 lines (85 loc) · 3.56 KB
/
CMakeLists.txt
File metadata and controls
104 lines (85 loc) · 3.56 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
98
99
100
101
102
103
104
#
# (c) Copyright 2016 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
cmake_minimum_required(VERSION 3.8.2)
project(alps VERSION 0.1.0)
include(FeatureSummary)
include(cmake/internal_utils.cmake)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# compiler flags for different build types
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -O0 -g")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O3")
if( NOT CMAKE_BUILD_TYPE )
set(CMAKE_BUILD_TYPE Debug)
endif()
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)
message(STATUS "Configuring build type: ${CMAKE_BUILD_TYPE}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}}")
# configuration based on target architecture
if( NOT TARGET_ARCH_MEM )
set(TARGET_ARCH_MEM "CC-NUMA" CACHE STRING "" FORCE)
message(STATUS "WARNING: Undefined target memory architecture.")
message(STATUS "WARNING: You can define target memory architecture through command line option: -DTARGET_ARCH_MEM=target_arch_mem")
message(STATUS "WARNING: Defaulting to: " ${TARGET_ARCH_MEM})
endif()
set_arch_conf(${TARGET_ARCH_MEM} ARCH_LIBS ARCH_DEFS)
# check for dependencies
find_package(Boost 1.65.0 REQUIRED COMPONENTS serialization log system program_options filesystem thread)
find_package(Numa REQUIRED)
find_package(XATTR REQUIRED)
find_package(yaml-cpp 0.5.2 REQUIRED)
find_package(gflags 2.1.2 REQUIRED)
# TODO: We need to upgrade gtest to the newer system-wide version.
# but, there are some incompatibility with embeded gtest.
#find_package(GTest REQUIRED)
# check for target architecture dependencies
if(${TARGET_ARCH_MEM} MATCHES "NV-NCC-FAM")
find_package(FamAtomic REQUIRED)
endif()
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# third-party libraries
set(GTEST_ROOT ${PROJECT_SOURCE_DIR}/third-party/gtest)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
add_subdirectory(third-party/gtest)
include_directories(${PROJECT_SOURCE_DIR}/third-party/gtest/include)
# We cannot use find_package(libbacktrace)
# so that boost stacktrace might be a better alternative.
add_subdirectory(third-party/libbacktrace)
include_directories(${PROJECT_SOURCE_DIR}/third-party/libbacktrace)
# library source
add_subdirectory(src)
# examples source
add_subdirectory(examples)
# testing
enable_testing()
add_subdirectory(test)
###############################################################################
#
# Install headers/libraries
#
###############################################################################
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_GENERATOR "TGZ;DEB;RPM")
set(CPACK_PACKAGE_NAME "alps")
set(CPACK_PACKAGE_RELEASE 1)
set(CPACK_PACKAGE_CONTACT "Haris Volos -- haris.volos@hpe.com")
set(CPACK_PACKAGE_VENDOR "Hewlett Packard Enterprise")
set(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_COMPONENTS_ALL unspecified tests)
include(CPack)
feature_summary(FATAL_ON_MISSING_REQUIRED_PACKAGES WHAT ALL)