X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=gdcmPython%2FCMakeLists.txt;h=eb5c1a19999f7de5d2aa7db341b6411797612240;hb=5154dc89c0a2a565e9e79024ba8910f405279dd2;hp=2d47656509efcd7a6fee17579f5cf26277016658;hpb=09f5bc8993ebabc6af98370630d2ea64649d5a39;p=gdcm.git diff --git a/gdcmPython/CMakeLists.txt b/gdcmPython/CMakeLists.txt index 2d476565..eb5c1a19 100644 --- a/gdcmPython/CMakeLists.txt +++ b/gdcmPython/CMakeLists.txt @@ -1,6 +1,3 @@ -#IF(GDCM_WRAP_PYTHON) -#If we reach this dir we have selected this option - # TODO # http://www.cmake.org/pipermail/cmake/2003-August/004185.html # http://www.cmake.org/pipermail/cmake/2003-January/001092.html @@ -11,24 +8,26 @@ INCLUDE_DIRECTORIES( ${GDCM_BINARY_DIR}/ ) -SET(GDCM_INC - ${GDCM_SOURCE_DIR}/src -) +#----------------------------------------------------------------------------- +# Create the gdcmVersion.py file: +FILE(WRITE ${GDCM_BINARY_DIR}/gdcmVersion.py + "gdcmVERSION=\"${GDCM_VERSION_FULL}\"" + ) -SET(SWIG_INC - ${PYTHON_INCLUDES} - ${GDCM_INC} -) +#----------------------------------------------------------------------------- +# SWIG Wrapping +# +# Since the file gdcm_wrap.cxx does not exist, mark it as GENERATED: SET_SOURCE_FILES_PROPERTIES(gdcm_wrap.cxx GENERATED) - ADD_LIBRARY(pygdcm gdcm_wrap.cxx) -# http://www.cmake.org/pipermail/cmake/2003-August/004190.html -# SET_TARGET_PROPERTIES(pygdcm PROPERTIES PREFIX "_") + TARGET_LINK_LIBRARIES(pygdcm ${PYTHON_LIBRARY} gdcm ) +# http://www.cmake.org/pipermail/cmake/2003-August/004190.html +# SET_TARGET_PROPERTIES(pygdcm PROPERTIES PREFIX "_") #----------------------------------------------------------------------------- # SWIG Wrapping @@ -38,16 +37,19 @@ TARGET_LINK_LIBRARIES(pygdcm # later we should use SWIG instead of swig # Build our custom command : ADD_CUSTOM_COMMAND( - SOURCE ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i + TARGET pygdcm COMMAND swig ARGS -python -c++ -I${GDCM_SOURCE_DIR}/src -o ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i - TARGET pygdcm + SOURCE ${GDCM_SOURCE_DIR}/gdcmPython/gdcm.i OUTPUTS ${GDCM_BINARY_DIR}/gdcmPython/gdcm_wrap.cxx - COMMENT "Generating gdcm_wrap.cxx based on gdcm.i" + COMMENT "Generating gdcm_wrap.cxx/gdcm.py based on gdcm.i" ) +# This swig command will also outputs gdcm.py : +SET_SOURCE_FILES_PROPERTIES(gdcm.py GENERATED) + #----------------------------------------------------------------------------- # VTK Wrapping # @@ -84,20 +86,26 @@ IF(GDCM_VTK) ${GDCM_SOURCE_DIR}/gdcmPython/setup.py.in ${GDCM_BINARY_DIR}/setup.py ) - + #MESSAGE(STATUS ${VTKPATH}) ENDIF(GDCM_VTK) -#I should install in path of PYTHON_LIBRARY -#GET_FILENAME_COMPONENT(PYTHON_LIB_INSTALL ${PYTHON_LIBRARY} PATH) -#GET_FILENAME_COMPONENT(SITEPACKAGE ${PYTHON_LIB_INSTALL}/../site-packages ABSOLUTE) +#----------------------------------------------------------------------------- +# Install stuff: + +#Should install in path of PYTHON_LIBRARY and not the default CMAKE_INSTALL_PREFIX + +GET_FILENAME_COMPONENT(PYTHON_LIB_INSTALL ${PYTHON_LIBRARY} PATH) +GET_FILENAME_COMPONENT(SITEPACKAGE + ${PYTHON_LIB_INSTALL}/../site-packages ABSOLUTE) #MESSAGE(STATUS ${SITEPACKAGE}) #INSTALL_FILES(/include "\\.h$") #INSTALL_TARGETS(/lib/ gdcm) -#INSTALL_TARGETS(/lib/ gdcm.py) # gdcm.py is a file generated by swig # then from python you can do import gdcm, and it will load _gdcm.so -INSTALL_FILES(/lib/ .py gdcm.py) +#INSTALL_TARGETS(/lib/ gdcm.py) +#INSTALL_PROGRAMS(/lib/ gdcm.py) +#INSTALL_FILES(/lib/ .py gdcm.py) # When installing swig-generated python module one should pay attention # to library naming convention, see here for more detail: