Enhance CMAKE install instructions with std install location/destination (#85)
* Enhancement - usage of package name flags commonly across for getting unique folder name * Enhancements - updating libexec/pkg usage, avoid sbin * CMAKE Format Update * Python Format Update * Revert "Enhancement - usage of package name flags commonly across for getting unique folder name" This reverts commit 2dcd1ac5f22ab90112d90648e4b5dab5c54bc639. * REview Comments - Revert PACKAGE_NAME usage * Review Comments - Update source folders accordingly to new cmake install locations
This commit is contained in:
committed by
GitHub
orang tua
89cfb5317d
melakukan
6bb60bf930
@@ -2,4 +2,4 @@
|
||||
#
|
||||
#
|
||||
|
||||
add_subdirectory(rocprofiler-avail)
|
||||
add_subdirectory(rocprofiler-sdk)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
add_subdirectory(rocprofiler-avail)
|
||||
add_subdirectory(rocprofiler-sdk-launch-compiler)
|
||||
+3
-2
@@ -13,7 +13,8 @@ target_link_libraries(
|
||||
|
||||
set_target_properties(
|
||||
rocprofv3-list-avail
|
||||
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}
|
||||
PROPERTIES LIBRARY_OUTPUT_DIRECTORY
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}/rocprofiler-sdk
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR}
|
||||
VERSION ${PROJECT_VERSION}
|
||||
BUILD_RPATH "\$ORIGIN:\$ORIGIN/.."
|
||||
@@ -21,6 +22,6 @@ set_target_properties(
|
||||
|
||||
install(
|
||||
TARGETS rocprofv3-list-avail
|
||||
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}
|
||||
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/rocprofiler-sdk
|
||||
COMPONENT tools
|
||||
EXPORT rocprofiler-sdk-tool-targets)
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
|
||||
configure_file(
|
||||
rocprofiler-sdk-launch-compiler.sh
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}/rocprofiler-sdk/rocprofiler-sdk-launch-compiler
|
||||
COPYONLY)
|
||||
|
||||
install(
|
||||
FILES
|
||||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBEXECDIR}/rocprofiler-sdk/rocprofiler-sdk-launch-compiler
|
||||
DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/rocprofiler-sdk
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ
|
||||
WORLD_EXECUTE
|
||||
COMPONENT tools)
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
#!/bin/bash -e
|
||||
#
|
||||
# This script allows CMAKE_CXX_COMPILER to be a standard
|
||||
# C++ compiler and rocprofiler-sdk sets RULE_LAUNCH_COMPILE and
|
||||
# RULE_LAUNCH_LINK in CMake so that all compiler and link
|
||||
# commands are prefixed with this script followed by the
|
||||
# C++ compiler. Thus if $1 == $2 then we know the command
|
||||
# was intended for the C++ compiler and we discard both
|
||||
# $1 and $2 and redirect the command to linker.
|
||||
# If $1 != $2 then we know that the command was not intended
|
||||
# for the C++ compiler and we just discard $1 and launch
|
||||
# the original command. Examples of when $2 will not equal
|
||||
# $1 are 'ar', 'cmake', etc. during the linking phase
|
||||
#
|
||||
|
||||
# emit a message about the underlying command executed
|
||||
: ${DEBUG:=0}
|
||||
: ${ROCPROFILER_SDK_LAUNCH_COMPILER_DEBUG:=${DEBUG}}
|
||||
|
||||
debug-message()
|
||||
{
|
||||
if [ "${ROCPROFILER_SDK_LAUNCH_COMPILER_DEBUG}" -ne 0 ]; then
|
||||
echo -e "##### $(basename ${BASH_SOURCE[0]}) executing: \"$@\"... #####"
|
||||
fi
|
||||
}
|
||||
|
||||
# if rocprofiler-sdk compiler is not passed, someone is probably trying to invoke it directly
|
||||
if [ -z "${1}" ]; then
|
||||
echo -e "\n${BASH_SOURCE[0]} was invoked without the rocprofiler-sdk compiler as the first argument."
|
||||
echo "This script is not indended to be directly invoked by any mechanism other"
|
||||
echo -e "than through a RULE_LAUNCH_COMPILE or RULE_LAUNCH_LINK property set in CMake.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if rocprofiler-sdk compiler is not passed, someone is probably trying to invoke it directly
|
||||
if [ -z "${2}" ]; then
|
||||
echo -e "\n${BASH_SOURCE[0]} was invoked without the C++ compiler as the second argument."
|
||||
echo "This script is not indended to be directly invoked by any mechanism other"
|
||||
echo -e "than through a RULE_LAUNCH_COMPILE or RULE_LAUNCH_LINK property set in CMake.\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if there aren't two args, this isn't necessarily invalid, just a bit strange
|
||||
if [ -z "${3}" ]; then exit 0; fi
|
||||
|
||||
# store the rocprofiler-sdk compiler
|
||||
ROCPROFILER_SDK_COMPILER=${1}
|
||||
|
||||
# remove the rocprofiler-sdk compiler from the arguments
|
||||
shift
|
||||
|
||||
# store the expected C++ compiler
|
||||
CXX_COMPILER=${1}
|
||||
|
||||
# remove the expected C++ compiler from the arguments
|
||||
shift
|
||||
|
||||
# discards the clang-tidy arguments
|
||||
if [ "$(basename ${1})" = "cmake" ] && [ "${2}" = "-E" ] && [ "${3}" = "__run_co_compile" ]; then
|
||||
c=1
|
||||
n=1
|
||||
for i in "${@}"
|
||||
do
|
||||
if [ "${i}" = "--" ]; then
|
||||
break;
|
||||
fi
|
||||
if [ "${c}" -gt 3 ]; then
|
||||
n=$((${n} + 1))
|
||||
fi
|
||||
c=$((${c} + 1))
|
||||
done
|
||||
|
||||
if [[ $# -gt ${c} ]]; then
|
||||
n=$((${n} + 3)) # add three because of the first 3 args
|
||||
for i in $(seq 1 1 ${n})
|
||||
do
|
||||
shift
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${CXX_COMPILER}" != "${1}" ]]; then
|
||||
debug-message $@
|
||||
# the command does not depend on rocprofiler-sdk so just execute the command w/o re-directing to ${ROCPROFILER_SDK_COMPILER}
|
||||
exec $@
|
||||
else
|
||||
# the executable is the C++ compiler, so we need to re-direct to ${ROCPROFILER_SDK_COMPILER}
|
||||
if [ ! -f "${ROCPROFILER_SDK_COMPILER}" ]; then
|
||||
echo -e "\nError: the compiler redirect for rocprofiler-sdk was not found at ${ROCPROFILER_SDK_COMPILER}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# discard the compiler from the command
|
||||
shift
|
||||
|
||||
if [ -n "$(basename ${ROCPROFILER_SDK_COMPILER} | egrep 'amdclang|amdllvm')" ]; then
|
||||
# this ensures the libomptarget-amdgpu-gfx*.bc files are found
|
||||
LLVM_LIB_DIR=$(cd $(dirname $(realpath ${ROCPROFILER_SDK_COMPILER}))/../lib && pwd)
|
||||
debug-message export LIBRARY_PATH=${LLVM_LIB_DIR}:${LIBRARY_PATH}
|
||||
export LIBRARY_PATH=${LLVM_LIB_DIR}:${LIBRARY_PATH}
|
||||
fi
|
||||
|
||||
debug-message ${ROCPROFILER_SDK_COMPILER} $@
|
||||
# execute ${ROCPROFILER_SDK_COMPILER}
|
||||
exec ${ROCPROFILER_SDK_COMPILER} $@
|
||||
fi
|
||||
Reference in New Issue
Block a user