-
Notifications
You must be signed in to change notification settings - Fork 92
/
CMakeLists.txt
132 lines (105 loc) · 4.14 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
cmake_minimum_required(VERSION 3.16)
project(kphp
VERSION 1.0.1
LANGUAGES CXX ASM
DESCRIPTION "Compiler for PHP (aka KPHP)"
HOMEPAGE_URL https://github.com/VKCOM/kphp)
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
message(FATAL_ERROR [[
In-source build is forbidden! Run following command:
rm -rf CMakeFiles CMakeCache.txt && cmake -H. -Bbuild
]])
endif()
# include(CMakeGraphVizOptions)
# set(GRAPHVIZ_CUSTOM_TARGETS TRUE)
include(CMakePrintHelpers)
include(CheckCXXCompilerFlag)
include(AddFileDependencies)
include(FetchContent)
include(GNUInstallDirs)
# Global includes must be before all other includes/add_subdirectories
include(cmake/utils.cmake)
include(cmake/init-global-vars.cmake)
include(cmake/init-compilation-options.cmake)
include(cmake/external-libraries.cmake)
include(cmake/init-compilation-flags.cmake)
include(cmake/popular-common.cmake)
# TODO: use FetchContent_Declare instead of include_directories
include_directories(.)
# Custom modules
include(${BASE_DIR}/flex/flex.cmake)
include(${BASE_DIR}/net/net.cmake)
include(${BASE_DIR}/vkext/vkext.cmake)
include(${COMMON_DIR}/binlog/binlog.cmake)
include(${COMMON_DIR}/common.cmake)
include(${COMMON_DIR}/tl/tl.cmake)
include(${COMMON_DIR}/unicode/unicode.cmake)
include(${RUNTIME_COMMON_DIR}/runtime-common.cmake)
if(COMPILE_RUNTIME_LIGHT)
include(${BASE_DIR}/runtime-light/runtime-light.cmake)
file(GLOB EXCLUDE_FILES "runtime/*")
else()
include(${BASE_DIR}/runtime/runtime.cmake)
include(${BASE_DIR}/server/server.cmake)
file(GLOB EXCLUDE_FILES "runtime-light/*")
endif()
include(${BASE_DIR}/compiler/compiler.cmake)
include(${BASE_DIR}/tests/tests.cmake)
if(KPHP_CUSTOM_CMAKE AND EXISTS ${OBJS_DIR}/custom_php_project.cmake)
include(${OBJS_DIR}/custom_php_project.cmake)
endif()
add_custom_target(kphp ALL DEPENDS ${OBJS_DIR}/php_lib_version.sha256)
if (COMPILE_RUNTIME_LIGHT)
add_dependencies(kphp kphp2cpp kphp-light-runtime)
else ()
add_dependencies(kphp kphp2cpp kphp-full-runtime)
endif ()
install(TARGETS kphp2cpp
COMPONENT KPHP
RUNTIME DESTINATION ${VK_INSTALL_DIR}/bin/)
install_symlink(${VK_INSTALL_DIR}/bin/kphp2cpp bin/kphp KPHP)
if (COMPILE_RUNTIME_LIGHT)
install(TARGETS kphp-light-runtime
COMPONENT KPHP
LIBRARY DESTINATION ${INSTALL_KPHP_SOURCE}/objs)
else ()
install(TARGETS kphp-full-runtime
COMPONENT KPHP
LIBRARY DESTINATION ${INSTALL_KPHP_SOURCE}/objs
ARCHIVE DESTINATION ${INSTALL_KPHP_SOURCE}/objs)
endif ()
install(DIRECTORY ${COMMON_DIR}
${BASE_DIR}/runtime
${RUNTIME_COMMON_DIR}
${BASE_DIR}/server
${BASE_DIR}/third-party
COMPONENT KPHP
DESTINATION ${INSTALL_KPHP_SOURCE}
FILES_MATCHING REGEX ".*\\.(hpp|h|inl)$")
install(FILES ${OBJS_DIR}/php_lib_version.sha256
COMPONENT KPHP
DESTINATION ${INSTALL_KPHP_SOURCE}/objs)
install(DIRECTORY ${BASE_DIR}/builtin-functions
COMPONENT KPHP
DESTINATION ${INSTALL_KPHP_SOURCE}/)
install(FILES ${COMMON_DIR}/php-functions.h
COMPONENT KPHP
DESTINATION ${INSTALL_KPHP_SOURCE}/)
install(FILES ${AUTO_DIR}/runtime/runtime-headers.h
COMPONENT KPHP
DESTINATION ${INSTALL_KPHP_SOURCE}/objs/generated/auto/runtime/)
set(CPACK_DEBIAN_KPHP_PACKAGE_DEPENDS "vk-flex-data, curl-kphp-vk, libuber-h3, libpcre3-dev, libre2-dev, libyaml-cpp-dev, libssl-dev, zlib1g-dev, \
libzstd-dev, g++, libnghttp2-dev, kphp-timelib, libnuma-dev")
if (PDO_DRIVER_MYSQL)
set(CPACK_DEBIAN_KPHP_PACKAGE_DEPENDS "${CPACK_DEBIAN_KPHP_PACKAGE_DEPENDS}, libmysqlclient-dev")
endif()
if (PDO_DRIVER_PGSQL)
set(CPACK_DEBIAN_KPHP_PACKAGE_DEPENDS "${CPACK_DEBIAN_KPHP_PACKAGE_DEPENDS}, libpq-dev")
endif()
set(CPACK_DEBIAN_KPHP_PACKAGE_RECOMMENDS "vk-tl-tools")
set(CPACK_DEBIAN_KPHP_DESCRIPTION "kphp2cpp compiler and runtime for it")
set(CPACK_DEBIAN_KPHP_PACKAGE_NAME "kphp")
add_custom_target(force_clean_all
COMMAND rm -rf ${OBJS_DIR}
COMMAND rm -rf ${CMAKE_CURRENT_BINARY_DIR}/*)
include(CPack)