renaming Ast_defs `class_kind` into `classish_kind`
[hiphop-php.git] / hphp / CMakeLists.txt
blobe28f27f5c3a9f0bcfc2c5b4ac1856d725ec97037
2 #   +----------------------------------------------------------------------+
3 #   | HipHop for PHP                                                       |
4 #   +----------------------------------------------------------------------+
5 #   | Copyright (c) 2010 Facebook, Inc. (http://www.facebook.com)          |
6 #   | Copyright (c) 1997-2010 The PHP Group                                |
7 #   +----------------------------------------------------------------------+
8 #   | This source file is subject to version 3.01 of the PHP license,      |
9 #   | that is bundled with this package in the file LICENSE, and is        |
10 #   | available through the world-wide-web at the following url:           |
11 #   | http://www.php.net/license/3_01.txt                                  |
12 #   | If you did not receive a copy of the PHP license and are unable to   |
13 #   | obtain it through the world-wide-web, please send a note to          |
14 #   | license@php.net so we can mail you a copy immediately.               |
15 #   +----------------------------------------------------------------------+
18 add_definitions("-DHHVM")
20 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/facebook")
21   # I'm sorry, but facebook's internal repo has the top level dir stored inside
22   # of hphp/, so we need to pull that one in first if it exists
23   CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7 FATAL_ERROR)
24   get_filename_component(HPHP_HOME "${CMAKE_CURRENT_SOURCE_DIR}/.." ABSOLUTE)
25   set(ENABLE_EXTENSION_PGSQL OFF CACHE INTERNAL "" FORCE)
26   set(TP_DIR "${HPHP_HOME}/hphp/public_tld/third-party/")
27   set(TP_BUILD_DIR "${TP_DIR}")
28   set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/facebook/CMake"
29                         "${CMAKE_CURRENT_SOURCE_DIR}/public_tld/CMake"
30                         ${CMAKE_MODULE_PATH})
31   include(HPHPCompiler)
32 endif()
34 include(HHVMProject)
36 include(HHVMExtensionConfig)
37 add_custom_target(generated_systemlib)
38 # Before we do anything else, we'll configure the extensions,
39 # so that the defines take effect globally.
40 file(GLOB subdirs ${CMAKE_CURRENT_SOURCE_DIR}/runtime/ext/*)
41 foreach (dir ${subdirs})
42   if (IS_DIRECTORY ${dir})
43     if (EXISTS "${dir}/config.cmake")
44       set(HRE_CURRENT_EXT_PATH "${dir}")
45       include("${dir}/config.cmake")
46     endif()
47   endif()
48 endforeach()
49 HHVM_EXTENSION_RESOLVE_DEPENDENCIES()
51 if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/facebook")
52   include(FBTLD)
53 endif()
55 include(HPHPSetup)
56 include(HPHPFindLibs)
57 include(HHVMGenerateConfig)
58 HHVM_GENERATE_CONFIG("${CMAKE_CURRENT_BINARY_DIR}/util/hphp-config.h")
60 if (ENABLE_COTIRE)
61   include(cotire)
62   FIND_PATH(LIBC_INCLUDE_PATH stdlib.h)
64   # Detect the architecture-specific include directory
65   IF("${CMAKE_LIBRARY_ARCHITECTURE}" STREQUAL "")
66     # For CentOS/Red Hat where they store it directly in /usr/include
67     SET(ARCH_INCLUDE_PATH "${LIBC_INCLUDE_PATH}/bits")
68   ELSE()
69     FIND_PATH(ARCH_INCLUDE_PATH ${CMAKE_LIBRARY_ARCHITECTURE})
70     SET(ARCH_INCLUDE_PATH "${ARCH_INCLUDE_PATH}/${CMAKE_LIBRARY_ARCHITECTURE}")
71   ENDIF()
73   set_property(DIRECTORY
74     PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH
75       "${LIBC_INCLUDE_PATH}/stdlib.h"
76       "${LIBC_INCLUDE_PATH}/string.h"
77       "${LIBC_INCLUDE_PATH}/ansidecl.h"
78       "${LIBC_INCLUDE_PATH}/bfd.h"
79       "${LIBC_INCLUDE_PATH}/libelf.h"
80       "${LIBC_INCLUDE_PATH}/elf.h"
81       "${LIBC_INCLUDE_PATH}/gelf.h"
82       "${LIBC_INCLUDE_PATH}/resolv.h"
83       "${ARCH_INCLUDE_PATH}"
84       "${CCLIENT_INCLUDE_PATH}"
85       "${LIBPNG_INCLUDE_DIRS}/png.h"
86       "${LDAP_INCLUDE_DIR}/ldap.h"
87       "${LIBSQLITE3_INCLUDE_DIR}/sqlite3ext.h"
88       "${CMAKE_SOURCE_DIR}"
89       "${CMAKE_BINARY_DIR}")
91   # XED headers need to be wrapped in extern "C"
92   if (ENABLE_XED)
93     if (LibXed_INCLUDE_DIR)
94       set_property(DIRECTORY
95           APPEND PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH
96             "${LibXed_INCLUDE_DIR}")
97     else()
98       set_property(DIRECTORY
99           APPEND PROPERTY COTIRE_PREFIX_HEADER_IGNORE_PATH
100             "${TP_DIR}/xed/xed/build/include/xed")
101     endif()
102   endif()
103 endif()
105 # Only thing to do directly in tools is install this one script. Tools also has
106 # its own Makefile, so just do it here instead of dealing with moving that all
107 # around.
108 install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/tools/oss-repo-mode
109   RENAME hhvm-repo-mode
110   DESTINATION bin
111   COMPONENT dev)
113 add_definitions("-DUSE_CMAKE")
115 enable_language(ASM)
117 if (NOT PCRE_LIBRARY)
118   link_libraries(pcre)
119 endif()
121 add_subdirectory(tools/hfsort)
122 add_subdirectory(tools/version)
123 add_subdirectory(tools/tc-print)
125 add_subdirectory(compiler)
126 add_subdirectory(hack)
127 add_subdirectory(hhbbc)
128 add_subdirectory(neo)
129 add_subdirectory(parser)
131 add_subdirectory(runtime)
132 add_subdirectory(runtime/ext)
134 # The runtime/test binary require GTest and GMock to be installed globally
135 option(RUNTIME_TEST_BIN "Create the HHVM runtime/test binary" OFF)
136 if (RUNTIME_TEST_BIN)
137   add_subdirectory(runtime/test)
138 endif ()
140 add_subdirectory(system)
141 add_subdirectory(util)
142 add_subdirectory(vixl)
143 add_subdirectory(zend)
145 add_subdirectory(hhvm)
147 option(TEST_BIN "Create the HHVM test binary" OFF)
148 if (TEST_BIN)
149   add_subdirectory(test)
150 endif ()
152 add_subdirectory(tools/gdb)
154 include(test/dso_test/dso_test.cmake)
156 # Keep this last
157 add_subdirectory(tools/hphpize)