Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #39 from raramakr/gnuinstall
Browse files Browse the repository at this point in the history
Use GNUInstallDirs
  • Loading branch information
ashwinma authored Jun 14, 2022
2 parents f71cef0 + c7bf8a5 commit 7ec0f96
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
5 changes: 4 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ include (FindPackageHandleStandardArgs)

project (atmi)

# Set default libdir to be "lib" for ROCm, distros will override this anyway:
set(CMAKE_INSTALL_LIBDIR "lib" CACHE STRING "Library install directory")
include(GNUInstallDirs)
macro(libatmi_runtime_say_and_exit message_to_user)
message(FATAL_ERROR "ATMI: ${message_to_user}")
endmacro()
Expand Down Expand Up @@ -112,7 +115,7 @@ set ( CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERS
set ( CPACK_PACKAGE_CONTACT "ATMI Support <atmi.support@amd.com>" )
set ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Asynchronous Task and Memory Interface" )
set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE.txt" )
install( FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION share/doc/atmi COMPONENT runtime )
install( FILES ${CPACK_RESOURCE_FILE_LICENSE} DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT runtime )

if ( NOT DEFINED CPACK_PACKAGING_INSTALL_PREFIX )
set ( CPACK_PACKAGING_INSTALL_PREFIX /opt/rocm )
Expand Down
14 changes: 8 additions & 6 deletions src/atmi-backward-compat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ set(ATMI_WRAPPER_DIR ${ATMI_BUILD_DIR}/wrapper_dir)
set(ATMI_WRAPPER_INC_DIR ${ATMI_WRAPPER_DIR}/include)
set(ATMI_WRAPPER_BIN_DIR ${ATMI_WRAPPER_DIR}/bin)
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(ATMI_LIB_NAME "lib-debug")
set(ATMI_LIB_DIR "lib-debug")
set(ROCM_LIB_DIR "lib-debug")
else()
set(ATMI_LIB_NAME "lib")
set(ATMI_LIB_DIR "lib")
set(ROCM_LIB_DIR "${CMAKE_INSTALL_LIBDIR}")
endif()
set(ATMI_WRAPPER_LIB_DIR ${ATMI_WRAPPER_DIR}/${ATMI_LIB_NAME})
set(ATMI_WRAPPER_LIB_DIR ${ATMI_WRAPPER_DIR}/${ATMI_LIB_DIR})

set(PUBLIC_HEADERS
atmi.h
Expand Down Expand Up @@ -72,7 +74,7 @@ function(generate_wrapper_header)
set(include_guard "${include_guard}ATMI_WRAPPER_INCLUDE_${INC_GAURD_NAME}_H")
get_filename_component(file_name ${header_file} NAME)
#set include statements
set(include_statements "${include_statements}#include \"../../include/${PROJECT_NAME}/${file_name}\"\n")
set(include_statements "${include_statements}#include \"../../${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}/${file_name}\"\n")
configure_file(${ATMI_WRAPPER_DIR}/header.hpp.in ${ATMI_WRAPPER_INC_DIR}/${file_name})
unset(include_statements)
endforeach()
Expand All @@ -88,7 +90,7 @@ function(create_binary_symlink)
add_custom_target(link_${file_name} ALL
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E create_symlink
../../libexec/${PROJECT_NAME}/${file_name} ${ATMI_WRAPPER_BIN_DIR}/${file_name})
../../${CMAKE_INSTALL_LIBEXECDIR}/${PROJECT_NAME}/${file_name} ${ATMI_WRAPPER_BIN_DIR}/${file_name})
endforeach()
endfunction()

Expand All @@ -110,7 +112,7 @@ function(create_library_symlink)
add_custom_target(link_${file_name} ALL
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E create_symlink
../../${ATMI_LIB_NAME}/${file_name} ${ATMI_WRAPPER_LIB_DIR}/${file_name})
../../${ROCM_LIB_DIR}/${file_name} ${ATMI_WRAPPER_LIB_DIR}/${file_name})
endforeach()
endfunction()

Expand Down
4 changes: 2 additions & 2 deletions src/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ if(ROCM_FOUND)
if(CMAKE_BUILD_TYPE MATCHES Debug)
install(TARGETS atmi_cplugin LIBRARY DESTINATION "lib-debug" COMPONENT cplugin )
else()
install(TARGETS atmi_cplugin LIBRARY DESTINATION "lib" COMPONENT cplugin )
install(TARGETS atmi_cplugin LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT cplugin )
endif()

INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../../include/atmi_c_ext.h
DESTINATION "include"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
COMPONENT cplugin
)

Expand Down
4 changes: 2 additions & 2 deletions src/device_runtime/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ foreach(mcpu ${mcpus})

install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../include/atmi_kl.h
DESTINATION include COMPONENT device_runtime)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT device_runtime)

if(CMAKE_BUILD_TYPE MATCHES Debug)
install(FILES
Expand All @@ -158,7 +158,7 @@ foreach(mcpu ${mcpus})
else()
install(FILES
${OUTPUTDIR}/atmi-${mcpu}.bc
DESTINATION lib COMPONENT device_runtime
DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT device_runtime
)
endif()
endforeach()
Expand Down
6 changes: 3 additions & 3 deletions src/runtime/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ add_custom_target(core_header ALL DEPENDS ${OUTPUT_INC_DIRECTORY}/atmi.h ${OUTPU
if(CMAKE_BUILD_TYPE MATCHES Debug)
install(TARGETS atmi_runtime LIBRARY DESTINATION "lib-debug" COMPONENT runtime )
else()
install(TARGETS atmi_runtime LIBRARY DESTINATION "lib" COMPONENT runtime )
install(TARGETS atmi_runtime LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT runtime )
endif()

INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../../include/atmi.h
${CMAKE_CURRENT_SOURCE_DIR}/../../../include/atmi_runtime.h
DESTINATION "include/atmi"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atmi"
COMPONENT runtime
)
INSTALL(FILES
Expand All @@ -159,6 +159,6 @@ INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/mygpu
${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/gputable.txt
PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
DESTINATION "libexec/atmi"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/atmi"
COMPONENT runtime
)
2 changes: 1 addition & 1 deletion src/runtime/interop/hsa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ add_custom_target(interop_header ALL DEPENDS ${OUTPUT_INC_DIRECTORY}/atmi_intero

INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/../../../../include/atmi_interop_hsa.h
DESTINATION "include/atmi"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atmi"
COMPONENT runtime
)

0 comments on commit 7ec0f96

Please sign in to comment.