CMakeLists.txt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. cmake_minimum_required(VERSION 3.14)
  2. project(QmlCustomPlot VERSION 0.1 LANGUAGES CXX C)
  3. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  4. set(CMAKE_AUTOUIC ON)
  5. set(CMAKE_AUTOMOC ON)
  6. set(CMAKE_AUTORCC ON)
  7. set(CMAKE_CXX_STANDARD 11)
  8. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  9. add_definitions(
  10. -DQCUSTOMPLOT_USE_OPENGL
  11. )
  12. link_directories(
  13. thirdparty/fftw/lib
  14. )
  15. link_libraries(
  16. libfftw3-3
  17. libfftw3f-3
  18. libfftw3l-3
  19. )
  20. set(PROJECT_SOURCES
  21. main.cpp
  22. thirdparty/qcustomplot/qcustomplot.h
  23. thirdparty/qcustomplot/qcustomplot.cpp
  24. thirdparty/fftw/include/fftw3.h
  25. qquickitem/timedomainplot.cpp
  26. qquickitem/timedomainplot.h
  27. qquickitem/audiowaveform.cpp
  28. qquickitem/audiowaveform.h
  29. qquickitem/spectrum.cpp
  30. qquickitem/spectrum.h
  31. qquickitem/qabstractplot.h
  32. qquickitem/qabstractplot.cpp
  33. qquickitem/spectrumplot.h
  34. qquickitem/spectrumplot.cpp
  35. qquickitem/waveformplot.h
  36. qquickitem/waveformplot.cpp
  37. )
  38. set(PROJECT_RESOURCES
  39. resources/qml.qrc
  40. resources/audio.qrc
  41. resources/conf.qrc
  42. resources/other.qrc
  43. )
  44. link_libraries(
  45. opengl32
  46. glu32
  47. )
  48. add_executable(QmlCustomPlot
  49. ${PROJECT_SOURCES}
  50. ${PROJECT_RESOURCES}
  51. )
  52. find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Widgets PrintSupport OpenGL Multimedia)
  53. find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Widgets PrintSupport OpenGL Multimedia)
  54. target_link_libraries(QmlCustomPlot
  55. PRIVATE
  56. Qt${QT_VERSION_MAJOR}::Core
  57. Qt${QT_VERSION_MAJOR}::Quick
  58. Qt${QT_VERSION_MAJOR}::Widgets
  59. Qt${QT_VERSION_MAJOR}::PrintSupport
  60. Qt${QT_VERSION_MAJOR}::OpenGL ${OPENGL_gl_LIBRARY}
  61. Qt${QT_VERSION_MAJOR}::Multimedia
  62. )
  63. set_target_properties(QmlCustomPlot PROPERTIES
  64. WIN32_EXECUTABLE TRUE
  65. )