Commit 0082d927 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

add "includes" parameter in swig macro (needed if a layer depends on

several layers wrapping, e.g. dtk and dtk-imaging)
parent 5f5300f0
......@@ -48,3 +48,4 @@ build-*
TAGS
GTAGS
cscope.out
......@@ -88,10 +88,12 @@ if(SWIG_FOUND)
set(CMAKE_SWIG_FLAGS "")
macro(dtk_wrap project target name language input deps)
macro(dtk_wrap project target name language input deps swig_includes)
set(wrap_output ${project}_wrap_${language}.cpp)
string(REGEX REPLACE "([^;]+)" "-I\\1" include_dirs "${swig_includes}")
add_custom_command(
OUTPUT ${wrap_output}
COMMAND ${SWIG_EXECUTABLE}
......@@ -99,12 +101,9 @@ if(SWIG_FOUND)
"-${language}"
"-c++"
"-module" ${name}
${include_dirs}
"-I${PROJECT_SOURCE_DIR}/.."
"-I${PROJECT_SOURCE_DIR}/"
"-I${dtk_INCLUDE_DIR}/"
"-I${dtk_INCLUDE_DIR}/src"
"-I${dtk_INCLUDE_DIR}/src/dtkCore"
"-I${dtk_INCLUDE_DIR}/src/dtkCoreSupport"
"-I${PROJECT_SOURCE_DIR}/src"
"-outdir" ${CMAKE_CURRENT_BINARY_DIR}
"-o" ${wrap_output}
${input}
......
......@@ -112,22 +112,22 @@ if(DTK_BUILD_WRAPPERS)
sip${PROJECT_NAME}dtkCorePluginManagerBase.cpp
sip${PROJECT_NAME}dtkObjectManager.cpp)
dtk_wrap_sip(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkCore ${CMAKE_SOURCE_DIR}/sip/dtkCore/dtkCoremod.sip "${${PROJECT_NAME}_SIP_WRAPPERS}" ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap_sip(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkCore ${CMAKE_SOURCE_DIR}/sip/dtkCore/dtkCoremod.sip "${${PROJECT_NAME}_SIP_WRAPPERS}" "${${PROJECT_NAME}_WRAP_DEPENDS}")
endif(SIP_FOUND)
if(SWIG_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dtkCore.i ${CMAKE_BINARY_DIR}/dtkCore.i COPYONLY)
if (DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcore python ${PROJECT_SOURCE_DIR}/dtkCore.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcore python ${PROJECT_SOURCE_DIR}/dtkCore.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
if (DTK_WRAPPING_TCL AND TCL_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcore tcl ${PROJECT_SOURCE_DIR}/dtkCore.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcore tcl ${PROJECT_SOURCE_DIR}/dtkCore.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
if (DTK_WRAPPING_CSHARP)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcore csharp ${PROJECT_SOURCE_DIR}/dtkCore.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcore csharp ${PROJECT_SOURCE_DIR}/dtkCore.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif(SWIG_FOUND)
......
......@@ -107,18 +107,18 @@ if(DTK_BUILD_WRAPPERS AND SWIG_FOUND)
if (DTK_WRAPPING_PYTHON)
if (PYTHONLIBS_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcoresupport python ${PROJECT_SOURCE_DIR}/dtkCoreSupport.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcoresupport python ${PROJECT_SOURCE_DIR}/dtkCoreSupport.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif()
if (DTK_WRAPPING_TCL)
if (TCL_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcoresupport tcl ${PROJECT_SOURCE_DIR}/dtkCoreSupport.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcoresupport tcl ${PROJECT_SOURCE_DIR}/dtkCoreSupport.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif()
if (DTK_WRAPPING_CSHARP)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcoresupport csharp ${PROJECT_SOURCE_DIR}/dtkCoreSupport.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkcoresupport csharp ${PROJECT_SOURCE_DIR}/dtkCoreSupport.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif()
......
......@@ -48,18 +48,18 @@ if(DTK_BUILD_WRAPPERS AND SWIG_FOUND)
if (DTK_WRAPPING_PYTHON)
if (PYTHONLIBS_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtklog python ${PROJECT_SOURCE_DIR}/dtkLog.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtklog python ${PROJECT_SOURCE_DIR}/dtkLog.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif()
if (DTK_WRAPPING_TCL)
if (TCL_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtklog tcl ${PROJECT_SOURCE_DIR}/dtkLog.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtklog tcl ${PROJECT_SOURCE_DIR}/dtkLog.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif()
if (DTK_WRAPPING_CSHARP)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtklog csharp ${PROJECT_SOURCE_DIR}/dtkLog.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtklog csharp ${PROJECT_SOURCE_DIR}/dtkLog.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif()
......
......@@ -125,20 +125,20 @@ if(DTK_BUILD_WRAPPERS)
sip${PROJECT_NAME}dtkViewController.cpp
sip${PROJECT_NAME}dtkViewManager.cpp
sip${PROJECT_NAME}dtkViewWidget.cpp)
dtk_wrap_sip(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkWidgets ${CMAKE_SOURCE_DIR}/sip/dtkWidgets/dtkWidgetsmod.sip "${${PROJECT_NAME}_SIP_WRAPPERS}" ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap_sip(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkWidgets ${CMAKE_SOURCE_DIR}/sip/dtkWidgets/dtkWidgetsmod.sip "${${PROJECT_NAME}_SIP_WRAPPERS}" "${${PROJECT_NAME}_WRAP_DEPENDS}")
endif(SIP_FOUND)
if(SWIG_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dtkWidgets.i ${CMAKE_BINARY_DIR}/dtkWidgets.i COPYONLY)
if (DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets python ${PROJECT_SOURCE_DIR}/dtkWidgets.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets python ${PROJECT_SOURCE_DIR}/dtkWidgets.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
if (DTK_WRAPPING_TCL AND TCL_FOUND)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets tcl ${PROJECT_SOURCE_DIR}/dtkWidgets.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets tcl ${PROJECT_SOURCE_DIR}/dtkWidgets.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
if (DTK_WRAPPING_CSHARP)
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets csharp ${PROJECT_SOURCE_DIR}/dtkWidgets.i ${${PROJECT_NAME}_WRAP_DEPENDS})
dtk_wrap(${PROJECT_NAME} ${PROJECT_NAME}_SOURCES_WRAP dtkwidgets csharp ${PROJECT_SOURCE_DIR}/dtkWidgets.i "${${PROJECT_NAME}_WRAP_DEPENDS}" ".")
endif()
endif(SWIG_FOUND)
endif()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment