-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
74 lines (61 loc) · 1.99 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
cmake_minimum_required(VERSION 3.14)
set(LIB_NAME event_batch)
project(${LIB_NAME} LANGUAGES CXX)
# C++ version
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(${LIB_NAME}_DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/doc)
set(${LIB_NAME}_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
set(${LIB_NAME}_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(${LIB_NAME}_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test)
# CXX flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -march=native -mtune=native")
# Default to Release
set(DEFAULT_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
# Options
option(${LIB_NAME}_BUILD_RUNTIME_BENCHMARK "Build runtime benchmark" OFF)
option(${LIB_NAME}_BUILD_TEST "Build tests" OFF)
option(${LIB_NAME}_BUILD_DOC "Build documentation" OFF)
# Dependencies
include(FetchContent)
set(FETCHCONTENT_QUIET OFF)
# pontella
FetchContent_Declare(
pontella
GIT_REPOSITORY https://github.com/neuromorphic-paris/pontella
GIT_TAG master
)
FetchContent_MakeAvailable(pontella)
# sepia
FetchContent_Declare(
sepia
GIT_REPOSITORY https://github.com/neuromorphic-paris/sepia
GIT_TAG master
)
FetchContent_MakeAvailable(sepia)
# tarsier
FetchContent_Declare(
tarsier
GIT_REPOSITORY https://github.com/neuromorphic-paris/tarsier
GIT_TAG master
)
FetchContent_MakeAvailable(tarsier)
# Source
add_subdirectory(${${LIB_NAME}_SOURCE_DIR})
# Tests
if(${LIB_NAME}_BUILD_TEST)
enable_testing()
add_subdirectory(${${LIB_NAME}_TEST_DIR})
endif()
# Documentation
if(${LIB_NAME}_BUILD_DOC)
add_subdirectory(${${LIB_NAME}_DOC_DIR})
endif()