This repository has been archived by the owner on Jun 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
112 lines (99 loc) · 3.26 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
cmake_minimum_required(VERSION 3.1.3)
project(sigil2)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
################################
# Testing Framework uses Catch #
################################
enable_testing(true)
include(CTest)
######################
# Include everything #
# TODO(cleanup) #
######################
get_filename_component(SRC_CORE src/Core ABSOLUTE)
get_filename_component(SRC_FRONTENDS src/Frontends ABSOLUTE)
get_filename_component(SRC_BACKENDS src/Backends ABSOLUTE)
get_filename_component(THIRD_PARTY third_party ABSOLUTE)
execute_process(
COMMAND git submodule update --init ${THIRD_PARTY}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# Apply patch, or check if already applied
execute_process(
COMMAND git apply --check ${CMAKE_SOURCE_DIR}/gitpatches/spdlog.patch
WORKING_DIRECTORY ${THIRD_PARTY}/spdlog
RESULT_VARIABLE PATCH_RESULT
OUTPUT_QUIET
ERROR_QUIET)
if (${PATCH_RESULT} EQUAL 0)
execute_process(
COMMAND git apply --whitespace=nowarn ${CMAKE_SOURCE_DIR}/gitpatches/spdlog.patch
WORKING_DIRECTORY ${THIRD_PARTY}/spdlog)
else()
execute_process(
COMMAND git apply --check -R ${CMAKE_SOURCE_DIR}/gitpatches/spdlog.patch
WORKING_DIRECTORY ${THIRD_PARTY}/spdlog
RESULT_VARIABLE PATCH_RESULT)
if (NOT ${PATCH_RESULT} EQUAL 0)
message(FATAL_ERROR "could not git patch spdlog library")
endif()
endif()
include_directories(${THIRD_PARTY}/Catch/include)
include_directories(${THIRD_PARTY}/whereami/src)
include_directories(${THIRD_PARTY}/spdlog/include)
include_directories(${THIRD_PARTY}/spdlog/include/spdlog)
include_directories(${THIRD_PARTY}/elfio-3.1)
include_directories(${THIRD_PARTY}/zlib/contrib/iostream3)
include_directories(${THIRD_PARTY}/capnproto/include)
include_directories(src)
include_directories(src/Utils)
include_directories(${SRC_FRONTENDS})
include_directories(${SRC_BACKENDS})
######################
# Optional Frontends #
######################
if(NOT DYNAMORIO_ENABLE)
set(DYNAMORIO_ENABLE FALSE CACHE BOOL
"Enable DynamoRIO frontend"
FORCE)
endif(NOT DYNAMORIO_ENABLE)
if(NOT PERF_ENABLE)
set(PERF_ENABLE FALSE CACHE BOOL
"Enable perf frontend"
FORCE)
endif(NOT PERF_ENABLE)
################
# Build Sigil2 #
################
set(SOURCES
${THIRD_PARTY}/whereami/src/whereami.c
${SRC_CORE}/Backends.cpp
${SRC_CORE}/Frontends.cpp
${SRC_CORE}/Parser.cpp
${SRC_CORE}/Config.cpp
${SRC_CORE}/main.cpp)
add_executable(sigil2 ${SOURCES})
target_link_libraries(sigil2 pthread rt)
set_target_properties(sigil2
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
###################
# Plugin Backends #
###################
add_subdirectory(${SRC_BACKENDS}/SynchroTraceGen)
add_dependencies(sigil2 STGen)
target_link_libraries(sigil2 ${STGEN_LIB} z)
add_subdirectory(${SRC_BACKENDS}/SimpleCount)
target_link_libraries(sigil2 SimpleCount)
add_subdirectory(${SRC_BACKENDS}/SigilClassic)
target_link_libraries(sigil2 SigilClassic)
##########################
# Interface to Frontends #
##########################
add_subdirectory(${SRC_FRONTENDS})
target_link_libraries(sigil2 frontends)