CMakeLists.txt 4.14 KB
Newer Older
Philipp Götze's avatar
Philipp Götze committed
1
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
Philipp Götze's avatar
Philipp Götze committed
2
3
4
5
6
7
8
project (nvm-DS)

################################################################################
# customization section                                                        #
################################################################################

# Set the mount path of your pmem device where the structures should be stored
9
10
11
if(NOT PMEM_MNT_PATH)
  set(PMEM_MNT_PATH "/mnt/pmem0/test")
endif()
Philipp Götze's avatar
Philipp Götze committed
12

13
14
15
16
17
# Installation path (creates include and lib within this directory)
if(NOT PROJECT_INSTALL_DIR)
  set(PROJECT_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
endif()

18
19
option(ENABLE_LOG         "enables log output for e.g. debugging"        OFF)
option(BUILD_TEST_CASES   "build tests for functionality of structures"  ON )
20
option(BUILD_GOOGLE_BENCH "build google benchmark"                       OFF)
21
option(BUILD_BENCHMARKS   "build benchmarks for structures"              ON )
Philipp Götze's avatar
Philipp Götze committed
22
23
24
25
26
27

################################################################################
# End of customization section                                                 #
################################################################################

if(ENABLE_LOG)
28
  add_definitions("-DENABLE_LOG")
Philipp Götze's avatar
Philipp Götze committed
29
30
31
32
33
34
35
36
endif()

# Benchmark test requires benchmark library
if (BUILD_BENCHMARKS)
  set(BUILD_GOOGLE_BENCH ON)
endif()

# C++ compiler flags
37
38
39
40
41
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS_DEBUG -g)
set(CMAKE_CXX_FLAGS_RELEASE -O3)
if(NOT CMAKE_BUILD_TYPE)
42
43
  message(STATUS "Setting build type to 'Release' as none was specified.")
  set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
Philipp Götze's avatar
Philipp Götze committed
44
endif()
45
if(CMAKE_BUILD_TYPE MATCHES Release)
46
47
48
  # this disables asserts for release builds
  add_definitions("-DNDEBUG")
endif()
Philipp Götze's avatar
Philipp Götze committed
49
50
51
52
53

# show used compiler
message("Using Compiler: ${CMAKE_CXX_COMPILER_ID}.")

# Add our CMake directory to CMake's module path
54
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
Philipp Götze's avatar
Philipp Götze committed
55

Philipp Götze's avatar
Philipp Götze committed
56
57
# We fetch some 3rdparty modules from github.com before building the project.
include(Fetch3rdParty)
Philipp Götze's avatar
Philipp Götze committed
58

Philipp Götze's avatar
Philipp Götze committed
59
60
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
Philipp Götze's avatar
Philipp Götze committed
61
62
63
64
65

#################################
# Pre-built common dependencies #
#################################
#
66
67
68
69
configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/generated/config.h
)
Philipp Götze's avatar
Philipp Götze committed
70

71
include_directories(${PROJECT_SOURCE_DIR}/src
72
                    ${THIRD_PARTY_DIR}
Philipp Götze's avatar
Philipp Götze committed
73
74
75
76
77
78
79
80
                    ${CMAKE_CURRENT_BINARY_DIR}/generated
)
add_library(nvmDS_deps STATIC ${PMDK_INCLUDE_DIRS})
target_link_libraries(nvmDS_deps
    Threads::Threads
    stdc++fs
    ${PMDK_LIBRARIES} ndctl daxctl
)
81
set_target_properties(nvmDS_deps PROPERTIES LINKER_LANGUAGE CXX)
Philipp Götze's avatar
Philipp Götze committed
82

83
84
85
86
87
#################
# Install Paths #
#################
#
#set(PROJECT_LIBS ${PROJECT_LIBS})
88
set(PROJECT_INCLUDES_D ${PROJECT_INCLUDES_D}
Philipp Götze's avatar
Philipp Götze committed
89
  ${CMAKE_CURRENT_SOURCE_DIR}/utils)
90
set(PROJECT_INCLUDES_F ${PROJECT_INCLUDES_F}
Philipp Götze's avatar
Philipp Götze committed
91
  ${CMAKE_CURRENT_BINARY_DIR}/generated/config.h)
92
93
94
95

set(PROJECT_LIB_DIR ${PROJECT_INSTALL_DIR}/lib)
set(PROJECT_INCLUDE_DIR ${PROJECT_INSTALL_DIR}/include)

Philipp Götze's avatar
Philipp Götze committed
96
97
98
99
#############################
# Including Data Structures #
#############################
#
100
101
102
103
add_subdirectory(src/pbptrees) # Persistent versions of B⁺-Tree, contains also:
                               # - Remake of the FPTree
                               # - Remake of the wB+Tree
add_subdirectory(src/ptable)  # BDCC-based analytical table structure
Philipp Götze's avatar
Philipp Götze committed
104

105
add_subdirectory(src/pskiplists) 
Philipp Götze's avatar
Philipp Götze committed
106
107
108
109
#########################
# Unit test using Catch #
#########################
#
Philipp Götze's avatar
Philipp Götze committed
110
111
112
113
if(BUILD_TEST_CASES)
  enable_testing()
  add_subdirectory(test)
endif()
Philipp Götze's avatar
Philipp Götze committed
114
115

#############################################
116
# Micro-benchmarking using Google Benchmark #
Philipp Götze's avatar
Philipp Götze committed
117
118
#############################################
#
Philipp Götze's avatar
Philipp Götze committed
119
120
121
if(BUILD_BENCHMARKS)
  add_subdirectory(bench)
endif()
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

###################
# Install Process #
###################
#
#foreach(LIB ${PROJECT_LIBS})
#  install(TARGETS ${LIB} DESTINATION ${PROJECT_LIB_DIR})
#endforeach(LIB)

install(DIRECTORY ${PROJECT_INCLUDES_D}
  DESTINATION ${PROJECT_INCLUDE_DIR}
  FILES_MATCHING
  PATTERN "*.hpp"
  PATTERN "*.h"
)

install(FILES ${PROJECT_INCLUDES_F} DESTINATION ${PROJECT_INCLUDE_DIR})