CMakeLists.txt 4.0 KB

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