CMakeLists.txt 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # -*- cmake -*-
  2. # cmake_minimum_required should appear before any other commands to guarantee
  3. # full compatibility with the version specified.
  4. if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  5. # For Darwin, cmake must be aware of the legacy build system that must be
  6. # specified when building with Xcode 10 or later... This only exists in
  7. # cmake v3.12.0 and newer.
  8. cmake_minimum_required(VERSION 3.12.0 FATAL_ERROR)
  9. cmake_policy(VERSION 3.12.0)
  10. else ()
  11. # Warning: with cmake_policy > 3.1, we cannot link any more with a *static*
  12. # jemalloc library under Linux without seeing the CEF plugin fail. This is
  13. # apparently due to how cmake passes the library pathes to the linker. HB
  14. cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
  15. cmake_policy(VERSION 3.5)
  16. endif ()
  17. set(ROOT_PROJECT_NAME "CoolVLViewer" CACHE STRING
  18. "The root project/makefile/solution name. Defaults to CoolVLViewer.")
  19. project(${ROOT_PROJECT_NAME})
  20. set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
  21. include(Variables)
  22. if (USELTO AND ${CMAKE_VERSION} VERSION_GREATER 3.8.9)
  23. cmake_policy(SET CMP0069 NEW)
  24. endif (USELTO AND ${CMAKE_VERSION} VERSION_GREATER 3.8.9)
  25. # Load versions now. Install locations need them.
  26. include(Versions)
  27. if (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
  28. set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
  29. "Build type. One of: Debug Release RelWithDebInfo" FORCE)
  30. endif (NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
  31. # Create a 'prepare' target in which to perform setup actions. This must be the
  32. # first target created so other targets can depend on it.
  33. set(prepare_depends ${CMAKE_BINARY_DIR}/prepare/prebuilt)
  34. add_custom_target(prepare DEPENDS ${prepare_depends})
  35. add_subdirectory(cmake)
  36. add_subdirectory(libopenjpeg)
  37. add_subdirectory(llappearance)
  38. add_subdirectory(llaudio)
  39. add_subdirectory(llcharacter)
  40. add_subdirectory(llcommon)
  41. add_subdirectory(llfilesystem)
  42. add_subdirectory(llgltf)
  43. add_subdirectory(llimage)
  44. add_subdirectory(llinventory)
  45. add_subdirectory(llmath)
  46. add_subdirectory(llmessage)
  47. add_subdirectory(llplugin)
  48. add_subdirectory(llprimitive)
  49. add_subdirectory(llrender)
  50. add_subdirectory(llui)
  51. add_subdirectory(llwindow)
  52. add_subdirectory(llxml)
  53. add_custom_target(viewer)
  54. # Viewer media plugins
  55. add_subdirectory(media_plugins)
  56. add_subdirectory(newview)
  57. add_dependencies(viewer CoolVLViewer)
  58. # Configure prebuilt binary download. This must be done last so that all
  59. # subdirectories have a chance to list the packages they need.
  60. # The use_prebuilt_binary macro in cmake/Prebuilt.cmake records packages in
  61. # the PREBUILT property of the 'prepare' target.
  62. get_property(PREBUILT_PACKAGES TARGET prepare PROPERTY PREBUILT)
  63. # Create a script to download the needed binaries.
  64. configure_file(${CMAKE_SOURCE_DIR}/cmake/DownloadPrebuilt.cmake.in
  65. ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake @ONLY)
  66. # Drive the download script at build time. Depend on 'install.xml' to acquire
  67. # new binaries when needed.
  68. add_custom_command(
  69. COMMENT "Obtaining prebuilt binaries..."
  70. OUTPUT ${CMAKE_BINARY_DIR}/prepare/prebuilt
  71. COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
  72. DEPENDS ${CMAKE_SOURCE_DIR}/../install.xml
  73. ${CMAKE_BINARY_DIR}/DownloadPrebuilt.cmake
  74. )