CMakeLists.txt 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 14)
  8. SET(CMAKE_CXX_STANDARD_REQUIRED True)
  9. SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wunreachable-code -Wno-register")
  10. SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wno-register")
  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/EMFTrackPoint.cpp
  57. src/ActionPoint.cpp
  58. src/SteamVRTrackPoint.cpp
  59. src/OpenScadRenderer.cpp
  60. src/StringBasics.cpp
  61. src/TrackPointRenderer.cpp
  62. src/PointShape.cpp
  63. src/HudCallback.cpp
  64. src/STLImport.cpp
  65. src/MeshTools.cpp
  66. )
  67. if(NOT BUILD_STATIC_RELEASE)
  68. INCLUDE_DIRECTORIES(
  69. ${${OPENSCENEGRAPH_PREFIX}_SOURCE_DIR}/include
  70. ${${OPENSCENEGRAPH_PREFIX}_BINARY_DIR}/include
  71. ${${LIB3MF_PREFIX}_BINARY_DIR}/Autogenerated/Bindings/Cpp
  72. )
  73. TARGET_LINK_LIBRARIES(TrackpointApp PRIVATE
  74. osg osgViewer osgDB osgGA osgText osgUtil
  75. lib3mf
  76. )
  77. ENDIF()
  78. if(BUILD_STATIC_RELEASE)
  79. INCLUDE_DIRECTORIES(
  80. ${OPENSCENEGRAPH_INCLUDE_DIRS}
  81. ${LIB3MF_INCLUDE_DIRS}
  82. )
  83. TARGET_LINK_LIBRARIES(TrackpointApp PRIVATE
  84. ${OPENSCENEGRAPH_LIBRARIES}
  85. ${LIB3MF_LIBRARIES}
  86. )
  87. ENDIF()
  88. INCLUDE_DIRECTORIES(
  89. ${${JSON_PREFIX}_SOURCE_DIR}/include
  90. ${CMAKE_CURRENT_LIST_DIR}/thirdparty/stl_reader/install
  91. include
  92. gui
  93. resources
  94. )
  95. TARGET_LINK_LIBRARIES(TrackpointApp PRIVATE
  96. nlohmann_json::nlohmann_json
  97. Qt6::Core
  98. Qt6::Gui
  99. Qt6::Widgets
  100. Qt6::OpenGLWidgets
  101. )
  102. # Header to have version number available in the code
  103. CONFIGURE_FILE(include/trackpointapp.hpp.in include/trackpointapp.hpp)