mirror of
https://github.com/NVIDIA/cuda-samples.git
synced 2026-01-09 20:07:49 +08:00
Bug 5591814: Support "make install" for Windows
This commit is contained in:
parent
4eae2ccc04
commit
9600b04a3c
@ -22,4 +22,7 @@ endif()
|
|||||||
|
|
||||||
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
|
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --extended-lambda")
|
||||||
|
|
||||||
|
# Include installation configuration before processing samples
|
||||||
|
include(cmake/InstallSamples.cmake)
|
||||||
|
|
||||||
add_subdirectory(Samples)
|
add_subdirectory(Samples)
|
||||||
|
|||||||
@ -15,57 +15,105 @@
|
|||||||
#
|
#
|
||||||
# Users can override by setting CMAKE_INSTALL_PREFIX or CUDA_SAMPLES_INSTALL_DIR
|
# Users can override by setting CMAKE_INSTALL_PREFIX or CUDA_SAMPLES_INSTALL_DIR
|
||||||
|
|
||||||
# Detect target architecture - use lowercase of CMAKE_SYSTEM_PROCESSOR
|
# Configure paths only once (but always define the function below)
|
||||||
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" TARGET_ARCH)
|
if(NOT CUDA_SAMPLES_INSTALL_CONFIGURED)
|
||||||
|
set(CUDA_SAMPLES_INSTALL_CONFIGURED TRUE CACHE INTERNAL "InstallSamples configuration guard")
|
||||||
|
|
||||||
# Detect target OS
|
# Detect target architecture - use lowercase of CMAKE_SYSTEM_PROCESSOR
|
||||||
if(WIN32)
|
string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" TARGET_ARCH_TEMP)
|
||||||
set(TARGET_OS "windows")
|
set(TARGET_ARCH "${TARGET_ARCH_TEMP}" CACHE INTERNAL "Target architecture")
|
||||||
elseif(APPLE)
|
|
||||||
set(TARGET_OS "darwin")
|
# Detect target OS
|
||||||
elseif(UNIX)
|
if(WIN32)
|
||||||
|
set(TARGET_OS_TEMP "windows")
|
||||||
|
elseif(APPLE)
|
||||||
|
set(TARGET_OS_TEMP "darwin")
|
||||||
|
elseif(UNIX)
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES QNX)
|
if(CMAKE_SYSTEM_NAME MATCHES QNX)
|
||||||
set(TARGET_OS "qnx")
|
set(TARGET_OS_TEMP "qnx")
|
||||||
else()
|
else()
|
||||||
set(TARGET_OS "linux")
|
set(TARGET_OS_TEMP "linux")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(TARGET_OS "unknown")
|
set(TARGET_OS_TEMP "unknown")
|
||||||
endif()
|
endif()
|
||||||
|
set(TARGET_OS "${TARGET_OS_TEMP}" CACHE INTERNAL "Target OS")
|
||||||
|
|
||||||
# Get build type (default to release if not specified)
|
# Detect if using multi-config generator (Visual Studio, Xcode, Ninja Multi-Config)
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
get_property(MULTI_CONFIG_TEMP GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||||||
set(CMAKE_BUILD_TYPE "release")
|
set(MULTI_CONFIG "${MULTI_CONFIG_TEMP}" CACHE INTERNAL "Multi-config generator flag")
|
||||||
endif()
|
|
||||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER)
|
|
||||||
|
|
||||||
# Set default install prefix to build/bin if not explicitly set by user
|
# Get build type
|
||||||
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
if(MULTI_CONFIG)
|
||||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/bin" CACHE PATH "Installation directory" FORCE)
|
# Multi-config generators: use $<CONFIG> which is evaluated at build/install time
|
||||||
endif()
|
set(BUILD_TYPE_EXPR "$<LOWER_CASE:$<CONFIG>>" CACHE INTERNAL "Build type expression")
|
||||||
|
set(BUILD_TYPE_MSG "multi-config (specified at build time)")
|
||||||
|
else()
|
||||||
|
# Single-config generators: use CMAKE_BUILD_TYPE (default to release if not specified)
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE "Release")
|
||||||
|
endif()
|
||||||
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER_TEMP)
|
||||||
|
set(BUILD_TYPE_EXPR "${BUILD_TYPE_LOWER_TEMP}" CACHE INTERNAL "Build type expression")
|
||||||
|
set(BUILD_TYPE_MSG "${BUILD_TYPE_LOWER_TEMP}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Create the installation path: bin/$(TARGET_ARCH)/$(TARGET_OS)/$(BUILD_TYPE)
|
# Set default install prefix to build/bin if not explicitly set by user
|
||||||
set(CUDA_SAMPLES_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${TARGET_ARCH}/${TARGET_OS}/${BUILD_TYPE_LOWER}" CACHE PATH "Installation directory for CUDA samples")
|
# Use the root binary directory (where CMakeCache.txt is located)
|
||||||
|
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
# Find the directory containing CMakeCache.txt (the root build directory)
|
||||||
|
set(ROOT_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
||||||
|
set(PREV_DIR "")
|
||||||
|
set(MAX_ITERATIONS 50)
|
||||||
|
set(ITERATION 0)
|
||||||
|
while(NOT EXISTS "${ROOT_BINARY_DIR}/CMakeCache.txt"
|
||||||
|
AND NOT "${ROOT_BINARY_DIR}" STREQUAL "/"
|
||||||
|
AND NOT "${ROOT_BINARY_DIR}" STREQUAL ""
|
||||||
|
AND NOT "${ROOT_BINARY_DIR}" STREQUAL "${PREV_DIR}"
|
||||||
|
AND ITERATION LESS MAX_ITERATIONS)
|
||||||
|
set(PREV_DIR "${ROOT_BINARY_DIR}")
|
||||||
|
get_filename_component(ROOT_BINARY_DIR "${ROOT_BINARY_DIR}" DIRECTORY)
|
||||||
|
math(EXPR ITERATION "${ITERATION} + 1")
|
||||||
|
endwhile()
|
||||||
|
# If CMakeCache.txt wasn't found, fall back to CMAKE_BINARY_DIR
|
||||||
|
if(NOT EXISTS "${ROOT_BINARY_DIR}/CMakeCache.txt")
|
||||||
|
set(ROOT_BINARY_DIR "${CMAKE_BINARY_DIR}")
|
||||||
|
endif()
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${ROOT_BINARY_DIR}/bin" CACHE PATH "Installation directory" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Print installation configuration only once
|
# Create the installation path: bin/$(TARGET_ARCH)/$(TARGET_OS)/$(BUILD_TYPE)
|
||||||
if(NOT CUDA_SAMPLES_INSTALL_CONFIG_PRINTED)
|
# 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")
|
||||||
|
|
||||||
|
# Print installation configuration
|
||||||
message(STATUS "CUDA Samples installation configured:")
|
message(STATUS "CUDA Samples installation configured:")
|
||||||
message(STATUS " Architecture: ${TARGET_ARCH}")
|
message(STATUS " Architecture: ${TARGET_ARCH}")
|
||||||
message(STATUS " OS: ${TARGET_OS}")
|
message(STATUS " OS: ${TARGET_OS}")
|
||||||
message(STATUS " Build Type: ${BUILD_TYPE_LOWER}")
|
message(STATUS " Build Type: ${BUILD_TYPE_MSG}")
|
||||||
|
message(STATUS " Install Prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||||
|
if(NOT MULTI_CONFIG)
|
||||||
message(STATUS " Install Directory: ${CUDA_SAMPLES_INSTALL_DIR}")
|
message(STATUS " Install Directory: ${CUDA_SAMPLES_INSTALL_DIR}")
|
||||||
set(CUDA_SAMPLES_INSTALL_CONFIG_PRINTED TRUE CACHE INTERNAL "Installation config printed flag")
|
else()
|
||||||
|
message(STATUS " Install Directory: ${CMAKE_INSTALL_PREFIX}/${TARGET_ARCH}/${TARGET_OS}/<config>")
|
||||||
|
endif()
|
||||||
endif()
|
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 will copy executables and specific file types
|
||||||
# - Executables: copied to flat root directory (easy access)
|
# All files are copied to flat root directory
|
||||||
# - Data files: copied to subdirectories (preserves relative paths)
|
|
||||||
# - run_tests.py automatically tries flattened paths as fallback
|
|
||||||
# This script runs at install time, after the build is complete
|
# This script runs at install time, after the build is complete
|
||||||
install(CODE "
|
install(CODE "
|
||||||
|
# Determine the actual install directory based on the configuration
|
||||||
|
# CMAKE_INSTALL_CONFIG_NAME is available at install time for multi-config generators
|
||||||
|
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}\")
|
||||||
|
|
||||||
# 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
|
||||||
@ -90,8 +138,45 @@ function(setup_samples_install)
|
|||||||
\"${CMAKE_CURRENT_SOURCE_DIR}/../../../../Common/data/*\")
|
\"${CMAKE_CURRENT_SOURCE_DIR}/../../../../Common/data/*\")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Copy shared library files from bin/win64 directory (Windows only)
|
||||||
|
# These are pre-built DLLs like freeglut.dll, glew64.dll, etc.
|
||||||
|
set(SHARED_LIB_FILES \"\")
|
||||||
|
if(CMAKE_HOST_WIN32)
|
||||||
|
# Determine build configuration at install time
|
||||||
|
# CMAKE_INSTALL_CONFIG_NAME is set by CMake at install time for multi-config generators
|
||||||
|
if(DEFINED CMAKE_INSTALL_CONFIG_NAME)
|
||||||
|
string(TOLOWER \"\${CMAKE_INSTALL_CONFIG_NAME}\" INSTALL_CONFIG_LOWER)
|
||||||
|
else()
|
||||||
|
# Fallback for single-config generators
|
||||||
|
set(INSTALL_CONFIG_LOWER \"${BUILD_TYPE_EXPR}\")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Try multiple possible paths for bin/win64 directory
|
||||||
|
set(BIN_WIN64_PATHS
|
||||||
|
\"${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/win64/\${INSTALL_CONFIG_LOWER}\"
|
||||||
|
\"${CMAKE_CURRENT_SOURCE_DIR}/../../../../bin/win64/\${INSTALL_CONFIG_LOWER}\"
|
||||||
|
\"${CMAKE_SOURCE_DIR}/bin/win64/\${INSTALL_CONFIG_LOWER}\"
|
||||||
|
)
|
||||||
|
foreach(BIN_PATH IN LISTS BIN_WIN64_PATHS)
|
||||||
|
if(EXISTS \"\${BIN_PATH}\")
|
||||||
|
file(GLOB SHARED_LIB_FILES
|
||||||
|
LIST_DIRECTORIES false
|
||||||
|
\"\${BIN_PATH}/*.dll\")
|
||||||
|
if(SHARED_LIB_FILES)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Combine all lists
|
# Combine all lists
|
||||||
set(SAMPLE_FILES \${BINARY_FILES} \${SAMPLE_DATA_FILES} \${COMMON_DATA_FILES})
|
set(SAMPLE_FILES \${BINARY_FILES} \${SAMPLE_DATA_FILES} \${COMMON_DATA_FILES} \${SHARED_LIB_FILES})
|
||||||
|
|
||||||
|
# Remove duplicates to avoid copying the same file multiple times
|
||||||
|
# This preserves the order, so files from earlier sources take precedence
|
||||||
|
list(REMOVE_DUPLICATES SAMPLE_FILES)
|
||||||
|
|
||||||
|
set(INSTALLED_COUNT 0)
|
||||||
|
|
||||||
# Filter to include executable files and specific file types
|
# Filter to include executable files and specific file types
|
||||||
foreach(SAMPLE_FILE IN LISTS SAMPLE_FILES)
|
foreach(SAMPLE_FILE IN LISTS SAMPLE_FILES)
|
||||||
@ -102,18 +187,30 @@ function(setup_samples_install)
|
|||||||
|
|
||||||
set(SHOULD_INSTALL FALSE)
|
set(SHOULD_INSTALL FALSE)
|
||||||
|
|
||||||
# Skip build artifacts and CMake files
|
# Skip build artifacts, source files, and CMake files
|
||||||
if(NOT SAMPLE_EXT MATCHES \"\\\\.(o|a|so|cmake)$\" AND
|
# Note: .lib (Windows import libs) and .a (static libs) are excluded - link-time only
|
||||||
|
# .so (Linux shared libs) and .dll (Windows DLLs) are included - runtime dependencies
|
||||||
|
# Source files (.cu, .cpp, .c, .h, etc.) are excluded - not needed at runtime
|
||||||
|
if(NOT SAMPLE_EXT MATCHES \"\\\\.(o|a|cmake|obj|lib|exp|ilk|pdb|cu|cpp|cxx|cc|c|h|hpp|hxx|cuh|inl)$\" AND
|
||||||
NOT SAMPLE_NAME MATCHES \"^(Makefile|cmake_install\\\\.cmake)$\" AND
|
NOT SAMPLE_NAME MATCHES \"^(Makefile|cmake_install\\\\.cmake)$\" AND
|
||||||
NOT \"\${SAMPLE_FILE}\" MATCHES \"/CMakeFiles/\")
|
NOT \"\${SAMPLE_FILE}\" MATCHES \"/CMakeFiles/\" AND
|
||||||
|
NOT \"\${SAMPLE_FILE}\" MATCHES \"\\\\\\\\CMakeFiles\\\\\\\\\")
|
||||||
|
|
||||||
# Check if file has required extension (fatbin, ptx, bc, raw, ppm) or is executable
|
# Check if file has required extension (fatbin, ptx, bc, raw, ppm) or is executable
|
||||||
if(SAMPLE_EXT MATCHES \"\\\\.(fatbin|ptx|bc|raw|ppm)$\")
|
if(SAMPLE_EXT MATCHES \"\\\\.(fatbin|ptx|bc|raw|ppm)$\")
|
||||||
set(SHOULD_INSTALL TRUE)
|
set(SHOULD_INSTALL TRUE)
|
||||||
|
# Check for shared libraries: .dll (Windows) or .so (Linux)
|
||||||
|
elseif(SAMPLE_EXT MATCHES \"\\\\.(dll|so)$\")
|
||||||
|
set(SHOULD_INSTALL TRUE)
|
||||||
|
# On Windows, check for .exe extension
|
||||||
|
elseif(CMAKE_HOST_WIN32 AND SAMPLE_EXT MATCHES \"\\\\.(exe)$\")
|
||||||
|
set(SHOULD_INSTALL TRUE)
|
||||||
else()
|
else()
|
||||||
# Check if file is executable
|
# On Unix-like systems, check if file has executable permissions
|
||||||
|
if(NOT CMAKE_HOST_WIN32)
|
||||||
if(IS_SYMLINK \"\${SAMPLE_FILE}\" OR
|
if(IS_SYMLINK \"\${SAMPLE_FILE}\" OR
|
||||||
(EXISTS \"\${SAMPLE_FILE}\" AND NOT IS_DIRECTORY \"\${SAMPLE_FILE}\"))
|
(EXISTS \"\${SAMPLE_FILE}\" AND NOT IS_DIRECTORY \"\${SAMPLE_FILE}\"))
|
||||||
|
# Use test -x to check if file has executable permissions
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND test -x \"\${SAMPLE_FILE}\"
|
COMMAND test -x \"\${SAMPLE_FILE}\"
|
||||||
RESULT_VARIABLE IS_EXEC
|
RESULT_VARIABLE IS_EXEC
|
||||||
@ -125,39 +222,108 @@ function(setup_samples_install)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(SHOULD_INSTALL)
|
if(SHOULD_INSTALL)
|
||||||
get_filename_component(FILE_NAME \"\${SAMPLE_FILE}\" NAME)
|
get_filename_component(FILE_NAME \"\${SAMPLE_FILE}\" NAME)
|
||||||
set(DEST_FILE \"${CUDA_SAMPLES_INSTALL_DIR}/\${FILE_NAME}\")
|
set(DEST_FILE \"\${INSTALL_DIR}/\${FILE_NAME}\")
|
||||||
|
|
||||||
# Check if file is executable
|
# Determine file type based on extension
|
||||||
execute_process(
|
get_filename_component(FILE_EXT \"\${SAMPLE_FILE}\" EXT)
|
||||||
COMMAND test -x \"\${SAMPLE_FILE}\"
|
set(IS_EXECUTABLE FALSE)
|
||||||
RESULT_VARIABLE HAS_EXEC_BIT
|
set(IS_SHARED_LIB FALSE)
|
||||||
OUTPUT_QUIET ERROR_QUIET
|
set(IS_DATA_FILE FALSE)
|
||||||
)
|
|
||||||
|
# Check for known data file extensions first
|
||||||
|
if(FILE_EXT MATCHES \"\\\\.(fatbin|ptx|bc|raw|ppm)$\")
|
||||||
|
set(IS_DATA_FILE TRUE)
|
||||||
|
# Check if it's a shared library
|
||||||
|
elseif(FILE_EXT MATCHES \"\\\\.(dll|so)$\")
|
||||||
|
set(IS_SHARED_LIB TRUE)
|
||||||
|
# Check if it's an executable
|
||||||
|
else()
|
||||||
|
# On Windows, check for .exe extension (not .dll - those are libraries)
|
||||||
|
if(CMAKE_HOST_WIN32)
|
||||||
|
if(FILE_EXT MATCHES \"\\\\.(exe)$\")
|
||||||
|
set(IS_EXECUTABLE TRUE)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# On Unix-like systems, check for no extension (typical for executables)
|
||||||
|
# .so files are shared libraries, not executables
|
||||||
|
if(FILE_EXT STREQUAL \"\")
|
||||||
|
set(IS_EXECUTABLE TRUE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
get_filename_component(DEST_DIR \"\${DEST_FILE}\" DIRECTORY)
|
get_filename_component(DEST_DIR \"\${DEST_FILE}\" DIRECTORY)
|
||||||
|
|
||||||
if(HAS_EXEC_BIT EQUAL 0)
|
# Check if this is a Common data file that already exists
|
||||||
# File is executable - copy with execute permissions
|
# Skip copying to avoid redundant operations when multiple samples use the same files
|
||||||
message(STATUS \"Installing executable: \${DEST_FILE}\")
|
set(SKIP_COPY FALSE)
|
||||||
file(COPY \"\${SAMPLE_FILE}\"
|
if(\"\${SAMPLE_FILE}\" MATCHES \"/Common/data/\" AND EXISTS \"\${DEST_FILE}\")
|
||||||
DESTINATION \"\${DEST_DIR}\"
|
set(SKIP_COPY TRUE)
|
||||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
endif()
|
||||||
GROUP_READ GROUP_EXECUTE
|
|
||||||
WORLD_READ WORLD_EXECUTE)
|
if(NOT SKIP_COPY)
|
||||||
else()
|
if(IS_DATA_FILE)
|
||||||
# Regular file - copy without execute permissions
|
# Data file (.raw, .ppm, .ptx, .fatbin, .bc) - copy without execute permissions
|
||||||
message(STATUS \"Installing data file: \${DEST_FILE}\")
|
message(STATUS \"Installing data file: \${DEST_FILE}\")
|
||||||
|
if(CMAKE_HOST_WIN32)
|
||||||
|
file(COPY \"\${SAMPLE_FILE}\" DESTINATION \"\${DEST_DIR}\")
|
||||||
|
else()
|
||||||
file(COPY \"\${SAMPLE_FILE}\"
|
file(COPY \"\${SAMPLE_FILE}\"
|
||||||
DESTINATION \"\${DEST_DIR}\"
|
DESTINATION \"\${DEST_DIR}\"
|
||||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
|
||||||
GROUP_READ
|
GROUP_READ
|
||||||
WORLD_READ)
|
WORLD_READ)
|
||||||
endif()
|
endif()
|
||||||
|
math(EXPR INSTALLED_COUNT \"\${INSTALLED_COUNT} + 1\")
|
||||||
|
elseif(IS_EXECUTABLE)
|
||||||
|
# File is executable - copy with execute permissions (Unix) or as-is (Windows)
|
||||||
|
message(STATUS \"Installing executable: \${DEST_FILE}\")
|
||||||
|
if(CMAKE_HOST_WIN32)
|
||||||
|
file(COPY \"\${SAMPLE_FILE}\" DESTINATION \"\${DEST_DIR}\")
|
||||||
|
else()
|
||||||
|
file(COPY \"\${SAMPLE_FILE}\"
|
||||||
|
DESTINATION \"\${DEST_DIR}\"
|
||||||
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||||
|
GROUP_READ GROUP_EXECUTE
|
||||||
|
WORLD_READ WORLD_EXECUTE)
|
||||||
|
endif()
|
||||||
|
math(EXPR INSTALLED_COUNT \"\${INSTALLED_COUNT} + 1\")
|
||||||
|
elseif(IS_SHARED_LIB)
|
||||||
|
# Shared library - copy with appropriate permissions
|
||||||
|
message(STATUS \"Installing shared library: \${DEST_FILE}\")
|
||||||
|
if(CMAKE_HOST_WIN32)
|
||||||
|
file(COPY \"\${SAMPLE_FILE}\" DESTINATION \"\${DEST_DIR}\")
|
||||||
|
else()
|
||||||
|
file(COPY \"\${SAMPLE_FILE}\"
|
||||||
|
DESTINATION \"\${DEST_DIR}\"
|
||||||
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
|
||||||
|
GROUP_READ
|
||||||
|
WORLD_READ)
|
||||||
|
endif()
|
||||||
|
math(EXPR INSTALLED_COUNT \"\${INSTALLED_COUNT} + 1\")
|
||||||
|
else()
|
||||||
|
# Unknown file type - copy as regular file without execute permissions
|
||||||
|
message(STATUS \"Installing file: \${DEST_FILE}\")
|
||||||
|
if(CMAKE_HOST_WIN32)
|
||||||
|
file(COPY \"\${SAMPLE_FILE}\" DESTINATION \"\${DEST_DIR}\")
|
||||||
|
else()
|
||||||
|
file(COPY \"\${SAMPLE_FILE}\"
|
||||||
|
DESTINATION \"\${DEST_DIR}\"
|
||||||
|
FILE_PERMISSIONS OWNER_READ OWNER_WRITE
|
||||||
|
GROUP_READ
|
||||||
|
WORLD_READ)
|
||||||
|
endif()
|
||||||
|
math(EXPR INSTALLED_COUNT \"\${INSTALLED_COUNT} + 1\")
|
||||||
|
endif()
|
||||||
|
endif() # NOT SKIP_COPY
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
message(STATUS \"Installation complete: \${INSTALLED_COUNT} files installed to \${INSTALL_DIR}\")
|
||||||
")
|
")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user