Skip to content

Commit

Permalink
Format cmake files
Browse files Browse the repository at this point in the history
  • Loading branch information
dgaliffiAMD committed Oct 7, 2024
1 parent a3b228e commit 1ff0b45
Show file tree
Hide file tree
Showing 26 changed files with 112 additions and 97 deletions.
36 changes: 18 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,30 +117,30 @@ include(GNUInstallDirs) # install directories
include(MacroUtilities) # various functions and macros

if(CI_BUILD)
rocprof_sys_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." ON ADVANCED
NO_FEATURE)
rocprof_sys_add_option(ROCPROFSYS_BUILD_TESTING "Enable building the testing suite" ON
ADVANCED)
rocprof_sys_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." ON
ADVANCED NO_FEATURE)
rocprof_sys_add_option(ROCPROFSYS_BUILD_TESTING "Enable building the testing suite"
ON ADVANCED)
rocprof_sys_add_option(ROCPROFSYS_BUILD_DEBUG
"Enable building with extensive debug symbols" OFF ADVANCED)
"Enable building with extensive debug symbols" OFF ADVANCED)
rocprof_sys_add_option(
ROCPROFSYS_BUILD_HIDDEN_VISIBILITY
"Build with hidden visibility (disable for Debug builds)" OFF ADVANCED)
rocprof_sys_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries" OFF ADVANCED)
else()
rocprof_sys_add_option(ROCPROFSYS_BUILD_CI "Enable internal asserts, etc." OFF
ADVANCED NO_FEATURE)
ADVANCED NO_FEATURE)
rocprof_sys_add_option(ROCPROFSYS_BUILD_EXAMPLES "Enable building the examples" OFF
ADVANCED)
ADVANCED)
rocprof_sys_add_option(ROCPROFSYS_BUILD_TESTING "Enable building the testing suite"
OFF ADVANCED)
OFF ADVANCED)
rocprof_sys_add_option(ROCPROFSYS_BUILD_DEBUG
"Enable building with extensive debug symbols" OFF ADVANCED)
"Enable building with extensive debug symbols" OFF ADVANCED)
rocprof_sys_add_option(
ROCPROFSYS_BUILD_HIDDEN_VISIBILITY
"Build with hidden visibility (disable for Debug builds)" ON ADVANCED)
rocprof_sys_add_option(ROCPROFSYS_STRIP_LIBRARIES "Strip the libraries"
${_STRIP_LIBRARIES_DEFAULT} ADVANCED)
${_STRIP_LIBRARIES_DEFAULT} ADVANCED)
endif()

include(Compilers) # compiler identification
Expand All @@ -160,43 +160,43 @@ rocprof_sys_add_feature(CMAKE_CXX_STANDARD "CXX language standard")
rocprof_sys_add_option(CMAKE_CXX_STANDARD_REQUIRED "Require C++ language standard" ON)
rocprof_sys_add_option(CMAKE_CXX_EXTENSIONS "Compiler specific language extensions" OFF)
rocprof_sys_add_option(CMAKE_INSTALL_RPATH_USE_LINK_PATH
"Enable rpath to linked libraries" ON)
"Enable rpath to linked libraries" ON)
set(CMAKE_INSTALL_MESSAGE
"LAZY"
CACHE STRING "Installation message")
mark_as_advanced(CMAKE_INSTALL_MESSAGE)

rocprof_sys_add_option(ROCPROFSYS_USE_CLANG_TIDY "Enable clang-tidy" OFF)
rocprof_sys_add_option(ROCPROFSYS_USE_BFD
"Enable BFD support (map call-stack samples to LOC)" ON)
"Enable BFD support (map call-stack samples to LOC)" ON)
rocprof_sys_add_option(ROCPROFSYS_USE_MPI "Enable MPI support" OFF)
rocprof_sys_add_option(ROCPROFSYS_USE_HIP "Enable HIP support" ON)
rocprof_sys_add_option(ROCPROFSYS_USE_PAPI "Enable HW counter support via PAPI" ON)
rocprof_sys_add_option(ROCPROFSYS_USE_ROCTRACER "Enable roctracer support"
${ROCPROFSYS_USE_HIP})
${ROCPROFSYS_USE_HIP})
rocprof_sys_add_option(ROCPROFSYS_USE_ROCPROFILER "Enable rocprofiler support"
${ROCPROFSYS_USE_HIP})
${ROCPROFSYS_USE_HIP})
rocprof_sys_add_option(
ROCPROFSYS_USE_ROCM_SMI "Enable rocm-smi support for power/temp/etc. sampling"
${ROCPROFSYS_USE_HIP})
rocprof_sys_add_option(ROCPROFSYS_USE_RCCL "Enable RCCL support" ${ROCPROFSYS_USE_HIP})
rocprof_sys_add_option(ROCPROFSYS_USE_MPI_HEADERS
"Enable wrapping MPI functions w/o enabling MPI dependency" ON)
"Enable wrapping MPI functions w/o enabling MPI dependency" ON)
rocprof_sys_add_option(ROCPROFSYS_USE_OMPT "Enable OpenMP tools support" ON)
rocprof_sys_add_option(ROCPROFSYS_USE_PYTHON "Enable Python support" OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_DYNINST "Build dyninst from submodule" OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_LIBUNWIND "Build libunwind from submodule" ON)
rocprof_sys_add_option(ROCPROFSYS_BUILD_CODECOV "Build for code coverage" OFF)
rocprof_sys_add_option(ROCPROFSYS_INSTALL_PERFETTO_TOOLS
"Install perfetto tools (i.e. traced, perfetto, etc.)" OFF)
"Install perfetto tools (i.e. traced, perfetto, etc.)" OFF)

if(ROCPROFSYS_USE_PAPI)
rocprof_sys_add_option(ROCPROFSYS_BUILD_PAPI "Build PAPI from submodule" ON)
endif()

if(ROCPROFSYS_USE_PYTHON)
rocprof_sys_add_option(ROCPROFSYS_BUILD_PYTHON
"Build python bindings with internal pybind11" ON)
"Build python bindings with internal pybind11" ON)
elseif("$ENV{ROCPROFSYS_CI}")
# quiet warnings in dashboard
if(ROCPROFSYS_PYTHON_ENVS OR ROCPROFSYS_PYTHON_PREFIX)
Expand Down Expand Up @@ -330,7 +330,7 @@ if(ROCPROFSYS_BUILD_CODECOV)
rocprof_sys_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
rocprof_sys_save_variables(CODECOV_FLAGS VARIABLES CMAKE_C_FLAGS_${_BUILD_TYPE}
CMAKE_CXX_FLAGS_${_BUILD_TYPE})
CMAKE_CXX_FLAGS_${_BUILD_TYPE})
endforeach()

foreach(_BUILD_TYPE DEBUG MINSIZEREL RELWITHDEBINFO RELEASE)
Expand Down
45 changes: 24 additions & 21 deletions cmake/BuildSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,32 @@ rocprof_sys_add_option(
ROCPROFSYS_BUILD_DEVELOPER "Extra build flags for development like -Werror"
${ROCPROFSYS_BUILD_CI})
rocprof_sys_add_option(ROCPROFSYS_BUILD_RELEASE "Build with minimal debug line info" OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS "Extra optimization flags" OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS "Extra optimization flags"
OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_LTO "Build with link-time optimization" OFF)
rocprof_sys_add_option(ROCPROFSYS_USE_COMPILE_TIMING
"Build with timing metrics for compilation" OFF)
"Build with timing metrics for compilation" OFF)
rocprof_sys_add_option(ROCPROFSYS_USE_SANITIZER
"Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" OFF)
"Build with -fsanitze=\${ROCPROFSYS_SANITIZER_TYPE}" OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_STATIC_LIBGCC
"Build with -static-libgcc if possible" OFF)
"Build with -static-libgcc if possible" OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_STATIC_LIBSTDCXX
"Build with -static-libstdc++ if possible" OFF)
"Build with -static-libstdc++ if possible" OFF)
rocprof_sys_add_option(ROCPROFSYS_BUILD_STACK_PROTECTOR "Build with -fstack-protector" ON)
rocprof_sys_add_cache_option(
ROCPROFSYS_BUILD_LINKER
"If set to a non-empty value, pass -fuse-ld=\${ROCPROFSYS_BUILD_LINKER}" STRING "bfd")
rocprof_sys_add_cache_option(ROCPROFSYS_BUILD_NUMBER "Internal CI use" STRING "0" ADVANCED
NO_FEATURE)
rocprof_sys_add_cache_option(ROCPROFSYS_BUILD_NUMBER "Internal CI use" STRING "0"
ADVANCED NO_FEATURE)

rocprof_sys_add_interface_library(rocprof-sys-static-libgcc
"Link to static version of libgcc")
"Link to static version of libgcc")
rocprof_sys_add_interface_library(rocprof-sys-static-libstdcxx
"Link to static version of libstdc++")
"Link to static version of libstdc++")
rocprof_sys_add_interface_library(rocprof-sys-static-libgcc-optional
"Link to static version of libgcc")
"Link to static version of libgcc")
rocprof_sys_add_interface_library(rocprof-sys-static-libstdcxx-optional
"Link to static version of libstdc++")
"Link to static version of libstdc++")

target_compile_definitions(rocprof-sys-compile-options INTERFACE $<$<CONFIG:DEBUG>:DEBUG>)

Expand All @@ -49,12 +50,12 @@ set(ROCPROFSYS_SANITIZER_TYPE
CACHE STRING "Sanitizer type")
if(ROCPROFSYS_USE_SANITIZER)
rocprof_sys_add_feature(ROCPROFSYS_SANITIZER_TYPE
"Sanitizer type, e.g. leak, thread, address, memory, etc.")
"Sanitizer type, e.g. leak, thread, address, memory, etc.")
endif()

if(ROCPROFSYS_BUILD_CI)
rocprof_sys_target_compile_definitions(${LIBNAME}-compile-options
INTERFACE ROCPROFSYS_CI)
INTERFACE ROCPROFSYS_CI)
endif()

# ----------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -147,8 +148,8 @@ endif()
rocprof_sys_add_interface_library(rocprof-sys-compile-extra "Extra optimization flags")
if(NOT ROCPROFSYS_BUILD_CODECOV AND ROCPROFSYS_BUILD_EXTRA_OPTIMIZATIONS)
add_target_flag_if_avail(
rocprof-sys-compile-extra "-finline-functions" "-funroll-loops" "-ftree-vectorize"
"-ftree-loop-optimize" "-ftree-loop-vectorize")
rocprof-sys-compile-extra "-finline-functions" "-funroll-loops"
"-ftree-vectorize" "-ftree-loop-optimize" "-ftree-loop-vectorize")
endif()

if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Debug"
Expand Down Expand Up @@ -211,19 +212,21 @@ else()
endif()

if(ROCPROFSYS_USE_COMPILE_TIMING)
target_link_libraries(rocprof-sys-compile-options INTERFACE rocprof-sys-compile-timing)
target_link_libraries(rocprof-sys-compile-options
INTERFACE rocprof-sys-compile-timing)
endif()

# ----------------------------------------------------------------------------------------#
# fstack-protector
#
rocprof_sys_add_interface_library(rocprof-sys-stack-protector
"Adds stack-protector compiler flags")
"Adds stack-protector compiler flags")
add_target_flag_if_avail(rocprof-sys-stack-protector "-fstack-protector-strong"
"-Wstack-protector")

if(ROCPROFSYS_BUILD_STACK_PROTECTOR)
target_link_libraries(rocprof-sys-compile-options INTERFACE rocprof-sys-stack-protector)
target_link_libraries(rocprof-sys-compile-options
INTERFACE rocprof-sys-stack-protector)
endif()

# ----------------------------------------------------------------------------------------#
Expand Down Expand Up @@ -259,9 +262,9 @@ endif()
# visibility build flags
#
rocprof_sys_add_interface_library(rocprof-sys-default-visibility
"Adds -fvisibility=default compiler flag")
"Adds -fvisibility=default compiler flag")
rocprof_sys_add_interface_library(rocprof-sys-hidden-visibility
"Adds -fvisibility=hidden compiler flag")
"Adds -fvisibility=hidden compiler flag")

add_target_flag_if_avail(rocprof-sys-default-visibility "-fvisibility=default")
add_target_flag_if_avail(rocprof-sys-hidden-visibility "-fvisibility=hidden"
Expand Down Expand Up @@ -293,7 +296,7 @@ set(ROCPROFSYS_SANITIZER_TYPES
set_property(CACHE ROCPROFSYS_SANITIZER_TYPE PROPERTY STRINGS
"${ROCPROFSYS_SANITIZER_TYPES}")
rocprof_sys_add_interface_library(rocprof-sys-sanitizer-compile-options
"Adds compiler flags for sanitizers")
"Adds compiler flags for sanitizers")
rocprof_sys_add_interface_library(
rocprof-sys-sanitizer
"Adds compiler flags to enable ${ROCPROFSYS_SANITIZER_TYPE} sanitizer (-fsanitizer=${ROCPROFSYS_SANITIZER_TYPE})"
Expand Down
6 changes: 3 additions & 3 deletions cmake/ConfigCPack.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if(ROCPROFSYS_USE_MPI)
)
else()
rocprof_sys_add_feature(ROCPROFSYS_MPI_IMPL
"MPI implementation for CPack DEBIAN depends")
"MPI implementation for CPack DEBIAN depends")
endif()

if("${ROCPROFSYS_MPI_IMPL}" STREQUAL "openmpi")
Expand Down Expand Up @@ -249,13 +249,13 @@ rocprof_sys_add_feature(CPACK_DEBIAN_FILE_NAME "Debian file name")
rocprof_sys_add_feature(CPACK_DEBIAN_PACKAGE_RELEASE "Debian package release version")
rocprof_sys_add_feature(CPACK_DEBIAN_PACKAGE_DEPENDS "Debian package dependencies")
rocprof_sys_add_feature(CPACK_DEBIAN_PACKAGE_SHLIBDEPS
"Debian package shared library dependencies")
"Debian package shared library dependencies")

rocprof_sys_add_feature(CPACK_RPM_FILE_NAME "RPM file name")
rocprof_sys_add_feature(CPACK_RPM_PACKAGE_RELEASE "RPM package release version")
rocprof_sys_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package dependencies")
rocprof_sys_add_feature(CPACK_RPM_PACKAGE_AUTOREQPROV
"RPM package auto generate requires and provides")
"RPM package auto generate requires and provides")
rocprof_sys_add_feature(CPACK_RPM_PACKAGE_REQUIRES "RPM package requires")
rocprof_sys_add_feature(CPACK_RPM_PACKAGE_PROVIDES "RPM package provides")

Expand Down
6 changes: 4 additions & 2 deletions cmake/MacroUtilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ function(ROCPROF_SYS_STRIP_TARGET)
--keep-symbol="rocprof_sys_pop_trace"
--keep-symbol="rocprof_sys_push_region"
--keep-symbol="rocprof_sys_pop_region"
--keep-symbol="rocprof_sys_set_env" --keep-symbol="rocprof_sys_set_mpi"
--keep-symbol="rocprof_sys_set_env"
--keep-symbol="rocprof_sys_set_mpi"
--keep-symbol="rocprof_sys_reset_preload"
--keep-symbol="rocprof_sys_set_instrumented"
--keep-symbol="rocprof_sys_user_*" --keep-symbol="ompt_start_tool"
Expand Down Expand Up @@ -879,7 +880,8 @@ function(ROCPROF_SYS_INSTALL_TPL _TPL_TARGET _NEW_NAME _BUILD_TREE_DIR _COMPONEN
endforeach()

# build tree symbolic links
rocprof_sys_buildtree_tpl("${_TPL_TARGET}" "${_NEW_NAME}" "${_BUILD_TREE_DIR}" ${ARGN})
rocprof_sys_buildtree_tpl("${_TPL_TARGET}" "${_NEW_NAME}" "${_BUILD_TREE_DIR}"
${ARGN})

install(
FILES $<TARGET_FILE:${_TPL_TARGET}>
Expand Down
4 changes: 2 additions & 2 deletions cmake/PAPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ if(NOT EXISTS "${ROCPROFSYS_PAPI_INSTALL_DIR}")
endif()

rocprof_sys_add_option(ROCPROFSYS_PAPI_AUTO_COMPONENTS "Automatically enable components"
OFF)
OFF)

# -------------- PACKAGES -----------------------------------------------------

Expand Down Expand Up @@ -262,7 +262,7 @@ set(PAPI_pfm_STATIC_LIBRARY
target_include_directories(rocprof-sys-papi SYSTEM
INTERFACE $<BUILD_INTERFACE:${PAPI_INCLUDE_DIR}>)
target_link_libraries(rocprof-sys-papi INTERFACE $<BUILD_INTERFACE:${PAPI_LIBRARY}>
$<BUILD_INTERFACE:${PAPI_pfm_LIBRARY}>)
$<BUILD_INTERFACE:${PAPI_pfm_LIBRARY}>)
rocprof_sys_target_compile_definitions(
rocprof-sys-papi INTERFACE ROCPROFSYS_USE_PAPI $<BUILD_INTERFACE:TIMEMORY_USE_PAPI=1>)

Expand Down
Loading

0 comments on commit 1ff0b45

Please sign in to comment.