more flexible destination folder for scripts installation
parent
0a979f6a55
commit
1ec09ddf6a
|
@ -6,9 +6,9 @@ unset(CYTHON_EXECUTABLE CACHE)
|
||||||
find_package(Cython 0.25.2 REQUIRED)
|
find_package(Cython 0.25.2 REQUIRED)
|
||||||
|
|
||||||
# Set up cache options
|
# Set up cache options
|
||||||
set(GTSAM_CYTHON_INSTALL_PATH "" CACHE PATH "Cython toolbox destination, blank defaults to CMAKE_INSTALL_PREFIX/gtsam_cython")
|
set(GTSAM_CYTHON_INSTALL_PATH "" CACHE PATH "Cython toolbox destination, blank defaults to CMAKE_INSTALL_PREFIX/cython")
|
||||||
if(NOT GTSAM_CYTHON_INSTALL_PATH)
|
if(NOT GTSAM_CYTHON_INSTALL_PATH)
|
||||||
set(GTSAM_CYTHON_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/cython")
|
set(GTSAM_CYTHON_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/cython")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# User-friendly Cython wrapping and installing function.
|
# User-friendly Cython wrapping and installing function.
|
||||||
|
@ -110,7 +110,15 @@ endfunction()
|
||||||
|
|
||||||
# Helper function to install Cython scripts and handle multiple build types where the scripts
|
# Helper function to install Cython scripts and handle multiple build types where the scripts
|
||||||
# should be installed to all build type toolboxes
|
# should be installed to all build type toolboxes
|
||||||
function(install_cython_scripts source_directory patterns)
|
#
|
||||||
|
# Arguments:
|
||||||
|
# source_directory: The source directory to be installed. "The last component of each directory
|
||||||
|
# name is appended to the destination directory but a trailing slash may be
|
||||||
|
# used to avoid this because it leaves the last component empty."
|
||||||
|
# (https://cmake.org/cmake/help/v3.3/command/install.html?highlight=install#installing-directories)
|
||||||
|
# dest_directory: The destination directory to install to.
|
||||||
|
# patterns: list of file patterns to install
|
||||||
|
function(install_cython_scripts source_directory dest_directory patterns)
|
||||||
set(patterns_args "")
|
set(patterns_args "")
|
||||||
set(exclude_patterns "")
|
set(exclude_patterns "")
|
||||||
|
|
||||||
|
@ -126,13 +134,13 @@ function(install_cython_scripts source_directory patterns)
|
||||||
set(build_type_tag "${build_type}")
|
set(build_type_tag "${build_type}")
|
||||||
endif()
|
endif()
|
||||||
# Split up filename to strip trailing '/' in GTSAM_CYTHON_INSTALL_PATH if there is one
|
# Split up filename to strip trailing '/' in GTSAM_CYTHON_INSTALL_PATH if there is one
|
||||||
get_filename_component(location "${GTSAM_CYTHON_INSTALL_PATH}" PATH)
|
get_filename_component(location "${dest_directory}" PATH)
|
||||||
get_filename_component(name "${GTSAM_CYTHON_INSTALL_PATH}" NAME)
|
get_filename_component(name "${dest_directory}" NAME)
|
||||||
install(DIRECTORY "${source_directory}" DESTINATION "${location}/${name}${build_type_tag}" CONFIGURATIONS "${build_type}"
|
install(DIRECTORY "${source_directory}" DESTINATION "${location}/${name}${build_type_tag}" CONFIGURATIONS "${build_type}"
|
||||||
FILES_MATCHING ${patterns_args} PATTERN "${exclude_patterns}" EXCLUDE)
|
FILES_MATCHING ${patterns_args} PATTERN "${exclude_patterns}" EXCLUDE)
|
||||||
endforeach()
|
endforeach()
|
||||||
else()
|
else()
|
||||||
install(DIRECTORY "${source_directory}" DESTINATION "${GTSAM_CYTHON_INSTALL_PATH}" FILES_MATCHING ${patterns_args} PATTERN "${exclude_patterns}" EXCLUDE)
|
install(DIRECTORY "${source_directory}" DESTINATION "${dest_directory}" FILES_MATCHING ${patterns_args} PATTERN "${exclude_patterns}" EXCLUDE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Install cython components
|
# Install cython components
|
||||||
include(GtsamCythonWrap)
|
include(GtsamCythonWrap)
|
||||||
# install scripts and tests
|
# install scripts and tests
|
||||||
install_cython_scripts("${CMAKE_SOURCE_DIR}/cython/gtsam" "*.py")
|
install_cython_scripts("${CMAKE_SOURCE_DIR}/cython/gtsam" "${GTSAM_CYTHON_INSTALL_PATH}/gtsam" "*.py")
|
||||||
|
|
Loading…
Reference in New Issue