Support type-aliased shapes in IsNameD
[hiphop-php.git] / CMakeLists.txt
blobc5b932f72fb6c1161108352e6b335f78cba0b3b5
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7 FATAL_ERROR)
3 # This needs to be done before any languages are enabled or
4 # projects are created.
5 INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/CMake/VisualStudioToolset.cmake")
7 # includes
8 SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
9 include_directories(${CMAKE_CURRENT_BINARY_DIR})
11 # package information
12 SET(PACKAGE_NAME      "hhvm")
13 SET(PACKAGE_VERSION   "3.20.0-dev")
14 SET(PACKAGE_STRING    "${PACKAGE_NAME} ${PACKAGE_VERSION}")
15 SET(PACKAGE_TARNAME   "${PACKAGE_NAME}-${PACKAGE_VERSION}")
16 SET(PACKAGE_BUGREPORT "https://github.com/facebook/hhvm/issues")
18 PROJECT(${PACKAGE_NAME} C CXX ASM)
20 include(HHVMProject)
22 if (MSVC)
23   enable_language(ASM_MASM)
24 endif()
26 # Look for and apply patches to the third-party (and sub) repo.
27 file(GLOB PATCHES "${CMAKE_SOURCE_DIR}/patches/*.patch")
28 if (PATCHES)
29   message(STATUS "Patches: ${PATCHES}")
30   foreach(PATCH ${PATCHES})
31     message(STATUS "Applying ${PATCH}")
32     execute_process(
33       COMMAND patch -p1 --forward --ignore-whitespace
34       WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
35       INPUT_FILE "${PATCH}"
36       OUTPUT_VARIABLE OUTPUT
37       RESULT_VARIABLE RESULT)
38     if (RESULT EQUAL 0)
39       message(STATUS "Patch applied: ${PATCH}")
40     else()
41       # Unfortunately although patch will recognise that a patch is already
42       # applied it will still return an error.
43       execute_process(
44         COMMAND patch -p1 -R --dry-run
45         WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
46         INPUT_FILE "${PATCH}"
47         OUTPUT_VARIABLE OUTPUT
48         RESULT_VARIABLE RESULT2)
49       if (RESULT2 EQUAL 0)
50         message(STATUS "Patch was already applied: ${PATCH}")
51       else()
52         message(FATAL_ERROR "Error applying patch ${PATCH}")
53       endif()
54     endif()
55   endforeach(PATCH)
56 endif()
59 MARK_AS_ADVANCED(CLEAR CMAKE_INSTALL_PREFIX)
60 IF(APPLE)
61   # CMake really likes finding libraries inside OS X frameworks. This can
62   # create super unexpected results, such as the LDAP framework, where the
63   # ldap.h header there just consists of "#include <ldap.h>" -- obviously
64   # assuming /usr/include appears on the include path before that framework
65   # (which wasn't really supposed to be on the include path at all). This
66   # leads to a hilarious recursive include and general fireworks. Instead,
67   # tell CMake to search frameworks *last*, if it doesn't find something in
68   # /usr (or MacPorts/Homebrew).
69   SET(CMAKE_FIND_FRAMEWORK "LAST")
70   MARK_AS_ADVANCED(CMAKE_OSX_ARCHITECTURES
71     CMAKE_OSX_DEPLOYMENT_TARGET
72     CMAKE_OSX_SYSROOT)
73 ENDIF()
75 # Check architecture OS
76 IF(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
77   MESSAGE(FATAL_ERROR "HHVM requires a 64bit OS")
78 ENDIF()
80 # Enable ccache if present and not already enabled system wide.
81 option(SKIP_CCACHE "Skip detecting/enabling ccache - no effect if ccache enabled system wide" FALSE)
82 if(NOT SKIP_CCACHE)
83   find_program(CCACHE_FOUND ccache)
84   if(CCACHE_FOUND)
85     if (NOT ("${CMAKE_CXX_COMPILER} ${CMAKE_C_COMPILER}" MATCHES ".*ccache.*"))
86       set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
87       message(STATUS "Found ccache: ${CCACHE_FOUND} - enabling ccache as compiler wrapper")
88     else()
89       message(STATUS "Found ccache - ccache already in use as C and/or CXX compiler wrapper")
90    endif()
91   endif(CCACHE_FOUND)
92 endif(NOT SKIP_CCACHE)
94 # 3rd party library
95 IF(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third-party/CMakeLists.txt")
96   MESSAGE(FATAL_ERROR "third-party/CMakeLists.txt missing. "
97                       "Try updating your submodule with:
98 rm -r third-party
99 git submodule update --init --recursive
101 ENDIF()
103 INCLUDE(HPHPFunctions)
104 INCLUDE(CheckFunctionExists)
106 SET(HPHP_HOME ${CMAKE_CURRENT_SOURCE_DIR})
107 SET(TP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third-party")
108 SET(TP_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/third-party")
110 include(MSVCDefaults)
111 include(Options)
112 include(HPHPCompiler)
113 include(HPHPFindLibs)
115 ADD_SUBDIRECTORY(third-party)
116 ADD_SUBDIRECTORY(hphp)
118 # use GNU install dirs (e.g. lib64 instead of lib)
119 INCLUDE(GNUInstallDirs)
121 # modules / depends
122 FILE(GLOB HHVM_CMAKE_FILES "CMake/*.cmake")
123 INSTALL(
124   FILES ${HHVM_CMAKE_FILES}
125   DESTINATION "${CMAKE_INSTALL_LIBDIR}/hhvm/CMake"
126   COMPONENT dev)