Skip to content

Commit 22dd7ac

Browse files
committed
Generate config headers from configs.specification
1 parent 0e3ca63 commit 22dd7ac

File tree

8 files changed

+507
-1
lines changed

8 files changed

+507
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
function (HHVM_RENDER_CONFIG_SPECIFICATION TARGET)
2+
cmake_parse_arguments("HHVM_RENDER_CONFIG_SPEC" "" "TYPE;OUTPUT_PATH" "CONFIG_SECTIONS" ${ARGN})
3+
4+
get_target_property(CARGO_EXE cargo LOCATION)
5+
get_target_property(RUSTC_EXE rustc LOCATION)
6+
7+
foreach(SECTION ${HHVM_RENDER_CONFIG_SPEC_CONFIG_SECTIONS})
8+
list(APPEND HHVM_RENDER_CONFIG_SPEC_CONFIG_SOURCES ${HHVM_RENDER_CONFIG_SPEC_OUTPUT_PATH}/${SECTION}.cpp)
9+
list(APPEND HHVM_RENDER_CONFIG_SPEC_CONFIG_HEADERS ${HHVM_RENDER_CONFIG_SPEC_OUTPUT_PATH}/${SECTION}.h)
10+
endforeach()
11+
12+
add_custom_command(
13+
OUTPUT ${HHVM_RENDER_CONFIG_SPEC_CONFIG_SOURCES} ${HHVM_RENDER_CONFIG_SPEC_CONFIG_HEADERS}
14+
COMMAND ${CMAKE_COMMAND} -E make_directory ${HHVM_RENDER_CONFIG_SPEC_OUTPUT_PATH} &&
15+
${CMAKE_COMMAND} -E env RUSTC=${RUSTC_EXE} ${CARGO_EXE} run --quiet -- ${HHVM_RENDER_CONFIG_SPEC_TYPE} ${HHVM_RENDER_CONFIG_SPEC_OUTPUT_PATH} ${CMAKE_SOURCE_DIR}/hphp/doc/configs.specification
16+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/hphp/tools/configs
17+
DEPENDS ${CMAKE_SOURCE_DIR}/hphp/doc/configs.specification rustc cargo
18+
VERBATIM
19+
)
20+
21+
add_custom_target(hhvm_render_config_section_${HHVM_RENDER_CONFIG_SPEC_TYPE}
22+
DEPENDS ${HHVM_RENDER_CONFIG_SPEC_CONFIG_SOURCES} ${HHVM_RENDER_CONFIG_SPEC_CONFIG_HEADERS})
23+
24+
add_dependencies(${TARGET} hhvm_render_config_section_${HHVM_RENDER_CONFIG_SPEC_TYPE})
25+
target_sources(${TARGET} PRIVATE ${HHVM_RENDER_CONFIG_SPEC_CONFIG_SOURCES})
26+
endfunction(HHVMRenderConfigSpecification)

hphp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ if (NOT PCRE_LIBRARY)
132132
link_libraries(pcre)
133133
endif()
134134

135+
add_subdirectory(tools/configs)
135136
add_subdirectory(tools/hfsort)
136137
add_subdirectory(tools/version)
137138
add_subdirectory(tools/tc-print)

hphp/hack/src/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

hphp/runtime/CMakeLists.txt

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,53 @@ add_object_library(hphp_runtime_static
4545
"${CMAKE_CURRENT_BINARY_DIR}/ir-opcode-generated.h")
4646
auto_source_group("hphp_runtime_static" "${CMAKE_CURRENT_SOURCE_DIR}"
4747
${ASM_SOURCES} ${C_SOURCES} ${CXX_SOURCES} ${HEADER_SOURCES})
48+
49+
50+
set(LOADER_CONFIG_SECTIONS
51+
adminserver-loader
52+
autoload-loader
53+
codecache-loader
54+
configs-generated
55+
debugger-loader
56+
debug-loader
57+
errorhandling-loader
58+
eval-loader
59+
gc-loader
60+
hacklang-loader
61+
hhir-loader
62+
http-loader
63+
jit-loader
64+
log-loader
65+
mail-loader
66+
pageletserver-loader
67+
pcre-loader
68+
php7-loader
69+
proxy-loader
70+
repo-loader
71+
sandbox-loader
72+
server-loader
73+
setprofile-loader
74+
simplexml-loader
75+
stats-loader
76+
strobelight-loader
77+
watchman-loader
78+
xbox-loader
79+
xenon-loader
80+
)
81+
82+
include(HHVMRenderConfigSpecification)
83+
HHVM_RENDER_CONFIG_SPECIFICATION(
84+
hphp_runtime_static
85+
CONFIG_SECTIONS ${LOADER_CONFIG_SECTIONS}
86+
TYPE loader
87+
OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/base/configs
88+
)
89+
4890
SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES OUTPUT_NAME "hphp_runtime")
4991
SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES PREFIX "lib")
5092
SET_TARGET_PROPERTIES(hphp_runtime_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
5193
object_library_hphp_link(hphp_runtime_static)
52-
object_library_ld_link_libraries(hphp_runtime_static hphp_util proxygen vixl hphp_zend hphp_system jit_sort hphp_system)
94+
object_library_ld_link_libraries(hphp_runtime_static hphp_util proxygen mvfst vixl hphp_zend hphp_system jit_sort hphp_system)
5395
HHVM_CONFIGURE_TARGET_FOR_EXTENSION_DEPENDENCIES(hphp_runtime_static)
5496

5597
HHVM_PUBLIC_HEADERS(runtime ${HEADER_SOURCES})

hphp/tools/configs/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
get_target_property(CARGO_EXE cargo LOCATION)
2+
get_target_property(RUSTC_EXE rustc LOCATION)
3+
4+
add_custom_command(
5+
OUTPUT ${CMAKE_BINARY_DIR}/hphp/hack/src/hackc/compile/options_gen.h
6+
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/hphp/hack/src/hackc/compile &&
7+
${CMAKE_COMMAND} -E env RUSTC=${RUSTC_EXE} ${CARGO_EXE} run --quiet -- hackc ${CMAKE_BINARY_DIR}/hphp/hack/src/hackc/compile ${CMAKE_SOURCE_DIR}/hphp/doc/configs.specification
8+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
9+
DEPENDS ${CMAKE_SOURCE_DIR}/hphp/doc/configs.specification rustc cargo
10+
VERBATIM
11+
)
12+
13+
add_custom_target(hackc_options DEPENDS ${CMAKE_BINARY_DIR}/hphp/hack/src/hackc/compile/options_gen.h)

0 commit comments

Comments
 (0)