Replace use of Cls.extends by Cls.has_ancestor
[hiphop-php.git] / third-party / CMakeLists.txt
blobd7253db0aca80d90490bff153d6bdbdc1fedfd98
1 #   +----------------------------------------------------------------------+
2 #   | HipHop for PHP                                                       |
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")
28   install(
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}\"
33       ${files})"
34     COMPONENT dev)
35 endfunction()
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")
50 # Required by folly
51 add_subdirectory(double-conversion)
52 add_subdirectory(boost)
53 add_subdirectory(fmt)
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")
78 if (NOT MSVC)
79   list(APPEND THIRD_PARTY_MODULES libafdt)
80   list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/libafdt/src/src")
81 endif()
83 add_subdirectory(lz4)
85 # fb-mysql must go after lz4 and zstd because it needs to know its <INSTALL_DIR>
86 add_subdirectory(fb-mysql)
87 find_package(RE2)
88 if(NOT RE2_LIBRARY)
89   message(STATUS "Building RE2 from third-party")
90   add_subdirectory(re2)
91 endif()
92 add_subdirectory(squangle)
94 if (ENABLE_MCROUTER)
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")
101 endif()
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")
107 endif()
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")
113 endif()
115 # Add bundled PCRE if the system one will not be used
116 find_package(PCRE)
117 if(NOT PCRE_LIBRARY)
118   list(APPEND THIRD_PARTY_MODULES forks/pcre)
119   # Disable building a few parts of PCRE by default that we don't
120   # actually use.
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")
124 endif()
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")
136 endif()
139 ##### rustc #####
141 add_subdirectory("rustc")
143 ##### --- footer --- #####
145 foreach(MODULE ${THIRD_PARTY_MODULES})
146   add_subdirectory(${MODULE})
147   TP_INSTALL_HEADERS(${MODULE} ${MODULE} ${MODULE})
148 endforeach()
149 set(THIRD_PARTY_INCLUDE_PATHS ${EXTRA_INCLUDE_PATHS} CACHE INTERNAL "" FORCE)
151 if(NOT PCRE_LIBRARY)
152   target_include_directories(pcre PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/forks/pcre")
153   target_compile_definitions(pcre PUBLIC "PCRE_STATIC=1")
154 endif()
156 ##### --- new style, but only depends on old style --- #####
157 add_subdirectory(watchman)