CMakeLists.txt 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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. set(KIT_INCLUDE_DIRECTORIES )
  57. if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  58. list(APPEND KIT_INCLUDE_DIRECTORIES
  59. ${PYTHON_INCLUDE_DIRS}
  60. ${PYTHONQT_INCLUDE_DIR}
  61. )
  62. endif()
  63. # Set VTK_LIBRARIES variable
  64. if(${VTK_VERSION_MAJOR} GREATER 5)
  65. set(VTK_LIBRARIES
  66. # a few of these have to be specified explicitly to workaround
  67. # underlinked libraries from the debian VTK package
  68. # see Debian bug #747436
  69. vtkCommonCore
  70. vtkCommonDataModel
  71. vtkCommonSystem
  72. vtkIOImage
  73. vtkIOMPIImage
  74. vtkInteractionStyle
  75. vtkRenderingAnnotation
  76. vtkRenderingCore
  77. vtkRenderingFreeTypeOpenGL
  78. vtkRenderingMatplotlib
  79. vtkRenderingFreeTypeFontConfig
  80. vtkRenderingOpenGL
  81. )
  82. if(TARGET vtkTestingRendering)
  83. message("Testing exists")
  84. list(APPEND VTK_LIBRARIES
  85. vtkTestingRendering
  86. )
  87. endif()
  88. if (TARGET vtkRenderingFreeTypeFontConfig AND UNIX AND NOT APPLE)
  89. find_package(FontConfig QUIET)
  90. if (FONTCONFIG_FOUND)
  91. list(APPEND VTK_LIBRARIES
  92. vtkRenderingFreeTypeFontConfig
  93. )
  94. endif()
  95. endif()
  96. else()
  97. set(VTK_LIBRARIES
  98. vtkCommon
  99. vtkFiltering
  100. vtkRendering
  101. vtkHybrid
  102. )
  103. endif()
  104. if(CTK_LIB_Scripting/Python/Core AND CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)
  105. list(APPEND VTK_LIBRARIES ${PYTHON_LIBRARY} ${PYTHONQT_LIBRARIES})
  106. if(${VTK_VERSION_MAJOR} GREATER 5)
  107. list(APPEND VTK_LIBRARIES vtkWrappingPythonCore)
  108. elseif(${VTK_VERSION_MAJOR}.${VTK_VERSION_MINOR} VERSION_GREATER 5.6)
  109. list(APPEND VTK_LIBRARIES vtkPythonCore)
  110. else()
  111. list(APPEND VTK_LIBRARIES vtkCommonPythonD)
  112. endif()
  113. endif()
  114. if(Q_WS_X11)
  115. # If the faster 'gold' linker is used, to avoid complaints about undefined symbol
  116. # 'XGetWindowAttributes', 'XCreateWindow', ..., let's link against X11 libraries.
  117. find_package(X11)
  118. list(APPEND VTK_LIBRARIES ${X11_LIBRARIES})
  119. endif()
  120. # Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
  121. # The following macro will read the target libraries from the file 'target_libraries.cmake'
  122. ctkFunctionGetTargetLibraries(KIT_target_libraries)
  123. ctkMacroBuildLib(
  124. NAME ${PROJECT_NAME}
  125. EXPORT_DIRECTIVE ${KIT_export_directive}
  126. SRCS ${KIT_SRCS}
  127. MOC_SRCS ${KIT_MOC_SRCS}
  128. UI_FORMS ${KIT_UI_FORMS}
  129. INCLUDE_DIRECTORIES ${KIT_INCLUDE_DIRECTORIES}
  130. TARGET_LIBRARIES ${KIT_target_libraries}
  131. RESOURCES ${KIT_resources}
  132. LIBRARY_TYPE ${CTK_LIBRARY_MODE}
  133. )
  134. if(CTK_WRAP_PYTHONQT_LIGHT)
  135. ctkMacroBuildLibWrapper(
  136. TARGET ${PROJECT_NAME}
  137. SRCS ${KIT_SRCS}
  138. WRAPPER_LIBRARY_TYPE ${CTK_LIBRARY_MODE}
  139. )
  140. endif()
  141. # Plugins
  142. #if(CTK_BUILD_QTDESIGNER_PLUGINS)
  143. # add_subdirectory(Plugins)
  144. #endif()
  145. # Testing
  146. if(BUILD_TESTING)
  147. add_subdirectory(Testing)
  148. endif()