CMakeLists.txt 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. set(PROJECT_SOURCES
  13. main.cpp
  14. thirdparty/qcustomplot/qcustomplot.h
  15. thirdparty/qcustomplot/qcustomplot.cpp
  16. qquickitem/timedomainplot.cpp
  17. qquickitem/timedomainplot.h
  18. qquickitem/audiowaveform.cpp
  19. qquickitem/audiowaveform.h
  20. qquickitem/spectrum.cpp
  21. qquickitem/spectrum.h
  22. qquickitem/qabstractplot.h
  23. qquickitem/qabstractplot.cpp
  24. qquickitem/spectrumplot.h
  25. qquickitem/spectrumplot.cpp
  26. qquickitem/waveformplot.h
  27. qquickitem/waveformplot.cpp
  28. )
  29. set(PROJECT_RESOURCES
  30. resources/qml.qrc
  31. resources/audio.qrc
  32. resources/conf.qrc
  33. resources/other.qrc
  34. )
  35. link_libraries(
  36. opengl32
  37. glu32
  38. )
  39. add_executable(QmlCustomPlot
  40. ${PROJECT_SOURCES}
  41. ${PROJECT_RESOURCES}
  42. )
  43. find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick Widgets PrintSupport OpenGL Multimedia)
  44. find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick Widgets PrintSupport OpenGL Multimedia)
  45. target_link_libraries(QmlCustomPlot
  46. PRIVATE
  47. Qt${QT_VERSION_MAJOR}::Core
  48. Qt${QT_VERSION_MAJOR}::Quick
  49. Qt${QT_VERSION_MAJOR}::Widgets
  50. Qt${QT_VERSION_MAJOR}::PrintSupport
  51. Qt${QT_VERSION_MAJOR}::OpenGL ${OPENGL_gl_LIBRARY}
  52. Qt${QT_VERSION_MAJOR}::Multimedia
  53. )
  54. set_target_properties(QmlCustomPlot PROPERTIES
  55. WIN32_EXECUTABLE TRUE
  56. )