Commit 865d36e0 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas
Browse files

wrap dtkLog

parent 1c995d45
......@@ -34,16 +34,62 @@ set(${PROJECT_NAME}_SOURCES
dtkLogDestination.cpp
dtkLogModel.cpp)
## #################################################################
## Wrapping
## #################################################################
set(${PROJECT_NAME}_SOURCES_WRAP)
if(DTK_BUILD_WRAPPERS AND SWIG_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dtkLog.i ${CMAKE_BINARY_DIR}/dtkLog.i COPYONLY)
set(${PROJECT_NAME}_WRAP_DEPENDS ${${PROJECT_NAME}_HEADERS})
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})
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})
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})
endif()
endif()
## #################################################################
## Build rules
## #################################################################
add_library(${PROJECT_NAME} SHARED
${${PROJECT_NAME}_SOURCES}
${${PROJECT_NAME}_SOURCES_WRAP}
${${PROJECT_NAME}_HEADERS})
## #################################################################
## Link rules
## #################################################################
target_link_libraries(${PROJECT_NAME} Qt5::Core)
if(DTK_BUILD_WRAPPERS AND SWIG_FOUND)
if (DTK_WRAPPING_TCL AND TCL_FOUND)
target_link_libraries(${PROJECT_NAME} ${TCL_LIBRARY})
endif()
if(DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND)
target_link_libraries(${PROJECT_NAME} ${PYTHON_LIBRARIES})
endif()
endif(DTK_BUILD_WRAPPERS AND SWIG_FOUND)
## #################################################################
## Target properties
## #################################################################
......@@ -72,6 +118,60 @@ set(${PROJECT_NAME}_HEADERS
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}Export"
"${CMAKE_BINARY_DIR}/${PROJECT_NAME}Export.h")
## #################################################################
## Handling of generated script modules
## #################################################################
set(${PROJECT_NAME}_MODULES)
if(DTK_BUILD_WRAPPERS AND SWIG_FOUND)
if(DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND )
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
DEPENDS ${PROJECT_SOURCE_DIR}/dtkLog.i
COMMAND ${CMAKE_COMMAND} ARGS -E make_directory ${CMAKE_BINARY_DIR}/modules
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${${PROJECT_NAME}_BINARY_DIR}/dtklog.py ${CMAKE_BINARY_DIR}/modules
COMMENT "-- Moving python modules to ${CMAKE_BINARY_DIR}/modules")
set(${PROJECT_NAME}_MODULES ${CMAKE_BINARY_DIR}/modules/dtklog.py)
if(APPLE)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
DEPENDS ${PROJECT_SOURCE_DIR}/dtkLog.i
COMMAND ln -sf ../lib/libdtkLog.dylib _dtklog.so
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/modules)
set(${PROJECT_NAME}_MODULES ${${PROJECT_NAME}_MODULES} ${CMAKE_BINARY_DIR}/modules/_dtklog.so)
endif(APPLE)
if(UNIX AND NOT APPLE)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
DEPENDS ${PROJECT_SOURCE_DIR}/dtkLog.i
COMMAND ln -fs ../${CMAKE_INSTALL_LIBDIR}/libdtkLog.so _dtklog.so
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/modules)
set(${PROJECT_NAME}_MODULES ${${PROJECT_NAME}_MODULES} ${CMAKE_BINARY_DIR}/modules/_dtklog.so)
endif(UNIX AND NOT APPLE)
endif(DTK_WRAPPING_PYTHON AND PYTHONLIBS_FOUND )
if (DTK_WRAPPING_CSHARP)
file(GLOB DTK_CSHARP_SOURCES "${${PROJECT_NAME}_BINARY_DIR}/*.cs")
foreach(DTK_CSHARP_SOURCE ${DTK_CSHARP_SOURCES})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
DEPENDS ${PROJECT_SOURCE_DIR}/dtkLog.i
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${DTK_CSHARP_SOURCE} ${CMAKE_BINARY_DIR}/modules
COMMENT "-- Moving csharp ${DTK_CSHARP_SOURCE} source to ${CMAKE_BINARY_DIR}/modules")
endforeach(DTK_CSHARP_SOURCE ${DTK_CSHARP_SOURCES})
endif (DTK_WRAPPING_CSHARP)
endif(DTK_BUILD_WRAPPERS AND SWIG_FOUND)
## ###################################################################
## Install rules - files
## ###################################################################
......
/* Version: $Id$
*
*/
/* Commentary:
*
*/
/* Change Log:
*
*/
/* Code: */
#pragma once
%module log
%include "../../wrp/dtk_base.i"
%{
#include <dtkLog/dtkLogger.h>
%}
// /////////////////////////////////////////////////////////////////
// Macro undefinition
// /////////////////////////////////////////////////////////////////
#undef DTKLOG_EXPORT
#define DTKLOG_EXPORT
// /////////////////////////////////////////////////////////////////
// Wrapper input
// /////////////////////////////////////////////////////////////////
%include <dtkLog/dtkLogger.h>
/* dtkLog.i ends here */
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