00-BuildOptions.cmake 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # -*- cmake -*-
  2. if (BUILDOPTIONS_CMAKE_INCLUDED)
  3. return()
  4. endif (BUILDOPTIONS_CMAKE_INCLUDED)
  5. set (BUILDOPTIONS_CMAKE_INCLUDED TRUE)
  6. include(Variables)
  7. ###############################################################################
  8. # Build options.
  9. ###############################################################################
  10. # If you want to enable or disable jemalloc viewer builds, this is the place.
  11. # Set ON or OFF as desired.
  12. # NOTE: jemalloc cannot currently replace macOS's neither Microsoft Visual C++
  13. # runtime malloc(), and Linux aarch64 kernels got various possible page sizes,
  14. # making it impossible to provide an universal pre-compiled library (see the
  15. # comment at the end of this file). This setting is therefore only relevant to
  16. # Linux x86_64 builds and will be automatically overridden to OFF for the rest.
  17. set(USE_JEMALLOC ON)
  18. # HIGHLY EXPERIMENTAL: If you want to enable or disable mimalloc overriding in
  19. # viewer builds, this is the place. Set ON or OFF as desired. NOTE: for Linux
  20. # builds, USE_JEMALLOC above takes precedence when set to ON.
  21. # BEWARE:
  22. # - In spite of the authors' claims about its supposed performances, mimalloc
  23. # causes a significant increase in memory usage by the viewer (up to +40% in
  24. # low memory usage conditions, such as in a skybox), while not bringing any
  25. # speed benefit when compared with jemalloc under Linux or the standard
  26. # Windows allocator (my tests so far show that mimalloc is in fact slightly
  27. # slower, by 1% or so on the measured frame rates).
  28. # - macOS builds using mimalloc are totally untested.
  29. set(USE_MIMALLOC OFF)
  30. # Change to ON to disable parallel-hashmap usage (a header-only rewrite of the
  31. # Abseil hash maps) and instead use the (slower) equivalent boost containers.
  32. # In the (unlikely) event you would get a weird crash where you would suspect
  33. # an issue with a phmap container, this is the thing to do.
  34. set(NO_PHMAP OFF)
  35. # Set to OFF if you do not want to build with FMOD support.
  36. set(BUILD_WITH_FMOD ON)
  37. # Change to ON to build with libcurl v7.64.1 (the last pipelining-compatible
  38. # version, once patched with a one-liner) and OpenSSL v1.1.1. Alas, this curl
  39. # version (and in fact all versions after v7.4x) got a buggy pipelining
  40. # implementation causing "rainbow textures" (especially seen in OpenSim grids,
  41. # but sometimes too in SL, depending on the configuration of the CDN server you
  42. # are hitting).
  43. # The good old libcurl v7.47.0 (sadly using the deprecated OpenSSL v1.0.2) is
  44. # still, for now, the only safe and reliable choice. :-(
  45. set(USE_NEW_LIBCURL OFF)
  46. # Change to ON to build against an older CEF version; relevant to Windows (to
  47. # restore the Win7/8.x compatibility of the CEF plugin) and macOS only.
  48. set(USE_OLD_CEF OFF)
  49. # Set to ON to replace fast timers with Tracy. This results in a slightly
  50. # slower (~1%) viewer. Use for development builds only. NOTE: this may be
  51. # enabled at configuration time instead by passing -DTRACY:BOOL=TRUE to cmake.
  52. set(USE_TRACY OFF)
  53. # Set to OFF to disable memory usage profiling when Tracy is enabled. Note that
  54. # only allocations done via the viewer custom allocators are actually logged
  55. # (which represents only part of the total used memory).
  56. set(TRACY_MEMORY ON)
  57. # Set to ON to keep fast timers along Tracy's when the latter is enabled; the
  58. # resulting binary is then slightly slower, of course.
  59. set(TRACY_WITH_FAST_TIMERS OFF)
  60. # Set to ON to enable Puppetry support (project withdrawn by LL).
  61. set(ENABLE_PUPPETRY OFF)
  62. # Set to OFF to do away with the netapi32 DLL (Netbios) dependency in Windows
  63. # builds; sadly, this causes the MAC address to change, invalidating all saved
  64. # login passwords...
  65. set(USE_NETBIOS ON)
  66. # Compilation/optimization options: uncomment to enable (may also be passed as
  67. # boolean defines to cmake: see Variables.cmake). Mainly relevant to Windows
  68. # and macOS builds (for Linux, simply use the corresponding options in the
  69. # linux-build.sh script, which will pass the appropriate boolean defines to
  70. # cmake).
  71. #set(USELTO ON)
  72. #set(USEAVX ON)
  73. #set(USEAVX2 ON)
  74. # Please note that the current OpenMP optimizations are totally experimental,
  75. # insufficiently tested, and may result in crashes !
  76. #set(OPENMP ON)
  77. # Set to use cmake v3.16.0+ UNITY_BUILD feature to speed-up the compilation
  78. # (experimental and resulting binaries are untested).
  79. #set(USEUNITYBUILD ON)
  80. ###############################################################################
  81. # SELECTION LOGIC: DO NOT EDIT UNLESS YOU KNOW EXACTLY WHAT YOU ARE DOING !
  82. ###############################################################################
  83. # Toggle for when -DTRACY=ON is passed to cmake.
  84. if (TRACY)
  85. set(USE_TRACY ON)
  86. endif (TRACY)
  87. # We only have Linux support for jemalloc...
  88. if (USE_JEMALLOC AND NOT LINUX)
  89. set(USE_JEMALLOC OFF)
  90. endif (USE_JEMALLOC AND NOT LINUX)
  91. if (LINUX AND ARCH STREQUAL "arm64")
  92. # Disable jemalloc usage for arm64, because we do not have a patched CEF
  93. # arm64 build that works with it instead of crashing (Spotify's builds
  94. # currently used are not patched and therefore not compatible with
  95. # jemalloc), and using jemalloc on aarch64 is only possible if the jemalloc
  96. # library is built and used on systems with the same page size configured
  97. # in the kernel. See: https://github.com/jemalloc/jemalloc/issues/467
  98. # As a result of the page size issue, I also simply stopped providing a
  99. # pre-built jemalloc library for aarch64... HB
  100. set(USE_JEMALLOC OFF)
  101. # The corresponding libraries have not yet been compiled for Linux ARM64
  102. set(USE_MIMALLOC OFF)
  103. set(USE_TRACY OFF)
  104. endif ()
  105. # jemalloc gets precedence over mimalloc under Linux.
  106. if (USE_JEMALLOC AND LINUX)
  107. set(USE_MIMALLOC OFF)
  108. endif (USE_JEMALLOC AND LINUX)
  109. # Select audio backend(s):
  110. if (BUILD_WITH_FMOD AND ARCH STREQUAL "arm64")
  111. # No FMOD Studio package available for arm64...
  112. set(BUILD_WITH_FMOD OFF)
  113. endif (BUILD_WITH_FMOD AND ARCH STREQUAL "arm64")
  114. if (BUILD_WITH_FMOD)
  115. set(FMOD ON)
  116. else (BUILD_WITH_FMOD)
  117. set(FMOD OFF)
  118. endif (BUILD_WITH_FMOD)
  119. # We now always build with OpenAL support (LL's viewer is removing FMOD in
  120. # favour of OpenAL).
  121. set(OPENAL ON)
  122. if (USE_OLD_CEF AND LINUX)
  123. # No older CEF available for Linux.
  124. set(USE_OLD_CEF OFF)
  125. endif ()
  126. # Last, let's deal with macOS limitations...
  127. if (DARWIN)
  128. # OpenMP support is missing from Apple's llvm/clang...
  129. set(OPENMP OFF)
  130. # For some reason, macOS does not find the bundled libopenal.dylib library:
  131. # perhaps we need to sign it change its 'rpath', or declare it in the
  132. # *.plist file ?... Dunno. Any help would be apprecaited here. In the mean
  133. # time, just disable OpenAL support for macOS... HB
  134. set(OPENAL OFF)
  135. endif (DARWIN)