CMakeLists.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. FOREACH(lib_name ${MY_CTK_WRAPPED_LIBRARIES_PYTHONQT})
  75. LIST(APPEND KIT_target_libraries ${lib_name}PythonQt)
  76. SET(CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION
  77. "${CTK_PYTHONQT_INITIALIZATION_METHOD_DEFINITION}
  78. void PythonQt_init_org_commontk_${lib_name}(PyObject*);")
  79. SET(CTK_PYTHONQT_INITIALIZATION_METHOD_CALL
  80. "${CTK_PYTHONQT_INITIALIZATION_METHOD_CALL}
  81. PythonQt_init_org_commontk_${lib_name}(0);")
  82. ENDFOREACH()
  83. ENDIF()
  84. CONFIGURE_FILE(
  85. ctkSimplePythonManager.cpp.in
  86. ${CMAKE_CURRENT_BINARY_DIR}/ctkSimplePythonManager.cpp
  87. )
  88. ctkMacroBuildApp(
  89. NAME ${PROJECT_NAME}
  90. SRCS ${KIT_SRCS}
  91. MOC_SRCS ${KIT_MOC_SRCS}
  92. UI_FORMS ${KIT_UI_FORMS}
  93. TARGET_LIBRARIES ${KIT_target_libraries}
  94. RESOURCES ${KIT_resources}
  95. )
  96. ADD_SUBDIRECTORY(Python)
  97. # Testing
  98. IF(BUILD_TESTING)
  99. ADD_SUBDIRECTORY(Testing)
  100. ENDIF(BUILD_TESTING)