Don't make use of HNI property type hints if AllFuncsInterceptable is true
[hiphop-php.git] / CMake / HPHPSetup.cmake
blob4d83e477df2568a21fb17a8940209ef5a5b8022a
1 include(Options)
3 # Do this until cmake has a define for ARMv8
4 INCLUDE(CheckCXXSourceCompiles)
5 CHECK_CXX_SOURCE_COMPILES("
6 #ifndef __AARCH64EL__
7 #error Not ARMv8
8 #endif
9 int main() { return 0; }" IS_AARCH64)
11 set(HHVM_WHOLE_ARCHIVE_LIBRARIES
12     hphp_runtime_static
13     hphp_runtime_ext
14    )
16 if (ENABLE_ZEND_COMPAT)
17   add_definitions("-DENABLE_ZEND_COMPAT=1")
18   list(APPEND HHVM_WHOLE_ARCHIVE_LIBRARIES hphp_ext_zend_compat)
19 endif()
21 if (APPLE)
22   set(ENABLE_FASTCGI 1)
23   set(HHVM_ANCHOR_SYMS
24     -Wl,-u,_register_fastcgi_server
25     -Wl,-all_load ${HHVM_WHOLE_ARCHIVE_LIBRARIES})
26 elseif (IS_AARCH64)
27   set(HHVM_ANCHOR_SYMS
28     -Wl,--whole-archive ${HHVM_WHOLE_ARCHIVE_LIBRARIES} -Wl,--no-whole-archive)
29 else()
30   set(ENABLE_FASTCGI 1)
31   set(HHVM_ANCHOR_SYMS
32     -Wl,-uregister_libevent_server,-uregister_fastcgi_server
33     -Wl,--whole-archive ${HHVM_WHOLE_ARCHIVE_LIBRARIES} -Wl,--no-whole-archive)
34 endif()
36 set(HHVM_LINK_LIBRARIES
37   ${HHVM_ANCHOR_SYMS}
38   hphp_analysis
39   ext_hhvm_static
40   hphp_system
41   hphp_parser
42   hphp_zend
43   hphp_util
44   hphp_hhbbc
45   vixl neo)
47 if(ENABLE_FASTCGI)
48   LIST(APPEND HHVM_LINK_LIBRARIES hphp_thrift)
49   LIST(APPEND HHVM_LINK_LIBRARIES hphp_proxygen)
50 endif()
52 if(NOT CMAKE_BUILD_TYPE)
53   set(CMAKE_BUILD_TYPE "Release")
54   message(STATUS "Build type not specified: cmake build type Release.")
55 endif()
57 # Look for the chrpath tool so we can warn if it's not there
58 SET(FOUND_CHRPATH OFF)
59 IF(UNIX AND NOT APPLE)
60     find_program(CHRPATH chrpath)
61     IF (NOT CHRPATH STREQUAL "CHRPATH-NOTFOUND")
62         SET(FOUND_CHRPATH ON)
63     endif()
64 ENDIF(UNIX AND NOT APPLE)
66 LIST(APPEND CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
68 if(APPLE)
69   if(EXISTS "/opt/local/var/macports/")
70     LIST (APPEND CMAKE_PREFIX_PATH "/opt/local")
71     LIST (APPEND CMAKE_LIBRARY_PATH "/opt/local/lib/x86_64")
72   endif()
73 endif()
75 include(HPHPCompiler)
76 include(HPHPFunctions)
77 include(HPHPFindLibs)
79 add_definitions(-D_REENTRANT=1 -D_PTHREADS=1 -D__STDC_FORMAT_MACROS -DFOLLY_HAVE_WEAK_SYMBOLS=1)
81 if (LINUX)
82   add_definitions(-D_GNU_SOURCE)
83 endif()
85 if(${CMAKE_BUILD_TYPE} MATCHES "Release")
86   add_definitions(-DRELEASE=1)
87   add_definitions(-DNDEBUG)
88   message("Generating Release build")
89 else()
90   add_definitions(-DDEBUG)
91   message("Generating DEBUG build")
92 endif()
94 if(DEBUG_MEMORY_LEAK)
95   add_definitions(-DDEBUG_MEMORY_LEAK=1)
96 endif()
98 if(DEBUG_APC_LEAK)
99   add_definitions(-DDEBUG_APC_LEAK=1)
100 endif()
102 if(ALWAYS_ASSERT)
103   add_definitions(-DALWAYS_ASSERT=1)
104 endif()
106 if(HOTPROFILER)
107   add_definitions(-DHOTPROFILER=1)
108 endif()
110 if(EXECUTION_PROFILER)
111   add_definitions(-DEXECUTION_PROFILER=1)
112 endif()
114 if(ENABLE_FULL_SETLINE)
115   add_definitions(-DENABLE_FULL_SETLINE=1)
116 endif()
118 if(APPLE OR FREEBSD)
119   add_definitions(-DSKIP_USER_CHANGE=1)
120 endif()
122 if(ENABLE_TRACE)
123     add_definitions(-DUSE_TRACE=1)
124 endif()
126 if(APPLE)
127   # We have to be a little more permissive in some cases.
128   add_definitions(-fpermissive)
130   # Skip deprecation warnings in OpenSSL.
131   add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6)
133   # Just assume we have sched.h
134   add_definitions(-DFOLLY_HAVE_SCHED_H=1)
136   # Enable weak linking
137   add_definitions(-DMACOSX_DEPLOYMENT_TARGET=10.6)
138 endif()
140 if(ENABLE_FASTCGI)
141   add_definitions(-DENABLE_FASTCGI=1)
142 endif ()
144 if(DISABLE_HARDWARE_COUNTERS)
145   add_definitions(-DNO_HARDWARE_COUNTERS=1)
146 endif ()
148 if(PACKED_TV)
149   # Allows a packed tv build
150   add_definitions(-DPACKED_TV=1)
151 endif()
153 # enable the OSS options if we have any
154 add_definitions(-DHPHP_OSS=1)
156 # later versions of binutils don't play well without automake
157 add_definitions(-DPACKAGE=hhvm -DPACKAGE_VERSION=Release)
159 if (NOT LIBSQLITE3_LIBRARY)
160   include_directories("${TP_DIR}/libsqlite3")
161 endif()
163 if (NOT DOUBLE_CONVERSION_LIBRARY)
164   include_directories("${TP_DIR}/double-conversion/src")
165 endif()
167 if (NOT LZ4_LIBRARY)
168   include_directories("${TP_DIR}/lz4")
169 endif()
171 if (NOT LIBZIP_INCLUDE_DIR_ZIP)
172   include_directories("${TP_DIR}/libzip")
173 endif()
175 include_directories("${TP_DIR}/fastlz")
176 include_directories("${TP_DIR}/timelib")
177 include_directories("${TP_DIR}/libafdt/src")
178 include_directories("${TP_DIR}/libmbfl")
179 include_directories("${TP_DIR}/libmbfl/mbfl")
180 include_directories("${TP_DIR}/libmbfl/filter")
181 include_directories("${TP_DIR}/folly")
182 include_directories(${TP_DIR})
184 include_directories(${HPHP_HOME}/hphp)
185 include_directories(${HPHP_HOME})