-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
57 lines (46 loc) · 2.29 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
cmake_minimum_required(VERSION 3.13)
project(PARLAYHASH VERSION 1.0 DESCRIPTION "Lock-Free Locks" LANGUAGES CXX)
# Set a default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (Debug Release RelWithDebInfo MinSizeRel)" FORCE)
message(STATUS "No build type specified. Defaulted to RELEASE.")
message(STATUS "To specify a build type, add -DCMAKE_BUILD_TYPE=<DEBUG/RELEASE/RELWITHDEBINFO/MINSIZEREL>")
endif(NOT CMAKE_BUILD_TYPE)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -fno-omit-frame-pointer")
message(STATUS "--------------- General configuration -------------")
message(STATUS "CMake Generator: ${CMAKE_GENERATOR}")
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message(STATUS "CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
message(STATUS "CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS}")
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}" )
# set(CMAKE_CXX_CLANG_TIDY
# clang-tidy;
# -format-style='file';
# -header-filter=${CMAKE_CURRENT_SOURCE_DIR};
# )
# -------------------------------------------------------------------
# Library definition
set(PARLAYHASH_INCLUDE_DIR "${PARLAYHASH_SOURCE_DIR}/include")
#set(CMAKE_CXX_COMPILER "/usr/bin/g++-11")
#set(CMAKE_CXX_COMPILER "/usr/bin/clang++-16")
add_library(parlay INTERFACE)
target_include_directories(parlay INTERFACE ${PARLAYHASH_INCLUDE_DIR})
target_compile_features(parlay INTERFACE cxx_std_17)
target_compile_options(parlay INTERFACE -g)
# Find threading library
find_package(Threads REQUIRED)
target_link_libraries(parlay INTERFACE Threads::Threads)
# Link against jemalloc
find_library(JEMALLOC_LIB jemalloc)
if(NOT JEMALLOC_LIB)
message(FATAL_ERROR "Could not find jemalloc.")
else()
message("-- Found jemalloc: ${JEMALLOC_LIB}")
target_link_libraries(parlay INTERFACE optimized ${JEMALLOC_LIB})
endif()
add_subdirectory(benchmarks)
add_subdirectory(examples)