3 # Do this until cmake has a define for ARMv8
4 INCLUDE(CheckCXXSourceCompiles)
5 CHECK_CXX_SOURCE_COMPILES("
9 int main() { return 0; }" IS_AARCH64)
11 if (APPLE OR IS_AARCH64)
13 -Wl,-u,_register_libevent_server
14 -Wl,-all_load hphp_runtime_static)
18 -Wl,-uregister_libevent_server,-uregister_fastcgi_server
19 -Wl,--whole-archive hphp_runtime_static -Wl,--no-whole-archive)
22 set(HHVM_LINK_LIBRARIES
34 LIST(APPEND HHVM_LINK_LIBRARIES hphp_thrift)
35 LIST(APPEND HHVM_LINK_LIBRARIES hphp_proxygen)
38 if(NOT CMAKE_BUILD_TYPE)
39 set(CMAKE_BUILD_TYPE "Release")
42 IF(NOT DEFINED CMAKE_PREFIX_PATH)
43 message(STATUS "CMAKE_PREFIX_PATH was missing, proceeding anyway")
46 # Look for the chrpath tool so we can warn if it's not there
47 find_program(CHRPATH chrpath)
48 IF (CHRPATH STREQUAL "CHRPATH-NOTFOUND")
49 SET(FOUND_CHRPATH OFF)
50 message(WARNING "chrpath not found, rpath will not be stripped from installed binaries")
55 LIST(APPEND CMAKE_PREFIX_PATH "$ENV{CMAKE_PREFIX_PATH}")
58 if(EXISTS "/opt/local/var/macports/")
59 LIST (APPEND CMAKE_PREFIX_PATH "/opt/local")
60 LIST (APPEND CMAKE_LIBRARY_PATH "/opt/local/lib/x86_64")
65 include(HPHPFunctions)
68 add_definitions(-D_REENTRANT=1 -D_PTHREADS=1 -D__STDC_FORMAT_MACROS -DFOLLY_HAVE_WEAK_SYMBOLS=1)
71 add_definitions(-D_GNU_SOURCE)
74 if(${CMAKE_BUILD_TYPE} MATCHES "Release")
75 add_definitions(-DRELEASE=1)
76 add_definitions(-DNDEBUG)
77 message("Generating Release build")
79 add_definitions(-DDEBUG)
80 message("Generating DEBUG build")
84 add_definitions(-DDEBUG_MEMORY_LEAK=1)
88 add_definitions(-DDEBUG_APC_LEAK=1)
92 add_definitions(-DALWAYS_ASSERT=1)
96 add_definitions(-DHOTPROFILER=1)
99 if(EXECUTION_PROFILER)
100 add_definitions(-DEXECUTION_PROFILER=1)
103 if(ENABLE_FULL_SETLINE)
104 add_definitions(-DENABLE_FULL_SETLINE=1)
108 add_definitions(-DSKIP_USER_CHANGE=1)
112 # We have to be a little more permissive in some cases.
113 add_definitions(-fpermissive)
115 # Skip deprecation warnings in OpenSSL.
116 add_definitions(-DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6)
118 # Just assume we have sched.h
119 add_definitions(-DFOLLY_HAVE_SCHED_H=1)
121 # Enable weak linking
122 add_definitions(-DMACOSX_DEPLOYMENT_TARGET=10.6)
126 add_definitions(-DENABLE_FASTCGI=1)
129 if(DISABLE_HARDWARE_COUNTERS)
130 add_definitions(-DNO_HARDWARE_COUNTERS=1)
133 # enable the OSS options if we have any
134 add_definitions(-DHPHP_OSS=1)
136 # later versions of binutils don't play well without automake
137 add_definitions(-DPACKAGE=hhvm -DPACKAGE_VERSION=Release)
139 include_directories(${HPHP_HOME}/hphp)
140 include_directories(${HPHP_HOME}/hphp/lib/system/gen)
141 include_directories(${HPHP_HOME})