Convert extern.c using C2Rust
[hiphop-php.git] / third-party / CMakeLists.txt
blob2d327f3b99af156dedfb6899c45989272bbfd52f
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)
25 include(GNUInstallDirs)
27 function(TP_INSTALL_HEADERS TARGET SRCDIR DEST)
28   file(GLOB_RECURSE files "${SRCDIR}/*.h")
29   install(
30     CODE "INCLUDE(\"${HPHP_HOME}/CMake/HPHPFunctions.cmake\")
31       HHVM_INSTALL_HEADERS(${TARGET}
32         \"${CMAKE_CURRENT_BINARY_DIR}/${SRCDIR}\"
33       \"\${CMAKE_INSTALL_FULL_INCLUDEDIR}/hphp/third-party/${DEST}\"
34       ${files})"
35     COMPONENT dev)
36 endfunction()
39 ##### easy stuff #####
41 list(APPEND THIRD_PARTY_MODULES forks/libmbfl)
42 list(APPEND EXTRA_INCLUDE_PATHS
43   "${TP_DIR}/forks/libmbfl"
44   "${TP_DIR}/forks/libmbfl/mbfl"
45   "${TP_DIR}/forks/libmbfl/filters"
48 list(APPEND THIRD_PARTY_MODULES 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
64 add_subdirectory(fizz)
65 add_subdirectory(wangle)
66 add_subdirectory(proxygen)
67 add_subdirectory(thrift)
69 if (NOT MSVC)
70   list(APPEND THIRD_PARTY_MODULES libafdt)
71   list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/libafdt/src/src")
72 endif()
74 add_subdirectory(lz4)
76 # fb-mysql must go after lz4 and zstd because it needs to know its <INSTALL_DIR>
77 add_subdirectory(re2)
78 add_subdirectory(fb-mysql)
79 add_subdirectory(squangle)
81 if (ENABLE_MCROUTER)
82   # Build dependency of mcrouter
83   add_subdirectory(forks/ragel)
85   add_subdirectory(mcrouter)
86 endif()
88 # Add bundled fastlz if the system one will not be used
89 if(NOT FASTLZ_LIBRARY)
90   list(APPEND THIRD_PARTY_MODULES fastlz)
91   list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/fastlz/src")
92 endif()
94 # Add bundled PCRE if the system one will not be used
95 find_package(PCRE)
96 if(NOT PCRE_LIBRARY)
97   list(APPEND THIRD_PARTY_MODULES forks/pcre)
98   # Disable building a few parts of PCRE by default that we don't
99   # actually use.
100   set(PCRE_BUILD_PCRECPP OFF CACHE BOOL "Build the PCRE C++ library (pcrecpp).")
101   set(PCRE_BUILD_PCREGREP OFF CACHE BOOL "Build pcregrep")
102   set(PCRE_BUILD_TESTS OFF CACHE BOOL "Build the tests")
103 endif()
105 # Add bundled libzip if the system one will not be used
106 add_subdirectory(libzip)
108 list(APPEND THIRD_PARTY_MODULES opam)
110 # Add bundled XED library if XED is enabled and the specified XED library
111 # is either not found or incompatible.
112 if(ENABLE_XED AND NOT LibXed_FOUND)
113   list(APPEND THIRD_PARTY_MODULES xed)
114   list(APPEND EXTRA_INCLUDE_PATHS "${TP_DIR}/xed/xed/build/include/xed")
115 endif()
118 ##### rustc #####
120 add_subdirectory("rustc")
122 ##### --- footer --- #####
124 foreach(MODULE ${THIRD_PARTY_MODULES})
125   add_subdirectory(${MODULE})
126   TP_INSTALL_HEADERS(${MODULE} ${MODULE} ${MODULE})
127 endforeach()
128 set(THIRD_PARTY_INCLUDE_PATHS ${EXTRA_INCLUDE_PATHS} CACHE INTERNAL "" FORCE)
130 if(NOT PCRE_LIBRARY)
131   target_include_directories(pcre PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/forks/pcre")
132   target_compile_definitions(pcre PUBLIC "PCRE_STATIC=1")
133 endif()
135 ##### --- new style, but only depends on old style --- #####
136 add_subdirectory(watchman)