X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=gdcmPython%2FCMakeLists.txt;h=04a30511a219ad8b7e494b3c942f83e387d3bf2a;hb=aa0fc6ed66dc186bae363418702f402dc3f0ea21;hp=a5a26ed797d5aea17fb315eb4c6e42dc2cf062f2;hpb=3eacdfdf6a420946ec76fd931826a0bbbcbea00a;p=gdcm.git diff --git a/gdcmPython/CMakeLists.txt b/gdcmPython/CMakeLists.txt index a5a26ed7..04a30511 100644 --- a/gdcmPython/CMakeLists.txt +++ b/gdcmPython/CMakeLists.txt @@ -14,34 +14,38 @@ INCLUDE_DIRECTORIES( IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) + # We need to pass that to swig to be sure all modules are generated in the proper dir + SET(CMAKE_SWIG_FLAGS "-outdir ${GDCM_BINARY_DIR}/bin") + # Looks like a bug to me in cmake 2.0.x: + SEPARATE_ARGUMENTS(CMAKE_SWIG_FLAGS) + FIND_PACKAGE(SWIG REQUIRED) INCLUDE(${SWIG_USE_FILE}) - #INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) - #SET(CMAKE_SWIG_FLAGS "") - #SET_SOURCE_FILES_PROPERTIES(gdcm.i PROPERTIES PYTHON ON) SET_SOURCE_FILES_PROPERTIES(gdcm.i PROPERTIES CPLUSPLUS ON) - SET_SOURCE_FILES_PROPERTIES(gdcm.i PROPERTIES SWIG_FLAGS "-includeall") + # Setting SWIG_FLAGS to "-includeall" at the following line looks like + # a bad idea since swig tries to reculsively include all the referenced + # files, "including" the C++ , , ... Of course swig + # has no way of finding the path to those files (unless it is told by + # cmake) since they are related to the compiler installation layout. + # Anyhow, since this inclusion recursion is not necessary, just don't + # do it. + # Note: apparently the line is required in order to avoid a NOTFOUND + # as argument of swig on invocation of make. + SET_SOURCE_FILES_PROPERTIES(gdcm.i PROPERTIES SWIG_FLAGS "") SWIG_ADD_MODULE(gdcm python gdcm.i) #gdcm_wrap.cxx SWIG_LINK_LIBRARIES(gdcm gdcm ${PYTHON_LIBRARIES}) - - #SWIG_GET_EXTRA_OUTPUT_FILES(python foobar "/usr/" "gdcm" ) - #MESSAGE(FATAL_ERROR ${swig_generated_file_fullname}) - #MESSAGE(FATAL_ERROR ${swig_source_file_fullname}) - - # Swig creates a gdcm.py file put it in the right place, if only cmake - # was able to do stuff properly ... - ADD_CUSTOM_TARGET( CMAKE_S____ ALL) - ADD_CUSTOM_COMMAND( - TARGET CMAKE_S____ - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy - ${GDCM_BINARY_DIR}/gdcmPython/gdcm.py - ${GDCM_BINARY_DIR}/bin/gdcm.py - ) + SET(GDCM_CXX_FLAGS ${CMAKE_SWIG_FLAGS}) + # Get rid of -Wall / -W / -pedantic if exist + SET(CMAKE_CXX_FLAGS "") + # I guess I need to put them back on the this file: + SET_SOURCE_FILES_PROPERTIES(${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx + PROPERTIES COMPILE_FLAGS "") +# SET_TARGET_PROPERTIES(${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx +# PROPERTIES CMAKE_CXX_FLAGS "-foo") + ELSE(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) # As of 09/10/2003 there was no FindSWIG.cmake @@ -157,6 +161,9 @@ ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 1.9) # VTK Wrapping # IF(GDCM_VTK) + # Include the VTK library + INCLUDE(${VTK_USE_FILE}) + INCLUDE_DIRECTORIES( ${GDCM_SOURCE_DIR}/vtk ) @@ -184,7 +191,8 @@ IF(GDCM_VTK) vtkCommonPython vtkIOPython) ENDIF (GDCM_WRAP_PYTHON) - +ENDIF(GDCM_VTK) + # generate a setup.py according to VTK installation # put it in subdir in order to not override old one @@ -193,7 +201,6 @@ IF(GDCM_VTK) ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in ${GDCM_BINARY_DIR}/setup.py ) -ENDIF(GDCM_VTK) #----------------------------------------------------------------------------- # Install stuff: