CMakeLists.txt 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. PROJECT(ctkSimplePythonShell)
  2. #
  3. # 3rd party dependencies
  4. #
  5. INCLUDE(${VTK_USE_FILE})
  6. #
  7. # See CTK/CMake/ctkMacroBuildApp.cmake for details
  8. #
  9. SET(KIT_SRCS
  10. ${CMAKE_CURRENT_BINARY_DIR}/ctkSimplePythonManager.cpp
  11. ctkSimplePythonManager.h
  12. ctkSimplePythonQtDecorators.h
  13. ctkSimplePythonShellMain.cpp
  14. ctkTestWrappedQProperty.h
  15. ctkTestWrappedQInvokable.h
  16. ctkTestWrappedSlot.h
  17. )
  18. IF(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  19. LIST(APPEND KIT_SRCS
  20. ctkTestWrappedQListOfVTKObject.h
  21. ctkTestWrappedVTKSlot.h
  22. ctkTestWrappedVTKQInvokable.h
  23. )
  24. ENDIF()
  25. # Headers that should run through moc
  26. SET(KIT_MOC_SRCS
  27. ctkSimplePythonManager.h
  28. ctkSimplePythonQtDecorators.h
  29. ctkTestWrappedQProperty.h
  30. ctkTestWrappedQInvokable.h
  31. ctkTestWrappedSlot.h
  32. )
  33. IF(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  34. LIST(APPEND KIT_MOC_SRCS
  35. ctkTestWrappedQListOfVTKObject.h
  36. ctkTestWrappedVTKSlot.h
  37. ctkTestWrappedVTKQInvokable.h
  38. )
  39. ENDIF()
  40. # UI files
  41. SET(KIT_UI_FORMS
  42. )
  43. # Resources
  44. SET(KIT_resources
  45. )
  46. # Set VTK_LIBRARIES variable
  47. SET(VTK_LIBRARIES
  48. vtkCommon
  49. vtkFiltering
  50. )
  51. # Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
  52. # The following macro will read the target libraries from the file 'target_libraries.cmake'
  53. ctkFunctionGetTargetLibraries(KIT_target_libraries)
  54. # Configure file will be configured using CTK_WRAP_PYTHONQT_{LIGHT, FULL} variable
  55. CONFIGURE_FILE(
  56. ctkSimplePythonShellConfigure.h.in
  57. ${CMAKE_CURRENT_BINARY_DIR}/ctkSimplePythonShellConfigure.h
  58. )
  59. IF(CTK_WRAP_PYTHONQT_LIGHT OR CTK_WRAP_PYTHONQT_FULL)
  60. # Update list of target libraries with the list of available PythonQt libraries
  61. # and set variables holding list of pythonqt initialization method
  62. SET(CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION)
  63. SET(CTK_PYTHONQT_INITIALIZATION_METHOD_CALL)
  64. # To avoid the complex process of resolving the dependencies associated with each
  65. # external project required by each decorator. For now, let's just include the decorator
  66. # associated with CTKCore and CTKWidgets.
  67. SET(MY_CTK_WRAPPED_LIBRARIES_PYTHONQT)
  68. IF(CTK_LIB_Core)
  69. LIST(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKCore)
  70. ENDIF()
  71. IF(CTK_LIB_Widgets)
  72. LIST(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKWidgets)
  73. ENDIF()
  74. IF(CTK_LIB_DICOM/Core)
  75. LIST(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKDICOMCore)
  76. ENDIF()
  77. IF(CTK_LIB_DICOM/Widgets)
  78. LIST(APPEND MY_CTK_WRAPPED_LIBRARIES_PYTHONQT CTKDICOMWidgets)
  79. ENDIF()
  80. FOREACH(lib_name ${MY_CTK_WRAPPED_LIBRARIES_PYTHONQT})
  81. LIST(APPEND KIT_target_libraries ${lib_name}PythonQt)
  82. SET(CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION
  83. "${CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION}
  84. void PythonQt_init_org_commontk_${lib_name}(PyObject*);")
  85. SET(CTK_PYTHONQT_INITIALIZATION_METHOD_CALL
  86. "${CTK_PYTHONQT_INITIALIZATION_METHOD_CALL}
  87. PythonQt_init_org_commontk_${lib_name}(0);")
  88. ENDFOREACH()
  89. ENDIF()
  90. CONFIGURE_FILE(
  91. ctkSimplePythonManager.cpp.in
  92. ${CMAKE_CURRENT_BINARY_DIR}/ctkSimplePythonManager.cpp
  93. )
  94. ctkMacroBuildApp(
  95. NAME ${PROJECT_NAME}
  96. SRCS ${KIT_SRCS}
  97. MOC_SRCS ${KIT_MOC_SRCS}
  98. UI_FORMS ${KIT_UI_FORMS}
  99. TARGET_LIBRARIES ${KIT_target_libraries}
  100. RESOURCES ${KIT_resources}
  101. )
  102. ADD_SUBDIRECTORY(Python)
  103. # Testing
  104. IF(BUILD_TESTING)
  105. ADD_SUBDIRECTORY(Testing)
  106. ENDIF(BUILD_TESTING)