-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
99 lines (74 loc) · 3.15 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
cmake_minimum_required(VERSION 3.22.1)
project(brouhaha VERSION 0.1.0 LANGUAGES CXX)
# Set additional directories
set(DEPENDENCIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/dependencies)
set(BDWGC_INCLUDE_DIR ${DEPENDENCIES_DIR}/bdwgc/include)
set(GMP_INCLUDE_DIR ${DEPENDENCIES_DIR}/gmp/include)
set(VALGRIND_INCLUDE_DIR ${DEPENDENCIES_DIR}/valgrind/include)
set(HAMT_INCLUDE_DIR ${DEPENDENCIES_DIR}/hamt)
# Set additional library directories
set(BDWGC_LIBRARY_DIR ${DEPENDENCIES_DIR}/bdwgc/lib)
set(GMP_LIBRARY_DIR ${DEPENDENCIES_DIR}/gmp/lib)
set(VALGRIND_LIBRARY_DIR ${DEPENDENCIES_DIR}/valgrind/lib)
set(CMAKE_CXX_STANDARD 14) # requiring 14 as google test requires 14
# If the compiler does not support the specified standard, CMake will fail the configuration step.
set(CMAKE_CXX_STANDARD_REQUIRED True)
# used to control whether or not compiler-specific extensions are enabled when compiling the C++ code.
set(CMAKE_CXX_EXTENSIONS OFF)
# Add compiler flags for optimization and inlining
# set(CMAKE_CXX_FLAGS_RELEASE "-O3") # for release builds
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -finline-functions")
# set(CMAKE_CXX_FLAGS_DEBUG "-O2") # for debug builds
# set(CMAKE_CXX_FLAGS_DEBUG) # for debug builds
# for profiling
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pg")
# set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -pg")
# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)
# add_definitions(-DGC_DEBUG) #for gc debugging
include(FetchContent)
option(BUILD_GMOCK OFF)
option(INSTALL_GTEST OFF)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.13.0
)
FetchContent_MakeAvailable(googletest)
include(CTest)
enable_testing()
add_library(prelude prelude.hpp)
set_target_properties(prelude PROPERTIES LINKER_LANGUAGE CXX)
# add_compile_options(-Wall -Wextra -g) # for debugging
add_subdirectory(runtime-testing)
add_subdirectory(tests)
# Add executable
# add_executable(brouhaha tests2/easy/easy_cpp_program.cpp)
# # ../dependencies/valgrind/bin/valgrind --leak-check=full ./brouhaha
find_library(gmp_lib
NAMES gmp
PATHS ${GMP_LIBRARY_DIR}
REQUIRED)
find_library(gmpxx_lib
NAMES gmpxx
PATHS ${GMP_LIBRARY_DIR}
REQUIRED)
find_library(gc_lib
NAMES gc
PATHS ${BDWGC_LIBRARY_DIR}
REQUIRED)
find_library(gccpp_lib
NAMES gccpp
PATHS ${BDWGC_LIBRARY_DIR}
REQUIRED)
# target_include_directories(brouhaha PRIVATE ${DEPENDENCIES_DIR} ${BDWGC_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ${VALGRIND_INCLUDE_DIR} ${HAMT_INCLUDE_DIR})
target_include_directories(prelude PUBLIC ${DEPENDENCIES_DIR} ${BDWGC_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ${VALGRIND_INCLUDE_DIR} ${HAMT_INCLUDE_DIR})
# # Link libraries
# target_link_libraries(brouhaha PRIVATE ${gmpxx_lib} ${gmp_lib} ${gc_lib} ${gccpp_lib})
target_link_libraries(prelude PUBLIC ${gmpxx_lib} ${gmp_lib} ${gc_lib} ${gccpp_lib})
# # target_link_libraries(brouhaha PRIVATE gmpxx gmp gc gccpp)
# set(CPACK_PROJECT_NAME ${PROJECT_NAME})
# set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
# include(CPack)
# docker run --name=brouhaha_v4 --entrypoint=/slog/slog-server --rm --detach brouhaha_v4