forked from facebook/redex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
102 lines (83 loc) · 2.23 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
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
cmake_minimum_required(VERSION 3.0.2)
project("Redex")
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH})
include(Commons)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
if(NOT BUILD_TYPE)
set(BUILD_TYPE Shared)
endif ()
if(BUILD_TYPE STREQUAL Static)
set(ENABLE_STATIC ON CACHE BOOL "" FORCE)
elseif (BUILD_TYPE STREQUAL Shared)
set(ENABLE_STATIC OFF CACHE BOOL "" FORCE)
endif ()
set_common_cxx_flags_for_redex()
add_dependent_packages_for_redex()
file(GLOB includes
"libredex"
"service/*"
"opt/*"
"util"
"liblocator"
"libresource"
"shared"
"sparta/include"
"tools/common"
)
include_directories(
${Boost_INCLUDE_DIRS}
${JSONCPP_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${includes})
file(GLOB_RECURSE redex_srcs
"libredex/*.cpp"
"libredex/*.h"
"service/*.cpp"
"service/*.h"
"opt/*.cpp"
"opt/*.h"
"util/CommandProfiling.cpp"
"util/CommandProfiling.h"
"util/JemallocUtil.cpp"
"util/JemallocUtil.h"
"util/Sha1.cpp"
"util/Sha1.h"
"shared/*.cpp"
"shared/*.h"
"liblocator/locator.cpp"
"liblocator/locator.h"
)
add_library(redex STATIC ${redex_srcs})
file(GLOB_RECURSE tool_srcs
"tools/tool/*.cpp"
"tools/tool/*.h"
)
add_library(tool STATIC ${tool_srcs})
file(GLOB_RECURSE resource_srcs
"libresource/*.cpp"
"libresource/*.h"
)
add_library(resource STATIC ${resource_srcs})
file(GLOB redex_all_srcs
"tools/redex-all/*.cpp"
"tools/redex-all/*.h"
"tools/common/*.cpp"
"tools/common/*.h"
)
add_executable(redex-all ${redex_all_srcs})
target_link_libraries(redex-all
${Boost_LIBRARIES}
${REDEX_JSONCPP_LIBRARY}
${REDEX_ZLIB_LIBRARY}
${CMAKE_DL_LIBS}
redex
resource
)
target_compile_definitions(redex-all PRIVATE)
set_link_whole(redex-all redex)