From ea6ecdd9d561bc8b6b7b4834d5f999d2ac9541ce Mon Sep 17 00:00:00 2001 From: Ellon Mendes Date: Wed, 25 Nov 2015 18:21:10 +0100 Subject: [PATCH] Move subdirlist macro to cmake/GtsamPythonWrap.cmake Conflicts: cmake/GtsamPythonWrap.cmake --- CMakeLists.txt | 3 ++- cmake/GtsamPythonWrap.cmake | 12 ++++++++++++ python/handwritten/CMakeLists.txt | 21 +++++---------------- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2719a77ab..bbb998e80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -347,12 +347,13 @@ endif() # Python wrap if (GTSAM_BUILD_PYTHON) + include(GtsamPythonWrap) + # NOTE: The automatic generation of python wrapper from the gtsampy.h interface is # not working yet, so we're using a handwritten wrapper files on python/handwritten. # Once the python wrapping from the interface file is working, you can _swap_ the # comments on the next lines - # include(GtsamPythonWrap) # wrap_and_install_python(gtsampy.h "${GTSAM_ADDITIONAL_LIBRARIES}" "") add_subdirectory(python) diff --git a/cmake/GtsamPythonWrap.cmake b/cmake/GtsamPythonWrap.cmake index cfbe89c1f..c23ee783d 100644 --- a/cmake/GtsamPythonWrap.cmake +++ b/cmake/GtsamPythonWrap.cmake @@ -87,3 +87,15 @@ function(wrap_python TARGET_NAME PYTHON_MODULE_DIRECTORY) list(APPEND AMCF ${PYTHON_MODULE_DIRECTORY}/${PYLIB_SO_NAME}) set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${AMCF}") endfunction(wrap_python) + +# Macro to get list of subdirectories +macro(SUBDIRLIST result curdir) + file(GLOB children RELATIVE ${curdir} ${curdir}/*) + set(dirlist "") + foreach(child ${children}) + if(IS_DIRECTORY ${curdir}/${child}) + list(APPEND dirlist ${child}) + endif() + endforeach() + set(${result} ${dirlist}) +endmacro() diff --git a/python/handwritten/CMakeLists.txt b/python/handwritten/CMakeLists.txt index 93b928d94..1090ef9cf 100644 --- a/python/handwritten/CMakeLists.txt +++ b/python/handwritten/CMakeLists.txt @@ -1,24 +1,13 @@ -# Macro to get list of subdirectories -MACRO(SUBDIRLIST result curdir) - FILE(GLOB children RELATIVE ${curdir} ${curdir}/*) - SET(dirlist "") - FOREACH(child ${children}) - IF(IS_DIRECTORY ${curdir}/${child}) - LIST(APPEND dirlist ${child}) - ENDIF() - ENDFOREACH() - SET(${result} ${dirlist}) -ENDMACRO() # get subdirectories list -SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) +subdirlist(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}) # get the sources needed to compile gtsam python module -SET(gtsam_python_srcs "") -FOREACH(subdir ${SUBDIRS}) +set(gtsam_python_srcs "") +foreach(subdir ${SUBDIRS}) file(GLOB ${subdir}_src "${subdir}/*.cpp") - LIST(APPEND gtsam_python_srcs ${${subdir}_src}) -ENDFOREACH() + list(APPEND gtsam_python_srcs ${${subdir}_src}) +endforeach() # Create the library set(moduleName gtsam)