-
Notifications
You must be signed in to change notification settings - Fork 412
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(various): add cmake-format (#10820)
Hey, so I realized we weren't really formatting our cmake files, and we have a lot of them, so maybe we should have a consistent style? ## Checklist - [X] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
- Loading branch information
Showing
15 changed files
with
430 additions
and
454 deletions.
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
61 changes: 34 additions & 27 deletions
61
ddtrace/internal/datadog/profiling/cmake/AnalysisFunc.cmake
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 |
---|---|---|
@@ -1,47 +1,54 @@ | ||
include(CheckIPOSupported) | ||
|
||
function(add_ddup_config target) | ||
target_compile_options(${target} PRIVATE | ||
"$<$<CONFIG:Debug>:-Og;-ggdb3>" | ||
"$<$<CONFIG:RelWithDebInfo>:-Os;-ggdb3>" | ||
"$<$<CONFIG:Release>:-Os>" | ||
-ffunction-sections -fno-semantic-interposition | ||
-Wall -Werror -Wextra -Wshadow -Wnon-virtual-dtor -Wold-style-cast | ||
) | ||
target_link_options(${target} PRIVATE | ||
"$<$<CONFIG:Release>:-s>" | ||
"$<$<CONFIG:RelWithDebInfo>:>" | ||
-Wl,--as-needed -Wl,-Bsymbolic-functions -Wl,--gc-sections -Wl,-z,nodelete -Wl,--exclude-libs,ALL | ||
) | ||
target_compile_options( | ||
${target} | ||
PRIVATE "$<$<CONFIG:Debug>:-Og;-ggdb3>" | ||
"$<$<CONFIG:RelWithDebInfo>:-Os;-ggdb3>" | ||
"$<$<CONFIG:Release>:-Os>" | ||
-ffunction-sections | ||
-fno-semantic-interposition | ||
-Wall | ||
-Werror | ||
-Wextra | ||
-Wshadow | ||
-Wnon-virtual-dtor | ||
-Wold-style-cast) | ||
target_link_options( | ||
${target} | ||
PRIVATE | ||
"$<$<CONFIG:Release>:-s>" | ||
"$<$<CONFIG:RelWithDebInfo>:>" | ||
-Wl,--as-needed | ||
-Wl,-Bsymbolic-functions | ||
-Wl,--gc-sections | ||
-Wl,-z,nodelete | ||
-Wl,--exclude-libs,ALL) | ||
|
||
# If we can IPO, then do so | ||
check_ipo_supported(RESULT result) | ||
if (result) | ||
set_property(TARGET ${target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) | ||
if(result) | ||
set_property(TARGET ${target} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) | ||
endif() | ||
|
||
# Propagate sanitizers | ||
if (SANITIZE_OPTIONS) | ||
# Some sanitizers (or the analysis--such as symbolization--tooling thereof) work better with frame | ||
# pointers, so we include it here. | ||
if(SANITIZE_OPTIONS) | ||
# Some sanitizers (or the analysis--such as symbolization--tooling thereof) work better with frame pointers, so | ||
# we include it here. | ||
target_compile_options(${target} PRIVATE -fsanitize=${SANITIZE_OPTIONS} -fno-omit-frame-pointer) | ||
target_link_options(${target} PRIVATE -fsanitize=${SANITIZE_OPTIONS}) | ||
|
||
# We need to do a little bit of work in order to ensure the dynamic *san libraries can be linked | ||
# Procedure adapted from datadog/ddprof :) | ||
# We need to do a little bit of work in order to ensure the dynamic *san libraries can be linked Procedure | ||
# adapted from datadog/ddprof :) | ||
execute_process( | ||
COMMAND ${CMAKE_CXX_COMPILER} -print-file-name= | ||
OUTPUT_VARIABLE LIBSAN_LIB_PATH | ||
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY | ||
) | ||
set_target_properties(${target} PROPERTIES | ||
INSTALL_RPATH ${LIBSAN_LIB_PATH} | ||
BUILD_RPATH ${LIBSAN_LIB_PATH} | ||
) | ||
OUTPUT_STRIP_TRAILING_WHITESPACE COMMAND_ERROR_IS_FATAL ANY) | ||
set_target_properties(${target} PROPERTIES INSTALL_RPATH ${LIBSAN_LIB_PATH} BUILD_RPATH ${LIBSAN_LIB_PATH}) | ||
endif() | ||
|
||
# If DO_FANALYZER is specified and we're using gcc, then we can use -fanalyzer | ||
if (DO_FANALYZER AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
target_compile_options(${target} PRIVATE -fanalyzer) | ||
if(DO_FANALYZER AND CMAKE_CXX_COMPILER_ID MATCHES "GNU") | ||
target_compile_options(${target} PRIVATE -fanalyzer) | ||
endif() | ||
endfunction() |
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
Oops, something went wrong.