forked from hhvm/hhvm-third-party
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
159 lines (132 loc) · 5.52 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#
# +----------------------------------------------------------------------+
# | HipHop for PHP |
# +----------------------------------------------------------------------+
# | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
# | Copyright (c) 1997-2010 The PHP Group |
# +----------------------------------------------------------------------+
# | This source file is subject to version 3.01 of the PHP license, |
# | that is bundled with this package in the file LICENSE, and is |
# | available through the world-wide-web at the following url: |
# | http://www.php.net/license/3_01.txt |
# | If you did not receive a copy of the PHP license and are unable to |
# | obtain it through the world-wide-web, please send a note to |
# | [email protected] so we can mail you a copy immediately. |
# +----------------------------------------------------------------------+
#
set(EXTRA_INCLUDE_PATHS)
set(THIRD_PARTY_MODULES)
set(THIRD_PARTY_HEADERS)
list(APPEND THIRD_PARTY_MODULES libmbfl)
list(APPEND EXTRA_INCLUDE_PATHS
"${TP_DIR}/libmbfl"
"${TP_DIR}/libmbfl/mbfl"
"${TP_DIR}/libmbfl/filters"
)
list(APPEND THIRD_PARTY_MODULES timelib)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/timelib")
list(APPEND THIRD_PARTY_MODULES folly)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/folly/src")
# Fatal is a header-only library, so there's nothing to build.
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/fatal")
list(APPEND THIRD_PARTY_MODULES wangle)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/wangle/src")
list(APPEND THIRD_PARTY_MODULES brotli)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/brotli/src")
if(ENABLE_FASTCGI)
list(APPEND THIRD_PARTY_MODULES proxygen)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/proxygen/src")
list(APPEND THIRD_PARTY_MODULES thrift)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/thrift/src")
list(APPEND THIRD_PARTY_MODULES zstd)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/zstd/src/lib")
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/zstd/src/lib/dictBuilder")
endif()
if (NOT MSVC)
list(APPEND THIRD_PARTY_MODULES libafdt)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/libafdt/src/src")
endif()
if(ENABLE_ASYNC_MYSQL)
find_package(RE2)
if(NOT RE2_LIBRARY)
message(STATUS "Building RE2 from third-party")
list(APPEND THIRD_PARTY_MODULES re2)
endif()
list(APPEND THIRD_PARTY_MODULES squangle)
list(APPEND THIRD_PARTY_MODULES webscalesqlclient)
endif()
if (ENABLE_MCROUTER)
# Ragel is only used at build time to generate some files for MCRouter.
list(APPEND THIRD_PARTY_MODULES ragel)
list(APPEND THIRD_PARTY_MODULES mcrouter)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/mcrouter/src")
endif()
# Add bundled fastlz if the system one will not be used
if(NOT FASTLZ_LIBRARY)
list(APPEND THIRD_PARTY_MODULES fastlz)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/fastlz/src")
endif()
# Add bundled libsqlite3 if the system one will not be used
if(NOT LIBSQLITE3_LIBRARY)
list(APPEND THIRD_PARTY_MODULES libsqlite3)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/libsqlite3")
endif()
# Add bundled lz4 if the system one will not be used
if(NOT LZ4_FOUND)
list(APPEND THIRD_PARTY_MODULES lz4)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/lz4/src/lib")
endif()
# Add bundled double-conversion if the system one will not be used
if(NOT DOUBLE_CONVERSION_FOUND)
list(APPEND THIRD_PARTY_MODULES double-conversion)
list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/double-conversion")
endif()
# Add bundled PCRE if the system one will not be used
find_package(PCRE)
if(NOT PCRE_LIBRARY)
list(APPEND THIRD_PARTY_MODULES pcre)
# Disable building a few parts of PCRE by default that we don't
# actually use.
set(PCRE_BUILD_PCRECPP OFF CACHE BOOL "Build the PCRE C++ library (pcrecpp).")
set(PCRE_BUILD_PCREGREP OFF CACHE BOOL "Build pcregrep")
set(PCRE_BUILD_TESTS OFF CACHE BOOL "Build the tests")
endif()
# Add bundled libzip if the system one will not be used
if(NOT LIBZIP_LIBRARY)
list(APPEND THIRD_PARTY_MODULES libzip)
list(APPEND EXTRA_INCLUDE_PATHS
"${CMAKE_CURRENT_BINARY_DIR}/libzip/src/lib"
"${TP_DIR}/libzip/src/lib"
)
endif()
list(APPEND THIRD_PARTY_MODULES ocaml)
function(TP_INSTALL_HEADERS TARGET SRCDIR DEST)
file(GLOB_RECURSE files "${SRCDIR}/*.h")
install(
CODE "INCLUDE(\"${HPHP_HOME}/CMake/HPHPFunctions.cmake\")
HHVM_INSTALL_HEADERS(${TARGET}
\"${CMAKE_CURRENT_SOURCE_DIR}/${SRCDIR}\"
\"\${CMAKE_INSTALL_PREFIX}/include/hphp/third-party/${DEST}\"
${files})"
COMPONENT dev)
endfunction()
foreach(MODULE ${THIRD_PARTY_MODULES})
add_subdirectory(${MODULE})
# Install headers here, rather than in the individual submodules, so that we
# can easily control the destination. Put them in include/hphp/third-party.
if(MODULE STREQUAL folly)
TP_INSTALL_HEADERS(folly folly/src/folly folly)
else()
TP_INSTALL_HEADERS(${MODULE} ${MODULE} ${MODULE})
endif()
endforeach()
if(NOT PCRE_LIBRARY)
target_include_directories(pcre PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/pcre")
target_compile_definitions(pcre PUBLIC "PCRE_STATIC=1")
endif()
set(THIRD_PARTY_INCLUDE_PATHS ${EXTRA_INCLUDE_PATHS} CACHE INTERNAL "" FORCE)
# boost checks
find_package(Boost 1.51.0 COMPONENTS context filesystem program_options regex system thread REQUIRED)
add_library(boost INTERFACE)
target_include_directories(boost INTERFACE ${Boost_INCLUDE_DIRS})
target_link_libraries(boost INTERFACE ${Boost_LIBRARIES})