mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
c3506bf16d
- Uses a small assembly file to include binary resources, rather than objcopy - Updates `base/common/getResource.cpp` for this new method of inclusion - Removes linux-only guards in CMake files, as this solution is cross-platform. The resulting binary resources are available in the ClickHouse server binary on Linux, macOS, and illumos platforms. FreeBSD has not been tested, but will likely work as well.
18 lines
675 B
ArmAsm
18 lines
675 B
ArmAsm
// Embed a binary file into an executable.
|
|
|
|
// The variable BINARY_FILE_NAME is the actual name of the file to include
|
|
// The variable SYMBOL_NAME is the "normalized" name of the symbol, with
|
|
// symbols like `-`, `.`, and `/` replaced with `_`. This is to match how
|
|
// objcopy rewrites symbol names, and matches the expectation in
|
|
// `base/common/getResource.cpp`
|
|
|
|
.data
|
|
.global _binary_@SYMBOL_NAME@_start
|
|
_binary_@SYMBOL_NAME@_start:
|
|
.incbin "@BINARY_FILE_NAME@"
|
|
.global _binary_@SYMBOL_NAME@_end
|
|
_binary_@SYMBOL_NAME@_end:
|
|
.global _binary_@SYMBOL_NAME@_size
|
|
_binary_@SYMBOL_NAME@_size:
|
|
.quad _binary_@SYMBOL_NAME@_end - _binary_@SYMBOL_NAME@_start
|