CMakeLists.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. project(CTKWidgets)
  2. #
  3. # See CTK/CMake/ctkMacroBuildLib.cmake for details
  4. #
  5. set(KIT_export_directive "CTK_WIDGETS_EXPORT")
  6. # add local include directory for FreeBSD
  7. # (QtOpengl can't find GL/gl.h)
  8. # actual bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195105
  9. if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
  10. include_directories("/usr/local/include")
  11. endif()
  12. #
  13. # Add the libraries QtTesting
  14. #
  15. if(CTK_USE_QTTESTING)
  16. find_package(QtTesting REQUIRED)
  17. include_directories(
  18. ${QtTesting_INCLUDE_DIRS}
  19. ${CMAKE_BINARY_DIR} # For ctkConfig.h
  20. )
  21. endif()
  22. # Source files
  23. set(KIT_SRCS
  24. ctkActionsWidget.cpp
  25. ctkActionsWidget.h
  26. ctkAddRemoveComboBox.cpp
  27. ctkAddRemoveComboBox.h
  28. ctkAxesWidget.cpp
  29. ctkAxesWidget.h
  30. ctkBasePopupWidget.cpp
  31. ctkBasePopupWidget.h
  32. ctkBasePopupWidget_p.h
  33. ctkButtonGroup.cpp
  34. ctkButtonGroup.h
  35. ctkCheckableComboBox.cpp
  36. ctkCheckableComboBox.h
  37. ctkCheckableHeaderView.cpp
  38. ctkCheckableHeaderView.h
  39. ctkCheckableModelHelper.cpp
  40. ctkCheckableModelHelper.h
  41. ctkCheckBox.cpp
  42. ctkCheckBox.h
  43. ctkCheckBoxPixmaps.cpp
  44. ctkCheckBoxPixmaps.h
  45. ctkCheckablePushButton.cpp
  46. ctkCheckablePushButton.h
  47. ctkComboBox.cpp
  48. ctkComboBox.h
  49. ctkCompleter.cpp
  50. ctkCompleter.h
  51. ctkCollapsibleButton.cpp
  52. ctkCollapsibleButton.h
  53. ctkCollapsibleGroupBox.cpp
  54. ctkCollapsibleGroupBox.h
  55. ctkColorDialog.cpp
  56. ctkColorDialog.h
  57. ctkColorPickerButton.cpp
  58. ctkColorPickerButton.h
  59. ctkConsole.cpp
  60. ctkConsole.h
  61. ctkConsole_p.h
  62. ctkCoordinatesWidget.cpp
  63. ctkCoordinatesWidget.h
  64. ctkCoordinatesWidget_p.h
  65. ctkCrosshairLabel.cpp
  66. ctkCrosshairLabel.h
  67. ctkDateRangeWidget.cpp
  68. ctkDateRangeWidget.h
  69. ctkDirectoryButton.cpp
  70. ctkDirectoryButton.h
  71. ctkDoubleRangeSlider.cpp
  72. ctkDoubleRangeSlider.h
  73. ctkDoubleSlider.cpp
  74. ctkDoubleSlider.h
  75. ctkDoubleSpinBox.cpp
  76. ctkDoubleSpinBox.h
  77. ctkDynamicSpacer.cpp
  78. ctkDynamicSpacer.h
  79. ctkErrorLogModel.cpp
  80. ctkErrorLogModel.h
  81. ctkErrorLogStatusMessageHandler.cpp
  82. ctkErrorLogStatusMessageHandler.h
  83. ctkErrorLogWidget.cpp
  84. ctkErrorLogWidget.h
  85. ctkExpandButton.cpp
  86. ctkExpandButton.h
  87. ctkExpandableWidget.cpp
  88. ctkExpandableWidget.h
  89. ctkFileDialog.cpp
  90. ctkFileDialog.h
  91. ctkFittedTextBrowser.cpp
  92. ctkFittedTextBrowser.h
  93. ctkFlatProxyModel.cpp
  94. ctkFlatProxyModel.h
  95. ctkFlowLayout.cpp
  96. ctkFlowLayout.h
  97. ctkFontButton.cpp
  98. ctkFontButton.h
  99. ctkHistogram.cpp
  100. ctkHistogram.h
  101. ctkIconEnginePlugin.cpp
  102. ctkIconEnginePlugin.h
  103. ctkIconEnginePlugin_qt4.h
  104. ctkIconEnginePlugin_qt5.h
  105. ctkLanguageComboBox.cpp
  106. ctkLanguageComboBox.h
  107. ctkLayoutFactory.cpp
  108. ctkLayoutFactory.h
  109. ctkLayoutManager.cpp
  110. ctkLayoutManager.h
  111. ctkLayoutViewFactory.cpp
  112. ctkLayoutViewFactory.h
  113. ctkMaterialPropertyPreviewLabel.cpp
  114. ctkMaterialPropertyPreviewLabel.h
  115. ctkMaterialPropertyWidget.cpp
  116. ctkMaterialPropertyWidget.h
  117. ctkMatrixWidget.cpp
  118. ctkMatrixWidget.h
  119. ctkMenuButton.cpp
  120. ctkMenuButton.h
  121. ctkMenuComboBox.cpp
  122. ctkMenuComboBox.h
  123. ctkMenuComboBox_p.h
  124. ctkMessageBox.cpp
  125. ctkMessageBox.h
  126. ctkModalityWidget.cpp
  127. ctkModalityWidget.h
  128. ctkPathLineEdit.cpp
  129. ctkPathLineEdit.h
  130. ctkPathListButtonsWidget.cpp
  131. ctkPathListButtonsWidget.h
  132. ctkPathListButtonsWidget_p.h
  133. ctkPathListWidget.cpp
  134. ctkPathListWidget.h
  135. ctkPixmapIconEngine.cpp
  136. ctkPixmapIconEngine.h
  137. ctkPopupWidget.cpp
  138. ctkPopupWidget.h
  139. ctkPopupWidget_p.h
  140. ctkProxyStyle.cpp
  141. ctkProxyStyle.h
  142. ctkPushButton.cpp
  143. ctkPushButton.h
  144. ctkPushButton_p.h
  145. ctkQImageView.cpp
  146. ctkQImageView.h
  147. ctkRangeSlider.cpp
  148. ctkRangeSlider.h
  149. ctkRangeWidget.cpp
  150. ctkRangeWidget.h
  151. ctkScreenshotDialog.cpp
  152. ctkScreenshotDialog.h
  153. ctkScreenshotDialog_p.h
  154. ctkSearchBox.cpp
  155. ctkSearchBox.h
  156. ctkSettings.cpp
  157. ctkSettings.h
  158. ctkSettingsDialog.cpp
  159. ctkSettingsDialog.h
  160. ctkSettingsPanel.cpp
  161. ctkSettingsPanel.h
  162. ctkSignalMapper.cpp
  163. ctkSignalMapper.h
  164. ctkSizeGrip.cpp
  165. ctkSizeGrip.h
  166. ctkSliderWidget.cpp
  167. ctkSliderWidget.h
  168. ctkTestApplication.cpp
  169. ctkTestApplication.h
  170. ctkThumbnailLabel.cpp
  171. ctkThumbnailLabel.h
  172. ctkThumbnailListWidget.cpp
  173. ctkThumbnailListWidget.h
  174. ctkThumbnailListWidget_p.h
  175. ctkToolTipTrapper.cpp
  176. ctkToolTipTrapper.h
  177. ctkTransferFunction.cpp
  178. ctkTransferFunction.h
  179. ctkTransferFunctionBarsItem.cpp
  180. ctkTransferFunctionBarsItem.h
  181. ctkTransferFunctionControlPointsItem.cpp
  182. ctkTransferFunctionControlPointsItem.h
  183. ctkTransferFunctionGradientItem.cpp
  184. ctkTransferFunctionGradientItem.h
  185. ctkTransferFunctionItem.cpp
  186. ctkTransferFunctionItem.h
  187. ctkTransferFunctionRepresentation.cpp
  188. ctkTransferFunctionRepresentation.h
  189. ctkTransferFunctionScene.cpp
  190. ctkTransferFunctionScene.h
  191. ctkTransferFunctionView.cpp
  192. ctkTransferFunctionView.h
  193. ctkTreeComboBox.cpp
  194. ctkTreeComboBox.h
  195. ctkWidgetsTestingUtilities.cpp
  196. ctkWidgetsTestingUtilities.h
  197. ctkWidgetsUtils.cpp
  198. ctkWidgetsUtils.h
  199. ctkWorkflowAbstractPagedWidget.cpp
  200. ctkWorkflowAbstractPagedWidget.h
  201. ctkWorkflowButtonBoxWidget.cpp
  202. ctkWorkflowButtonBoxWidget.h
  203. ctkWorkflowGroupBox.cpp
  204. ctkWorkflowGroupBox.h
  205. ctkWorkflowStackedWidget.cpp
  206. ctkWorkflowStackedWidget.h
  207. ctkWorkflowTabWidget.cpp
  208. ctkWorkflowTabWidget.h
  209. ctkWorkflowWidget.cpp
  210. ctkWorkflowWidget.h
  211. ctkWorkflowWidgetStep.cpp
  212. ctkWorkflowWidgetStep_p.h
  213. ctkWorkflowWidgetStep.h
  214. )
  215. # Headers that should run through moc
  216. set(KIT_MOC_SRCS
  217. ctkActionsWidget.h
  218. ctkAxesWidget.h
  219. ctkAddRemoveComboBox.h
  220. ctkBasePopupWidget.h
  221. ctkBasePopupWidget_p.h
  222. ctkButtonGroup.h
  223. ctkCheckableComboBox.h
  224. ctkCheckableHeaderView.h
  225. ctkCheckableModelHelper.h
  226. ctkCheckablePushButton.h
  227. ctkCheckBox.h
  228. ctkCheckBoxPixmaps.h
  229. ctkComboBox.h
  230. ctkCompleter.h
  231. ctkCollapsibleButton.h
  232. ctkCollapsibleGroupBox.h
  233. ctkColorDialog.h
  234. ctkColorPickerButton.h
  235. ctkConsole.h
  236. ctkConsole_p.h
  237. ctkCoordinatesWidget.h
  238. ctkCoordinatesWidget_p.h
  239. ctkCrosshairLabel.h
  240. ctkDateRangeWidget.h
  241. ctkDirectoryButton.h
  242. ctkDoubleRangeSlider.h
  243. ctkDoubleSlider.h
  244. ctkDoubleSpinBox.h
  245. ctkDoubleSpinBox_p.h
  246. ctkDynamicSpacer.h
  247. ctkErrorLogModel.h
  248. ctkErrorLogWidget.h
  249. ctkErrorLogStatusMessageHandler.h
  250. ctkExpandButton.h
  251. ctkExpandableWidget.h
  252. ctkFileDialog.h
  253. ctkFittedTextBrowser.h
  254. ctkFlatProxyModel.h
  255. ctkFlowLayout.h
  256. ctkFontButton.h
  257. ctkHistogram.h
  258. ctkLanguageComboBox.h
  259. ctkLayoutFactory.h
  260. ctkLayoutManager.h
  261. ctkLayoutViewFactory.h
  262. ctkMaterialPropertyPreviewLabel.h
  263. ctkMaterialPropertyWidget.h
  264. ctkMatrixWidget.h
  265. ctkMenuButton.h
  266. ctkMenuComboBox.h
  267. ctkMenuComboBox_p.h
  268. ctkMessageBox.h
  269. ctkModalityWidget.h
  270. ctkPathListButtonsWidget.h
  271. ctkPathListButtonsWidget_p.h
  272. ctkPopupWidget.h
  273. ctkPopupWidget_p.h
  274. ctkProxyStyle.h
  275. ctkPushButton.h
  276. ctkQImageView.h
  277. ctkRangeSlider.h
  278. ctkRangeWidget.h
  279. ctkScreenshotDialog.h
  280. ctkScreenshotDialog_p.h
  281. ctkSearchBox.h
  282. ctkSettings.h
  283. ctkSettingsDialog.h
  284. ctkSettingsPanel.h
  285. ctkSignalMapper.h
  286. ctkSizeGrip.h
  287. ctkSliderWidget.h
  288. ctkTestApplication.h
  289. ctkThumbnailLabel.h
  290. ctkThumbnailListWidget.h
  291. ctkToolTipTrapper.h
  292. ctkTransferFunction.h
  293. ctkTransferFunctionBarsItem.h
  294. ctkTransferFunctionControlPointsItem.h
  295. ctkTransferFunctionGradientItem.h
  296. ctkTransferFunctionItem.h
  297. ctkTransferFunctionRepresentation.h
  298. ctkTransferFunctionScene.h
  299. ctkTransferFunctionView.h
  300. ctkTreeComboBox.h
  301. ctkWorkflowAbstractPagedWidget.h
  302. ctkWorkflowButtonBoxWidget.h
  303. ctkWorkflowGroupBox.h
  304. ctkWorkflowStackedWidget.h
  305. ctkWorkflowTabWidget.h
  306. ctkWorkflowWidget.h
  307. ctkWorkflowWidgetStep.h
  308. ctkWorkflowWidgetStep_p.h
  309. )
  310. if(CTK_QT_VERSION VERSION_GREATER "4")
  311. list(APPEND KIT_MOC_SRCS ctkIconEnginePlugin_qt5.h)
  312. else()
  313. list(APPEND KIT_MOC_SRCS ctkIconEnginePlugin_qt4.h)
  314. endif()
  315. # Headers that should run through moc without adding
  316. # the generated cpp file to the source list
  317. set(KIT_GENERATE_MOC_SRCS
  318. ctkPathLineEdit.h
  319. ctkPathListWidget.h
  320. )
  321. # UI files
  322. set(KIT_UI_FORMS
  323. Resources/UI/ctkAddRemoveComboBox.ui
  324. Resources/UI/ctkRangeWidget.ui
  325. Resources/UI/ctkDateRangeWidget.ui
  326. Resources/UI/ctkErrorLogWidget.ui
  327. Resources/UI/ctkMaterialPropertyWidget.ui
  328. Resources/UI/ctkModalityWidget.ui
  329. Resources/UI/ctkPathListButtonsWidget.ui
  330. Resources/UI/ctkScreenshotDialog.ui
  331. Resources/UI/ctkSettingsDialog.ui
  332. Resources/UI/ctkSliderWidget.ui
  333. Resources/UI/ctkThumbnailLabel.ui
  334. Resources/UI/ctkThumbnailListWidget.ui
  335. Resources/UI/ctkWorkflowGroupBox.ui
  336. )
  337. # Resources
  338. set(KIT_resources
  339. Resources/ctkWidgets.qrc
  340. )
  341. # Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
  342. # The following macro will read the target libraries from the file 'target_libraries.cmake'
  343. ctkFunctionGetTargetLibraries(KIT_target_libraries)
  344. if(CTK_QT_VERSION VERSION_GREATER "4")
  345. list(APPEND KIT_target_libraries Qt5::Widgets Qt5::Xml Qt5::OpenGL)
  346. endif()
  347. # A player and a translator must be added for custom Qt widgets
  348. if(CTK_USE_QTTESTING)
  349. list(APPEND KIT_SRCS
  350. ctkAxesWidgetEventPlayer.cpp
  351. ctkAxesWidgetEventPlayer.h
  352. ctkAxesWidgetEventTranslator.cpp
  353. ctkAxesWidgetEventTranslator.h
  354. ctkCheckableComboBoxEventPlayer.cpp
  355. ctkCheckableComboBoxEventPlayer.h
  356. ctkCheckableComboBoxEventTranslator.cpp
  357. ctkCheckableComboBoxEventTranslator.h
  358. ctkCheckableHeaderViewEventPlayer.cpp
  359. ctkCheckableHeaderViewEventPlayer.h
  360. ctkCheckableHeaderViewEventTranslator.cpp
  361. ctkCheckableHeaderViewEventTranslator.h
  362. ctkConsoleEventPlayer.cpp
  363. ctkConsoleEventPlayer.h
  364. ctkConsoleEventTranslator.cpp
  365. ctkConsoleEventTranslator.h
  366. ctkDoubleRangeSliderEventPlayer.cpp
  367. ctkDoubleRangeSliderEventPlayer.h
  368. ctkDoubleRangeSliderEventTranslator.cpp
  369. ctkDoubleRangeSliderEventTranslator.h
  370. ctkFileDialogEventPlayer.cpp
  371. ctkFileDialogEventPlayer.h
  372. ctkFileDialogEventTranslator.cpp
  373. ctkFileDialogEventTranslator.h
  374. ctkFontButtonEventPlayer.cpp
  375. ctkFontButtonEventPlayer.h
  376. ctkFontButtonEventTranslator.cpp
  377. ctkFontButtonEventTranslator.h
  378. ctkMatrixWidgetEventPlayer.cpp
  379. ctkMatrixWidgetEventPlayer.h
  380. ctkMatrixWidgetEventTranslator.cpp
  381. ctkMatrixWidgetEventTranslator.h
  382. ctkMenuComboBoxEventPlayer.cpp
  383. ctkMenuComboBoxEventPlayer.h
  384. ctkMenuComboBoxEventTranslator.cpp
  385. ctkMenuComboBoxEventTranslator.h
  386. ctkPathLineEditEventPlayer.cpp
  387. ctkPathLineEditEventPlayer.h
  388. ctkPathLineEditEventTranslator.cpp
  389. ctkPathLineEditEventTranslator.h
  390. ctkPopupWidgetEventPlayer.cpp
  391. ctkPopupWidgetEventPlayer.h
  392. ctkPopupWidgetEventTranslator.cpp
  393. ctkPopupWidgetEventTranslator.h
  394. ctkRangeSliderEventPlayer.cpp
  395. ctkRangeSliderEventPlayer.h
  396. ctkRangeSliderEventTranslator.cpp
  397. ctkRangeSliderEventTranslator.h
  398. ctkTreeComboBoxEventPlayer.cpp
  399. ctkTreeComboBoxEventPlayer.h
  400. ctkTreeComboBoxEventTranslator.cpp
  401. ctkTreeComboBoxEventTranslator.h
  402. )
  403. list(APPEND KIT_MOC_SRCS
  404. ctkAxesWidgetEventPlayer.h
  405. ctkAxesWidgetEventTranslator.h
  406. ctkCheckableComboBoxEventPlayer.h
  407. ctkCheckableComboBoxEventTranslator.h
  408. ctkCheckableHeaderViewEventPlayer.h
  409. ctkCheckableHeaderViewEventTranslator.h
  410. ctkCheckableModelHelper.h
  411. ctkConsoleEventPlayer.h
  412. ctkConsoleEventTranslator.h
  413. ctkDoubleRangeSliderEventPlayer.h
  414. ctkDoubleRangeSliderEventTranslator.h
  415. ctkFileDialogEventPlayer.h
  416. ctkFileDialogEventTranslator.h
  417. ctkFontButtonEventPlayer.h
  418. ctkFontButtonEventTranslator.h
  419. ctkMatrixWidgetEventPlayer.h
  420. ctkMatrixWidgetEventTranslator.h
  421. ctkMenuComboBoxEventPlayer.h
  422. ctkMenuComboBoxEventTranslator.h
  423. ctkPathLineEditEventPlayer.h
  424. ctkPathLineEditEventTranslator.h
  425. ctkPopupWidgetEventPlayer.h
  426. ctkPopupWidgetEventTranslator.h
  427. ctkRangeSliderEventPlayer.h
  428. ctkRangeSliderEventTranslator.h
  429. ctkTreeComboBoxEventPlayer.h
  430. ctkTreeComboBoxEventTranslator.h
  431. )
  432. list(APPEND KIT_target_libraries QtTesting)
  433. endif()
  434. ctkMacroBuildLib(
  435. NAME ${PROJECT_NAME}
  436. EXPORT_DIRECTIVE ${KIT_export_directive}
  437. SRCS ${KIT_SRCS}
  438. MOC_SRCS ${KIT_MOC_SRCS}
  439. GENERATE_MOC_SRCS ${KIT_GENERATE_MOC_SRCS}
  440. UI_FORMS ${KIT_UI_FORMS}
  441. TARGET_LIBRARIES ${KIT_target_libraries}
  442. RESOURCES ${KIT_resources}
  443. LIBRARY_TYPE ${CTK_LIBRARY_MODE}
  444. )
  445. if(CTK_WRAP_PYTHONQT_LIGHT)
  446. ctkMacroBuildLibWrapper(
  447. TARGET ${PROJECT_NAME}
  448. SRCS ${KIT_SRCS}
  449. WRAPPER_LIBRARY_TYPE ${CTK_LIBRARY_MODE}
  450. )
  451. endif()
  452. # Plugins
  453. if(CTK_BUILD_QTDESIGNER_PLUGINS)
  454. add_subdirectory(Plugins)
  455. endif()
  456. # Testing
  457. if(BUILD_TESTING)
  458. add_subdirectory(Testing)
  459. endif()