mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
Fix build
This commit is contained in:
parent
b4ac900462
commit
f459640269
@ -26,29 +26,32 @@ clickhouse_program_add(server)
|
|||||||
|
|
||||||
install(FILES config.xml users.xml DESTINATION ${CLICKHOUSE_ETC_DIR}/clickhouse-server COMPONENT clickhouse)
|
install(FILES config.xml users.xml DESTINATION ${CLICKHOUSE_ETC_DIR}/clickhouse-server COMPONENT clickhouse)
|
||||||
|
|
||||||
# Embed default config files as a resource into the binary.
|
# TODO We actually need this on Mac, FreeBSD and AArch64.
|
||||||
# This is needed for two purposes:
|
if (OS_LINUX AND ARCH_AMD64)
|
||||||
# 1. Allow to run the binary without download of any other files.
|
# Embed default config files as a resource into the binary.
|
||||||
# 2. Allow to implement "sudo clickhouse install" tool.
|
# This is needed for two purposes:
|
||||||
|
# 1. Allow to run the binary without download of any other files.
|
||||||
|
# 2. Allow to implement "sudo clickhouse install" tool.
|
||||||
|
|
||||||
foreach(CONFIG_FILE config users embedded)
|
foreach(CONFIG_FILE config users embedded)
|
||||||
set(CONFIG_OBJ ${CONFIG_FILE}.o)
|
set(CONFIG_OBJ ${CONFIG_FILE}.o)
|
||||||
set(CONFIG_OBJS ${CONFIG_OBJS} ${CONFIG_OBJ})
|
set(CONFIG_OBJS ${CONFIG_OBJS} ${CONFIG_OBJ})
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/14776463/compile-and-add-an-object-file-from-a-binary-with-cmake
|
# https://stackoverflow.com/questions/14776463/compile-and-add-an-object-file-from-a-binary-with-cmake
|
||||||
add_custom_command(OUTPUT ${CONFIG_OBJ}
|
add_custom_command(OUTPUT ${CONFIG_OBJ}
|
||||||
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${OBJCOPY_PATH} -I binary -O elf64-x86-64 -B i386 ${CONFIG_FILE}.xml ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_OBJ}
|
COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${OBJCOPY_PATH} -I binary -O elf64-x86-64 -B i386 ${CONFIG_FILE}.xml ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_OBJ}
|
||||||
COMMAND ${OBJCOPY_PATH} --rename-section .data=.rodata,alloc,load,readonly,data,contents
|
COMMAND ${OBJCOPY_PATH} --rename-section .data=.rodata,alloc,load,readonly,data,contents
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_OBJ} ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_OBJ})
|
${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_OBJ} ${CMAKE_CURRENT_BINARY_DIR}/${CONFIG_OBJ})
|
||||||
|
|
||||||
set_source_files_properties(${CONFIG_OBJ} PROPERTIES EXTERNAL_OBJECT true GENERATED true)
|
set_source_files_properties(${CONFIG_OBJ} PROPERTIES EXTERNAL_OBJECT true GENERATED true)
|
||||||
endforeach(CONFIG_FILE)
|
endforeach(CONFIG_FILE)
|
||||||
|
|
||||||
add_library(clickhouse_server_configs STATIC ${CONFIG_OBJS})
|
add_library(clickhouse_server_configs STATIC ${CONFIG_OBJS})
|
||||||
set_target_properties(clickhouse_server_configs PROPERTIES LINKER_LANGUAGE C)
|
set_target_properties(clickhouse_server_configs PROPERTIES LINKER_LANGUAGE C)
|
||||||
|
|
||||||
# whole-archive prevents symbols from being discarded for unknown reason
|
# whole-archive prevents symbols from being discarded for unknown reason
|
||||||
# CMake can shuffle each of target_link_libraries arguments with other
|
# CMake can shuffle each of target_link_libraries arguments with other
|
||||||
# libraries in linker command. To avoid this we hardcode whole-archive
|
# libraries in linker command. To avoid this we hardcode whole-archive
|
||||||
# library into single string.
|
# library into single string.
|
||||||
add_dependencies(clickhouse-server-lib clickhouse_server_configs)
|
add_dependencies(clickhouse-server-lib clickhouse_server_configs)
|
||||||
|
endif ()
|
||||||
|
Loading…
Reference in New Issue
Block a user