-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Before: ``` build_debug$ ls -lh samples/hello_service/userver-samples-hello_service -rwxrwxr-x 1 segoon segoon 78M Jan 28 19:32 samples/hello_service/userver-samples-hello_service ``` After: ``` build_debug$ ls -lh samples/hello_service/userver-samples-hello_service -rwxrwxr-x 1 segoon segoon 37M Jan 28 19:20 samples/hello_service/userver-samples-hello_service ``` commit_hash:d09e127fadf845e60d1f4be0e59879148a1ac1f5
- Loading branch information
Showing
4 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
function(setup_linker_debug_info_compression) | ||
write_file("${CMAKE_CURRENT_BINARY_DIR}/empty.cpp" "int main() {return 0;}") | ||
try_compile(LINKER_HAS_ZSTD ${CMAKE_CURRENT_BINARY_DIR} | ||
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/empty.cpp | ||
LINK_OPTIONS -Werror -gz=zstd | ||
) | ||
if (NOT LINKER_HAS_ZSTD) | ||
try_compile(LINKER_HAS_GZ ${CMAKE_CURRENT_BINARY_DIR} | ||
SOURCES ${CMAKE_CURRENT_BINARY_DIR}/empty.cpp | ||
LINK_OPTIONS -Werror -gz | ||
) | ||
endif() | ||
|
||
if(LINKER_HAS_ZSTD) | ||
message(STATUS "Using linker debug info compression: zstd") | ||
add_link_options("-gz=zstd") | ||
elseif(LINKER_HAS_GZ) | ||
message(STATUS "Using linker debug info compression: z") | ||
add_link_options("-gz") | ||
else() | ||
message(STATUS "Using linker debug info compression: none") | ||
endif() | ||
endfunction() | ||
|
||
function(setup_compiler_debug_info_compression) | ||
userver_is_cxx_compile_option_supported(COMPILER_HAS_ZSTD "-gz=zstd") | ||
|
||
if(COMPILER_HAS_ZSTD) | ||
message(STATUS "Using compiler debug info compression: zstd") | ||
add_compile_options("-gz=zstd") | ||
else() | ||
message(STATUS "Using compiler debug info compression: z") | ||
add_compile_options("-gz") | ||
endif() | ||
endfunction() | ||
|
||
setup_linker_debug_info_compression() | ||
setup_compiler_debug_info_compression() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters