Files
rocm-systems/projects/rocprofiler-systems/source/lib/CMakeLists.txt
T
Milan Radosavljevic 318d13870f [rocprofiler-systems] Update logging to use spdlog library (#2428)
## Motivation

- Structured logging with proper log levels (TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL)
- Better performance through compile-time formatting
- Consistent formatting using fmt library
- Runtime log level control via arguments and environment variables
- Easier maintenance and debugging capabilities

## Technical Details

- Added spdlog as a submodule and integrated it into CMake build system
- Created new `rocprofiler-systems-logger` library wrapping spdlog functionality
- Replaced custom logging macros (`ROCPROFSYS_VERBOSE`, `ROCPROFSYS_DEBUG`, `ROCPROFSYS_FATAL`, `ROCPROFSYS_REQUIRE`, `ROCPROFSYS_CI_THROW`, etc.) with spdlog equivalents (`LOG_DEBUG`, `LOG_WARNING`, `LOG_CRITICAL`, etc.)
- Implemented log level control through command-line arguments and environment variables
- Converted assertion macros to proper error handling with exceptions and std::abort()
2026-01-14 15:27:51 -05:00

80 sor
3.3 KiB
CMake

# ----------------------------------------------------------------------------- #
#
# rocprofiler-systems: contains all instrumentation functionality
#
# rocprofiler-systems-dl: contains minimal symbols and dlopen's rocprofiler-systems
#
# rocprofiler-systems-user: contains symbols for user API
#
# ----------------------------------------------------------------------------- #
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
cmake_policy(SET CMP0115 NEW)
endif()
set(ROCPROFSYS_LIB_INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${PROJECT_NAME}")
# ------------------------------------------------------------------------------#
#
# rocprofiler-systems interface library
#
# ------------------------------------------------------------------------------#
add_library(rocprofiler-systems-interface-library INTERFACE)
add_library(
rocprofiler-systems::rocprofiler-systems-interface-library
ALIAS rocprofiler-systems-interface-library
)
target_include_directories(
rocprofiler-systems-interface-library
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/rocprof-sys
)
target_link_libraries(
rocprofiler-systems-interface-library
INTERFACE
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-headers>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-threading>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-common-library>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-options>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-compile-definitions>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-perfetto>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sqlite3>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-json>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-logger>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-timemory>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-elfutils>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-bfd>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-mpi>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-libva>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-ptl>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocm>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libgcc-optional>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-static-libstdcxx-optional>
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-sanitizer>
$<BUILD_INTERFACE:$<IF:$<BOOL:${ROCPROFSYS_BUILD_LTO}>,rocprofiler-systems::rocprofiler-systems-lto,>>
)
# ------------------------------------------------------------------------------#
#
# rocprofiler-systems internal libraries
#
# ------------------------------------------------------------------------------#
add_subdirectory(common)
add_subdirectory(core)
add_subdirectory(binary)
add_subdirectory(logger)
# ------------------------------------------------------------------------------#
#
# rocprofiler-systems exported libraries
#
# ------------------------------------------------------------------------------#
add_subdirectory(rocprof-sys)
add_subdirectory(rocprof-sys-dl)
add_subdirectory(rocprof-sys-rt)
add_subdirectory(rocprof-sys-user)