Commit 6b047bc9 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

use SWIG_AND_SIP instead of BOTH; reorder stuff to make it work in layers

parent aa6e61f3
......@@ -14,19 +14,41 @@
if(DTK_BUILD_WRAPPERS)
## #################################################################
## Python
## #################################################################
if(DTK_WRAPPING_PYTHON)
set(DTK_PYTHON_VERSION 2 CACHE STRING "Python version to use: 2, 2.x, 3, 3.x, or empty")
find_package(PythonInterp ${DTK_PYTHON_VERSION})
find_package(PythonLibs QUIET)
if(PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_DIRS})
get_filename_component(PYTHON_PATH ${PYTHON_LIBRARIES} PATH)
link_directories(${PYTHON_PATH})
add_definitions(-DHAVE_PYTHON) # Towards deprecation
set(DTK_HAVE_PYTHON 1)
else(PYTHONLIBS_FOUND)
set(DTK_HAVE_PYTHON 0)
endif(PYTHONLIBS_FOUND)
endif(DTK_WRAPPING_PYTHON)
if(NOT DTK_PYTHON_WRAPPER)
set(DTK_PYTHON_WRAPPER SWIG CACHE STRING "Choose the type of python wrapping")
else()
set(DTK_PYTHON_WRAPPER ${DTK_PYTHON_WRAPPER} CACHE STRING "dtk python wrapper")
endif()
set_property(CACHE DTK_PYTHON_WRAPPER PROPERTY STRINGS "SWIG" "SIP" "BOTH")
set_property(CACHE DTK_PYTHON_WRAPPER PROPERTY STRINGS "SWIG" "SIP" "SWIG_AND_SIP")
if(DTK_PYTHON_WRAPPER MATCHES "SIP" OR DTK_PYTHON_WRAPPER MATCHES "BOTH")
find_package(SIP)
if(DTK_PYTHON_WRAPPER MATCHES "SIP")
find_package(SIP QUIET)
endif()
if(DTK_PYTHON_WRAPPER MATCHES "SWIG" OR DTK_PYTHON_WRAPPER MATCHES "BOTH")
if(DTK_PYTHON_WRAPPER MATCHES "SWIG")
find_package(SWIG QUIET)
endif()
......@@ -95,9 +117,11 @@ if(SWIG_FOUND)
if(DTK_BUILD_WRAPPERS)
option(DTK_WRAPPING_PYTHON "Build python wrapper" OFF)
option(DTK_WRAPPING_TCL "Build TCL wrapper" OFF)
option(DTK_WRAPPING_CSHARP "Build C# wrapper" OFF)
if(${PROJECT_NAME} STREQUAL "dtk")
option(DTK_WRAPPING_PYTHON "Build python wrapper" OFF)
option(DTK_WRAPPING_TCL "Build TCL wrapper" OFF)
option(DTK_WRAPPING_CSHARP "Build C# wrapper" OFF)
endif()
if(NOT ${PROJECT_NAME} STREQUAL "dtk")
mark_as_advanced(DTK_WRAPPING_PYTHON)
......@@ -105,7 +129,7 @@ if(SWIG_FOUND)
mark_as_advanced(DTK_WRAPPING_CSHARP)
endif()
endif(DTK_BUILD_WRAPPERS)
endif()
else(SWIG_FOUND)
......@@ -140,28 +164,6 @@ endif(TCL_FOUND)
endif(DTK_WRAPPING_TCL)
## #################################################################
## Python
## #################################################################
if(DTK_WRAPPING_PYTHON)
set(DTK_PYTHON_VERSION 2 CACHE STRING "Python version to use: 2, 2.x, 3, 3.x, or empty")
find_package(PythonInterp ${DTK_PYTHON_VERSION})
find_package(PythonLibs QUIET)
if(PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_DIRS})
get_filename_component(PYTHON_PATH ${PYTHON_LIBRARIES} PATH)
link_directories(${PYTHON_PATH})
add_definitions(-DHAVE_PYTHON) # Towards deprecation
set(DTK_HAVE_PYTHON 1)
else(PYTHONLIBS_FOUND)
set(DTK_HAVE_PYTHON 0)
endif(PYTHONLIBS_FOUND)
endif(DTK_WRAPPING_PYTHON)
mark_as_advanced(SWIG_DIR)
mark_as_advanced(SWIG_EXECUTABLE)
......
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