1 # +----------------------------------------------------------------------+
3 # +----------------------------------------------------------------------+
4 # | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com) |
5 # | Copyright (c) 1997-2010 The PHP Group |
6 # +----------------------------------------------------------------------+
7 # | This source file is subject to version 3.01 of the PHP license, |
8 # | that is bundled with this package in the file LICENSE, and is |
9 # | available through the world-wide-web at the following url: |
10 # | http://www.php.net/license/3_01.txt |
11 # | If you did not receive a copy of the PHP license and are unable to |
12 # | obtain it through the world-wide-web, please send a note to |
13 # | license@php.net so we can mail you a copy immediately. |
14 # +----------------------------------------------------------------------+
17 # oniguruma/ is special: it is set up from HPHPFindLibs as it must be included
18 # *first* to take precedence over libc regexp functions
19 add_subdirectory(oniguruma)
21 ##### --- header --- #####
22 set(EXTRA_INCLUDE_PATHS)
23 set(THIRD_PARTY_MODULES)
24 set(THIRD_PARTY_HEADERS)
26 function(TP_INSTALL_HEADERS TARGET SRCDIR DEST)
27 file(GLOB_RECURSE files "${SRCDIR}/*.h")
29 CODE "INCLUDE(\"${HPHP_HOME}/CMake/HPHPFunctions.cmake\")
30 HHVM_INSTALL_HEADERS(${TARGET}
31 \"${CMAKE_CURRENT_BINARY_DIR}/${SRCDIR}\"
32 \"\${CMAKE_INSTALL_PREFIX}/include/hphp/third-party/${DEST}\"
38 ##### easy stuff #####
40 list(APPEND THIRD_PARTY_MODULES forks/libmbfl)
41 list(APPEND EXTRA_INCLUDE_PATHS
42 "${TP_DIR}/forks/libmbfl"
43 "${TP_DIR}/forks/libmbfl/mbfl"
44 "${TP_DIR}/forks/libmbfl/filters"
47 list(APPEND THIRD_PARTY_MODULES forks/timelib)
48 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/forks/timelib")
51 add_subdirectory(double-conversion)
52 add_subdirectory(boost)
54 add_subdirectory(jemalloc)
55 add_subdirectory(libsodium)
56 add_subdirectory(zstd)
58 add_subdirectory(folly)
60 # Fatal is a header-only library, so there's nothing to build.
61 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/fatal")
63 add_subdirectory(brotli) # Required by fizz
65 list(APPEND THIRD_PARTY_MODULES fizz)
66 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/fizz/src")
68 list(APPEND THIRD_PARTY_MODULES wangle)
69 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/wangle/src")
71 list(APPEND THIRD_PARTY_MODULES proxygen)
72 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/proxygen/src")
74 list(APPEND THIRD_PARTY_MODULES thrift)
75 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/thrift/src")
76 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/thrift/gen")
79 list(APPEND THIRD_PARTY_MODULES libafdt)
80 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/libafdt/src/src")
85 # fb-mysql must go after lz4 and zstd because it needs to know its <INSTALL_DIR>
86 add_subdirectory(fb-mysql)
89 message(STATUS "Building RE2 from third-party")
92 add_subdirectory(squangle)
95 # Ragel is only used at build time to generate some files for MCRouter.
96 list(APPEND THIRD_PARTY_MODULES forks/ragel)
98 list(APPEND THIRD_PARTY_MODULES mcrouter)
99 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/mcrouter/src")
100 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/mcrouter/gen")
103 # Add bundled fastlz if the system one will not be used
104 if(NOT FASTLZ_LIBRARY)
105 list(APPEND THIRD_PARTY_MODULES fastlz)
106 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/fastlz/src")
109 # Add bundled libsqlite3 if the system one will not be used
110 if(NOT LIBSQLITE3_LIBRARY)
111 list(APPEND THIRD_PARTY_MODULES forks/libsqlite3)
112 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/forks/libsqlite3")
115 # Add bundled PCRE if the system one will not be used
118 list(APPEND THIRD_PARTY_MODULES forks/pcre)
119 # Disable building a few parts of PCRE by default that we don't
121 set(PCRE_BUILD_PCRECPP OFF CACHE BOOL "Build the PCRE C++ library (pcrecpp).")
122 set(PCRE_BUILD_PCREGREP OFF CACHE BOOL "Build pcregrep")
123 set(PCRE_BUILD_TESTS OFF CACHE BOOL "Build the tests")
126 # Add bundled libzip if the system one will not be used
127 add_subdirectory(libzip)
129 list(APPEND THIRD_PARTY_MODULES opam)
131 # Add bundled XED library if XED is enabled and the specified XED library
132 # is either not found or incompatible.
133 if(ENABLE_XED AND NOT LibXed_FOUND)
134 list(APPEND THIRD_PARTY_MODULES xed)
135 list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/xed/xed/build/include/xed")
141 add_subdirectory("rustc")
143 ##### --- footer --- #####
145 foreach(MODULE ${THIRD_PARTY_MODULES})
146 add_subdirectory(${MODULE})
147 TP_INSTALL_HEADERS(${MODULE} ${MODULE} ${MODULE})
149 set(THIRD_PARTY_INCLUDE_PATHS ${EXTRA_INCLUDE_PATHS} CACHE INTERNAL "" FORCE)
152 target_include_directories(pcre PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/forks/pcre")
153 target_compile_definitions(pcre PUBLIC "PCRE_STATIC=1")
156 ##### --- new style, but only depends on old style --- #####
157 add_subdirectory(watchman)