CMakeLists.txt 3.6 KB

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