mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-04-02 15:45:41 +08:00
Merge branch 'make_install' into 'master'
Make_install: enable setting CUDA_SAMPLES_INSTALL_DIR See merge request cuda-samples/cuda-samples!145
This commit is contained in:
commit
cdedff42d2
@ -79,12 +79,22 @@ if(NOT CUDA_SAMPLES_INSTALL_CONFIGURED)
|
|||||||
if(NOT EXISTS "${ROOT_BINARY_DIR}/CMakeCache.txt")
|
if(NOT EXISTS "${ROOT_BINARY_DIR}/CMakeCache.txt")
|
||||||
set(ROOT_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
set(ROOT_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
# If user didn't specify CMAKE_INSTALL_PREFIX, default to build/bin
|
||||||
set(CMAKE_INSTALL_PREFIX "${ROOT_BINARY_DIR}/bin" CACHE PATH "Installation directory" FORCE)
|
set(CMAKE_INSTALL_PREFIX "${ROOT_BINARY_DIR}/bin" CACHE PATH "Installation directory" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Create the installation path: bin/$(TARGET_ARCH)/$(TARGET_OS)/$(BUILD_TYPE)
|
# Create the installation path: bin/$(TARGET_ARCH)/$(TARGET_OS)/$(BUILD_TYPE)
|
||||||
# For multi-config generators, this will be evaluated at install time
|
# For multi-config generators, this will be evaluated at install time
|
||||||
set(CUDA_SAMPLES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${TARGET_ARCH}/${TARGET_OS}/${BUILD_TYPE_EXPR}" CACHE INTERNAL "Install directory for samples")
|
if(NOT DEFINED CUDA_SAMPLES_INSTALL_DIR)
|
||||||
|
set(CUDA_SAMPLES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${TARGET_ARCH}/${TARGET_OS}/${BUILD_TYPE_EXPR}" CACHE PATH "Install directory for samples")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check if we should use the default dynamic installation logic
|
||||||
|
if("${CUDA_SAMPLES_INSTALL_DIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${TARGET_ARCH}/${TARGET_OS}/${BUILD_TYPE_EXPR}")
|
||||||
|
set(CUDA_SAMPLES_INSTALL_USE_DEFAULT TRUE)
|
||||||
|
else()
|
||||||
|
set(CUDA_SAMPLES_INSTALL_USE_DEFAULT FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Print installation configuration
|
# Print installation configuration
|
||||||
message(STATUS "CUDA Samples installation configured:")
|
message(STATUS "CUDA Samples installation configured:")
|
||||||
@ -102,18 +112,21 @@ endif()
|
|||||||
# Function to setup installation for regular samples
|
# Function to setup installation for regular samples
|
||||||
# This should be called after all targets are defined
|
# This should be called after all targets are defined
|
||||||
function(setup_samples_install)
|
function(setup_samples_install)
|
||||||
# Create an install script that will copy executables and specific file types
|
# Create an install script that copies executables, data files, and shared libraries
|
||||||
# All files are copied to flat root directory
|
# This script only installs - build must be done separately
|
||||||
# This script runs at install time, after the build is complete
|
|
||||||
install(CODE "
|
install(CODE "
|
||||||
# Determine the actual install directory based on the configuration
|
if(\"${CUDA_SAMPLES_INSTALL_USE_DEFAULT}\" STREQUAL \"TRUE\")
|
||||||
# CMAKE_INSTALL_CONFIG_NAME is available at install time for multi-config generators
|
# Determine the actual install directory based on the configuration
|
||||||
if(DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
# CMAKE_INSTALL_CONFIG_NAME is available at install time for multi-config generators
|
||||||
string(TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" INSTALL_BUILD_TYPE)
|
if(DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||||
|
string(TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" INSTALL_BUILD_TYPE)
|
||||||
|
else()
|
||||||
|
set(INSTALL_BUILD_TYPE \"${BUILD_TYPE_EXPR}\")
|
||||||
|
endif()
|
||||||
|
set(INSTALL_DIR \"${CMAKE_INSTALL_PREFIX}/${TARGET_ARCH}/${TARGET_OS}/\${INSTALL_BUILD_TYPE}\")
|
||||||
else()
|
else()
|
||||||
set(INSTALL_BUILD_TYPE \"${BUILD_TYPE_EXPR}\")
|
set(INSTALL_DIR \"${CUDA_SAMPLES_INSTALL_DIR}\")
|
||||||
endif()
|
endif()
|
||||||
set(INSTALL_DIR \"${CMAKE_INSTALL_PREFIX}/${TARGET_ARCH}/${TARGET_OS}/\${INSTALL_BUILD_TYPE}\")
|
|
||||||
|
|
||||||
# Search in the current project's binary directory for built executables
|
# Search in the current project's binary directory for built executables
|
||||||
file(GLOB_RECURSE BINARY_FILES
|
file(GLOB_RECURSE BINARY_FILES
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user