File tree Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Expand file tree Collapse file tree 4 files changed +44
-1
lines changed Original file line number Diff line number Diff line change 402
402
"cmake/SetupCURL.cmake":"taxi/uservices/userver/cmake/SetupCURL.cmake",
403
403
"cmake/SetupClickhouseCPP.cmake":"taxi/uservices/userver/cmake/SetupClickhouseCPP.cmake",
404
404
"cmake/SetupCryptoPP.cmake":"taxi/uservices/userver/cmake/SetupCryptoPP.cmake",
405
+ "cmake/SetupDebugInfoCompression.cmake":"taxi/uservices/userver/cmake/SetupDebugInfoCompression.cmake",
405
406
"cmake/SetupFmt.cmake":"taxi/uservices/userver/cmake/SetupFmt.cmake",
406
407
"cmake/SetupGBench.cmake":"taxi/uservices/userver/cmake/SetupGBench.cmake",
407
408
"cmake/SetupGTest.cmake":"taxi/uservices/userver/cmake/SetupGTest.cmake",
Original file line number Diff line number Diff line change
1
+ function (setup_linker_debug_info_compression )
2
+ write_file ("${CMAKE_CURRENT_BINARY_DIR} /empty.cpp" "int main() {return 0;}" )
3
+ try_compile (LINKER_HAS_ZSTD ${CMAKE_CURRENT_BINARY_DIR}
4
+ SOURCES ${CMAKE_CURRENT_BINARY_DIR} /empty.cpp
5
+ LINK_OPTIONS -Werror -gz=zstd
6
+ )
7
+ if (NOT LINKER_HAS_ZSTD )
8
+ try_compile (LINKER_HAS_GZ ${CMAKE_CURRENT_BINARY_DIR}
9
+ SOURCES ${CMAKE_CURRENT_BINARY_DIR} /empty.cpp
10
+ LINK_OPTIONS -Werror -gz
11
+ )
12
+ endif ()
13
+
14
+ if (LINKER_HAS_ZSTD )
15
+ message (STATUS "Using linker debug info compression: zstd" )
16
+ add_link_options ("-gz=zstd" )
17
+ elseif (LINKER_HAS_GZ )
18
+ message (STATUS "Using linker debug info compression: z" )
19
+ add_link_options ("-gz" )
20
+ else ()
21
+ message (STATUS "Using linker debug info compression: none" )
22
+ endif ()
23
+ endfunction ()
24
+
25
+ function (setup_compiler_debug_info_compression )
26
+ userver_is_cxx_compile_option_supported (COMPILER_HAS_ZSTD "-gz=zstd" )
27
+
28
+ if (COMPILER_HAS_ZSTD )
29
+ message (STATUS "Using compiler debug info compression: zstd" )
30
+ add_compile_options ("-gz=zstd" )
31
+ else ()
32
+ message (STATUS "Using compiler debug info compression: z" )
33
+ add_compile_options ("-gz" )
34
+ endif ()
35
+ endfunction ()
36
+
37
+ setup_linker_debug_info_compression ()
38
+ setup_compiler_debug_info_compression ()
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ function(_userver_setup_environment_impl)
49
49
set (CMAKE_CXX_EXTENSIONS OFF PARENT_SCOPE )
50
50
set (CMAKE_VISIBILITY_INLINES_HIDDEN ON PARENT_SCOPE )
51
51
52
- add_compile_options ("-pipe" "-g" "-gz" "- fPIC" )
52
+ add_compile_options ("-pipe" "-g" "-fPIC" )
53
53
add_compile_definitions ("PIC=1" )
54
54
55
55
option (USERVER_COMPILATION_TIME_TRACE "Generate Clang compilation time trace" OFF )
@@ -63,6 +63,8 @@ function(_userver_setup_environment_impl)
63
63
include ("${USERVER_CMAKE_DIR} /SetupLinker.cmake" )
64
64
include ("${USERVER_CMAKE_DIR} /SetupLTO.cmake" )
65
65
include ("${USERVER_CMAKE_DIR} /SetupPGO.cmake" )
66
+ include ("${USERVER_CMAKE_DIR} /UserverCxxCompileOptionsIfSupported.cmake" )
67
+ include ("${USERVER_CMAKE_DIR} /SetupDebugInfoCompression.cmake" )
66
68
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} " PARENT_SCOPE )
67
69
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} " PARENT_SCOPE )
68
70
set (CMAKE_INTERPROCEDURAL_OPTIMIZATION "${CMAKE_INTERPROCEDURAL_OPTIMIZATION} " PARENT_SCOPE )
Original file line number Diff line number Diff line change @@ -396,8 +396,10 @@ _userver_directory_install(COMPONENT universal FILES
396
396
"${USERVER_ROOT_DIR} /cmake/SetupLTO.cmake"
397
397
"${USERVER_ROOT_DIR} /cmake/SetupPGO.cmake"
398
398
"${USERVER_ROOT_DIR} /cmake/SetupLinker.cmake"
399
+ "${USERVER_ROOT_DIR} /cmake/SetupDebugInfoCompression.cmake"
399
400
"${USERVER_ROOT_DIR} /cmake/SetupHomebrew.cmake"
400
401
"${USERVER_ROOT_DIR} /cmake/Sanitizers.cmake"
402
+ "${USERVER_ROOT_DIR} /cmake/UserverCxxCompileOptionsIfSupported.cmake"
401
403
"${USERVER_ROOT_DIR} /cmake/AddGoogleTests.cmake"
402
404
"${USERVER_ROOT_DIR} /cmake/DetectVersion.cmake"
403
405
"${USERVER_ROOT_DIR} /cmake/UserverSetupEnvironment.cmake"
You can’t perform that action at this time.
0 commit comments