Use gersemi for CMake formatting (#257)

* Replace `cmake-format` with `gersemi`

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Remove .cmake-format.yaml

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update workflow to use gersemi

Signed-off-by: David Galiffi <David.Galiffi@amd.com>

* Update CONTRIBUTING.md

* Update helper scripts

* Don't include `*/external/*` in workflows

---------

Signed-off-by: David Galiffi <David.Galiffi@amd.com>
Tento commit je obsažen v:
David Galiffi
2025-06-22 10:44:33 -04:00
odevzdal GitHub
rodič 1e13b590e7
revize 122623a929
106 změnil soubory, kde provedl 5116 přidání a 3156 odebrání
+73 -50
Zobrazit soubor
@@ -18,24 +18,25 @@ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME python)
# ########################################################################################
function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION)
add_library(rocprofiler-systems::${_TARGET} ALIAS ${_TARGET})
target_link_libraries(${_TARGET} PRIVATE libpyrocprofiler-systems-interface)
add_dependencies(libpyrocprofsys ${_TARGET})
set_target_properties(
${_TARGET}
PROPERTIES PREFIX ""
OUTPUT_NAME libpyrocprofsys
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
PDB_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
${EXTRA_PROPERTIES})
PROPERTIES
PREFIX ""
OUTPUT_NAME libpyrocprofsys
LIBRARY_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
ARCHIVE_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
RUNTIME_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
PDB_OUTPUT_DIRECTORY
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
${EXTRA_PROPERTIES}
)
set(_PYLIB ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys)
if(NOT IS_ABSOLUTE "${_PYLIB}")
@@ -45,28 +46,34 @@ function(ROCPROFILER_SYSTEMS_CONFIGURE_PYTARGET _TARGET _VERSION)
if(SKBUILD)
set(LIB_RELPATH ../../..)
else()
file(RELATIVE_PATH LIB_RELPATH "${_PYLIB}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
file(
RELATIVE_PATH
LIB_RELPATH
"${_PYLIB}"
"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}"
)
endif()
set_target_properties(${_TARGET} PROPERTIES INSTALL_RPATH
"\$ORIGIN:\$ORIGIN/${LIB_RELPATH}")
set_target_properties(
${_TARGET}
PROPERTIES INSTALL_RPATH "\$ORIGIN:\$ORIGIN/${LIB_RELPATH}"
)
install(
TARGETS ${_TARGET}
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
OPTIONAL)
install(TARGETS ${_TARGET} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL)
endfunction()
# ########################################################################################
add_library(rocprofiler-systems-python-compile-options INTERFACE)
add_library(rocprofiler-systems::rocprofiler-systems-python-compile-options ALIAS
rocprofiler-systems-python-compile-options)
add_library(
rocprofiler-systems::rocprofiler-systems-python-compile-options
ALIAS rocprofiler-systems-python-compile-options
)
add_target_cxx_flag_if_avail(
rocprofiler-systems-python-compile-options "-Wno-unused-value"
"-Wno-range-loop-analysis" "-Wno-deprecated-declarations"
"-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic")
"-Wno-unused-but-set-parameter" "-ftls-model=global-dynamic"
)
file(GLOB pyheaders ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys*.hpp)
set(pysources ${CMAKE_CURRENT_LIST_DIR}/libpyrocprofsys.cpp)
@@ -76,32 +83,36 @@ set(pybind_libs pybind11::module)
add_library(libpyrocprofiler-systems-interface INTERFACE)
target_link_libraries(
libpyrocprofiler-systems-interface
INTERFACE pybind11::module
timemory::timemory-headers
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-compile-options
rocprofiler-systems::rocprofiler-systems-static-libgcc-optional
rocprofiler-systems::rocprofiler-systems-lto
rocprofiler-systems::rocprofiler-systems-dl-library
rocprofiler-systems::rocprofiler-systems-user-library
rocprofiler-systems::rocprofiler-systems-python
rocprofiler-systems::rocprofiler-systems-python-compile-options)
INTERFACE
pybind11::module
timemory::timemory-headers
rocprofiler-systems::rocprofiler-systems-headers
rocprofiler-systems::rocprofiler-systems-compile-options
rocprofiler-systems::rocprofiler-systems-static-libgcc-optional
rocprofiler-systems::rocprofiler-systems-lto
rocprofiler-systems::rocprofiler-systems-dl-library
rocprofiler-systems::rocprofiler-systems-user-library
rocprofiler-systems::rocprofiler-systems-python
rocprofiler-systems::rocprofiler-systems-python-compile-options
)
rocprofiler_systems_target_compile_definitions(libpyrocprofiler-systems-interface
INTERFACE ROCPROFSYS_PYBIND11_SOURCE)
INTERFACE ROCPROFSYS_PYBIND11_SOURCE
)
add_custom_target(libpyrocprofsys)
file(GLOB_RECURSE PYTHON_FILES ${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys/*.py)
foreach(_IN ${PYTHON_FILES})
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys"
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys" _OUT
"${_IN}")
string(
REPLACE
"${CMAKE_CURRENT_SOURCE_DIR}/rocprofsys"
"${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/rocprofsys"
_OUT
"${_IN}"
)
configure_file(${_IN} ${_OUT} @ONLY)
install(
FILES ${_OUT}
DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys
OPTIONAL)
install(FILES ${_OUT} DESTINATION ${CMAKE_INSTALL_PYTHONDIR}/rocprofsys OPTIONAL)
endforeach()
rocprofiler_systems_python_console_script("${BINARY_NAME_PREFIX}-python" "rocprofsys")
@@ -113,22 +124,34 @@ foreach(_VERSION ${ROCPROFSYS_PYTHON_VERSIONS})
rocprofiler_systems_pybind11_add_module(
libpyrocprofiler-systems-${_VERSION} MODULE
PYTHON_VERSION ${_VERSION}
VISIBILITY "hidden" ${pysources} ${pyheaders})
VISIBILITY "hidden" ${pysources} ${pyheaders}
)
rocprofiler_systems_configure_pytarget(libpyrocprofiler-systems-${_VERSION}
${_VERSION})
${_VERSION}
)
if(ROCPROFSYS_USE_PYTHON)
rocprofiler_systems_python_console_script(
"${BINARY_NAME_PREFIX}-python" "rocprofsys"
VERSION ${_VERSION}
ROOT_DIR "${Python3_ROOT_DIR}")
ROOT_DIR "${Python3_ROOT_DIR}"
)
endif()
math(EXPR _INDEX "${_INDEX} + 1")
endforeach()
configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.py.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg @ONLY)
configure_file(${CMAKE_CURRENT_LIST_DIR}/pyproject.toml
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml COPYONLY)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/setup.py.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.py
@ONLY
)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/setup.cfg.in
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/setup.cfg
@ONLY
)
configure_file(
${CMAKE_CURRENT_LIST_DIR}/pyproject.toml
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}/pyproject.toml
COPYONLY
)