mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-10-26 06:38:16 +08:00
Bug 5591814: Support "make install" in single sample folder
This commit is contained in:
@@ -128,3 +128,8 @@ add_subdirectory(simple)
|
||||
add_subdirectory(syscalls)
|
||||
add_subdirectory(ptxgen)
|
||||
add_subdirectory(uvmlite)
|
||||
|
||||
# Include InstallSamples to set CUDA_SAMPLES_INSTALL_DIR
|
||||
# libNVVM samples will use this variable for installation
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake")
|
||||
include(InstallSamples)
|
||||
|
||||
@@ -80,7 +80,13 @@ add_library(mathfuncs64 STATIC math-funcs.cu)
|
||||
set_target_properties(mathfuncs64 PROPERTIES PREFIX "lib"
|
||||
OUTPUT_NAME "mathfuncs64"
|
||||
SUFFIX ".a" CUDA_SEPERABLE_COMPILATION ON)
|
||||
install(TARGETS cuda-c-linking mathfuncs64 DESTINATION bin)
|
||||
# Install to CUDA_SAMPLES_INSTALL_DIR if defined (for unified installation),
|
||||
# otherwise install to bin (for standalone libNVVM build)
|
||||
if(DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||
install(TARGETS cuda-c-linking mathfuncs64 DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
else()
|
||||
install(TARGETS cuda-c-linking mathfuncs64 DESTINATION bin)
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
add_custom_command(
|
||||
|
||||
@@ -39,9 +39,15 @@ set_tests_properties(test-cuda-shared-memory-shared_memory
|
||||
test-cuda-shared-memory-extern_shared_memory
|
||||
PROPERTIES FIXTURES_REQUIRED PTXGENTEST)
|
||||
|
||||
# Install the .ll files to the install/ folder
|
||||
install(FILES shared_memory.ll DESTINATION bin/cuda-shared-memory)
|
||||
install(FILES extern_shared_memory.ll DESTINATION bin/cuda-shared-memory)
|
||||
# Install to CUDA_SAMPLES_INSTALL_DIR if defined (for unified installation),
|
||||
# otherwise install to bin/cuda-shared-memory (for standalone libNVVM build)
|
||||
if(DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||
install(FILES shared_memory.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR}/cuda-shared-memory)
|
||||
install(FILES extern_shared_memory.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR}/cuda-shared-memory)
|
||||
else()
|
||||
install(FILES shared_memory.ll DESTINATION bin/cuda-shared-memory)
|
||||
install(FILES extern_shared_memory.ll DESTINATION bin/cuda-shared-memory)
|
||||
endif()
|
||||
|
||||
file(COPY shared_memory.ll DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
file(COPY extern_shared_memory.ll DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
@@ -41,8 +41,15 @@ else (WIN32)
|
||||
set_target_properties(dsl PROPERTIES LINK_FLAGS "-Wl,-rpath,${LIBNVVM_RPATH}")
|
||||
endif (WIN32)
|
||||
|
||||
install(TARGETS dsl DESTINATION bin)
|
||||
install(FILES dsl-gpu64.ll DESTINATION bin)
|
||||
# Install to CUDA_SAMPLES_INSTALL_DIR if defined (for unified installation),
|
||||
# otherwise install to bin (for standalone libNVVM build)
|
||||
if(DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||
install(TARGETS dsl DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
install(FILES dsl-gpu64.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
else()
|
||||
install(TARGETS dsl DESTINATION bin)
|
||||
install(FILES dsl-gpu64.ll DESTINATION bin)
|
||||
endif()
|
||||
|
||||
# 'dsl' will load dsl-gpu64.ll from the current working directory. That
|
||||
# .ll file should be present where tests are executed (the build directory).
|
||||
|
||||
@@ -48,8 +48,15 @@ else (WIN32)
|
||||
LINK_FLAGS "-Wl,-rpath,${LIBNVVM_RPATH}")
|
||||
endif (WIN32)
|
||||
|
||||
install(TARGETS ptxgen DESTINATION bin)
|
||||
install(FILES test.ll DESTINATION bin)
|
||||
# Install to CUDA_SAMPLES_INSTALL_DIR if defined (for unified installation),
|
||||
# otherwise install to bin (for standalone libNVVM build)
|
||||
if(DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||
install(TARGETS ptxgen DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
install(FILES test.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
else()
|
||||
install(TARGETS ptxgen DESTINATION bin)
|
||||
install(FILES test.ll DESTINATION bin)
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
TARGET ptxgen
|
||||
|
||||
@@ -40,8 +40,15 @@ else (WIN32)
|
||||
LINK_FLAGS "-Wl,-rpath,${LIBNVVM_RPATH}")
|
||||
endif (WIN32)
|
||||
|
||||
install(TARGETS simple DESTINATION bin)
|
||||
install(FILES simple-gpu64.ll DESTINATION bin)
|
||||
# Install to CUDA_SAMPLES_INSTALL_DIR if defined (for unified installation),
|
||||
# otherwise install to bin (for standalone libNVVM build)
|
||||
if(DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||
install(TARGETS simple DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
install(FILES simple-gpu64.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
else()
|
||||
install(TARGETS simple DESTINATION bin)
|
||||
install(FILES simple-gpu64.ll DESTINATION bin)
|
||||
endif()
|
||||
|
||||
# 'simple' will load simple-gpu64.ll from the current working directory. That
|
||||
# .ll file should be present where tests are executed (the build directory).
|
||||
|
||||
@@ -36,8 +36,15 @@ add_test(NAME test-syscalls-vprintf
|
||||
set_tests_properties(test-syscalls-vprintf test-syscalls-malloc-free
|
||||
PROPERTIES FIXTURES_REQUIRED PTXGENTEST)
|
||||
|
||||
install(FILES malloc-free.ll DESTINATION bin/syscalls)
|
||||
install(FILES vprintf.ll DESTINATION bin/syscalls)
|
||||
# Install to CUDA_SAMPLES_INSTALL_DIR if defined (for unified installation),
|
||||
# otherwise install to bin/syscalls (for standalone libNVVM build)
|
||||
if(DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||
install(FILES malloc-free.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR}/syscalls)
|
||||
install(FILES vprintf.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR}/syscalls)
|
||||
else()
|
||||
install(FILES malloc-free.ll DESTINATION bin/syscalls)
|
||||
install(FILES vprintf.ll DESTINATION bin/syscalls)
|
||||
endif()
|
||||
|
||||
file(COPY malloc-free.ll DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
file(COPY vprintf.ll DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
@@ -44,8 +44,15 @@ else (WIN32)
|
||||
LINK_FLAGS "-Wl,-rpath,${LIBNVVM_RPATH}")
|
||||
endif ()
|
||||
|
||||
install(TARGETS uvmlite DESTINATION bin)
|
||||
install(FILES uvmlite64.ll DESTINATION bin)
|
||||
# Install to CUDA_SAMPLES_INSTALL_DIR if defined (for unified installation),
|
||||
# otherwise install to bin (for standalone libNVVM build)
|
||||
if(DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||
install(TARGETS uvmlite DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
install(FILES uvmlite64.ll DESTINATION ${CUDA_SAMPLES_INSTALL_DIR})
|
||||
else()
|
||||
install(TARGETS uvmlite DESTINATION bin)
|
||||
install(FILES uvmlite64.ll DESTINATION bin)
|
||||
endif()
|
||||
|
||||
# 'uvmlite' will load uvmlite64.ll from the current working directory. That
|
||||
# .ll file should be present where tests are executed (the build directory).
|
||||
|
||||
Reference in New Issue
Block a user