CMakeLists.txt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. project(CTKVisualizationVTKCore)
  2. #
  3. # 3rd party dependencies
  4. #
  5. include(${VTK_USE_FILE})
  6. if(NOT DEFINED VTK_RENDERING_BACKEND)
  7. set(VTK_RENDERING_BACKEND "OpenGL")
  8. endif()
  9. if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  10. find_package(PythonQt REQUIRED)
  11. endif()
  12. #
  13. # See CTK/CMake/ctkMacroBuildLib.cmake for details
  14. #
  15. set(KIT_export_directive "CTK_VISUALIZATION_VTK_CORE_EXPORT")
  16. # Source files
  17. set(KIT_SRCS
  18. ctkVTKConnection.cpp
  19. ctkVTKConnection.h
  20. ctkVTKErrorLogMessageHandler.cpp
  21. ctkVTKErrorLogMessageHandler.h
  22. ctkVTKObject.h
  23. ctkVTKObjectEventsObserver.cpp
  24. ctkVTKObjectEventsObserver.h
  25. vtkLightBoxRendererManager.cpp
  26. vtkLightBoxRendererManager.h
  27. )
  28. # Headers that should run through moc
  29. set(KIT_MOC_SRCS
  30. ctkVTKConnection.h
  31. ctkVTKObjectEventsObserver.h
  32. )
  33. # UI files
  34. set(KIT_UI_FORMS
  35. )
  36. # Resources
  37. set(KIT_resources
  38. )
  39. if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  40. list(APPEND KIT_SRCS
  41. ctkVTKPythonQtWrapperFactory.cpp
  42. )
  43. endif()
  44. if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  45. include_directories(
  46. ${PYTHON_INCLUDE_DIRS}
  47. ${PYTHONQT_INCLUDE_DIR}
  48. )
  49. endif()
  50. # Set VTK_LIBRARIES variable
  51. if(${VTK_VERSION_MAJOR} GREATER 5)
  52. set(VTK_LIBRARIES
  53. # a few of these have to be specified explicitly to workaround
  54. # underlinked libraries from the debian VTK package
  55. # see Debian bug #747436
  56. vtkCommonCore
  57. vtkCommonDataModel
  58. vtkCommonSystem
  59. vtkIOImage
  60. vtkInteractionStyle
  61. vtkRenderingAnnotation
  62. vtkRenderingCore
  63. vtkRenderingFreeType${VTK_RENDERING_BACKEND}
  64. vtkRendering${VTK_RENDERING_BACKEND}
  65. )
  66. if(TARGET vtkIOMPIImage)
  67. list(APPEND VTK_LIBRARIES vtkIOMPIImage )
  68. endif()
  69. if(TARGET vtkRenderingMatplotlib)
  70. list(APPEND VTK_LIBRARIES vtkRenderingMatplotlib )
  71. endif()
  72. if(TARGET vtkTestingRendering)
  73. list(APPEND VTK_LIBRARIES vtkTestingRendering )
  74. endif()
  75. if (TARGET vtkRenderingFreeTypeFontConfig AND UNIX AND NOT APPLE)
  76. find_package(FontConfig QUIET)
  77. if (FONTCONFIG_FOUND)
  78. list(APPEND VTK_LIBRARIES
  79. vtkRenderingFreeTypeFontConfig
  80. )
  81. endif()
  82. endif()
  83. else()
  84. set(VTK_LIBRARIES
  85. vtkCommon
  86. vtkFiltering
  87. vtkRendering
  88. vtkHybrid
  89. )
  90. endif()
  91. if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  92. list(APPEND VTK_LIBRARIES ${PYTHON_LIBRARY} ${PYTHONQT_LIBRARIES})
  93. if(${VTK_VERSION_MAJOR} GREATER 5)
  94. list(APPEND VTK_LIBRARIES vtkWrappingPythonCore)
  95. elseif(${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR} VERSION_GREATER 5.6)
  96. list(APPEND VTK_LIBRARIES vtkPythonCore)
  97. else()
  98. list(APPEND VTK_LIBRARIES vtkCommonPythonD)
  99. endif()
  100. endif()
  101. if(Q_WS_X11)
  102. # If the faster 'gold' linker is used, to avoid complaints about undefined symbol
  103. # 'XGetWindowAttributes', 'XCreateWindow', ..., let's link against X11 libraries.
  104. find_package(X11)
  105. list(APPEND VTK_LIBRARIES ${X11_LIBRARIES})
  106. endif()
  107. # Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
  108. # The following macro will read the target libraries from the file 'target_libraries.cmake'
  109. ctkFunctionGetTargetLibraries(KIT_target_libraries)
  110. ctkMacroBuildLib(
  111. NAME ${PROJECT_NAME}
  112. EXPORT_DIRECTIVE ${KIT_export_directive}
  113. SRCS ${KIT_SRCS}
  114. MOC_SRCS ${KIT_MOC_SRCS}
  115. UI_FORMS ${KIT_UI_FORMS}
  116. TARGET_LIBRARIES ${KIT_target_libraries}
  117. RESOURCES ${KIT_resources}
  118. LIBRARY_TYPE ${CTK_LIBRARY_MODE}
  119. )
  120. if(CTK_WRAP_PYTHONQT_LIGHT)
  121. ctkMacroBuildLibWrapper(
  122. TARGET ${PROJECT_NAME}
  123. SRCS ${KIT_SRCS}
  124. WRAPPER_LIBRARY_TYPE ${CTK_LIBRARY_MODE}
  125. )
  126. endif()
  127. # Plugins
  128. #if(CTK_BUILD_QTDESIGNER_PLUGINS)
  129. # add_subdirectory(Plugins)
  130. #endif()
  131. # Testing
  132. if(BUILD_TESTING)
  133. add_subdirectory(Testing)
  134. endif()