SWDEV-290637 - Migrate cmake build from hip to hipamd
Change-Id: I31baef5a76ea0721927598615794437999ec195e
[ROCm/hip commit: 4903b0d834]
Этот коммит содержится в:
коммит произвёл
Anusha Godavarthy Surya
родитель
9e9b89c4c3
Коммит
7638199a50
@@ -1,527 +0,0 @@
|
||||
# Copyright (C) 2016-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(hip)
|
||||
|
||||
# sample command for hip-rocclr runtime, you'll need to have rocclr built
|
||||
# For shared lib of hip-rocclr runtime
|
||||
# For release version
|
||||
# cmake -DCMAKE_PREFIX_PATH="$ROCclr_DIR/build;/opt/rocm/" -DCMAKE_INSTALL_PREFIX=</where/to/install/hip> ..
|
||||
# For debug version
|
||||
# cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$ROCclr_DIR/build;/opt/rocm/" -DCMAKE_INSTALL_PREFIX=</where/to/install/hip> ..
|
||||
# For static lib of hip-rocclr runtime
|
||||
# For release version
|
||||
# cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_PREFIX_PATH="$ROCclr_DIR/build;/opt/rocm/" -DCMAKE_INSTALL_PREFIX=</where/to/install/hip> ..
|
||||
# For debug version
|
||||
# cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_PREFIX_PATH="$ROCclr_DIR/build;/opt/rocm/" -DCMAKE_INSTALL_PREFIX=</where/to/install/hip> ..
|
||||
# If you don't specify CMAKE_INSTALL_PREFIX, hip-rocclr runtime will be installed to "/opt/rocm/hip".
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
#############################
|
||||
# Options
|
||||
#############################
|
||||
option(BUILD_HIPIFY_CLANG "Enable building the CUDA->HIP converter" OFF)
|
||||
option(__HIP_ENABLE_PCH "Enable/Disable pre-compiled hip headers" ON)
|
||||
option(__HIP_ENABLE_RTC "Enable/Disable pre-processed hiprtc shared lib" ON)
|
||||
|
||||
if(__HIP_ENABLE_PCH)
|
||||
set(_pchStatus 1)
|
||||
else()
|
||||
set(_pchStatus 0)
|
||||
endif()
|
||||
|
||||
# With HIP project split plan, for interim puropose it is REQUIRED to pass
|
||||
# HIP_AMD_BACKEND_SOURCE_DIR=<hipamd source dir> as cmake variable_
|
||||
if(NOT DEFINED HIP_AMD_BACKEND_SOURCE_DIR)
|
||||
message(FATAL_ERROR "HIP_AMD_BACKEND_SOURCE_DIR not defined ")
|
||||
endif()
|
||||
|
||||
#############################
|
||||
# Setup config generation
|
||||
#############################
|
||||
string(TIMESTAMP _timestamp UTC)
|
||||
set(_versionInfo "# Auto-generated by cmake\n")
|
||||
set(_buildInfo "# Auto-generated by cmake on ${_timestamp} UTC\n")
|
||||
macro(add_to_config _configfile _variable)
|
||||
set(${_configfile} "${${_configfile}}${_variable}=${${_variable}}\n")
|
||||
endmacro()
|
||||
|
||||
#############################
|
||||
# Setup version information
|
||||
#############################
|
||||
# hipconfig is a perl script and is not trivially invokable on Windows.
|
||||
if(NOT WIN32)
|
||||
# Determine HIP_BASE_VERSION
|
||||
set(ENV{HIP_PATH} "")
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/hipconfig --version
|
||||
OUTPUT_VARIABLE HIP_BASE_VERSION
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
string(REPLACE "." ";" VERSION_LIST ${HIP_BASE_VERSION})
|
||||
list(GET VERSION_LIST 0 HIP_VERSION_MAJOR)
|
||||
list(GET VERSION_LIST 1 HIP_VERSION_MINOR)
|
||||
set(HIP_VERSION_GITDATE 0)
|
||||
endif()
|
||||
|
||||
find_package(Git)
|
||||
|
||||
# FIXME: Two different version strings used.
|
||||
# Below we use UNIX commands, not compatible with Windows.
|
||||
if(GIT_FOUND AND (NOT WIN32))
|
||||
# get date information based on UTC
|
||||
# use the last two digits of year + week number + day in the week as HIP_VERSION_GITDATE
|
||||
# use the commit date, instead of build date
|
||||
# add xargs to remove strange trailing newline character
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --format=@%ct
|
||||
COMMAND xargs
|
||||
COMMAND date -f - --utc +%y%U%w
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(git_result EQUAL 0)
|
||||
set(HIP_VERSION_GITDATE ${git_output})
|
||||
endif()
|
||||
|
||||
# get commit short hash
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(git_result EQUAL 0)
|
||||
set(HIP_VERSION_GITHASH ${git_output})
|
||||
endif()
|
||||
|
||||
# get commit count
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-list --count HEAD
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
RESULT_VARIABLE git_result
|
||||
OUTPUT_VARIABLE git_output
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(git_result EQUAL 0)
|
||||
set(HIP_VERSION_GITCOUNT ${git_output})
|
||||
endif()
|
||||
|
||||
set(HIP_VERSION_PATCH ${HIP_VERSION_GITDATE}-${HIP_VERSION_GITHASH})
|
||||
|
||||
if(DEFINED ENV{ROCM_LIBPATCH_VERSION})
|
||||
set(HIP_PACKAGING_VERSION_PATCH ${HIP_VERSION_GITDATE}.${HIP_VERSION_GITCOUNT}.$ENV{ROCM_LIBPATCH_VERSION})
|
||||
else()
|
||||
set(HIP_PACKAGING_VERSION_PATCH ${HIP_VERSION_GITDATE}.${HIP_VERSION_GITCOUNT}-${HIP_VERSION_GITHASH})
|
||||
endif()
|
||||
else()
|
||||
# FIXME: Some parts depend on this being set.
|
||||
set(HIP_PACKAGING_VERSION_PATCH "0")
|
||||
endif()
|
||||
|
||||
## Debian package specific variables
|
||||
if ( DEFINED ENV{CPACK_DEBIAN_PACKAGE_RELEASE} )
|
||||
set ( CPACK_DEBIAN_PACKAGE_RELEASE $ENV{CPACK_DEBIAN_PACKAGE_RELEASE} )
|
||||
else()
|
||||
set ( CPACK_DEBIAN_PACKAGE_RELEASE "local" )
|
||||
endif()
|
||||
message (STATUS "Using CPACK_DEBIAN_PACKAGE_RELEASE ${CPACK_DEBIAN_PACKAGE_RELEASE}" )
|
||||
|
||||
## RPM package specific variables
|
||||
if ( DEFINED ENV{CPACK_RPM_PACKAGE_RELEASE} )
|
||||
set ( CPACK_RPM_PACKAGE_RELEASE $ENV{CPACK_RPM_PACKAGE_RELEASE} )
|
||||
else()
|
||||
set ( CPACK_RPM_PACKAGE_RELEASE "local" )
|
||||
endif()
|
||||
|
||||
## 'dist' breaks manual builds on debian systems due to empty Provides
|
||||
execute_process( COMMAND rpm --eval %{?dist}
|
||||
RESULT_VARIABLE PROC_RESULT
|
||||
OUTPUT_VARIABLE EVAL_RESULT
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE )
|
||||
|
||||
if ( PROC_RESULT EQUAL "0" AND NOT EVAL_RESULT STREQUAL "" )
|
||||
string ( APPEND CPACK_RPM_PACKAGE_RELEASE "%{?dist}" )
|
||||
endif()
|
||||
message(STATUS "CPACK_RPM_PACKAGE_RELEASE: ${CPACK_RPM_PACKAGE_RELEASE}")
|
||||
|
||||
add_to_config(_versionInfo HIP_PACKAGING_VERSION_PATCH)
|
||||
add_to_config(_versionInfo CPACK_DEBIAN_PACKAGE_RELEASE)
|
||||
add_to_config(_versionInfo CPACK_RPM_PACKAGE_RELEASE)
|
||||
|
||||
add_to_config(_versionInfo HIP_VERSION_MAJOR)
|
||||
add_to_config(_versionInfo HIP_VERSION_MINOR)
|
||||
add_to_config(_versionInfo HIP_VERSION_PATCH)
|
||||
|
||||
set (HIP_LIB_VERSION_MAJOR ${HIP_VERSION_MAJOR})
|
||||
set (HIP_LIB_VERSION_MINOR ${HIP_VERSION_MINOR})
|
||||
if (${ROCM_PATCH_VERSION} )
|
||||
set (HIP_LIB_VERSION_PATCH ${ROCM_PATCH_VERSION})
|
||||
else ()
|
||||
set (HIP_LIB_VERSION_PATCH ${HIP_VERSION_PATCH})
|
||||
endif ()
|
||||
set (HIP_LIB_VERSION_STRING "${HIP_LIB_VERSION_MAJOR}.${HIP_LIB_VERSION_MINOR}.${HIP_LIB_VERSION_PATCH}")
|
||||
if (DEFINED ENV{ROCM_RPATH})
|
||||
set (CMAKE_INSTALL_RPATH "$ENV{ROCM_RPATH}")
|
||||
set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set (CMAKE_SKIP_BUILD_RPATH TRUE)
|
||||
endif ()
|
||||
|
||||
# overwrite HIP_VERSION_PATCH for packaging
|
||||
set(HIP_VERSION ${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_PACKAGING_VERSION_PATCH})
|
||||
|
||||
# Remove when CI is updated
|
||||
if(HIP_PLATFORM STREQUAL "rocclr")
|
||||
set(HIP_PLATFORM "amd")
|
||||
endif()
|
||||
#############################
|
||||
# Configure variables
|
||||
#############################
|
||||
# Determine HIP_PLATFORM
|
||||
if(NOT DEFINED HIP_PLATFORM)
|
||||
if(NOT DEFINED ENV{HIP_PLATFORM})
|
||||
execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/hipconfig --platform
|
||||
OUTPUT_VARIABLE HIP_PLATFORM
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
else()
|
||||
set(HIP_PLATFORM $ENV{HIP_PLATFORM} CACHE STRING "HIP Platform")
|
||||
endif()
|
||||
endif()
|
||||
message(STATUS "HIP Platform: " ${HIP_PLATFORM})
|
||||
|
||||
if(HIP_PLATFORM STREQUAL "nvidia")
|
||||
set(HIP_RUNTIME "cuda" CACHE STRING "HIP Runtime")
|
||||
set(HIP_COMPILER "nvcc" CACHE STRING "HIP Compiler")
|
||||
elseif(HIP_PLATFORM STREQUAL "amd")
|
||||
set(HIP_RUNTIME "rocclr" CACHE STRING "HIP Runtime")
|
||||
set(HIP_COMPILER "clang" CACHE STRING "HIP Compiler")
|
||||
else()
|
||||
message(FATAL_ERROR "Unexpected HIP_PLATFORM: " ${HIP_PLATFORM})
|
||||
endif()
|
||||
|
||||
message(STATUS "HIP Runtime: " ${HIP_RUNTIME})
|
||||
message(STATUS "HIP Compiler: " ${HIP_COMPILER})
|
||||
|
||||
add_to_config(_buildInfo HIP_RUNTIME)
|
||||
add_to_config(_buildInfo HIP_COMPILER)
|
||||
|
||||
# Set default build type
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
# Determine HIP install path
|
||||
if (UNIX)
|
||||
set(HIP_DEFAULT_INSTALL_PREFIX "/opt/rocm/hip")
|
||||
endif()
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
set(CMAKE_INSTALL_PREFIX ${HIP_DEFAULT_INSTALL_PREFIX} CACHE PATH "Installation path for HIP" FORCE)
|
||||
endif()
|
||||
|
||||
if(DEV_LOG_ENABLE MATCHES "yes")
|
||||
add_definitions(-DDEV_LOG_ENABLE)
|
||||
endif()
|
||||
|
||||
# Set default install path as "/opt/rocm/hip", can override the path from cmake build.
|
||||
set(CPACK_INSTALL_PREFIX ${HIP_DEFAULT_INSTALL_PREFIX} CACHE PATH "Package Installation path for HIP")
|
||||
|
||||
if(IS_ABSOLUTE ${CMAKE_INSTALL_PREFIX})
|
||||
message(STATUS "HIP will be installed in: " ${CMAKE_INSTALL_PREFIX})
|
||||
else()
|
||||
message(FATAL_ERROR "Don't know where to install HIP. Please specify absolute path using -DCMAKE_INSTALL_PREFIX")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED ROCM_PATH )
|
||||
set ( ROCM_PATH "/opt/rocm" CACHE STRING "Default ROCM installation directory." )
|
||||
endif ()
|
||||
message (STATUS "ROCM Installation path(ROCM_PATH): ${ROCM_PATH}")
|
||||
|
||||
# set the installation path for the installer package
|
||||
set(CPACK_SET_DESTDIR ON CACHE BOOL "Installer package will install hip to CMAKE_INSTALL_PREFIX instead of CPACK_PACKAGING_INSTALL_PREFIX")
|
||||
if (NOT CPACK_SET_DESTDIR)
|
||||
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/rocm/hip" CACHE PATH "Default installation path of hcc installer package")
|
||||
endif (NOT CPACK_SET_DESTDIR)
|
||||
|
||||
#############################
|
||||
# Build steps
|
||||
#############################
|
||||
set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include)
|
||||
set(CONFIG_PACKAGE_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/hip)
|
||||
set(CONFIG_LANG_PACKAGE_INSTALL_DIR ${LIB_INSTALL_DIR}/cmake/hip-lang)
|
||||
|
||||
# Build clang hipify if enabled
|
||||
if (BUILD_HIPIFY_CLANG)
|
||||
add_subdirectory(hipify-clang)
|
||||
endif()
|
||||
|
||||
# Workaround for current versioning logic not being compatible with Windows
|
||||
if(WIN32)
|
||||
set(HIP_VERSION_MAJOR 0)
|
||||
set(HIP_VERSION_MINOR 0)
|
||||
set(HIP_VERSION_GITDATE 0)
|
||||
endif()
|
||||
|
||||
# Generate hip_version.h
|
||||
set(_versionInfoHeader
|
||||
"// Auto-generated by cmake\n
|
||||
#ifndef HIP_VERSION_H
|
||||
#define HIP_VERSION_H\n
|
||||
#define HIP_VERSION_MAJOR ${HIP_VERSION_MAJOR}
|
||||
#define HIP_VERSION_MINOR ${HIP_VERSION_MINOR}
|
||||
#define HIP_VERSION_PATCH ${HIP_VERSION_GITDATE}
|
||||
#define HIP_VERSION (HIP_VERSION_MAJOR * 100 + HIP_VERSION_MINOR)\n
|
||||
#define __HIP_HAS_GET_PCH ${_pchStatus}\n
|
||||
#endif\n
|
||||
")
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/include/hip/hip_version.h" ${_versionInfoHeader})
|
||||
|
||||
if(HIP_RUNTIME STREQUAL "rocclr")
|
||||
set(HIP_COMMON_DIR ${PROJECT_SOURCE_DIR})
|
||||
add_subdirectory(${HIP_AMD_BACKEND_SOURCE_DIR} src/hipamd)
|
||||
endif()
|
||||
|
||||
# Generate .hipInfo
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/.hipInfo" ${_buildInfo})
|
||||
|
||||
# Generate .hipVersion
|
||||
file(WRITE "${PROJECT_BINARY_DIR}/.hipVersion" ${_versionInfo})
|
||||
|
||||
# Build doxygen documentation
|
||||
find_program(DOXYGEN_EXE doxygen)
|
||||
if(DOXYGEN_EXE)
|
||||
add_custom_target(doc COMMAND HIP_PATH=${CMAKE_CURRENT_SOURCE_DIR} ${DOXYGEN_EXE} ${CMAKE_CURRENT_SOURCE_DIR}/docs/doxygen-input/doxy.cfg
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/docs)
|
||||
endif()
|
||||
|
||||
#############################
|
||||
# Install steps
|
||||
#############################
|
||||
|
||||
# Install .hipInfo
|
||||
install(FILES ${PROJECT_BINARY_DIR}/.hipInfo DESTINATION lib)
|
||||
|
||||
# Install .hipVersion
|
||||
install(FILES ${PROJECT_BINARY_DIR}/.hipVersion DESTINATION bin)
|
||||
|
||||
# Install src, bin, include & cmake if necessary
|
||||
execute_process(COMMAND test ${CMAKE_INSTALL_PREFIX} -ef ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
RESULT_VARIABLE INSTALL_SOURCE)
|
||||
if(NOT ${INSTALL_SOURCE} EQUAL 0)
|
||||
# Exclude .bat files on Linux.
|
||||
if(WIN32)
|
||||
install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS)
|
||||
else()
|
||||
install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS
|
||||
PATTERN *.bat EXCLUDE)
|
||||
endif()
|
||||
|
||||
# The following two lines will be removed after upstream updation
|
||||
install(CODE "MESSAGE(\"Removing ${CMAKE_INSTALL_PREFIX}/include\")")
|
||||
install(CODE "file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/include)")
|
||||
|
||||
install(DIRECTORY include DESTINATION .)
|
||||
install(DIRECTORY ${HIP_AMD_BACKEND_SOURCE_DIR}/include/hip/ DESTINATION include/hip/)
|
||||
install(DIRECTORY cmake DESTINATION .)
|
||||
endif()
|
||||
|
||||
# Install generated headers
|
||||
# FIXME: Associate with individual targets.
|
||||
if(HIP_PLATFORM STREQUAL "amd")
|
||||
install(FILES ${PROJECT_BINARY_DIR}/include/hip/amd_detail/hip_prof_str.h
|
||||
DESTINATION include/hip/amd_detail)
|
||||
endif()
|
||||
install(FILES ${PROJECT_BINARY_DIR}/include/hip/hip_version.h
|
||||
DESTINATION include/hip)
|
||||
|
||||
#############################
|
||||
# hip-config
|
||||
#############################
|
||||
# Packaging invokes UNIX commands, which are not available on Windows.
|
||||
if(NOT WIN32)
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
configure_package_config_file(
|
||||
hip-config.cmake.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hip-config.cmake
|
||||
INSTALL_DESTINATION ${CONFIG_PACKAGE_INSTALL_DIR}
|
||||
PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR BIN_INSTALL_DIR
|
||||
)
|
||||
|
||||
write_basic_package_version_file(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hip-config-version.cmake
|
||||
VERSION "${HIP_VERSION_MAJOR}.${HIP_VERSION_MINOR}.${HIP_VERSION_GITDATE}"
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
install(
|
||||
FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hip-config.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/hip-config-version.cmake
|
||||
DESTINATION
|
||||
${CONFIG_PACKAGE_INSTALL_DIR}
|
||||
)
|
||||
|
||||
#############################
|
||||
# Packaging steps
|
||||
#############################
|
||||
# Package: hip_base
|
||||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/hip-base)
|
||||
configure_file(packaging/hip-base.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
|
||||
configure_file(packaging/hip-base.postinst ${BUILD_DIR}/postinst @ONLY)
|
||||
configure_file(packaging/hip-base.prerm ${BUILD_DIR}/prerm @ONLY)
|
||||
|
||||
add_custom_target(pkg_hip_base COMMAND ${CMAKE_COMMAND} .
|
||||
COMMAND rm -rf *.deb *.rpm *.tar.gz
|
||||
COMMAND make package
|
||||
COMMAND cp *.deb ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.tar.gz ${PROJECT_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${BUILD_DIR} )
|
||||
|
||||
# Packaging needs to wait for hipify-clang to build if it's enabled...
|
||||
if (BUILD_HIPIFY_CLANG)
|
||||
add_dependencies(pkg_hip_base hipify-clang)
|
||||
endif()
|
||||
|
||||
if(HIP_RUNTIME STREQUAL "rocclr")
|
||||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/rocclr)
|
||||
configure_file(packaging/hip-rocclr.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
|
||||
configure_file(packaging/hip-rocclr.postinst ${BUILD_DIR}/postinst @ONLY)
|
||||
configure_file(packaging/hip-rocclr.prerm ${BUILD_DIR}/prerm @ONLY)
|
||||
add_custom_target(hip_on_rocclr COMMAND ${CMAKE_COMMAND} .
|
||||
COMMAND rm -rf *.deb *.rpm *.tar.gz
|
||||
COMMAND make package
|
||||
COMMAND cp *.deb ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.tar.gz ${PROJECT_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${BUILD_DIR} )
|
||||
endif()
|
||||
|
||||
# Package: hip_nvcc
|
||||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/hip-nvcc)
|
||||
configure_file(packaging/hip-nvcc.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
|
||||
add_custom_target(pkg_hip_nvcc COMMAND ${CMAKE_COMMAND} .
|
||||
COMMAND rm -rf *.deb *.rpm *.tar.gz
|
||||
COMMAND make package
|
||||
COMMAND cp *.deb ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.tar.gz ${PROJECT_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${BUILD_DIR})
|
||||
|
||||
# Package: hip_doc
|
||||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/hip-doc)
|
||||
configure_file(packaging/hip-doc.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
|
||||
add_custom_target(pkg_hip_doc COMMAND ${CMAKE_COMMAND} .
|
||||
COMMAND rm -rf *.deb *.rpm *.tar.gz
|
||||
COMMAND make package
|
||||
COMMAND cp *.deb ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.tar.gz ${PROJECT_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${BUILD_DIR})
|
||||
|
||||
# Package: hip_samples
|
||||
set(BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/hip_samples)
|
||||
configure_file(packaging/hip-samples.txt ${BUILD_DIR}/CMakeLists.txt @ONLY)
|
||||
add_custom_target(pkg_hip_samples COMMAND ${CMAKE_COMMAND} .
|
||||
COMMAND rm -rf *.deb *.rpm *.tar.gz
|
||||
COMMAND make package
|
||||
COMMAND cp *.deb ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.rpm ${PROJECT_BINARY_DIR}
|
||||
COMMAND cp *.tar.gz ${PROJECT_BINARY_DIR}
|
||||
WORKING_DIRECTORY ${BUILD_DIR})
|
||||
|
||||
# Package: all
|
||||
if(POLICY CMP0037)
|
||||
cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0037 OLD)
|
||||
endif()
|
||||
|
||||
if(HIP_RUNTIME STREQUAL "rocclr")
|
||||
add_custom_target(package
|
||||
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
||||
DEPENDS pkg_hip_base hip_on_rocclr pkg_hip_nvcc pkg_hip_doc pkg_hip_samples)
|
||||
endif()
|
||||
|
||||
if(POLICY CMP0037)
|
||||
cmake_policy(POP)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#############################
|
||||
# Code analysis
|
||||
#############################
|
||||
# Target: cppcheck
|
||||
find_program(CPPCHECK_EXE cppcheck)
|
||||
if(CPPCHECK_EXE)
|
||||
add_custom_target(cppcheck COMMAND ${CPPCHECK_EXE} --force --quiet --enable=warning,performance,portability,information,missingInclude src include -I /opt/rocm/include/hcc -I /opt/rocm/include --suppress=*:/opt/rocm/include/hcc/hc.hpp
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
#############################
|
||||
# Code formatting
|
||||
#############################
|
||||
# Target: clangformat
|
||||
find_program(CLANGFORMAT_EXE clang-format PATHS ${HCC_HOME}/bin)
|
||||
if(CLANGFORMAT_EXE)
|
||||
file(GLOB_RECURSE FORMAT_SOURCE_FILE_LIST *.cpp *.hpp *.h)
|
||||
add_custom_target(clangformat COMMAND ${CLANGFORMAT_EXE} -style=file -i ${FORMAT_SOURCE_FILE_LIST}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
#############################
|
||||
# Testing steps
|
||||
#############################
|
||||
# HIT is not compatible with Windows
|
||||
if(NOT WIN32)
|
||||
set(HIP_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(HIP_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
if(HIP_PLATFORM STREQUAL "nvidia")
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/include" "${HIP_ROOT_DIR}/include" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
|
||||
endif()
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_AMD_BACKEND_SOURCE_DIR}/include/hip/" "${HIP_ROOT_DIR}/include/hip/" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/cmake" "${HIP_ROOT_DIR}/cmake" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
|
||||
if(${RUN_HIT} EQUAL 0)
|
||||
execute_process(COMMAND "${CMAKE_COMMAND}" -E copy_directory "${HIP_SRC_PATH}/bin" "${HIP_ROOT_DIR}/bin" RESULT_VARIABLE RUN_HIT ERROR_QUIET)
|
||||
endif()
|
||||
if(HIP_CATCH_TEST EQUAL "1")
|
||||
enable_testing()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests/catch)
|
||||
else()
|
||||
if(${RUN_HIT} EQUAL 0)
|
||||
set(CMAKE_MODULE_PATH "${HIP_ROOT_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||
include(${HIP_SRC_PATH}/tests/hit/HIT.cmake)
|
||||
include(${HIP_SRC_PATH}/tests/Tests.cmake)
|
||||
else()
|
||||
message(STATUS "Testing targets will not be available. To enable them please ensure that the HIP installation directory is writeable. Use -DCMAKE_INSTALL_PREFIX to specify a suitable location")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#############################
|
||||
# Code analysis
|
||||
#############################
|
||||
# Target: clang
|
||||
if(HIP_HIPCC_EXECUTABLE)
|
||||
add_custom_target(analyze
|
||||
COMMAND ${HIP_HIPCC_EXECUTABLE} -fvisibility=hidden -fvisibility-inlines-hidden --analyze --analyzer-outputtext -isystem /opt/rocm/include -Wno-unused-command-line-argument -I/opt/rocm/include -c src/*.cpp -Iinclude/ -I./
|
||||
WORKING_DIRECTORY ${HIP_SRC_PATH})
|
||||
if(CPPCHECK_EXE)
|
||||
add_dependencies(analyze cppcheck)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# vim: ts=4:sw=4:expandtab:smartindent
|
||||
@@ -1,292 +0,0 @@
|
||||
# Copyright (C) 2020-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
@PACKAGE_INIT@
|
||||
include(CheckCXXCompilerFlag)
|
||||
include(CMakeFindDependencyMacro OPTIONAL RESULT_VARIABLE _CMakeFindDependencyMacro_FOUND)
|
||||
if (NOT _CMakeFindDependencyMacro_FOUND)
|
||||
macro(find_dependency dep)
|
||||
if (NOT ${dep}_FOUND)
|
||||
set(cmake_fd_version)
|
||||
if (${ARGC} GREATER 1)
|
||||
set(cmake_fd_version ${ARGV1})
|
||||
endif()
|
||||
set(cmake_fd_exact_arg)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION_EXACT)
|
||||
set(cmake_fd_exact_arg EXACT)
|
||||
endif()
|
||||
set(cmake_fd_quiet_arg)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||
set(cmake_fd_quiet_arg QUIET)
|
||||
endif()
|
||||
set(cmake_fd_required_arg)
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
|
||||
set(cmake_fd_required_arg REQUIRED)
|
||||
endif()
|
||||
find_package(${dep} ${cmake_fd_version}
|
||||
${cmake_fd_exact_arg}
|
||||
${cmake_fd_quiet_arg}
|
||||
${cmake_fd_required_arg}
|
||||
)
|
||||
string(TOUPPER ${dep} cmake_dep_upper)
|
||||
if (NOT ${dep}_FOUND AND NOT ${cmake_dep_upper}_FOUND)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.")
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)
|
||||
return()
|
||||
endif()
|
||||
set(cmake_fd_version)
|
||||
set(cmake_fd_required_arg)
|
||||
set(cmake_fd_quiet_arg)
|
||||
set(cmake_fd_exact_arg)
|
||||
endif()
|
||||
endmacro()
|
||||
endif()
|
||||
|
||||
#Number of parallel jobs by default is 1
|
||||
if(NOT DEFINED HIP_CLANG_NUM_PARALLEL_JOBS)
|
||||
set(HIP_CLANG_NUM_PARALLEL_JOBS 1)
|
||||
endif()
|
||||
set(HIP_COMPILER "@HIP_COMPILER@")
|
||||
set(HIP_RUNTIME "@HIP_RUNTIME@")
|
||||
|
||||
set_and_check( hip_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@" )
|
||||
set_and_check( hip_INCLUDE_DIRS "${hip_INCLUDE_DIR}" )
|
||||
set_and_check( hip_LIB_INSTALL_DIR "@PACKAGE_LIB_INSTALL_DIR@" )
|
||||
set_and_check( hip_BIN_INSTALL_DIR "@PACKAGE_BIN_INSTALL_DIR@" )
|
||||
|
||||
set_and_check(hip_HIPCC_EXECUTABLE "${hip_BIN_INSTALL_DIR}/hipcc")
|
||||
set_and_check(hip_HIPCONFIG_EXECUTABLE "${hip_BIN_INSTALL_DIR}/hipconfig")
|
||||
|
||||
# Windows Specific Definition here:
|
||||
if(WIN32)
|
||||
if(DEFINED ENV{HIP_PATH})
|
||||
set(HIP_PATH "$ENV{HIP_PATH}")
|
||||
elseif(DEFINED ENV{HIP_DIR})
|
||||
set(HIP_PATH "$ENV{HIP_DIR}")
|
||||
else()
|
||||
set(HIP_PATH "C:/Program Files/AMD HIP SDK/hip")
|
||||
endif()
|
||||
else()
|
||||
# Linux - set a default path for ROCM_PATH
|
||||
if(NOT DEFINED ROCM_PATH)
|
||||
set(ROCM_PATH /opt/rocm)
|
||||
endif()
|
||||
|
||||
#If HIP is not installed under ROCm, need this to find HSA assuming HSA is under ROCm
|
||||
if(DEFINED ENV{ROCM_PATH})
|
||||
set(ROCM_PATH "$ENV{ROCM_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HIP_COMPILER STREQUAL "clang")
|
||||
if(WIN32)
|
||||
set(HIP_CLANG_ROOT "${HIP_PATH}")
|
||||
else()
|
||||
set(HIP_CLANG_ROOT "${ROCM_PATH}/llvm")
|
||||
endif()
|
||||
if(NOT HIP_CXX_COMPILER)
|
||||
set(HIP_CXX_COMPILER ${CMAKE_CXX_COMPILER})
|
||||
endif()
|
||||
if(HIP_CXX_COMPILER MATCHES ".*hipcc" OR HIP_CXX_COMPILER MATCHES ".*clang\\+\\+")
|
||||
execute_process(COMMAND ${HIP_CXX_COMPILER} --version
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
OUTPUT_VARIABLE HIP_CXX_COMPILER_VERSION_OUTPUT)
|
||||
# Capture the repo, branch and patch level details of the HIP CXX Compiler.
|
||||
# Ex. clang version 13.0.0 (https://github.com/ROCm-Developer-Tools/HIP main 12345 COMMIT_HASH)
|
||||
# HIP_CLANG_REPO: https://github.com/ROCm-Developer-Tools/HIP
|
||||
# HIP_CLANG_BRANCH: main
|
||||
# HIP_CLANG_PATCH_LEVEL: 12345
|
||||
if(${HIP_CXX_COMPILER_VERSION_OUTPUT} MATCHES "clang version [0-9]+\\.[0-9]+\\.[0-9]+ \\(([^ \n]*) ([^ \n]*) ([^ \n]*)")
|
||||
set(HIP_CLANG_REPO ${CMAKE_MATCH_1})
|
||||
set(HIP_CLANG_BRANCH ${CMAKE_MATCH_2})
|
||||
set(HIP_CLANG_PATCH_LEVEL ${CMAKE_MATCH_3})
|
||||
endif()
|
||||
endif()
|
||||
if(HIP_CXX_COMPILER MATCHES ".*hipcc")
|
||||
if(HIP_CXX_COMPILER_VERSION_OUTPUT MATCHES "InstalledDir:[ \t]*([^\n]*)")
|
||||
get_filename_component(HIP_CLANG_ROOT "${CMAKE_MATCH_1}" DIRECTORY)
|
||||
endif()
|
||||
elseif (HIP_CXX_COMPILER MATCHES ".*clang\\+\\+")
|
||||
get_filename_component(HIP_CLANG_ROOT "${HIP_CXX_COMPILER}" DIRECTORY)
|
||||
get_filename_component(HIP_CLANG_ROOT "${HIP_CLANG_ROOT}" DIRECTORY)
|
||||
endif()
|
||||
file(GLOB HIP_CLANG_INCLUDE_SEARCH_PATHS ${HIP_CLANG_ROOT}/lib/clang/*/include)
|
||||
find_path(HIP_CLANG_INCLUDE_PATH stddef.h
|
||||
HINTS
|
||||
${HIP_CLANG_INCLUDE_SEARCH_PATHS}
|
||||
NO_DEFAULT_PATH)
|
||||
if(NOT WIN32)
|
||||
find_dependency(AMDDeviceLibs)
|
||||
endif()
|
||||
set(GPU_DEFAULT_TARGETS "gfx900;gfx906;gfx908;gfx90a;gfx1030")
|
||||
set(GPU_SUPPORTED_TARGETS "gfx701;gfx801;gfx802;gfx803;gfx900;gfx906;gfx908;gfx90a;gfx1010;gfx1011;gfx1012;gfx1030;gfx1031")
|
||||
set(GPU_TARGETS "${GPU_DEFAULT_TARGETS}" CACHE STRING "GPU targets to compile for")
|
||||
set_property(CACHE GPU_TARGETS PROPERTY STRINGS ${GPU_SUPPORTED_TARGETS})
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
find_dependency(amd_comgr)
|
||||
endif()
|
||||
|
||||
include( "${CMAKE_CURRENT_LIST_DIR}/hip-targets.cmake" )
|
||||
|
||||
#Using find_dependency to locate the dependency for the packages
|
||||
#This makes the cmake generated file xxxx-targets to supply the linker libraries
|
||||
# without worrying other transitive dependencies
|
||||
if(NOT WIN32)
|
||||
find_dependency(hsa-runtime64)
|
||||
find_dependency(Threads)
|
||||
endif()
|
||||
|
||||
#get_filename_component cannot resolve the symlinks if called from /opt/rocm/lib/hip
|
||||
#and do three level up again
|
||||
get_filename_component(_DIR "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
|
||||
get_filename_component(_IMPORT_PREFIX "${_DIR}/../../../" REALPATH)
|
||||
|
||||
# Windows doesn't need HSA
|
||||
if(NOT WIN32)
|
||||
#if HSA is not under ROCm then provide CMAKE_PREFIX_PATH=<HSA_PATH>
|
||||
find_path(HSA_HEADER hsa/hsa.h
|
||||
PATHS
|
||||
"${_IMPORT_PREFIX}/../include"
|
||||
/opt/rocm/include
|
||||
)
|
||||
|
||||
if (HSA_HEADER-NOTFOUND)
|
||||
message (FATAL_ERROR "HSA header not found! ROCM_PATH environment not set")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Right now this is only supported for amd platforms
|
||||
set_target_properties(hip::host PROPERTIES
|
||||
INTERFACE_COMPILE_DEFINITIONS "__HIP_PLATFORM_HCC__=1;__HIP_PLATFORM_AMD__=1"
|
||||
)
|
||||
|
||||
if(HIP_RUNTIME MATCHES "rocclr")
|
||||
set_target_properties(hip::amdhip64 PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include;${HSA_HEADER}"
|
||||
)
|
||||
|
||||
get_target_property(amdhip64_type hip::amdhip64 TYPE)
|
||||
message(STATUS "hip::amdhip64 is ${amdhip64_type}")
|
||||
|
||||
if(NOT WIN32)
|
||||
set_target_properties(hip::device PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/../include"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(HIP_COMPILER STREQUAL "clang")
|
||||
get_property(compilePropIsSet TARGET hip::device PROPERTY INTERFACE_COMPILE_OPTIONS SET)
|
||||
|
||||
if (NOT compilePropIsSet AND HIP_CXX_COMPILER MATCHES ".*clang\\+\\+")
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS -mllvm -amdgpu-early-inline-all=true -mllvm -amdgpu-function-calls=false
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT compilePropIsSet)
|
||||
if (EXISTS ${AMD_DEVICE_LIBS_PREFIX}/amdgcn/bitcode)
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS -xhip
|
||||
)
|
||||
else()
|
||||
# This path is to support an older build of the device library
|
||||
# TODO: To be removed in the future.
|
||||
if(WIN32)
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS -xhip -fms-extensions -fms-compatibility
|
||||
)
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS "--hip-device-lib-path=${HIP_PATH}/lib/bitcode"
|
||||
)
|
||||
else()
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS -xhip --hip-device-lib-path=${AMD_DEVICE_LIBS_PREFIX}/lib
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES --hip-link
|
||||
)
|
||||
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${HIP_CLANG_INCLUDE_PATH}/.."
|
||||
)
|
||||
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${HIP_CLANG_INCLUDE_PATH}/.."
|
||||
)
|
||||
|
||||
foreach(GPU_TARGET ${GPU_TARGETS})
|
||||
if (NOT compilePropIsSet)
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS "--offload-arch=${GPU_TARGET}"
|
||||
)
|
||||
endif()
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "--offload-arch=${GPU_TARGET}"
|
||||
)
|
||||
endforeach()
|
||||
#Add support for parallel build and link
|
||||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
|
||||
check_cxx_compiler_flag("-parallel-jobs=1" HIP_CLANG_SUPPORTS_PARALLEL_JOBS)
|
||||
endif()
|
||||
if(HIP_CLANG_NUM_PARALLEL_JOBS GREATER 1)
|
||||
if(${HIP_CLANG_SUPPORTS_PARALLEL_JOBS} )
|
||||
if (NOT compilePropIsSet)
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_COMPILE_OPTIONS -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS} -Wno-format-nonliteral
|
||||
)
|
||||
endif()
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES -parallel-jobs=${HIP_CLANG_NUM_PARALLEL_JOBS}
|
||||
)
|
||||
else()
|
||||
message("clang compiler doesn't support parallel jobs")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Add support for __fp16 and _Float16, explicitly link with compiler-rt
|
||||
set_property(TARGET hip::host APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "-L\"${HIP_CLANG_INCLUDE_PATH}/../lib/linux\" -lclang_rt.builtins-x86_64"
|
||||
)
|
||||
set_property(TARGET hip::device APPEND PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES "-L\"${HIP_CLANG_INCLUDE_PATH}/../lib/linux\" -lclang_rt.builtins-x86_64"
|
||||
)
|
||||
endif()
|
||||
|
||||
set( hip_LIBRARIES hip::host hip::device)
|
||||
set( hip_LIBRARY ${hip_LIBRARIES})
|
||||
|
||||
set(HIP_INCLUDE_DIR ${hip_INCLUDE_DIR})
|
||||
set(HIP_INCLUDE_DIRS ${hip_INCLUDE_DIRS})
|
||||
set(HIP_LIB_INSTALL_DIR ${hip_LIB_INSTALL_DIR})
|
||||
set(HIP_BIN_INSTALL_DIR ${hip_BIN_INSTALL_DIR})
|
||||
set(HIP_LIBRARIES ${hip_LIBRARIES})
|
||||
set(HIP_LIBRARY ${hip_LIBRARY})
|
||||
set(HIP_HIPCC_EXECUTABLE ${hip_HIPCC_EXECUTABLE})
|
||||
set(HIP_HIPCONFIG_EXECUTABLE ${hip_HIPCONFIG_EXECUTABLE})
|
||||
|
||||
@@ -19,117 +19,5 @@
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Parse command-line options
|
||||
# Option strings
|
||||
SHORT=hr:
|
||||
LONG=help,rocclr-src:
|
||||
# read the options
|
||||
OPTS=$(getopt --options $SHORT --long $LONG --name "$0" -- "$@")
|
||||
if [ $? != 0 ] ; then echo "Failed to parse options...exiting." >&2 ; exit 1 ; fi
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 -r|--roccclr-src <PATH to the rocclr src>" ;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
[ $# -eq 0 ] && usage
|
||||
|
||||
eval set -- "$OPTS"
|
||||
|
||||
# extract options and their arguments into variables.
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-r | --rocclr-src )
|
||||
ROCCLR_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h | --help )
|
||||
usage
|
||||
shift
|
||||
;;
|
||||
-- )
|
||||
shift
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Internal error!"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
BUILD_ROOT="$( mktemp -d )"
|
||||
SRC_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
WORKING_DIR=$PWD
|
||||
DASH_JAY="-j $(getconf _NPROCESSORS_ONLN)"
|
||||
OS_NAME="$(cat /etc/os-release | awk -F '=' '/^NAME/{print $2}' | awk '{print $1}' | tr -d '"')"
|
||||
|
||||
err() {
|
||||
echo "${1-Died}." >&2
|
||||
}
|
||||
|
||||
die() {
|
||||
err "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
pushd () {
|
||||
command pushd "$@" > /dev/null
|
||||
}
|
||||
|
||||
popd () {
|
||||
command popd "$@" > /dev/null
|
||||
}
|
||||
|
||||
function setupENV()
|
||||
{
|
||||
if [ "$OS_NAME" == "Ubuntu" ]
|
||||
then
|
||||
sudo apt-get update
|
||||
sudo apt-get install dpkg-dev rpm doxygen libelf-dev rename liburi-encode-perl \
|
||||
libfile-basedir-perl libfile-copy-recursive-perl libfile-listing-perl
|
||||
elif [ "$OS_NAME" == "CentOS" ]
|
||||
then
|
||||
yum install dpkg-dev rpm-build doxygen elfutils-libelf-devel prename \
|
||||
perl-URI-Encode perl-File-Listing perl-File-BaseDir
|
||||
fi
|
||||
}
|
||||
|
||||
function buildHIP()
|
||||
{
|
||||
pushd $BUILD_ROOT
|
||||
OPENCL_RUNTIME="$BUILD_ROOT/opencl"
|
||||
mkdir $OPENCL_RUNTIME
|
||||
git clone https://github.com/RadeonOpenCompute/ROCm-OpenCL-Runtime/ $OPENCL_RUNTIME
|
||||
ROCCLR_BUILD_DIR="$BUILD_ROOT/rocclr_build"
|
||||
mkdir $ROCCLR_BUILD_DIR
|
||||
pushd $ROCCLR_BUILD_DIR
|
||||
cmake $ROCCLR_DIR -DOPENCL_DIR=$OPENCL_RUNTIME -DCMAKE_BUILD_TYPE=Release
|
||||
make $DASH_JAY
|
||||
popd
|
||||
HIP_BUILD_DIR="$BUILD_ROOT/hip_build"
|
||||
mkdir $HIP_BUILD_DIR
|
||||
pushd $HIP_BUILD_DIR
|
||||
cmake $SRC_ROOT -DCMAKE_PREFIX_PATH="$ROCCLR_BUILD_DIR;/opt/rocm" -DCMAKE_BUILD_TYPE=Release
|
||||
make $DASH_JAY
|
||||
make package
|
||||
if [ "$OS_NAME" == "Ubuntu" ]
|
||||
then
|
||||
cp hip-*.deb $WORKING_DIR
|
||||
sudo dpkg -i -B hip-base*.deb hip-rocclr*.deb hip-sample*.deb hip-doc*.deb
|
||||
elif [ "$OS_NAME" == "CentOS" ]
|
||||
then
|
||||
cp hip-*.rpm $WORKING_DIR
|
||||
sudo rpm -ivh --replacefiles --force hip-base*.rpm hip-rocclr*.rpm hip-sample*.rpm \
|
||||
hip-doc*.rpm
|
||||
fi
|
||||
popd
|
||||
popd
|
||||
rm -rf $BUILD_ROOT
|
||||
}
|
||||
|
||||
echo "Preparing build environment"
|
||||
setupENV || die "setupENV failed"
|
||||
echo "Building and installing HIP packages"
|
||||
buildHIP || die "buildHIP failed"
|
||||
echo "Finished building HIP packages"
|
||||
echo "install.sh has moved to HIP-AMD backend repo"
|
||||
exit 1
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2016-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
function die {
|
||||
echo "${1-Died}." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
function cleanup {
|
||||
rm -rf "$workdir"
|
||||
}
|
||||
|
||||
# parse arguments
|
||||
hip_srcdir=$1
|
||||
html_destdir=$2
|
||||
[ "$hip_srcdir" != "" ] || [ "$html_destdir" != "" ] || die "Invalid arguments!"
|
||||
|
||||
# create temporary directory for grip settings
|
||||
workdir=`mktemp -d`
|
||||
trap cleanup EXIT
|
||||
|
||||
# setup grip
|
||||
export GRIPURL=$hip_srcdir
|
||||
export GRIPHOME=$workdir
|
||||
echo "CACHE_DIRECTORY = '$html_destdir/asset'" > $workdir/settings.py
|
||||
mkdir -p $html_destdir $html_destdir/docs/markdown
|
||||
|
||||
# convert all md files to html
|
||||
pushd $hip_srcdir
|
||||
for f in *.md docs/markdown/*.md; do grip --export --no-inline $f $html_destdir/${f%.*}.html; done
|
||||
popd
|
||||
|
||||
# convert absolute links to relative links
|
||||
pushd $html_destdir
|
||||
for f in *.html; do sed -i "s?$GRIPURL/??g" $f; done
|
||||
for f in docs/markdown/*.html; do sed -i "s?$GRIPURL/?../../?g" $f; done
|
||||
popd
|
||||
|
||||
# update document titles
|
||||
pushd $html_destdir
|
||||
for f in *.html; do sed -i "s?.md - Grip??g" $f; done
|
||||
for f in docs/markdown/*.html; do sed -i "s?.md - Grip??g" $f; done
|
||||
popd
|
||||
|
||||
# replace .md with .html in links
|
||||
pushd $html_destdir
|
||||
for f in *.html; do sed -i "s?.md\"?.html\"?g" $f; done
|
||||
for f in *.html; do sed -i "s?.md#?.html#?g" $f; done
|
||||
for f in docs/markdown/*.html; do sed -i "s?.md\"?.html\"?g" $f; done
|
||||
for f in docs/markdown/*.html; do sed -i "s?.md#?.html#?g" $f; done
|
||||
popd
|
||||
|
||||
# replace github.io links
|
||||
pushd $html_destdir
|
||||
sed -i "s?http://rocm-developer-tools.github.io/HIP?docs/RuntimeAPI/html/index.html?g" README.html
|
||||
sed -i "s?http://rocm-developer-tools.github.io/HIP?docs/RuntimeAPI/html/?g" RELEASE.html
|
||||
popd
|
||||
|
||||
exit 0
|
||||
@@ -1,49 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (C) 2016-2021 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
ROCMDIR=@ROCM_PATH@
|
||||
HIPDIR=$ROCMDIR/hip
|
||||
|
||||
# Soft-link to bin files
|
||||
HIPBINFILES=$HIPDIR/bin/*
|
||||
ROCMBINDIR=$ROCMDIR/bin
|
||||
mkdir -p $ROCMBINDIR
|
||||
CURRENTDIR=`pwd`
|
||||
cd $ROCMBINDIR
|
||||
for f in $HIPBINFILES
|
||||
do
|
||||
ln -r -s -f $f $(basename $f)
|
||||
done
|
||||
ln -r -s -f $HIPDIR/bin/.hipVersion .hipVersion
|
||||
cd $CURRENTDIR
|
||||
|
||||
# Soft-link to headers
|
||||
HIPINCDIR=$HIPDIR/include/hip
|
||||
ROCMINCDIR=$ROCMDIR/include
|
||||
mkdir -p $ROCMINCDIR
|
||||
cd $ROCMINCDIR
|
||||
ln -r -s -f $HIPINCDIR hip
|
||||
cd $CURRENTDIR
|
||||
|
||||
# The following will be removed after upstream updation
|
||||
cd $HIPINCDIR
|
||||
ln -r -s -f amd_detail hcc_detail
|
||||
ln -r -s -f nvidia_detail nvcc_detail
|
||||
cd $CURRENTDIR
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2016-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
ROCMDIR=@ROCM_PATH@
|
||||
HIPDIR=$ROCMDIR/hip
|
||||
([ ! -d $ROCMDIR ] || [ ! -d $HIPDIR ]) && exit 0
|
||||
|
||||
# Remove soft-link to bin files
|
||||
HIPBINDIR=$HIPDIR/bin
|
||||
ROCMBINDIR=$ROCMDIR/bin
|
||||
([ ! -d $ROCMBINDIR ] || [ ! -d $HIPBINDIR ]) && exit 0
|
||||
HIPBINFILES=$HIPBINDIR/*
|
||||
CURRENTDIR=`pwd`
|
||||
cd $ROCMBINDIR
|
||||
for f in $HIPBINFILES; do
|
||||
[ -e $f ] || continue
|
||||
rm $(basename $f)
|
||||
done
|
||||
rm .hipVersion
|
||||
cd $CURRENTDIR
|
||||
rmdir --ignore-fail-on-non-empty $ROCMBINDIR
|
||||
|
||||
# Remove soft-link to headers
|
||||
HIPINCDIR=$HIPDIR/include
|
||||
cd $HIPINCDIR/hip
|
||||
rm hcc_detail
|
||||
rm nvcc_detail
|
||||
cd $CURRENTDIR
|
||||
|
||||
ROCMINCDIR=$ROCMDIR/include
|
||||
([ ! -d $ROCMINCDIR ] || [ ! -d $HIPINCDIR ]) && exit 0
|
||||
cd $ROCMINCDIR
|
||||
rm hip
|
||||
cd $CURRENTDIR
|
||||
rmdir --ignore-fail-on-non-empty $ROCMINCDIR
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
# Copyright (c) 2016-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(hip_base)
|
||||
|
||||
if(WIN32)
|
||||
install(DIRECTORY @hip_SOURCE_DIR@/bin DESTINATION . USE_SOURCE_PERMISSIONS)
|
||||
else()
|
||||
install(DIRECTORY @hip_SOURCE_DIR@/bin DESTINATION . USE_SOURCE_PERMISSIONS
|
||||
PATTERN *.bat EXCLUDE)
|
||||
endif()
|
||||
install(DIRECTORY @hip_SOURCE_DIR@/include DESTINATION .)
|
||||
install(DIRECTORY @HIP_AMD_BACKEND_SOURCE_DIR@/include/hip/amd_detail DESTINATION include/hip)
|
||||
install(DIRECTORY @HIP_AMD_BACKEND_SOURCE_DIR@/include/hip/nvidia_detail DESTINATION include/hip)
|
||||
install(FILES @PROJECT_BINARY_DIR@/include/hip/amd_detail/hip_prof_str.h
|
||||
DESTINATION include/hip/amd_detail)
|
||||
install(FILES @PROJECT_BINARY_DIR@/include/hip/hip_version.h
|
||||
DESTINATION include/hip)
|
||||
install(FILES @PROJECT_BINARY_DIR@/.hipVersion DESTINATION bin)
|
||||
install(DIRECTORY @hip_SOURCE_DIR@/cmake DESTINATION .)
|
||||
|
||||
#############################
|
||||
# Packaging steps
|
||||
#############################
|
||||
set(CPACK_SET_DESTDIR TRUE)
|
||||
set(CPACK_INSTALL_PREFIX @CPACK_INSTALL_PREFIX@ )
|
||||
set(CPACK_PACKAGE_NAME "hip-base")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HIP Heterogenous-computing Interface for Portability [BASE]")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "HIP:
|
||||
Heterogenous-computing Interface for Portability [BASE]")
|
||||
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
|
||||
set(CPACK_PACKAGE_CONTACT "HIP Support <hip.support@amd.com>")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR @HIP_VERSION_MAJOR@)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR @HIP_VERSION_MINOR@)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH @HIP_PACKAGING_VERSION_PATCH@)
|
||||
set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_PACKAGING_VERSION_PATCH@)
|
||||
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
||||
|
||||
set(CPACK_BINARY_DEB "ON")
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE @CPACK_DEBIAN_PACKAGE_RELEASE@)
|
||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/postinst;${PROJECT_BINARY_DIR}/prerm")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "perl (>= 5.0), liburi-encode-perl, libfile-basedir-perl, libfile-copy-recursive-perl, libfile-listing-perl, libfile-which-perl, libc6, file")
|
||||
set(CPACK_DEBIAN_PACKAGE_PROVIDES "hip-base")
|
||||
set(CPACK_DEBIAN_PACKAGE_REPLACES "hip_base")
|
||||
|
||||
set(CPACK_BINARY_RPM "ON")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE @CPACK_RPM_PACKAGE_RELEASE@)
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/postinst")
|
||||
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/prerm")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "perl >= 5.0, perl-File-Which, perl-File-Listing, perl-File-BaseDir, perl-URI-Encode, file")
|
||||
set(CPACK_RPM_PACKAGE_OBSOLETES "hip_base")
|
||||
set(CPACK_RPM_PACKAGE_CONFLICTS "hip_base")
|
||||
set(CPACK_BINARY_RPM "ON")
|
||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
include(CPack)
|
||||
@@ -1,73 +0,0 @@
|
||||
# Copyright (c) 2016-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(hip_doc)
|
||||
|
||||
find_program(DOXYGEN_EXE doxygen)
|
||||
if(DOXYGEN_EXE)
|
||||
add_custom_target(build_doxygen ALL
|
||||
COMMAND HIP_PATH=@hip_SOURCE_DIR@ doxygen @hip_SOURCE_DIR@/docs/doxygen-input/doxy.cfg)
|
||||
install(DIRECTORY RuntimeAPI/html DESTINATION docs/docs/RuntimeAPI)
|
||||
endif()
|
||||
|
||||
#find_program(GRIP_EXE grip)
|
||||
#if(GRIP_EXE)
|
||||
# add_custom_target(convert_md_to_html ALL
|
||||
# COMMAND @hip_SOURCE_DIR@/packaging/convert_md_to_html.sh @hip_SOURCE_DIR@ ${PROJECT_BINARY_DIR}/md2html)
|
||||
# install(DIRECTORY md2html/ DESTINATION docs)
|
||||
#endif()
|
||||
|
||||
#############################
|
||||
# Packaging steps
|
||||
#############################
|
||||
set(CPACK_SET_DESTDIR TRUE)
|
||||
set(CPACK_INSTALL_PREFIX @CPACK_INSTALL_PREFIX@ )
|
||||
set(CPACK_PACKAGE_NAME "hip-doc")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HIP: Heterogenous-computing Interface for Portability [DOCUMENTATION]")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "HIP:
|
||||
Heterogenous-computing Interface for Portability [DOCUMENTATION]")
|
||||
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
|
||||
set(CPACK_PACKAGE_CONTACT "HIP Support <hip.support@amd.com>")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR @HIP_VERSION_MAJOR@)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR @HIP_VERSION_MINOR@)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH @HIP_PACKAGING_VERSION_PATCH@)
|
||||
set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_PACKAGING_VERSION_PATCH@)
|
||||
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
||||
|
||||
set(CPACK_BINARY_DEB "ON")
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE @CPACK_DEBIAN_PACKAGE_RELEASE@)
|
||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip-base (= ${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE})")
|
||||
set(CPACK_DEBIAN_PACKAGE_PROVIDES "hip-doc")
|
||||
set(CPACK_DEBIAN_PACKAGE_REPLACES "hip_doc")
|
||||
|
||||
set(CPACK_BINARY_RPM "ON")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE @CPACK_RPM_PACKAGE_RELEASE@)
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
|
||||
string(REPLACE "-" "_" HIP_BASE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "hip-base = ${HIP_BASE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}")
|
||||
set(CPACK_RPM_PACKAGE_OBSOLETES "hip_doc")
|
||||
set(CPACK_RPM_PACKAGE_CONFLICTS "hip_doc")
|
||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
include(CPack)
|
||||
@@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
ROCMDIR=@ROCM_PATH@
|
||||
HIPDIR=$ROCMDIR/hip
|
||||
|
||||
if [ -d $ROCMDIR] ; then
|
||||
ln -s -f $ROCMDIR /opt/rocm
|
||||
fi
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
if [ -L "/opt/rocm" ] ; then
|
||||
unlink /opt/rocm
|
||||
fi
|
||||
@@ -1,62 +0,0 @@
|
||||
# Copyright (c) 2016-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(hip_nvcc)
|
||||
|
||||
#############################
|
||||
# Packaging steps
|
||||
#############################
|
||||
set(CPACK_SET_DESTDIR TRUE)
|
||||
set(CPACK_INSTALL_PREFIX @CPACK_INSTALL_PREFIX@ )
|
||||
set(CPACK_PACKAGE_NAME "hip-nvcc")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "HIP:
|
||||
Heterogenous-computing Interface for Portability [NVCC]")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HIP: Heterogenous-computing Interface for Portability [NVCC]")
|
||||
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
|
||||
set(CPACK_PACKAGE_CONTACT "HIP Support <hip.support@amd.com>")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR @HIP_VERSION_MAJOR@)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR @HIP_VERSION_MINOR@)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH @HIP_VERSION_PATCH@)
|
||||
set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_PACKAGING_VERSION_PATCH@)
|
||||
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
||||
|
||||
set(CPACK_BINARY_DEB "ON")
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE @CPACK_DEBIAN_PACKAGE_RELEASE@)
|
||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/postinst;${PROJECT_BINARY_DIR}/prerm")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip-base (= ${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}), cuda (>= 7.5)")
|
||||
set(CPACK_DEBIAN_PACKAGE_PROVIDES "hip-nvcc")
|
||||
set(CPACK_DEBIAN_PACKAGE_REPLACES "hip_nvcc")
|
||||
|
||||
set(CPACK_BINARY_RPM "ON")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE @CPACK_RPM_PACKAGE_RELEASE@)
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/postinst")
|
||||
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/prerm")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
|
||||
string(REPLACE "-" "_" HIP_BASE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "hip-base = ${HIP_BASE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}, cuda >= 7.5")
|
||||
set(CPACK_RPM_PACKAGE_OBSOLETES "hip_nvcc")
|
||||
set(CPACK_RPM_PACKAGE_CONFLICTS "hip_nvcc")
|
||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
include(CPack)
|
||||
@@ -1,53 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
ROCMDIR=@ROCM_PATH@
|
||||
ROCMLIBDIR=$ROCMDIR/lib
|
||||
ROCCLRDIR=$ROCMDIR/rocclr
|
||||
ROCCLRLIBDIR=$ROCMDIR/rocclr/lib
|
||||
HIPDIR=$ROCMDIR/hip
|
||||
HIPLIBDIR=$ROCMDIR/hip/lib
|
||||
CURRENTDIR=`pwd`
|
||||
# Soft-link to library files
|
||||
ROCCLRLIBFILES=$(ls -A $ROCCLRLIBDIR | grep -v "cmake\|[-/$]")
|
||||
HIPLIBFILES=$(ls -A $HIPLIBDIR | grep -v "cmake\|[-/$]")
|
||||
|
||||
mkdir -p $ROCMLIBDIR
|
||||
mkdir -p $ROCMLIBDIR/cmake
|
||||
|
||||
cd $ROCMLIBDIR
|
||||
for f in $ROCCLRLIBFILES
|
||||
do
|
||||
ln -s -r -f $ROCCLRLIBDIR/$f $(basename $f)
|
||||
done
|
||||
|
||||
for f in $HIPLIBFILES
|
||||
do
|
||||
ln -s -r -f $HIPLIBDIR/$f $(basename $f)
|
||||
done
|
||||
cd $CURRENTDIR
|
||||
|
||||
# Make the hip cmake directory link.
|
||||
cd $ROCMLIBDIR/cmake
|
||||
ln -s -r -f $ROCCLRLIBDIR/cmake/rocclr rocclr
|
||||
ln -s -r -f $HIPLIBDIR/cmake/hip hip
|
||||
ln -s -r -f $HIPLIBDIR/cmake/hip-lang hip-lang
|
||||
cd $CURRENTDIR
|
||||
@@ -1,57 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2016-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
ROCMDIR=@ROCM_PATH@
|
||||
ROCMLIBDIR=$ROCMDIR/lib
|
||||
ROCCLRDIR=$ROCMDIR/rocclr
|
||||
ROCCLRLIBDIR=$ROCMDIR/rocclr/lib
|
||||
HIPDIR=$ROCMDIR/hip
|
||||
HIPLIBDIR=$ROCMDIR/hip/lib
|
||||
([ ! -d $ROCMDIR ] || [ ! -d $ROCCLRDIR ] || [ ! -d $HIPDIR ]) && exit 0
|
||||
([ ! -d $ROCMLIBDIR ] || [ ! -d $ROCCLRLIBDIR ] || [ ! -d $HIPLIBDIR ]) && exit 0
|
||||
CURRENTDIR=`pwd`
|
||||
# Remove soft-links to libraries
|
||||
ROCCLRLIBFILES=$(ls -A $ROCCLRLIBDIR | grep -v [-/$])
|
||||
HIPLIBFILES=$(ls -A $HIPLIBDIR | grep -v [-/$])
|
||||
|
||||
cd $ROCMLIBDIR
|
||||
for f in $ROCCLRLIBFILES; do
|
||||
[ -e $f ] || continue
|
||||
rm $(basename $f)
|
||||
done
|
||||
|
||||
for f in $HIPLIBFILES; do
|
||||
[ -e $f ] || continue
|
||||
rm $(basename $f)
|
||||
done
|
||||
cd $CURRENTDIR
|
||||
|
||||
cd $ROCMLIBDIR/cmake
|
||||
unlink rocclr
|
||||
unlink hip
|
||||
unlink hip-lang
|
||||
cd $CURRENTDIR
|
||||
|
||||
cd $ROCMLIBDIR
|
||||
rmdir --ignore-fail-on-non-empty cmake
|
||||
cd $CURRENTDIR
|
||||
rmdir --ignore-fail-on-non-empty $ROCMLIBDIR
|
||||
|
||||
@@ -1,95 +0,0 @@
|
||||
# Copyright (c) 2020-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(hip_rocclr)
|
||||
|
||||
if(@BUILD_SHARED_LIBS@)
|
||||
install(FILES @PROJECT_BINARY_DIR@/lib/libamdhip64.so DESTINATION lib)
|
||||
install(FILES @PROJECT_BINARY_DIR@/lib/libamdhip64.so.@HIP_LIB_VERSION_MAJOR@ DESTINATION lib)
|
||||
install(FILES @PROJECT_BINARY_DIR@/lib/libamdhip64.so.@HIP_LIB_VERSION_STRING@ DESTINATION lib)
|
||||
if(@__HIP_ENABLE_RTC@)
|
||||
install(FILES @PROJECT_BINARY_DIR@/lib/libhiprtc-builtins.so DESTINATION lib)
|
||||
install(FILES @PROJECT_BINARY_DIR@/lib/libhiprtc-builtins.so.@HIP_LIB_VERSION_MAJOR@ DESTINATION lib)
|
||||
install(FILES @PROJECT_BINARY_DIR@/lib/libhiprtc-builtins.so.@HIP_LIB_VERSION_STRING@ DESTINATION lib)
|
||||
endif()
|
||||
else()
|
||||
install(FILES @PROJECT_BINARY_DIR@/lib/libamdhip64.a DESTINATION lib)
|
||||
endif()
|
||||
|
||||
install(FILES @PROJECT_BINARY_DIR@/.hipInfo DESTINATION lib)
|
||||
install(FILES @PROJECT_BINARY_DIR@/hip-config.cmake @PROJECT_BINARY_DIR@/hip-config-version.cmake DESTINATION lib/cmake/hip)
|
||||
install(FILES @PROJECT_BINARY_DIR@/src/hipamd/hip-lang-config.cmake @PROJECT_BINARY_DIR@/src/hipamd/hip-lang-config-version.cmake DESTINATION lib/cmake/hip-lang)
|
||||
|
||||
#############################
|
||||
# Packaging steps
|
||||
#############################
|
||||
set(CPACK_SET_DESTDIR TRUE)
|
||||
set(CPACK_INSTALL_PREFIX @CPACK_INSTALL_PREFIX@)
|
||||
|
||||
## cmake generated target files contains IMPORTED_LOCATION_RELEASE etc. which
|
||||
## is installation path when building the project, which may be different from
|
||||
## the intallation path for packaging. These paths have to be replaced by
|
||||
## the package installation path, otherwise apps using pkg-config will fail.
|
||||
file(GLOB _target_files @CONFIG_PACKAGE_INSTALL_DIR@/hip-targets*.cmake)
|
||||
foreach(_target_file ${_target_files})
|
||||
execute_process(COMMAND sed -i s:@CMAKE_INSTALL_PREFIX@:${CPACK_INSTALL_PREFIX}:g ${_target_file})
|
||||
endforeach()
|
||||
install(FILES ${_target_files} DESTINATION lib/cmake/hip)
|
||||
|
||||
file(GLOB _target_files @CONFIG_LANG_PACKAGE_INSTALL_DIR@/hip-lang-targets*.cmake)
|
||||
foreach(_target_file ${_target_files})
|
||||
execute_process(COMMAND sed -i s:@CMAKE_INSTALL_PREFIX@:${CPACK_INSTALL_PREFIX}:g ${_target_file})
|
||||
endforeach()
|
||||
install(FILES ${_target_files} DESTINATION lib/cmake/hip-lang)
|
||||
|
||||
set(CPACK_PACKAGE_NAME "hip-rocclr")
|
||||
set(HCC_PACKAGE_NAME "rocclr")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HIP: Heterogenous-computing Interface for Portability [ROCClr]")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "HIP:
|
||||
Heterogenous-computing Interface for Portability [ROCClr]")
|
||||
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
|
||||
set(CPACK_PACKAGE_CONTACT "HIP Support <hip.support@amd.com>")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR @HIP_VERSION_MAJOR@)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR @HIP_VERSION_MINOR@)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH @HIP_VERSION_PATCH@)
|
||||
set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_PACKAGING_VERSION_PATCH@)
|
||||
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
||||
|
||||
set(CPACK_BINARY_DEB "ON")
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE @CPACK_DEBIAN_PACKAGE_RELEASE@)
|
||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
||||
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${PROJECT_BINARY_DIR}/postinst;${PROJECT_BINARY_DIR}/prerm")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hsa-rocr-dev (>= 1.3), rocminfo, hip-base (= ${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}), comgr (>= 2.0), llvm-amdgpu, libc6")
|
||||
set(CPACK_DEBIAN_PACKAGE_PROVIDES "hip-hcc (= ${CPACK_PACKAGE_VERSION})")
|
||||
|
||||
set(CPACK_BINARY_RPM "ON")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE @CPACK_RPM_PACKAGE_RELEASE@)
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/postinst")
|
||||
set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${PROJECT_BINARY_DIR}/prerm")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
|
||||
string(REPLACE "-" "_" HIP_BASE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "hsa-rocr-dev >= 1.3, rocminfo, hip-base = ${HIP_BASE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}, comgr >= 2.0, llvm-amdgpu")
|
||||
set(CPACK_RPM_PACKAGE_PROVIDES "hip-hcc = ${HIP_BASE_VERSION}")
|
||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
include(CPack)
|
||||
@@ -1,61 +0,0 @@
|
||||
# Copyright (c) 2016-2021 Advanced Micro Devices, Inc. All rights reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.3)
|
||||
project(hip_samples)
|
||||
|
||||
install(DIRECTORY @hip_SOURCE_DIR@/samples DESTINATION .)
|
||||
|
||||
#############################
|
||||
# Packaging steps
|
||||
#############################
|
||||
set(CPACK_SET_DESTDIR TRUE)
|
||||
set(CPACK_INSTALL_PREFIX @CPACK_INSTALL_PREFIX@ )
|
||||
set(CPACK_PACKAGE_NAME "hip-samples")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "HIP: Heterogenous-computing Interface for Portability [SAMPLES]")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "HIP:
|
||||
Heterogenous-computing Interface for Portability [SAMPLES]")
|
||||
set(CPACK_PACKAGE_VENDOR "Advanced Micro Devices, Inc.")
|
||||
set(CPACK_PACKAGE_CONTACT "HIP Support <hip.support@amd.com>")
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR @HIP_VERSION_MAJOR@)
|
||||
set(CPACK_PACKAGE_VERSION_MINOR @HIP_VERSION_MINOR@)
|
||||
set(CPACK_PACKAGE_VERSION_PATCH @HIP_VERSION_PATCH@)
|
||||
set(CPACK_PACKAGE_VERSION @HIP_VERSION_MAJOR@.@HIP_VERSION_MINOR@.@HIP_PACKAGING_VERSION_PATCH@)
|
||||
set(CPACK_GENERATOR "TGZ;DEB;RPM")
|
||||
|
||||
set(CPACK_BINARY_DEB "ON")
|
||||
set(CPACK_DEBIAN_PACKAGE_RELEASE @CPACK_DEBIAN_PACKAGE_RELEASE@)
|
||||
set(CPACK_DEBIAN_FILE_NAME "DEB-DEFAULT")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "hip-base (= ${CPACK_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE})")
|
||||
set(CPACK_DEBIAN_PACKAGE_PROVIDES "hip-samples")
|
||||
set(CPACK_DEBIAN_PACKAGE_REPLACES "hip_samples")
|
||||
|
||||
set(CPACK_BINARY_RPM "ON")
|
||||
set(CPACK_RPM_PACKAGE_RELEASE @CPACK_RPM_PACKAGE_RELEASE@)
|
||||
set(CPACK_RPM_FILE_NAME "RPM-DEFAULT")
|
||||
set(CPACK_RPM_PACKAGE_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CPACK_RPM_PACKAGE_AUTOREQPROV " no")
|
||||
string(REPLACE "-" "_" HIP_BASE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
set(CPACK_RPM_PACKAGE_REQUIRES "hip-base = ${HIP_BASE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}")
|
||||
set(CPACK_RPM_PACKAGE_OBSOLETES "hip_samples")
|
||||
set(CPACK_RPM_PACKAGE_CONFLICTS "hip_samples")
|
||||
set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/opt")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
include(CPack)
|
||||
Ссылка в новой задаче
Block a user