Inline object constructors
[hiphop-php.git] / hphp / CMakeLists.txt
blob45f218c7edf921fffe124d167bedea77d2d58640
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 include(HPHPSetup)
20 # HHVM Build
21 SET(USE_HHVM TRUE)
22 SET(ENV{HHVM} 1)
23 ADD_DEFINITIONS("-DHHVM -DHHVM_BINARY=1 -DHHVM_PATH=\\\"${HPHP_HOME}/hphp/hhvm/hhvm\\\"")
25 set(RECURSIVE_SOURCE_SUBDIRS runtime/base runtime/eval runtime/ext runtime/vm system util)
26 foreach (dir ${RECURSIVE_SOURCE_SUBDIRS})
28         auto_sources(files "*.cpp" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
29         list(APPEND CXX_SOURCES ${files})
31         auto_sources(files "*.c" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
32         list(APPEND C_SOURCES ${files})
34         auto_sources(files "*.S" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}/${dir}")
35         list(APPEND ASM_SOURCES ${files})
36 endforeach(dir ${RECURSIVE_SOURCE_SUBDIRS})
38 # Disable hardware counters off of Linux
39 if(NOT LINUX)
40         add_definitions(-DNO_HARDWARE_COUNTERS)
41         list(REMOVE_ITEM CXX_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/runtime/base/hardware_counter.cpp)
42 endif()
44 # remove ext_hhvm, and anything in a test folder
45 foreach (file ${CXX_SOURCES})
46         if (${file} MATCHES "ext_hhvm")
47                 list(REMOVE_ITEM CXX_SOURCES ${file})
48         endif()
49         if (${file} MATCHES "/test/")
50                 list(REMOVE_ITEM CXX_SOURCES ${file})
51         endif()
52 endforeach(file ${CXX_SOURCES})
54 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
55 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
57 add_subdirectory(third_party/libafdt)
58 add_subdirectory(third_party/libmbfl)
59 add_subdirectory(third_party/libsqlite3)
60 add_subdirectory(third_party/timelib)
61 add_subdirectory(third_party/lz4)
62 add_subdirectory(third_party/double-conversion)
63 add_subdirectory(third_party/folly)
65 foreach (CXX_FILE ${CXX_SOURCES})
66         if(${CXX_FILE} MATCHES ".no.cpp$")
67                 SET_SOURCE_FILES_PROPERTIES(
68                         ${CXX_FILE}
69                         PROPERTIES
70                         COMPILE_FLAGS -O0
71                 )
72         endif()
73 endforeach()
75 add_custom_command(
76   OUTPUT hphp_repo_schema.h hphp_build_info.cpp
77   COMMAND hphp/util/generate_buildinfo.sh
78   DEPENDS ${CXX_SOURCES} ${C_SOURCES}
79   WORKING_DIRECTORY ${HPHP_HOME}
80   COMMENT "Generating Repo Schema ID and Compiler ID"
81   VERBATIM)
83 ADD_LIBRARY(hphp_runtime_static STATIC
84             hphp_repo_schema.h hphp_build_info.cpp
85             ${CXX_SOURCES} ${C_SOURCES} ${ASM_SOURCES})
86 SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES OUTPUT_NAME "hphp_runtime")
87 SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES PREFIX "lib")
88 SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
90 SET(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> q <TARGET> <LINK_FLAGS> <OBJECTS>")
92 hphp_link(hphp_runtime_static)
94 add_subdirectory("tools/gen-ext-hhvm")
96 add_subdirectory(compiler)
97 add_subdirectory(runtime/ext_hhvm)
98 add_subdirectory(hhvm)
100 if (NOT "$ENV{HPHP_NOTEST}" STREQUAL "1")
101         add_subdirectory(test)
102 endif ()