-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
120 lines (89 loc) · 4.46 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
project(cracenExample)
cmake_minimum_required(VERSION 3.0.1)
# helper for libs and packages
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/lib/x86_64-linux-gnu/" "$ENV{CUDA_ROOT}" "$ENV{BOOST_ROOT}")
message(STATUS "CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}")
###############################################################################
# Compiler Flags
###############################################################################
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
# Supress boost hana warning
#set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-cpp")
###############################################################################
# Cracen
###############################################################################
find_package(cracen REQUIRED)
set(LIBS ${LIBS} ${cracen_LIBARIES})
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${cracen_INCLUDE_DIRS})
###############################################################################
# Find Boost
###############################################################################
find_package(Boost 1.60.0 COMPONENTS unit_test_framework REQUIRED)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Boost_LIBRARIES})
ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK)
enable_testing()
###############################################################################
# Executables
###############################################################################
include_directories(${INCLUDE_DIRS})
file(GLOB_RECURSE SRCFILES
"src/*"
)
file(GLOB_RECURSE REMOVE_SOURCES "src/Example/*")
file(GLOB_RECURSE REMOVE_TESTS "src/Test/*")
LIST(REMOVE_ITEM SRCFILES ${REMOVE_SOURCES})
LIST(REMOVE_ITEM SRCFILES ${REMOVE_TESTS})
LIST(REMOVE_DUPLICATES SRCFILES)
message(STATUS "CXX_FLAGS:" ${CMAKE_CXX_FLAGS})
message(STATUS "SRCFILES:" ${SRCFILES})
#add_library(Cracen STATIC "${SRCFILES}")
#target_link_libraries(Cracen ${LIBS})
#set(LIBS "Cracen" ${LIBS})
add_executable(CracenSource "${SRCFILES};${CMAKE_CURRENT_SOURCE_DIR}/src/Example/CracenSource.cpp;${graybat_GENERATED_FILES}")
target_link_libraries(CracenSource ${LIBS})
add_executable(CracenSink "${SRCFILES};${CMAKE_CURRENT_SOURCE_DIR}/src/Example/CracenSink.cpp;${graybat_GENERATED_FILES}")
target_link_libraries(CracenSink ${LIBS})
add_executable(Benchmark "${SRCFILES};${CMAKE_CURRENT_SOURCE_DIR}/src/Example/Benchmark.cpp;${graybat_GENERATED_FILES}")
target_link_libraries(Benchmark ${LIBS})
add_executable(Bench_Res "${SRCFILES};${CMAKE_CURRENT_SOURCE_DIR}/src/Example/Bench_Res.cpp;${graybat_GENERATED_FILES}")
target_link_libraries(Bench_Res ${LIBS})
# Test cases
file(GLOB TESTS Tests/*.cpp)
add_executable(unittest "${SRCFILES};${REMOVE_TESTS};${graybat_GENERATED_FILES}")
target_link_libraries(unittest ${LIBS})
add_test(ALL unittest)
#
#add_executable(CApi "${SRCFILES};${CMAKE_CURRENT_SOURCE_DIR}/src/Example/CApi.cpp")
#target_link_libraries(CApi ${LIBS})
#add_executable(BufferAdapterTest EXCLUDE_FROM_ALL "${SRCFILES};${CMAKE_CURRENT_SOURCE_DIR}/src/Example/BufferAdapterTest.cpp")
#target_link_libraries(BufferAdapterTest ${LIBS})
#add_executable(Chain "${SRCFILES};${CMAKE_CURRENT_SOURCE_DIR}/src/Example/example/Chain.cpp")
#target_link_libraries(Chain ${LIBS})
###############################################################################
# Documentation
###############################################################################
# add a target to generate API documentation with Doxygen
find_package(Doxygen)
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND})
if(BUILD_DOCUMENTATION)
if(NOT DOXYGEN_FOUND)
message(FATAL_ERROR "Doxygen is needed to build the documentation.")
endif()
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxygen.conf)
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
add_custom_target(doc
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
# install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/html DESTINATION share/doc)
endif()