CMakeLists.txt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. project( ccViewer VERSION 1.38.0 )
  2. include( CMakePolicies NO_POLICY_SCOPE )
  3. include_directories( ${CloudComparePlugins_SOURCE_DIR} )
  4. include_directories( ${CMAKE_CURRENT_SOURCE_DIR} )
  5. include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../qCC )
  6. include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
  7. file( GLOB header_list *.h )
  8. file( GLOB source_list *.cpp )
  9. file( GLOB ui_list ui_templates/*.ui )
  10. file( GLOB qrc_list ../qCC/*.qrc )
  11. file( GLOB rc_list ../qCC/*.rc )
  12. qt5_wrap_ui( generated_ui_list ${ui_list} )
  13. qt5_add_resources( generated_qrc_list ${qrc_list} )
  14. if( MSVC )
  15. # App icon with MSVC
  16. set( rc_list images/icon/cc_viewer_icon.rc )
  17. #to get rid of the (system) console
  18. add_executable( ${PROJECT_NAME} WIN32 ${header_list} ${source_list} ${generated_ui_list} ${generated_qrc_list} ${rc_list} ${CMAKE_CURRENT_SOURCE_DIR}/../scripts/windows/qt5.natvis )
  19. elseif( APPLE )
  20. add_executable( ${PROJECT_NAME} MACOSX_BUNDLE ${header_list} ${source_list} ${generated_ui_list} ${generated_qrc_list} ${rc_list} )
  21. else()
  22. add_executable( ${PROJECT_NAME} ${header_list} ${source_list} ${generated_ui_list} ${generated_qrc_list} ${rc_list} )
  23. endif()
  24. if( CCCORELIB_USE_QT_CONCURRENT )
  25. # We want deployqt to handle this dependency, so instead of just copying the file
  26. # link to the target.
  27. target_link_libraries( ${PROJECT_NAME}
  28. Qt5::Concurrent
  29. )
  30. endif()
  31. if( WIN32 )
  32. DeployQt(
  33. TARGET
  34. ${PROJECT_NAME}
  35. DEPLOY_PATH
  36. ${CCVIEWER_DEST_FOLDER}
  37. )
  38. else()
  39. DeployQt(
  40. TARGET
  41. ${PROJECT_NAME}
  42. DEPLOY_PATH
  43. ${PROJECT_NAME}
  44. )
  45. endif()
  46. target_link_libraries( ${PROJECT_NAME}
  47. CCAppCommon
  48. )
  49. # Add custom preprocessor definitions
  50. target_compile_definitions( ${PROJECT_NAME} PUBLIC CC_VIEWER )
  51. if (WIN32)
  52. if (MSVC)
  53. set_target_properties( ${PROJECT_NAME} PROPERTIES LINK_FLAGS " /MANIFEST:NO" )
  54. endif()
  55. endif()
  56. # App icon with Code::Blocks/MinGW
  57. if( WIN32 )
  58. if( MINGW )
  59. add_custom_command( TARGET ${PROJECT_NAME} PRE_BUILD COMMAND ${CMAKE_RC_COMPILER} -i ${CMAKE_CURRENT_SOURCE_DIR}/images/icon/cc_viewer_icon.rc --input-format=rc -o ${CMAKE_CURRENT_BINARY_DIR}/ccViewer.res -O coff )
  60. endif()
  61. endif()
  62. if (NOT APPLE)
  63. # install program
  64. install_ext( TARGETS ccViewer ${CCVIEWER_DEST_FOLDER} "" )
  65. endif()
  66. # Auxiliary files
  67. set( auxFiles bin_other/license.txt )
  68. if( WIN32 )
  69. # Additional auxiliary file(s)
  70. list( APPEND auxFiles bin_other/start.bat )
  71. endif()
  72. # Install auxiliary files
  73. if(APPLE OR WIN32) # For Linux it's already installed in by qCC
  74. foreach( filename ${auxFiles} )
  75. install_ext( FILES ${filename} ${CCVIEWER_DEST_FOLDER} "" )
  76. endforeach()
  77. endif()
  78. # Put together our Application bundle on macOS
  79. if( APPLE )
  80. add_subdirectory( Mac )
  81. endif( APPLE )
  82. # Export common shader files to all install destinations
  83. if( WIN32 ) # For Linux it's already installed in by qCC
  84. install_ext( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../qCC/shaders/ColorRamp/color_ramp.frag ${CCVIEWER_DEST_FOLDER} /shaders/ColorRamp )
  85. endif()
  86. # Install plugins & shaders in the correct folder for each platform
  87. if( APPLE )
  88. InstallPlugins(
  89. TYPES "gl;io"
  90. DEST_PATH "${CCVIEWER_MAC_PLUGIN_DIR}"
  91. SHADER_DEST_PATH "${CCVIEWER_MAC_BASE_DIR}/Contents/Shaders"
  92. )
  93. elseif( UNIX )
  94. InstallPlugins(
  95. TYPES "gl;io"
  96. DEST_PATH "${CMAKE_INSTALL_LIBDIR}/cloudcompare/plugins"
  97. SHADER_DEST_PATH share/cloudcompare/shaders
  98. )
  99. else()
  100. InstallPlugins(
  101. TYPES "gl;io"
  102. DEST_PATH "${CCVIEWER_DEST_FOLDER}"
  103. DEST_FOLDER "plugins"
  104. SHADER_DEST_PATH "${CCVIEWER_DEST_FOLDER}"
  105. SHADER_DEST_FOLDER "shaders"
  106. )
  107. endif()
  108. # Add a 'fake' custom target to force the recompilation of ccApplication.ccp in order to
  109. # always get an up-to-date version number (based on the current date)
  110. add_custom_target(CC_VIEWER_UPDATE_VERSION ALL COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${CMAKE_CURRENT_SOURCE_DIR}/ccViewerApplication.cpp)