Change HCC_DIR -> HCC_HOME, HSA_DIR -> HSA_PATH and HIP_INSTALL_PATH -> CMAKE_INSTALL_PREFIX
This commit is contained in:
+30
-32
@@ -5,56 +5,54 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED HCC_DIR)
|
||||
if(NOT DEFINED ENV{HCC_DIR})
|
||||
set(HCC_DIR "/opt/hcc" CACHE PATH "Path to which HCC has been installed")
|
||||
if(NOT DEFINED HCC_HOME)
|
||||
if(NOT DEFINED ENV{HCC_HOME})
|
||||
set(HCC_HOME "/opt/hcc" CACHE PATH "Path to which HCC has been installed")
|
||||
else()
|
||||
set(HCC_DIR $ENV{HCC_DIR} CACHE PATH "Path to which HCC has been installed")
|
||||
set(HCC_HOME $ENV{HCC_HOME} CACHE PATH "Path to which HCC has been installed")
|
||||
endif()
|
||||
endif()
|
||||
if(IS_ABSOLUTE ${HCC_DIR} AND EXISTS ${HCC_DIR} AND IS_DIRECTORY ${HCC_DIR})
|
||||
message(STATUS "Looking for HCC in: " ${HCC_DIR})
|
||||
if(IS_ABSOLUTE ${HCC_HOME} AND EXISTS ${HCC_HOME} AND IS_DIRECTORY ${HCC_HOME})
|
||||
message(STATUS "Looking for HCC in: " ${HCC_HOME})
|
||||
else()
|
||||
message(FATAL_ERROR "Don't know where to find HCC. Please specify abolute path using -DHCC_DIR")
|
||||
message(FATAL_ERROR "Don't know where to find HCC. Please specify abolute path using -DHCC_HOME")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED HSA_DIR)
|
||||
if(NOT DEFINED ENV{HSA_DIR})
|
||||
set(HSA_DIR "/opt/hsa" CACHE PATH "Path to which HSA runtime has been installed")
|
||||
if(NOT DEFINED HSA_PATH)
|
||||
if(NOT DEFINED ENV{HSA_PATH})
|
||||
set(HSA_PATH "/opt/hsa" CACHE PATH "Path to which HSA runtime has been installed")
|
||||
else()
|
||||
set(HSA_DIR $ENV{HSA_DIR} CACHE PATH "Path to which HSA runtime has been installed")
|
||||
set(HSA_PATH $ENV{HSA_PATH} CACHE PATH "Path to which HSA runtime has been installed")
|
||||
endif()
|
||||
endif()
|
||||
if(IS_ABSOLUTE ${HSA_DIR} AND EXISTS ${HSA_DIR} AND IS_DIRECTORY ${HSA_DIR})
|
||||
message(STATUS "Looking for HSA runtime in: " ${HSA_DIR})
|
||||
if(IS_ABSOLUTE ${HSA_PATH} AND EXISTS ${HSA_PATH} AND IS_DIRECTORY ${HSA_PATH})
|
||||
message(STATUS "Looking for HSA runtime in: " ${HSA_PATH})
|
||||
else()
|
||||
message(FATAL_ERROR "Don't know where to find HSA runtime. Please specify absolute path using -DHSA_DIR")
|
||||
message(FATAL_ERROR "Don't know where to find HSA runtime. Please specify absolute path using -DHSA_PATH")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED HIP_INSTALL_DIR)
|
||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(HIP_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Installation path for HIP")
|
||||
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Installation path for HIP" FORCE)
|
||||
elseif(CMAKE_BUILD_TYPE MATCHES Release)
|
||||
set(HIP_INSTALL_DIR "/opt/hip" CACHE PATH "Installation path for HIP")
|
||||
set(CMAKE_INSTALL_PREFIX "/opt/hip" CACHE PATH "Installation path for HIP" FORCE)
|
||||
else()
|
||||
message(FATAL_ERROR "Invalid CMAKE_BUILD_TYPE specified. Valid values are Debug and Release")
|
||||
endif()
|
||||
endif()
|
||||
if(IS_ABSOLUTE ${HIP_INSTALL_DIR})
|
||||
message(STATUS "HIP will be installed in: " ${HIP_INSTALL_DIR})
|
||||
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 -DHIP_INSTALL_DIR")
|
||||
message(FATAL_ERROR "Don't know where to install HIP. Please specify absolute path using -DCMAKE_INSTALL_PREFIX")
|
||||
endif()
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "${HIP_INSTALL_DIR}" CACHE INTERNAL "Installation path for HIP" FORCE)
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/include)
|
||||
|
||||
set(CMAKE_CXX_COMPILER "${HCC_DIR}/bin/hcc")
|
||||
set(CMAKE_C_COMPILER "${HCC_DIR}/bin/hcc")
|
||||
set(CMAKE_CXX_COMPILER "${HCC_HOME}/bin/hcc")
|
||||
set(CMAKE_C_COMPILER "${HCC_HOME}/bin/hcc")
|
||||
|
||||
set(CMAKE_CXX_FLAGS " -hc -I${HCC_DIR}/include -I${HSA_DIR}/include -stdlib=libc++ ")
|
||||
set(CMAKE_C_FLAGS " -hc -I${HCC_DIR}/include -I${HSA_DIR}/include -stdlib=libc++ ")
|
||||
set(CMAKE_CXX_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -stdlib=libc++ ")
|
||||
set(CMAKE_C_FLAGS " -hc -I${HCC_HOME}/include -I${HSA_PATH}/include -stdlib=libc++ ")
|
||||
|
||||
set(SOURCE_FILES src/device_util.cpp
|
||||
src/hip_hcc.cpp
|
||||
@@ -69,13 +67,13 @@ src/staging_buffer.cpp)
|
||||
#add_library(hip_hcc STATIC ${SOURCE_FILES})
|
||||
add_library(hip_hcc OBJECT ${SOURCE_FILES})
|
||||
|
||||
#install(TARGETS hip_hcc DESTINATION ${HIP_INSTALL_DIR}/lib)
|
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles/hip_hcc.dir/src/ DESTINATION ${HIP_INSTALL_DIR}/lib)
|
||||
set(EXECUTE_COMMAND test ${HIP_INSTALL_DIR} -ef ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
#install(TARGETS hip_hcc DESTINATION lib)
|
||||
install(DIRECTORY ${PROJECT_BINARY_DIR}/CMakeFiles/hip_hcc.dir/src/ DESTINATION lib)
|
||||
set(EXECUTE_COMMAND test ${CMAKE_INSTALL_PREFIX} -ef ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
execute_process(COMMAND ${EXECUTE_COMMAND} RESULT_VARIABLE INSTALL_SOURCE)
|
||||
if(NOT ${INSTALL_SOURCE} EQUAL 0)
|
||||
install(DIRECTORY src DESTINATION ${HIP_INSTALL_DIR})
|
||||
install(DIRECTORY bin DESTINATION ${HIP_INSTALL_DIR} USE_SOURCE_PERMISSIONS)
|
||||
install(DIRECTORY include DESTINATION ${HIP_INSTALL_DIR})
|
||||
install(DIRECTORY src DESTINATION .)
|
||||
install(DIRECTORY bin DESTINATION . USE_SOURCE_PERMISSIONS)
|
||||
install(DIRECTORY include DESTINATION .)
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user