CMAKE - Format with cmake-format
Change-Id: I08e71fc5060b1f6e0168225cc5fe66886c2044bd Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Этот коммит содержится в:
1 родитель
f89beb90f5
Коммит
fa8b89f4ae
18 files changed
+515
-437
No files matched your search
@@ -10,9 +10,7 @@ list(APPEND CMAKE_PREFIX_PATH ${ROCM_DIR})
|
||||
|
||||
find_library(
|
||||
${NAME}_LIBRARY
|
||||
NAMES ${NAME} ${NAME}64
|
||||
REQUIRED
|
||||
REGISTRY_VIEW BOTH
|
||||
NAMES ${NAME} ${NAME}64 REQUIRED REGISTRY_VIEW BOTH
|
||||
PATH_SUFFIXES lib)
|
||||
|
||||
if(NOT DEFINED (${NAME}_INCLUDE_DIR))
|
||||
@@ -24,16 +22,16 @@ if(NOT DEFINED (${NAME}_INCLUDE_DIR))
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(${NAME}
|
||||
find_package_handle_standard_args(
|
||||
${NAME}
|
||||
FOUND_VAR ${NAME}_FOUND
|
||||
REQUIRED_VARS
|
||||
${NAME}_LIBRARY
|
||||
${NAME}_INCLUDE_DIR)
|
||||
REQUIRED_VARS ${NAME}_LIBRARY ${NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${NAME}_FOUND AND NOT TARGET ${NAME}::${NAME})
|
||||
add_library(${NAME}::${NAME} UNKNOWN IMPORTED)
|
||||
set_target_properties(${NAME}::${NAME} PROPERTIES
|
||||
IMPORTED_LOCATION "${${NAME}_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_${NAME}_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${${NAME}_INCLUDE_DIR}")
|
||||
set_target_properties(
|
||||
${NAME}::${NAME}
|
||||
PROPERTIES IMPORTED_LOCATION "${${NAME}_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_${NAME}_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${${NAME}_INCLUDE_DIR}")
|
||||
endif()
|
||||
@@ -11,8 +11,7 @@ list(APPEND CMAKE_PREFIX_PATH ${ROCM_DIR})
|
||||
find_library(
|
||||
${NAME}_LIBRARY
|
||||
NAMES ${NAME} ${NAME}64 ${NAME}lib # RVS is special and is named librvslib.so
|
||||
REQUIRED
|
||||
REGISTRY_VIEW BOTH
|
||||
REQUIRED REGISTRY_VIEW BOTH
|
||||
PATH_SUFFIXES lib)
|
||||
|
||||
if(NOT DEFINED (${NAME}_INCLUDE_DIR))
|
||||
@@ -24,21 +23,19 @@ if(NOT DEFINED (${NAME}_INCLUDE_DIR))
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(${NAME}
|
||||
find_package_handle_standard_args(
|
||||
${NAME}
|
||||
FOUND_VAR ${NAME}_FOUND
|
||||
REQUIRED_VARS
|
||||
${NAME}_LIBRARY
|
||||
${NAME}_INCLUDE_DIR)
|
||||
REQUIRED_VARS ${NAME}_LIBRARY ${NAME}_INCLUDE_DIR)
|
||||
|
||||
if(${NAME}_FOUND AND NOT TARGET ${NAME}::${NAME})
|
||||
add_library(${NAME}::${NAME} UNKNOWN IMPORTED)
|
||||
set_target_properties(${NAME}::${NAME} PROPERTIES
|
||||
IMPORTED_LOCATION "${${NAME}_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_${NAME}_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${${NAME}_INCLUDE_DIR}")
|
||||
find_library(rocm-core
|
||||
NAMES rocm-core
|
||||
REQUIRED)
|
||||
set_target_properties(
|
||||
${NAME}::${NAME}
|
||||
PROPERTIES IMPORTED_LOCATION "${${NAME}_LIBRARY}"
|
||||
INTERFACE_COMPILE_OPTIONS "${PC_${NAME}_CFLAGS_OTHER}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${${NAME}_INCLUDE_DIR}")
|
||||
find_library(rocm-core NAMES rocm-core REQUIRED)
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
find_package(rocblas REQUIRED)
|
||||
find_package(hipblaslt REQUIRED)
|
||||
@@ -46,6 +43,14 @@ if(${NAME}_FOUND AND NOT TARGET ${NAME}::${NAME})
|
||||
find_package(hip REQUIRED)
|
||||
find_package(hsa-runtime64 REQUIRED)
|
||||
find_package(amd_smi REQUIRED)
|
||||
target_link_libraries(${NAME}::${NAME} INTERFACE
|
||||
${rocm-core} yaml-cpp roc::rocblas roc::hipblaslt hsakmt::hsakmt hip::amdhip64 hsa-runtime64::hsa-runtime64 amd_smi)
|
||||
target_link_libraries(
|
||||
${NAME}::${NAME}
|
||||
INTERFACE ${rocm-core}
|
||||
yaml-cpp
|
||||
roc::rocblas
|
||||
roc::hipblaslt
|
||||
hsakmt::hsakmt
|
||||
hip::amdhip64
|
||||
hsa-runtime64::hsa-runtime64
|
||||
amd_smi)
|
||||
endif()
|
||||
@@ -2,11 +2,10 @@ set(PACKAGE_VERSION "@RDC_VERSION@")
|
||||
|
||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -10,7 +10,6 @@ get_filename_component(RDC_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
set(ROCM_RDC_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
set(ROCM_RDC_LIB_DIR "${PACKAGE_PREFIX_DIR}/${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
|
||||
# Our library dependencies (contains definitions for IMPORTED targets)
|
||||
if(NOT TARGET rdc_libs AND NOT rdc_BINARY_DIR)
|
||||
include("${RDC_CMAKE_DIR}/rdcTargets.cmake")
|
||||
@@ -18,4 +17,3 @@ endif()
|
||||
|
||||
# These are IMPORTED targets created by rdcTargets.cmake
|
||||
set(ROCM_RDC_LIBRARIES "@CONF_LIBS@")
|
||||
|
||||
@@ -43,84 +43,108 @@
|
||||
## Parses the VERSION_STRING variable and places
|
||||
## the first, second and third number values in
|
||||
## the major, minor and patch variables.
|
||||
function( parse_version VERSION_STRING )
|
||||
function(parse_version VERSION_STRING)
|
||||
|
||||
string ( FIND ${VERSION_STRING} "-" STRING_INDEX )
|
||||
string(FIND ${VERSION_STRING} "-" STRING_INDEX)
|
||||
|
||||
if ( ${STRING_INDEX} GREATER -1 )
|
||||
math ( EXPR STRING_INDEX "${STRING_INDEX} + 1" )
|
||||
string ( SUBSTRING ${VERSION_STRING} ${STRING_INDEX} -1 VERSION_BUILD )
|
||||
endif ()
|
||||
if(${STRING_INDEX} GREATER -1)
|
||||
math(EXPR STRING_INDEX "${STRING_INDEX} + 1")
|
||||
string(SUBSTRING ${VERSION_STRING} ${STRING_INDEX} -1 VERSION_BUILD)
|
||||
endif()
|
||||
|
||||
string ( REGEX MATCHALL "[0123456789]+" VERSIONS ${VERSION_STRING} )
|
||||
list ( LENGTH VERSIONS VERSION_COUNT )
|
||||
string(REGEX MATCHALL "[0123456789]+" VERSIONS ${VERSION_STRING})
|
||||
list(LENGTH VERSIONS VERSION_COUNT)
|
||||
|
||||
if ( ${VERSION_COUNT} GREATER 0)
|
||||
list ( GET VERSIONS 0 MAJOR )
|
||||
set ( VERSION_MAJOR ${MAJOR} PARENT_SCOPE )
|
||||
set ( TEMP_VERSION_STRING "${MAJOR}" )
|
||||
endif ()
|
||||
if(${VERSION_COUNT} GREATER 0)
|
||||
list(GET VERSIONS 0 MAJOR)
|
||||
set(VERSION_MAJOR
|
||||
${MAJOR}
|
||||
PARENT_SCOPE)
|
||||
set(TEMP_VERSION_STRING "${MAJOR}")
|
||||
endif()
|
||||
|
||||
if ( ${VERSION_COUNT} GREATER 1 )
|
||||
list ( GET VERSIONS 1 MINOR )
|
||||
set ( VERSION_MINOR ${MINOR} PARENT_SCOPE )
|
||||
set ( TEMP_VERSION_STRING "${TEMP_VERSION_STRING}.${MINOR}" )
|
||||
endif ()
|
||||
if(${VERSION_COUNT} GREATER 1)
|
||||
list(GET VERSIONS 1 MINOR)
|
||||
set(VERSION_MINOR
|
||||
${MINOR}
|
||||
PARENT_SCOPE)
|
||||
set(TEMP_VERSION_STRING "${TEMP_VERSION_STRING}.${MINOR}")
|
||||
endif()
|
||||
|
||||
if ( ${VERSION_COUNT} GREATER 2 )
|
||||
list ( GET VERSIONS 2 PATCH )
|
||||
set ( VERSION_PATCH ${PATCH} PARENT_SCOPE )
|
||||
set ( TEMP_VERSION_STRING "${TEMP_VERSION_STRING}.${PATCH}" )
|
||||
endif ()
|
||||
if(${VERSION_COUNT} GREATER 2)
|
||||
list(GET VERSIONS 2 PATCH)
|
||||
set(VERSION_PATCH
|
||||
${PATCH}
|
||||
PARENT_SCOPE)
|
||||
set(TEMP_VERSION_STRING "${TEMP_VERSION_STRING}.${PATCH}")
|
||||
endif()
|
||||
|
||||
set ( VERSION_STRING "${TEMP_VERSION_STRING}" PARENT_SCOPE )
|
||||
set(VERSION_STRING
|
||||
"${TEMP_VERSION_STRING}"
|
||||
PARENT_SCOPE)
|
||||
|
||||
endfunction ()
|
||||
endfunction()
|
||||
|
||||
## Gets the current version of the repository
|
||||
## using versioning tags and git describe.
|
||||
## Passes back a packaging version string
|
||||
## and a library version string.
|
||||
function(get_version_from_tag DEFAULT_VERSION_STRING VERSION_PREFIX GIT)
|
||||
parse_version ( ${DEFAULT_VERSION_STRING} )
|
||||
parse_version(${DEFAULT_VERSION_STRING})
|
||||
|
||||
if ( GIT )
|
||||
execute_process ( COMMAND git describe --tags --dirty --long --match ${VERSION_PREFIX}-[0-9.]*
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_TAG_STRING
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE RESULT )
|
||||
if ( ${RESULT} EQUAL 0 )
|
||||
parse_version ( ${GIT_TAG_STRING} )
|
||||
endif ()
|
||||
if(GIT)
|
||||
execute_process(
|
||||
COMMAND git describe --tags --dirty --long --match ${VERSION_PREFIX}-[0-9.]*
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_TAG_STRING
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE RESULT)
|
||||
if(${RESULT} EQUAL 0)
|
||||
parse_version(${GIT_TAG_STRING})
|
||||
endif()
|
||||
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
set( VERSION_STRING "${VERSION_STRING}" PARENT_SCOPE )
|
||||
set( VERSION_MAJOR "${VERSION_MAJOR}" PARENT_SCOPE )
|
||||
set( VERSION_MINOR "${VERSION_MINOR}" PARENT_SCOPE )
|
||||
set( VERSION_PATCH "${VERSION_PATCH}" PARENT_SCOPE )
|
||||
set(VERSION_STRING
|
||||
"${VERSION_STRING}"
|
||||
PARENT_SCOPE)
|
||||
set(VERSION_MAJOR
|
||||
"${VERSION_MAJOR}"
|
||||
PARENT_SCOPE)
|
||||
set(VERSION_MINOR
|
||||
"${VERSION_MINOR}"
|
||||
PARENT_SCOPE)
|
||||
set(VERSION_PATCH
|
||||
"${VERSION_PATCH}"
|
||||
PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(num_change_since_prev_pkg VERSION_PREFIX)
|
||||
find_program(get_commits NAMES version_util.sh
|
||||
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
|
||||
if (get_commits)
|
||||
execute_process( COMMAND ${get_commits} -c ${VERSION_PREFIX}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE NUM_COMMITS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE RESULT )
|
||||
find_program(
|
||||
get_commits
|
||||
NAMES version_util.sh
|
||||
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules)
|
||||
if(get_commits)
|
||||
execute_process(
|
||||
COMMAND ${get_commits} -c ${VERSION_PREFIX}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE NUM_COMMITS
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
RESULT_VARIABLE RESULT)
|
||||
|
||||
set(NUM_COMMITS "${NUM_COMMITS}" PARENT_SCOPE )
|
||||
set(NUM_COMMITS
|
||||
"${NUM_COMMITS}"
|
||||
PARENT_SCOPE)
|
||||
|
||||
if ( ${RESULT} EQUAL 0 )
|
||||
message("${NUM_COMMITS} were found since previous release")
|
||||
if(${RESULT} EQUAL 0)
|
||||
message("${NUM_COMMITS} were found since previous release")
|
||||
else()
|
||||
message("Unable to determine number of commits since previous release")
|
||||
message("Unable to determine number of commits since previous release")
|
||||
endif()
|
||||
else()
|
||||
message("WARNING: Didn't find version_util.sh")
|
||||
set(NUM_COMMITS "unknown" PARENT_SCOPE )
|
||||
set(NUM_COMMITS
|
||||
"unknown"
|
||||
PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
Reference in new issue
Block a user