Fix HPHPC handling of foldable functions that can return Hack arrays
[hiphop-php.git] / CMakeLists.txt
blob92082b7aa0a27ecccfd7fbcdfd0afa6249f9674a
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.18.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 MARK_AS_ADVANCED(CLEAR CMAKE_INSTALL_PREFIX)
27 IF(APPLE)
28   # CMake really likes finding libraries inside OS X frameworks. This can
29   # create super unexpected results, such as the LDAP framework, where the
30   # ldap.h header there just consists of "#include <ldap.h>" -- obviously
31   # assuming /usr/include appears on the include path before that framework
32   # (which wasn't really supposed to be on the include path at all). This
33   # leads to a hilarious recursive include and general fireworks. Instead,
34   # tell CMake to search frameworks *last*, if it doesn't find something in
35   # /usr (or MacPorts/Homebrew).
36   SET(CMAKE_FIND_FRAMEWORK "LAST")
37   MARK_AS_ADVANCED(CMAKE_OSX_ARCHITECTURES
38     CMAKE_OSX_DEPLOYMENT_TARGET
39     CMAKE_OSX_SYSROOT)
40 ENDIF()
42 # Check architecture OS
43 IF(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
44   MESSAGE(FATAL_ERROR "HHVM requires a 64bit OS")
45 ENDIF()
47 # Enable ccache if present and not already enabled system wide.
48 option(SKIP_CCACHE "Skip detecting/enabling ccache - no effect if ccache enabled system wide" FALSE)
49 if(NOT SKIP_CCACHE)
50   find_program(CCACHE_FOUND ccache)
51   if(CCACHE_FOUND)
52     if (NOT ("${CMAKE_CXX_COMPILER} ${CMAKE_C_COMPILER}" MATCHES ".*ccache.*"))
53       set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_FOUND})
54       message(STATUS "Found ccache: ${CCACHE_FOUND} - enabling ccache as compiler wrapper")
55     else()
56       message(STATUS "Found ccache - ccache already in use as C and/or CXX compiler wrapper")
57    endif()
58   endif(CCACHE_FOUND)
59 endif(NOT SKIP_CCACHE)
61 # 3rd party library
62 IF(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/third-party/CMakeLists.txt")
63   MESSAGE(FATAL_ERROR "third-party/CMakeLists.txt missing. "
64                       "Try updating your submodule with:
65 rm -r third-party
66 git submodule update --init --recursive
68 ENDIF()
70 INCLUDE(HPHPFunctions)
71 INCLUDE(CheckFunctionExists)
73 SET(HPHP_HOME ${CMAKE_CURRENT_SOURCE_DIR})
74 SET(TP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third-party")
75 SET(TP_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/third-party")
77 include(MSVCDefaults)
78 include(Options)
79 include(HPHPCompiler)
80 include(HPHPFindLibs)
82 ADD_SUBDIRECTORY(third-party)
83 ADD_SUBDIRECTORY(hphp)
85 # use GNU install dirs (e.g. lib64 instead of lib)
86 INCLUDE(GNUInstallDirs)
88 # modules / depends
89 FILE(GLOB HHVM_CMAKE_FILES "CMake/*.cmake")
90 INSTALL(
91   FILES ${HHVM_CMAKE_FILES}
92   DESTINATION "${CMAKE_INSTALL_LIBDIR}/hhvm/CMake"
93   COMPONENT dev)