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>
Bu işleme şunda yer alıyor:
işlemeyi yapan:
GitHub
ebeveyn
1e13b590e7
işleme
122623a929
@@ -22,14 +22,14 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
if ! command -v cmake-format &> /dev/null; then
|
||||
echo "cmake-format could not be found. Please install it with 'pip install cmake-format' or 'apt install cmake-format'."
|
||||
if ! command -v gersemi &> /dev/null; then
|
||||
echo "gersemi could not be found. Please install it with 'pip install gersemi' or 'apt install gersemi'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in "$@"; do
|
||||
# Run cmake-format in-place
|
||||
cmake-format -i "$file"
|
||||
# Run gersemi in-place
|
||||
gersemi -i "$file"
|
||||
# Check if the file has changes using git diff
|
||||
if ! git diff --quiet -- "$file"; then
|
||||
echo "Formatted: $file"
|
||||
|
||||
@@ -25,8 +25,13 @@ cmake_minimum_required(VERSION 3.18.4)
|
||||
if(NOT DEFINED ROCPROFSYS_VERSION)
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../VERSION" FULL_VERSION_STRING LIMIT_COUNT 1)
|
||||
string(REGEX REPLACE "(\n|\r)" "" FULL_VERSION_STRING "${FULL_VERSION_STRING}")
|
||||
string(REGEX REPLACE "([0-9]+)\.([0-9]+)\.([0-9]+)(.*)" "\\1.\\2.\\3"
|
||||
ROCPROFSYS_VERSION "${FULL_VERSION_STRING}")
|
||||
string(
|
||||
REGEX REPLACE
|
||||
"([0-9]+)\.([0-9]+)\.([0-9]+)(.*)"
|
||||
"\\1.\\2.\\3"
|
||||
ROCPROFSYS_VERSION
|
||||
"${FULL_VERSION_STRING}"
|
||||
)
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
@@ -37,20 +42,22 @@ if(Git_FOUND AND EXISTS ".git")
|
||||
OUTPUT_VARIABLE ROCPROFSYS_GIT_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
||||
ERROR_QUIET)
|
||||
ERROR_QUIET
|
||||
)
|
||||
if(NOT _GIT_DESCRIBE_RESULT EQUAL 0)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe
|
||||
OUTPUT_VARIABLE ROCPROFSYS_GIT_TAG
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE _GIT_DESCRIBE_RESULT
|
||||
ERROR_QUIET)
|
||||
ERROR_QUIET
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
message(
|
||||
STATUS
|
||||
"Git not found or .git directory not found; using version ${ROCPROFSYS_VERSION}"
|
||||
)
|
||||
"Git not found or .git directory not found; using version ${ROCPROFSYS_VERSION}"
|
||||
)
|
||||
set(GIT_DESCRIBE "v${ROCPROFSYS_VERSION}")
|
||||
endif()
|
||||
|
||||
@@ -62,5 +69,8 @@ message(STATUS "Writing ${OUTPUT_DIR}/rocprofiler-systems-install.py.")
|
||||
message(STATUS "rocprofiler-systems version: ${ROCPROFSYS_VERSION}.")
|
||||
message(STATUS "rocprofiler-systems git describe: ${ROCPROFSYS_GIT_TAG}")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprof-sys-install.py.in
|
||||
${OUTPUT_DIR}/rocprofiler-systems-install.py @ONLY)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/../cmake/Templates/rocprof-sys-install.py.in
|
||||
${OUTPUT_DIR}/rocprofiler-systems-install.py
|
||||
@ONLY
|
||||
)
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle