Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkSwigPrepareFiles.cmake
Go to the documentation of this file.
1 
2 # This function is used to prepare all includes and files
3 # that are necessary for a general swig project.
4 function(mitkSwigPrepareFiles swig_module swig_file library_names)
5  # Ensure that the input file is parsed as a c++ file. This is done via
6  # an additional source file property.
7  set_source_files_properties ( ${swig_file} PROPERTIES CPLUSPLUS ON )
8 
9  # This variable is used to add additional parameters to SWIG.
10  # Using a list is necessary in order to be able to pass multiple parameters
11  # which are given as optional parameters to the input file.
12  set(ADDITIONAL_TMP_SWIG_INCLUDES "")
13 
14  foreach(library_name ${library_names})
15  # Extracting all include directories from each given project and
16  # then including these directories to the newly created swig project.
17  get_property(LIBRARY_INCLUDES
18  TARGET ${library_name}
19  PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
20  # Adding each include path as an additional swig parameter using
21  # the swig-option "-I":
22  foreach(INCLUDE_PATH ${LIBRARY_INCLUDES})
23  list(APPEND ADDITIONAL_TMP_SWIG_INCLUDES -I${INCLUDE_PATH} )
24 
25  file(GLOB_RECURSE header_files "${INCLUDE_PATH}/*.h")
26  list(APPEND SWIG_MODULE_${swig_module}_EXTRA_DEPS ${header_files})
27  # export variable to parent scope
28  set(SWIG_MODULE_${swig_module}_EXTRA_DEPS
29  ${SWIG_MODULE_${swig_module}_EXTRA_DEPS} PARENT_SCOPE)
30 
31  endforeach()
32  endforeach()
33 
34  # Add the Common Folder to the include system of SWIG
35  list(APPEND ADDITIONAL_TMP_SWIG_INCLUDES -I${MITK_WRAPPING_COMMON_DIR} )
36 
37  # This is necessary, because SWIG hard-codeds the integer size. See
38  # https://github.com/swig/swig/issues/568
39  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
40  list(APPEND ADDITIONAL_TMP_SWIG_INCLUDES -DSWIGWORDSIZE64)
41  endif()
42 
43 
44  # Set the additional parameters to the input project file:
45  set_property(SOURCE ${swig_file} PROPERTY SWIG_FLAGS ${ADDITIONAL_TMP_SWIG_INCLUDES} )
46 
47  # In addition include python dependencies:
48  include_directories( ${PYTHON_INCLUDE_DIR})
49  list(APPEND SWIG_MODULE_${swig_module}_EXTRA_DEPS ${PYTHON_INCLUDE_DIR})
50 
51  # Add additional include paths, for example to the common files:
52  list(APPEND SWIG_MODULE_${swig_module}_EXTRA_DEPS ${SWIG_EXTRA_DEPS})
53 
54  set(SWIG_MODULE_${swig_module}_EXTRA_DEPS
55  ${SWIG_MODULE_${swig_module}_EXTRA_DEPS} PARENT_SCOPE)
56 endfunction()
mitkSwigPrepareFiles(swig_module, swig_file, library_names)
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)
Definition: jsoncpp.cpp:244
const std::string TARGET