-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
86 lines (70 loc) · 2.44 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
# Author: Foivos Zakkak
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
cmake_minimum_required(VERSION 3.13)
# project name
project(arax)
set (CMAKE_CXX_STANDARD 11)
# disable builds in source tree
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install prefix" FORCE)
endif()
# export compile commands in compile_commands.json, for use with IDEs and
# editors
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# include modules from cmake dir
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(cache_detect)
include(Options)
include(CTest)
include(Coverage)
# the default CFLAGS
set(CMAKE_C_FLAGS "-Wall -Werror -fPIC ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "-ggdb3 ${CMAKE_C_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "-O2 -finline-functions -Werror ${CMAKE_C_FLAGS_RELEASE}")
add_subdirectory(src/async)
add_subdirectory(src/arch)
add_subdirectory(src/core)
add_subdirectory(src/utils)
add_subdirectory(src/alloc)
add_subdirectory(araxgrind)
add_subdirectory(vdf)
add_subdirectory(arax_plot)
add_subdirectory(noop)
add_subdirectory(vtop)
add_subdirectory(controller)
add_subdirectory(tests)
# link all sublibs to this lib ($<TARGET_OBJECTS:name> is to link OBJECT
# libraries)
set(DEPS $<TARGET_OBJECTS:arch> $<TARGET_OBJECTS:async> $<TARGET_OBJECTS:core>
$<TARGET_OBJECTS:utils> $<TARGET_OBJECTS:shm_allocator>)
add_library(arax SHARED ${DEPS})
target_include_directories(arax PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/arax>
)
set_target_properties(arax PROPERTIES INTERFACE_LINK_LIBRARIES "-lrt ${CMAKE_THREAD_LIBS_INIT}")
add_library(arax_st STATIC ${DEPS})
target_include_directories(arax_st PUBLIC
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include/arax>
)
set_target_properties(arax_st PROPERTIES INTERFACE_LINK_LIBRARIES "-lrt ${CMAKE_THREAD_LIBS_INIT}")
# Print build path
add_custom_target(
AraxBuildPath ALL
${CMAKE_COMMAND} -E cmake_echo_color --cyan
"Arax build path: ${PROJECT_BINARY_DIR}"
COMMENT "AraxBuildPath")
add_dependencies(AraxBuildPath arax)
find_package(Precommit)
include(Java)
include(CopyHeaders)
include(Documentation)
include(Package)
include(Install)
include(hide_advanced_options)