forked from Jokeren/gBolt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (50 loc) · 1.72 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
cmake_minimum_required (VERSION 2.6)
project (gbolt)
# The version number.
set(GBOLT_VERSION_MAJOR 1)
set(GBOLT_VERSION_MINOR 0)
option(GBOLT_PERFORMANCE "Performance Mode" ON)
option(GBOLT_SERIAL "Serial Mode" OFF)
if(GBOLT_PERFORMANCE)
add_definitions(-DGBOLT_PERFORMANCE)
endif(GBOLT_PERFORMANCE)
# Mode
set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -std=c++11 -Wall -Wextra -Wpedantic")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -std=c++11 -Wall -Wextra -Wpedantic")
# Packages
if(GBOLT_SERIAL)
add_definitions(-DGBOLT_SERIAL)
else()
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif(GBOLT_SERIAL)
# configure a header file to pass some of the CMake settings
# to the source code
configure_file(
"${PROJECT_SOURCE_DIR}/config.h.in"
"${PROJECT_SOURCE_DIR}/include/config.h"
)
# add the binary tree to the search path for include files
# so that we will find TutorialConfig.h
set(GBOLT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
set(CXXOPTS_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/extern/cxxopts/include")
INCLUDE_DIRECTORIES(${GBOLT_INCLUDE_DIR} ${CXXOPTS_INCLUDE_DIR})
set(GBOLT_SOURCE_DIR "${PROJECT_SOURCE_DIR}/src")
set(SOURCES
"${GBOLT_SOURCE_DIR}/history.cc"
"${GBOLT_SOURCE_DIR}/database.cc"
"${GBOLT_SOURCE_DIR}/output.cc"
"${GBOLT_SOURCE_DIR}/gbolt.cc"
"${GBOLT_SOURCE_DIR}/gbolt_count.cc"
"${GBOLT_SOURCE_DIR}/gbolt_execute.cc"
"${GBOLT_SOURCE_DIR}/gbolt_extend.cc"
"${GBOLT_SOURCE_DIR}/gbolt_mine.cc")
# add the executable
add_executable(gbolt ${SOURCES})
find_library(JEMALLOC NAMES jemalloc PATHS ${JEMALLOC_DIR} PATH_SUFFIXES lib NO_DEFAULT_PATH)
if (JEMALLOC)
TARGET_LINK_LIBRARIES(gbolt ${JEMALLOC})
endif()