2
0

Config.cmake 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. # PRC Config settings
  2. set(PRC_DEFAULT_DIR_ABSOLUTE "" CACHE STRING
  3. "Specify the PRC_DEFAULT_DIR as an absolute path.")
  4. if(NOT PRC_DEFAULT_DIR_ABSOLUTE)
  5. set(PRC_DEFAULT_DIR "etc" CACHE STRING
  6. "Panda uses prc files for runtime configuration. Panda will search the
  7. default .prc directory if the PRC_PATH and PRC_DIR environment variables
  8. are not defined.")
  9. else()
  10. set(PRC_DEFAULT_DIR "" CACHE STRING
  11. "Panda uses prc files for runtime configuration. Panda will search the
  12. default .prc directory if the PRC_PATH and PRC_DIR environment variables
  13. are not defined.")
  14. endif()
  15. if(PRC_DEFAULT_DIR AND PRC_DEFAULT_DIR_ABSOLUTE)
  16. message("Using PRC_DEFAULT_DIR_ABSOLUTE instead of PRC_DEFAULT_DIR.")
  17. endif()
  18. set(PRC_DIR_ENVVARS "PANDA_PRC_DIR" CACHE STRING "")
  19. set(PRC_PATH_ENVVARS "PANDA_PRC_PATH" CACHE STRING "")
  20. set(PRC_PATH2_ENVVARS "" CACHE STRING "")
  21. set(PRC_PATTERNS "*.prc" CACHE STRING "")
  22. set(PRC_ENCRYPTED_PATTERNS "*.prc.pe" CACHE STRING "")
  23. set(PRC_ENCRYPTION_KEY "" CACHE STRING "")
  24. set(PRC_EXECUTABLE_PATTERNS "" CACHE STRING "")
  25. set(PRC_EXECUTABLE_ARGS_ENVVAR "PANDA_PRC_XARGS" CACHE STRING "")
  26. set(PRC_PUBLIC_KEYS_FILENAME "" CACHE STRING "")
  27. set(PRC_RESPECT_TRUST_LEVEL CACHE STRING "")
  28. set(PRC_DCONFIG_TRUST_LEVEL 0 CACHE STRING
  29. "The trust level value for any legacy (DConfig) variables.")
  30. set(PRC_INC_TRUST_LEVEL 0 CACHE STRING
  31. "The amount by which we globally increment the trust level.")
  32. mark_as_advanced(PRC_DEFAULT_DIR PRC_DEFAULT_DIR_ABSOLUTE PRC_DIR_ENVVARS
  33. PRC_PATH_ENVVARS PRC_PATH2_ENVVARS PRC_PATTERNS PRC_ENCRYPTED_PATTERNS
  34. PRC_ENCRYPTION_KEY PRC_EXECUTABLE_PATTERNS PRC_EXECUTABLE_ARGS_ENVVAR
  35. PRC_PUBLIC_KEYS_FILENAME PRC_RESPECT_TRUST_LEVEL
  36. PRC_DCONFIG_TRUST_LEVEL PRC_INC_TRUST_LEVEL)
  37. # PRC special values for config headers
  38. if(PRC_DEFAULT_DIR_ABSOLUTE)
  39. set(DEFAULT_PRC_DIR ${PRC_ABSOLUTE_DIR})
  40. else()
  41. set(DEFAULT_PRC_DIR "${CMAKE_INSTALL_PREFIX}/panda/${PRC_DEFAULT_DIR}")
  42. endif()
  43. ### Configure interrogate ###
  44. message(STATUS "") # simple line break
  45. if(HAVE_PYTHON AND HAVE_OPENSSL)
  46. option(USE_INTERROGATE "If on, Panda3D will generate python interfaces" ON)
  47. if(USE_INTERROGATE)
  48. set(HAVE_INTERROGATE TRUE)
  49. endif()
  50. else()
  51. unset(USE_INTERROGATE CACHE)
  52. endif()
  53. if(HAVE_INTERROGATE)
  54. message(STATUS "Compilation will generate Python interfaces.")
  55. else()
  56. message(STATUS "Configuring Panda without Python interfaces.")
  57. endif()
  58. ### Configure threading support ###
  59. find_package(Threads)
  60. if(THREADS_FOUND)
  61. # Add basic use flag for threading
  62. option(BUILD_THREADS
  63. "If on, compile Panda3D with threading support.
  64. Building in support for threading will enable Panda to take
  65. advantage of multiple CPU's if you have them (and if the OS
  66. supports kernel threads running on different CPU's), but it will
  67. slightly slow down Panda for the single CPU case." ON)
  68. if(BUILD_THREADS)
  69. set(HAVE_THREADS TRUE)
  70. else()
  71. unset(BUILD_SIMPLE_THREADS CACHE)
  72. unset(BUILD_OS_SIMPLE_THREADS CACHE)
  73. endif()
  74. else()
  75. unset(BUILD_THREADS CACHE)
  76. endif()
  77. # Configure debug threads
  78. # Add advanced threading configuration
  79. if(HAVE_THREADS)
  80. if(CMAKE_BUILD_TYPE MATCHES "Debug")
  81. option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" ON)
  82. else()
  83. option(BUILD_DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" OFF)
  84. endif()
  85. if(BUILD_DEBUG_THREADS)
  86. set(DEBUG_THREADS TRUE)
  87. endif()
  88. set(HAVE_POSIX_THREADS ${CMAKE_USE_PTHREADS_INIT})
  89. if(HAVE_POSIX_THREADS)
  90. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
  91. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pthread")
  92. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pthread")
  93. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -pthread")
  94. set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -pthread")
  95. endif()
  96. option(BUILD_SIMPLE_THREADS
  97. "If on, compile with simulated threads. Threads, by default, use
  98. OS-provided threading constructs, which usually allows for full
  99. multithreading support (i.e. the program can use multiple CPU's).
  100. On the other hand, compiling in this full OS-provided support can
  101. impose some substantial runtime overhead, making the application
  102. run slower on a single-CPU machine. This settings avoid the overhead,
  103. but still gain some of the basic functionality of threads." OFF)
  104. if(BUILD_SIMPLE_THREADS)
  105. message(STATUS "Compilation will include simulated threading support.")
  106. option(BUILD_OS_SIMPLE_THREADS
  107. "If on, OS threading constructs will be used to perform context switches.
  108. A mutex is used to ensure that only one thread runs at a time, so the
  109. normal SIMPLE_THREADS optimizations still apply, and the normal
  110. SIMPLE_THREADS scheduler is used to switch between threads (instead
  111. of the OS scheduler). This may be more portable and more reliable,
  112. but it is a hybrid between user-space threads and os-provided threads." ON)
  113. set(SIMPLE_THREADS TRUE)
  114. if(BUILD_OS_SIMPLE_THREADS)
  115. set(OS_SIMPLE_THREADS TRUE)
  116. endif()
  117. else()
  118. unset(BUILD_OS_SIMPLE_THREADS CACHE)
  119. option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON)
  120. if(BUILD_PIPELINING)
  121. message(STATUS "Compilation will include full, pipelined threading support.")
  122. else()
  123. message(STATUS "Compilation will include nonpipelined threading support.")
  124. endif()
  125. endif()
  126. else()
  127. message(STATUS "Configuring Panda without threading support.")
  128. endif()
  129. ### Configure pipelining ###
  130. if(NOT DEFINED BUILD_PIPELINING)
  131. option(BUILD_PIPELINING "If on, compile with pipelined rendering." ON)
  132. endif()
  133. if(BUILD_PIPELINING)
  134. set(DO_PIPELINING TRUE)
  135. endif()
  136. ### Configure OS X options ###
  137. if(APPLE)
  138. option(BUILD_UNIVERSIAL_BINARIES "If on, compiling will create universal OS X binaries." ON)
  139. if(BUILD_UNIVERSAL_BINARIES)
  140. message(STATUS "Compilation will create universal binaries.")
  141. set(UNIVERSAL_BINARIES TRUE)
  142. else()
  143. message(STATUS "Compilation will not create universal binaries.")
  144. endif()
  145. endif()
  146. message(STATUS "")
  147. message(STATUS "See dtool_config.h for more details about the specified configuration.\n")
  148. ### Miscellaneous configuration
  149. if(CMAKE_BUILD_TYPE MATCHES "MinSizeRel")
  150. unset(BUILD_WITH_DEFAULT_FONT CACHE)
  151. option(BUILD_WITH_DEFAULT_FONT
  152. "If on, compiles in a default font, so that every TextNode will always
  153. have a font available without requiring the user to specify one.
  154. When turned off, the generated library will save a few kilobytes." OFF)
  155. else()
  156. option(BUILD_WITH_DEFAULT_FONT
  157. "If on, compiles in a default font, so that every TextNode will always
  158. have a font available without requiring the user to specify one.
  159. When turned off, the generated library will save a few kilobytes." ON)
  160. endif()
  161. if(BUILD_WITH_DEFAULT_FONT)
  162. set(COMPILE_IN_DEFAULT_FONT TRUE)
  163. endif()
  164. option(BUILD_PREFER_STDFLOAT
  165. "Define this true to compile a special version of Panda to use a
  166. 'double' floating-precision type for most internal values, such as
  167. positions and transforms, instead of the standard single-precision
  168. 'float' type. This does not affect the default numeric type of
  169. vertices, which is controlled by the runtime config variable
  170. vertices-float64." OFF)
  171. if(BUILD_PREFER_STDFLOAT)
  172. set(STDFLOAT_DOUBLE TRUE)
  173. endif()
  174. #XXX note from rdb: I've moved the automatically-configured
  175. # compiler settings to LocalSetup.cmake, which is also where
  176. # dtool_config.h.cmake is now being invoked.
  177. # LocalSetup.cmake is included in dtool/CMakeLists.txt, which
  178. # is OK since the variables in there don't have to be used
  179. # outside of dtool_config.h.cmake.
  180. if(WIN32)
  181. set(DEFAULT_PATHSEP ";")
  182. else()
  183. set(DEFAULT_PATHSEP ":")
  184. endif()