| 
									
										
										
										
											2017-03-21 12:55:50 +08:00
										 |  |  | # Check Cython version, need to be >=0.25.2
 | 
					
						
							|  |  |  | # Unset these cached variables to avoid surprises when the python/cython
 | 
					
						
							|  |  |  | # in the current environment are different from the cached!
 | 
					
						
							|  |  |  | unset(PYTHON_EXECUTABLE CACHE)
 | 
					
						
							|  |  |  | unset(CYTHON_EXECUTABLE CACHE)
 | 
					
						
							| 
									
										
										
										
											2019-02-13 17:45:06 +08:00
										 |  |  | unset(PYTHON_INCLUDE_DIR CACHE)
 | 
					
						
							|  |  |  | unset(PYTHON_MAJOR_VERSION CACHE)
 | 
					
						
							| 
									
										
										
										
											2019-02-14 17:45:48 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | if(GTSAM_PYTHON_VERSION STREQUAL "Default")
 | 
					
						
							| 
									
										
										
										
											2019-02-14 18:55:16 +08:00
										 |  |  |   find_package(PythonInterp REQUIRED)
 | 
					
						
							| 
									
										
										
										
											2019-02-14 17:45:48 +08:00
										 |  |  |   find_package(PythonLibs REQUIRED)
 | 
					
						
							|  |  |  | else()
 | 
					
						
							| 
									
										
										
										
											2019-02-14 18:55:16 +08:00
										 |  |  |   find_package(PythonInterp ${GTSAM_PYTHON_VERSION} EXACT REQUIRED)
 | 
					
						
							| 
									
										
										
										
											2019-02-14 17:45:48 +08:00
										 |  |  |   find_package(PythonLibs ${GTSAM_PYTHON_VERSION} EXACT REQUIRED)
 | 
					
						
							|  |  |  | endif()
 | 
					
						
							| 
									
										
										
										
											2017-03-21 12:55:50 +08:00
										 |  |  | find_package(Cython 0.25.2 REQUIRED)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-14 17:45:48 +08:00
										 |  |  | execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" | 
					
						
							|  |  |  |     "from __future__ import print_function;import sys;print(sys.version[0], end='')"
 | 
					
						
							|  |  |  |     OUTPUT_VARIABLE PYTHON_MAJOR_VERSION
 | 
					
						
							|  |  |  | )
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:46:36 +08:00
										 |  |  | # User-friendly Cython wrapping and installing function.
 | 
					
						
							|  |  |  | # Builds a Cython module from the provided interface_header.
 | 
					
						
							| 
									
										
										
										
											2016-12-16 13:26:03 +08:00
										 |  |  | # For example, for the interface header gtsam.h,
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | # this will build the wrap module 'gtsam'.
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Arguments:
 | 
					
						
							|  |  |  | #
 | 
					
						
							| 
									
										
										
										
											2016-12-16 13:26:03 +08:00
										 |  |  | # interface_header:  The relative path to the wrapper interface definition file.
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:46:36 +08:00
										 |  |  | # extra_imports: extra header to import in the Cython pxd file.
 | 
					
						
							|  |  |  | #                For example, to use Cython gtsam.pxd in your own module,
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  | #        use "from gtsam cimport *"
 | 
					
						
							| 
									
										
										
										
											2016-12-16 13:26:03 +08:00
										 |  |  | # install_path: destination to install the library
 | 
					
						
							| 
									
										
										
										
											2017-05-31 08:45:54 +08:00
										 |  |  | # libs: libraries to link with
 | 
					
						
							| 
									
										
										
										
											2017-05-23 04:23:46 +08:00
										 |  |  | # dependencies: Dependencies which need to be built before the wrapper
 | 
					
						
							| 
									
										
										
										
											2017-05-31 08:45:54 +08:00
										 |  |  | function(wrap_and_install_library_cython interface_header extra_imports install_path libs dependencies)
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   # Paths for generated files
 | 
					
						
							|  |  |  |   get_filename_component(module_name "${interface_header}" NAME_WE)
 | 
					
						
							|  |  |  |   set(generated_files_path "${PROJECT_BINARY_DIR}/cython/${module_name}")
 | 
					
						
							| 
									
										
										
										
											2017-05-31 08:45:54 +08:00
										 |  |  |   wrap_library_cython("${interface_header}" "${generated_files_path}" "${extra_imports}" "${libs}" "${dependencies}")
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   install_cython_wrapped_library("${interface_header}" "${generated_files_path}" "${install_path}")
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-23 10:40:43 +08:00
										 |  |  | function(set_up_required_cython_packages)
 | 
					
						
							|  |  |  |   # Set up building of cython module
 | 
					
						
							|  |  |  |   include_directories(${PYTHON_INCLUDE_DIRS})
 | 
					
						
							|  |  |  |   find_package(NumPy REQUIRED)
 | 
					
						
							|  |  |  |   include_directories(${NUMPY_INCLUDE_DIRS})
 | 
					
						
							|  |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-30 17:41:28 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-23 10:40:43 +08:00
										 |  |  | # Convert pyx to cpp by executing cython
 | 
					
						
							|  |  |  | # This is the first step to compile cython from the command line
 | 
					
						
							|  |  |  | # as described at: http://cython.readthedocs.io/en/latest/src/reference/compilation.html
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Arguments:
 | 
					
						
							|  |  |  | #    - target:  The specified target for this step
 | 
					
						
							|  |  |  | #    - pyx_file:   The input pyx_file in full *absolute* path
 | 
					
						
							|  |  |  | #    - generated_cpp:   The output cpp file in full absolute path
 | 
					
						
							|  |  |  | #    - include_dirs:   Directories to include when executing cython
 | 
					
						
							|  |  |  | function(pyx_to_cpp target pyx_file generated_cpp include_dirs)
 | 
					
						
							| 
									
										
										
										
											2017-07-24 03:00:34 +08:00
										 |  |  |   foreach(dir ${include_dirs})
 | 
					
						
							|  |  |  |     set(includes_for_cython ${includes_for_cython}  -I ${dir})
 | 
					
						
							|  |  |  |   endforeach()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-23 10:40:43 +08:00
										 |  |  |   add_custom_command( | 
					
						
							|  |  |  |     OUTPUT ${generated_cpp}
 | 
					
						
							|  |  |  |     COMMAND
 | 
					
						
							| 
									
										
										
										
											2019-01-30 17:41:28 +08:00
										 |  |  |     ${CYTHON_EXECUTABLE} -X boundscheck=False -v --fast-fail --cplus -${PYTHON_MAJOR_VERSION} ${includes_for_cython} ${pyx_file} -o ${generated_cpp}
 | 
					
						
							| 
									
										
										
										
											2017-07-23 10:40:43 +08:00
										 |  |  |     VERBATIM)
 | 
					
						
							|  |  |  |   add_custom_target(${target} ALL DEPENDS ${generated_cpp})
 | 
					
						
							|  |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Build the cpp file generated by converting pyx using cython
 | 
					
						
							|  |  |  | # This is the second step to compile cython from the command line
 | 
					
						
							|  |  |  | # as described at: http://cython.readthedocs.io/en/latest/src/reference/compilation.html
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Arguments:
 | 
					
						
							|  |  |  | #    - target:  The specified target for this step
 | 
					
						
							|  |  |  | #    - cpp_file:   The input cpp_file in full *absolute* path
 | 
					
						
							|  |  |  | #    - output_lib_we:   The output lib filename only (without extension)
 | 
					
						
							|  |  |  | #    - output_dir:   The output directory
 | 
					
						
							|  |  |  | function(build_cythonized_cpp target cpp_file output_lib_we output_dir)
 | 
					
						
							|  |  |  |   add_library(${target} MODULE ${cpp_file})
 | 
					
						
							| 
									
										
										
										
											2017-08-17 10:13:38 +08:00
										 |  |  |   if(APPLE)
 | 
					
						
							|  |  |  |     set(link_flags "-undefined dynamic_lookup")
 | 
					
						
							|  |  |  |   endif()
 | 
					
						
							|  |  |  |   set_target_properties(${target} PROPERTIES COMPILE_FLAGS "-w" LINK_FLAGS "${link_flags}" | 
					
						
							| 
									
										
										
										
											2017-07-23 10:40:43 +08:00
										 |  |  |     OUTPUT_NAME ${output_lib_we} PREFIX "" LIBRARY_OUTPUT_DIRECTORY ${output_dir})
 | 
					
						
							|  |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Cythonize a pyx from the command line as described at
 | 
					
						
							|  |  |  | # http://cython.readthedocs.io/en/latest/src/reference/compilation.html
 | 
					
						
							|  |  |  | # Arguments:
 | 
					
						
							| 
									
										
										
										
											2017-07-24 03:00:34 +08:00
										 |  |  | #    - target:        The specified target
 | 
					
						
							|  |  |  | #    - pyx_file:      The input pyx_file in full *absolute* path
 | 
					
						
							|  |  |  | #    - output_lib_we: The output lib filename only (without extension)
 | 
					
						
							|  |  |  | #    - output_dir:    The output directory
 | 
					
						
							|  |  |  | #    - include_dirs:  Directories to include when executing cython
 | 
					
						
							|  |  |  | #    - libs:          Libraries to link with
 | 
					
						
							| 
									
										
										
										
											2017-10-09 10:11:54 +08:00
										 |  |  | #    - interface_header: For dependency. Any update in interface header will re-trigger cythonize
 | 
					
						
							|  |  |  | function(cythonize target pyx_file output_lib_we output_dir include_dirs libs interface_header dependencies)
 | 
					
						
							| 
									
										
										
										
											2017-07-23 10:40:43 +08:00
										 |  |  |   get_filename_component(pyx_path "${pyx_file}" DIRECTORY)
 | 
					
						
							|  |  |  |   get_filename_component(pyx_name "${pyx_file}" NAME_WE)
 | 
					
						
							|  |  |  |   set(generated_cpp "${output_dir}/${pyx_name}.cpp")
 | 
					
						
							| 
									
										
										
										
											2017-07-24 03:00:34 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   set_up_required_cython_packages()
 | 
					
						
							|  |  |  |   pyx_to_cpp(${target}_pyx2cpp ${pyx_file} ${generated_cpp} "${include_dirs}")
 | 
					
						
							| 
									
										
										
										
											2017-10-09 10:11:54 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   # Late dependency injection, to make sure this gets called whenever the interface header is updated
 | 
					
						
							|  |  |  |   # See: https://stackoverflow.com/questions/40032593/cmake-does-not-rebuild-dependent-after-prerequisite-changes
 | 
					
						
							| 
									
										
										
										
											2018-10-14 10:46:20 +08:00
										 |  |  |   add_custom_command(OUTPUT ${generated_cpp} DEPENDS ${interface_header} ${pyx_file} APPEND)
 | 
					
						
							| 
									
										
										
										
											2017-07-23 10:40:43 +08:00
										 |  |  |   if (NOT "${dependencies}" STREQUAL "")
 | 
					
						
							|  |  |  |     add_dependencies(${target}_pyx2cpp "${dependencies}")
 | 
					
						
							|  |  |  |   endif()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   build_cythonized_cpp(${target} ${generated_cpp} ${output_lib_we} ${output_dir})
 | 
					
						
							|  |  |  |   if (NOT "${libs}" STREQUAL "")
 | 
					
						
							|  |  |  |     target_link_libraries(${target} "${libs}")
 | 
					
						
							|  |  |  |   endif()
 | 
					
						
							|  |  |  |   add_dependencies(${target} ${target}_pyx2cpp)
 | 
					
						
							|  |  |  | endfunction()
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | # Internal function that wraps a library and compiles the wrapper
 | 
					
						
							| 
									
										
										
										
											2017-05-31 08:45:54 +08:00
										 |  |  | function(wrap_library_cython interface_header generated_files_path extra_imports libs dependencies)
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   # Wrap codegen interface
 | 
					
						
							|  |  |  |   # Extract module path and name from interface header file name
 | 
					
						
							|  |  |  |   # wrap requires interfacePath to be *absolute*
 | 
					
						
							|  |  |  |   get_filename_component(interface_header "${interface_header}" ABSOLUTE)
 | 
					
						
							|  |  |  |   get_filename_component(module_path "${interface_header}" PATH)
 | 
					
						
							|  |  |  |   get_filename_component(module_name "${interface_header}" NAME_WE)
 | 
					
						
							| 
									
										
										
										
											2016-12-16 13:26:03 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-24 03:03:20 +08:00
										 |  |  |   # Wrap module to Cython pyx
 | 
					
						
							|  |  |  |   message(STATUS "Cython wrapper generating ${module_name}.pyx")
 | 
					
						
							|  |  |  |   set(generated_pyx "${generated_files_path}/${module_name}.pyx")
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   file(MAKE_DIRECTORY "${generated_files_path}")
 | 
					
						
							|  |  |  |   add_custom_command( | 
					
						
							| 
									
										
										
										
											2017-07-24 03:03:20 +08:00
										 |  |  |     OUTPUT ${generated_pyx}
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:51:45 +08:00
										 |  |  |     DEPENDS ${interface_header} wrap
 | 
					
						
							| 
									
										
										
										
											2017-07-24 03:03:20 +08:00
										 |  |  |     COMMAND
 | 
					
						
							|  |  |  |         wrap --cython ${module_path} ${module_name} ${generated_files_path} "${extra_imports}"
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |     VERBATIM
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:51:45 +08:00
										 |  |  |     WORKING_DIRECTORY ${generated_files_path}/../)
 | 
					
						
							| 
									
										
										
										
											2017-07-24 03:03:20 +08:00
										 |  |  |   add_custom_target(cython_wrap_${module_name}_pyx ALL DEPENDS ${generated_pyx})
 | 
					
						
							| 
									
										
										
										
											2017-07-25 02:55:37 +08:00
										 |  |  |   if(NOT "${dependencies}" STREQUAL "")
 | 
					
						
							| 
									
										
										
										
											2017-07-25 02:46:41 +08:00
										 |  |  |     add_dependencies(cython_wrap_${module_name}_pyx ${dependencies})
 | 
					
						
							|  |  |  |   endif()
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:51:45 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-24 03:03:20 +08:00
										 |  |  |   message(STATUS "Cythonize and build ${module_name}.pyx")
 | 
					
						
							|  |  |  |   get_property(include_dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
 | 
					
						
							| 
									
										
										
										
											2017-10-09 10:11:54 +08:00
										 |  |  |   cythonize(cythonize_${module_name} ${generated_pyx} ${module_name} | 
					
						
							|  |  |  |     ${generated_files_path} "${include_dirs}" "${libs}" ${interface_header} cython_wrap_${module_name}_pyx)
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:51:45 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   # distclean
 | 
					
						
							|  |  |  |   add_custom_target(wrap_${module_name}_cython_distclean | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |       COMMAND cmake -E remove_directory ${generated_files_path})
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Internal function that installs a wrap toolbox
 | 
					
						
							| 
									
										
										
										
											2016-12-16 13:26:03 +08:00
										 |  |  | function(install_cython_wrapped_library interface_header generated_files_path install_path)
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   get_filename_component(module_name "${interface_header}" NAME_WE)
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # NOTE: only installs .pxd and .pyx and binary files (not .cpp) - the trailing slash on the directory name
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   # here prevents creating the top-level module name directory in the destination.
 | 
					
						
							|  |  |  |   message(STATUS "Installing Cython Toolbox to ${install_path}") #${GTSAM_CYTHON_INSTALL_PATH}")
 | 
					
						
							|  |  |  |   if(GTSAM_BUILD_TYPE_POSTFIXES)
 | 
					
						
							|  |  |  |     foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
 | 
					
						
							|  |  |  |       string(TOUPPER "${build_type}" build_type_upper)
 | 
					
						
							|  |  |  |       if(${build_type_upper} STREQUAL "RELEASE")
 | 
					
						
							|  |  |  |         set(build_type_tag "") # Don't create release mode tag on installed directory
 | 
					
						
							|  |  |  |       else()
 | 
					
						
							|  |  |  |         set(build_type_tag "${build_type}")
 | 
					
						
							|  |  |  |       endif()
 | 
					
						
							|  |  |  |       # Split up filename to strip trailing '/' in GTSAM_CYTHON_INSTALL_PATH if there is one
 | 
					
						
							|  |  |  |       get_filename_component(location "${install_path}" PATH)
 | 
					
						
							|  |  |  |       get_filename_component(name "${install_path}" NAME)
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:46:36 +08:00
										 |  |  |       install(DIRECTORY "${generated_files_path}/" DESTINATION "${location}/${name}${build_type_tag}" | 
					
						
							|  |  |  |           CONFIGURATIONS "${build_type}"
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |           PATTERN "build" EXCLUDE
 | 
					
						
							|  |  |  |           PATTERN "CMakeFiles" EXCLUDE
 | 
					
						
							|  |  |  |           PATTERN "Makefile" EXCLUDE
 | 
					
						
							|  |  |  |           PATTERN "*.cmake" EXCLUDE
 | 
					
						
							|  |  |  |           PATTERN "*.cpp" EXCLUDE
 | 
					
						
							|  |  |  |           PATTERN "*.py" EXCLUDE)
 | 
					
						
							|  |  |  |     endforeach()
 | 
					
						
							|  |  |  |   else()
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:46:36 +08:00
										 |  |  |     install(DIRECTORY "${generated_files_path}/" DESTINATION ${install_path} | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |         PATTERN "build" EXCLUDE
 | 
					
						
							|  |  |  |         PATTERN "CMakeFiles" EXCLUDE
 | 
					
						
							|  |  |  |         PATTERN "Makefile" EXCLUDE
 | 
					
						
							|  |  |  |         PATTERN "*.cmake" EXCLUDE
 | 
					
						
							|  |  |  |         PATTERN "*.cpp" EXCLUDE
 | 
					
						
							|  |  |  |         PATTERN "*.py" EXCLUDE)
 | 
					
						
							|  |  |  |   endif()
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Helper function to install Cython scripts and handle multiple build types where the scripts
 | 
					
						
							|  |  |  | # should be installed to all build type toolboxes
 | 
					
						
							| 
									
										
										
										
											2017-03-26 11:35:46 +08:00
										 |  |  | #
 | 
					
						
							|  |  |  | # 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)
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   set(patterns_args "")
 | 
					
						
							|  |  |  |   set(exclude_patterns "")
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   foreach(pattern ${patterns})
 | 
					
						
							|  |  |  |     list(APPEND patterns_args PATTERN "${pattern}")
 | 
					
						
							|  |  |  |   endforeach()
 | 
					
						
							|  |  |  |   if(GTSAM_BUILD_TYPE_POSTFIXES)
 | 
					
						
							|  |  |  |     foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
 | 
					
						
							|  |  |  |       string(TOUPPER "${build_type}" build_type_upper)
 | 
					
						
							|  |  |  |       if(${build_type_upper} STREQUAL "RELEASE")
 | 
					
						
							|  |  |  |         set(build_type_tag "") # Don't create release mode tag on installed directory
 | 
					
						
							|  |  |  |       else()
 | 
					
						
							|  |  |  |         set(build_type_tag "${build_type}")
 | 
					
						
							|  |  |  |       endif()
 | 
					
						
							|  |  |  |       # Split up filename to strip trailing '/' in GTSAM_CYTHON_INSTALL_PATH if there is one
 | 
					
						
							|  |  |  |       get_filename_component(location "${dest_directory}" PATH)
 | 
					
						
							|  |  |  |       get_filename_component(name "${dest_directory}" NAME)
 | 
					
						
							|  |  |  |       install(DIRECTORY "${source_directory}" DESTINATION "${location}/${name}${build_type_tag}" CONFIGURATIONS "${build_type}" | 
					
						
							|  |  |  |             FILES_MATCHING ${patterns_args} PATTERN "${exclude_patterns}" EXCLUDE)
 | 
					
						
							|  |  |  |     endforeach()
 | 
					
						
							|  |  |  |   else()
 | 
					
						
							|  |  |  |     install(DIRECTORY "${source_directory}" DESTINATION "${dest_directory}" FILES_MATCHING ${patterns_args} PATTERN "${exclude_patterns}" EXCLUDE)
 | 
					
						
							|  |  |  |   endif()
 | 
					
						
							| 
									
										
										
										
											2016-11-25 15:27:12 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-08 00:10:28 +08:00
										 |  |  | # Helper function to install specific files and handle multiple build types where the scripts
 | 
					
						
							|  |  |  | # should be installed to all build type toolboxes
 | 
					
						
							|  |  |  | #
 | 
					
						
							|  |  |  | # Arguments:
 | 
					
						
							| 
									
										
										
										
											2017-05-24 23:46:36 +08:00
										 |  |  | #  source_files: The source files to be installed.
 | 
					
						
							| 
									
										
										
										
											2017-04-08 00:10:28 +08:00
										 |  |  | #  dest_directory: The destination directory to install to.
 | 
					
						
							|  |  |  | function(install_cython_files source_files dest_directory)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |   if(GTSAM_BUILD_TYPE_POSTFIXES)
 | 
					
						
							|  |  |  |     foreach(build_type ${CMAKE_CONFIGURATION_TYPES})
 | 
					
						
							|  |  |  |       string(TOUPPER "${build_type}" build_type_upper)
 | 
					
						
							|  |  |  |       if(${build_type_upper} STREQUAL "RELEASE")
 | 
					
						
							|  |  |  |         set(build_type_tag "") # Don't create release mode tag on installed directory
 | 
					
						
							|  |  |  |       else()
 | 
					
						
							|  |  |  |         set(build_type_tag "${build_type}")
 | 
					
						
							|  |  |  |       endif()
 | 
					
						
							|  |  |  |       # Split up filename to strip trailing '/' in GTSAM_CYTHON_INSTALL_PATH if there is one
 | 
					
						
							|  |  |  |       get_filename_component(location "${dest_directory}" PATH)
 | 
					
						
							|  |  |  |       get_filename_component(name "${dest_directory}" NAME)
 | 
					
						
							| 
									
										
										
										
											2017-05-17 04:56:04 +08:00
										 |  |  |       install(FILES "${source_files}" DESTINATION "${location}/${name}${build_type_tag}" CONFIGURATIONS "${build_type}")
 | 
					
						
							| 
									
										
										
										
											2017-05-17 05:01:45 +08:00
										 |  |  |     endforeach()
 | 
					
						
							|  |  |  |   else()
 | 
					
						
							|  |  |  |     install(FILES "${source_files}" DESTINATION "${dest_directory}")
 | 
					
						
							|  |  |  |   endif()
 | 
					
						
							| 
									
										
										
										
											2017-04-08 00:10:28 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | endfunction()
 | 
					
						
							|  |  |  | 
 |