CMakeLists.txt 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. CMAKE_MINIMUM_REQUIRED(VERSION 3.16.3)
  2. PROJECT(TrackpointApp VERSION 0.0.1 LANGUAGES CXX)
  3. # Include modules
  4. INCLUDE(FetchContent)
  5. # Build TrackpointApp
  6. # Set C++ mode
  7. SET(CMAKE_CXX_STANDARD 11)
  8. SET(CMAKE_CXX_STANDARD_REQUIRED True)
  9. SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wunreachable-code")
  10. SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
  11. SET(CMAKE_AUTOUIC ON)
  12. SET(CMAKE_AUTOMOC ON)
  13. SET(CMAKE_AUTORCC ON)
  14. SET(CMAKE_INCLUDE_CURRENT_DIR ON)
  15. ADD_COMPILE_DEFINITIONS(GL_SILENCE_DEPRECATION)
  16. # Qt
  17. LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/thirdparty/qt/install")
  18. FIND_PACKAGE(Qt6 COMPONENTS Core Gui Widgets OpenGLWidgets REQUIRED NO_CMAKE_SYSTEM_PATH)
  19. # Json
  20. INCLUDE(thirdparty/json.cmake)
  21. # Development build: dynamic link
  22. if(NOT BUILD_STATIC_RELEASE)
  23. # OpenSceneGraph
  24. INCLUDE(thirdparty/openscenegraph.cmake)
  25. # lib3mf
  26. INCLUDE(thirdparty/lib3mf.cmake)
  27. ENDIF()
  28. # Release build: static link
  29. if(BUILD_STATIC_RELEASE)
  30. ADD_DEFINITIONS(-DINCLUDE_PLUGINS)
  31. # OpenSceneGraph
  32. LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/thirdparty/openscenegraph/install")
  33. FIND_PACKAGE(OpenSceneGraph REQUIRED COMPONENTS osgViewer osgDB osgGA osgText osgUtil)
  34. # lib3mf
  35. LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/thirdparty/lib3mf/install")
  36. FIND_PACKAGE(Lib3MF REQUIRED)
  37. ENDIF()
  38. # The executable we want to build
  39. QT_ADD_EXECUTABLE(TrackpointApp
  40. src/main.cpp
  41. src/MainWindow.cpp
  42. include/MainWindow.hpp
  43. gui/MainWindow.ui
  44. src/NoMeshWidget.cpp
  45. include/NoMeshWidget.hpp
  46. gui/NoMeshWidget.ui
  47. src/EditWidget.cpp
  48. include/EditWidget.hpp
  49. gui/EditWidget.ui
  50. include/OSGWidget.hpp
  51. src/OSGWidget.cpp
  52. src/ProjectStore.cpp
  53. src/PickHandler.cpp
  54. src/TrackPoint.cpp
  55. src/OptiTrackPoint.cpp
  56. src/OpenScadRenderer.cpp
  57. src/StringBasics.cpp
  58. src/TrackPointRenderer.cpp
  59. src/PointShape.cpp
  60. )
  61. if(NOT BUILD_STATIC_RELEASE)
  62. INCLUDE_DIRECTORIES(
  63. ${${OPENSCENEGRAPH_PREFIX}_SOURCE_DIR}/include
  64. ${${OPENSCENEGRAPH_PREFIX}_BINARY_DIR}/include
  65. ${${LIB3MF_PREFIX}_BINARY_DIR}/Autogenerated/Bindings/Cpp
  66. )
  67. TARGET_LINK_LIBRARIES(TrackpointApp PRIVATE
  68. osg osgViewer osgDB osgGA osgText osgUtil
  69. lib3mf
  70. )
  71. ENDIF()
  72. if(BUILD_STATIC_RELEASE)
  73. INCLUDE_DIRECTORIES(
  74. ${OPENSCENEGRAPH_INCLUDE_DIRS}
  75. ${LIB3MF_INCLUDE_DIRS}
  76. )
  77. TARGET_LINK_LIBRARIES(TrackpointApp PRIVATE
  78. ${OPENSCENEGRAPH_LIBRARIES}
  79. ${LIB3MF_LIBRARIES}
  80. )
  81. ENDIF()
  82. INCLUDE_DIRECTORIES(
  83. ${${JSON_PREFIX}_SOURCE_DIR}/include
  84. include
  85. gui
  86. )
  87. TARGET_LINK_LIBRARIES(TrackpointApp PRIVATE
  88. nlohmann_json::nlohmann_json
  89. Qt6::Core
  90. Qt6::Gui
  91. Qt6::Widgets
  92. Qt6::OpenGLWidgets
  93. )
  94. # Header to have version number available in the code
  95. CONFIGURE_FILE(include/trackpointapp.hpp.in include/trackpointapp.hpp)