2
0

Config.cmake 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. #
  2. # dtool/Config.cmake
  3. #
  4. # This file defines certain configuration variables that are written
  5. # into the various make scripts. It is processed by CMake to
  6. # generate build scripts appropriate to each environment.
  7. #
  8. include(CMakeDependentOption)
  9. # Define our target platform.
  10. # The values "UNIX", "WIN32", "MINGW", "MSYS", and "CYGWIN"
  11. # are automatically provided by CMAKE. "APPLE" is also provided by
  12. # CMAKE but may be True on systems that are not OS X.
  13. if(CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android")
  14. set(IS_LINUX 1)
  15. endif()
  16. if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
  17. set(IS_OSX 1)
  18. endif()
  19. if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
  20. set(IS_FREEBSD 1)
  21. endif()
  22. # Define the type of build we are setting up.
  23. set(_configs Standard Release RelWithDebInfo Debug MinSizeRel)
  24. if(DEFINED CMAKE_CXX_FLAGS_COVERAGE)
  25. list(APPEND _configs Coverage)
  26. endif()
  27. # Are we building with static or dynamic linking?
  28. if(EMSCRIPTEN OR WASI)
  29. set(_default_shared OFF)
  30. else()
  31. set(_default_shared ON)
  32. endif()
  33. option(BUILD_SHARED_LIBS
  34. "Causes subpackages to be built separately -- setup for dynamic linking.
  35. Utilities/tools/binaries/etc are then dynamically linked to the
  36. libraries instead of being statically linked." ${_default_shared})
  37. option(BUILD_METALIBS
  38. "Should we build 'metalibs' -- fewer, larger libraries that contain the bulk
  39. of the code instead of many smaller components. Note that turning this off
  40. will still result in the 'metalibs' being built, but they will instead be many
  41. smaller stub libraries and not 'meta' libraries." ON)
  42. # The character used to separate components of an OS-specific
  43. # directory name depends on the platform (it is '/' on Unix, '\' on
  44. # Windows). That character selection is hardcoded into Panda and
  45. # cannot be changed here. (Note that an internal Panda filename
  46. # always uses the forward slash, '/', to separate the components of a
  47. # directory name.)
  48. # There's a different character used to separate the complete
  49. # directory names in a search path specification. On Unix, the
  50. # normal convention is ':', on Windows, it has to be ';', because the
  51. # colon is already used to mark the drive letter. This character is
  52. # selectable here. Most users won't want to change this. If
  53. # multiple characters are placed in this string, any one of them may
  54. # be used as a separator character.
  55. if(WIN32)
  56. set(DEFAULT_PATHSEP ";")
  57. else()
  58. set(DEFAULT_PATHSEP ":")
  59. endif()
  60. # Panda uses prc files for runtime configuration. There are many
  61. # compiled-in options to customize the behavior of the prc config
  62. # system; most users won't need to change any of them. Feel free to
  63. # skip over all of the PRC_* variables defined here.
  64. # The default behavior is to search for files names *.prc in the
  65. # directory specified by the PRC_DIR environment variable, and then
  66. # to search along all of the directories named by the PRC_PATH
  67. # environment variable. Either of these variables might be
  68. # undefined; if both of them are undefined, the default is to search
  69. # in the directory named here by DEFAULT_PRC_DIR.
  70. # By default, we specify the <auto>/etc dir, which is a special
  71. # syntax that causes it to automatically search up the directory
  72. # tree starting at the location of libpandaexpress.dll for any
  73. # directories called 'etc'.
  74. if(UNIX)
  75. set(_default_prc "<auto>etc/panda3d")
  76. else()
  77. set(_default_prc "<auto>etc")
  78. endif()
  79. set(DEFAULT_PRC_DIR "${_default_prc}" CACHE STRING
  80. "The compiled-in default directory to look for the Config.prc file,
  81. in the absence of the PRC_DIR environment variable set, and in
  82. the absence of anything specified via the configpath directive.")
  83. # You can specify the names of the environment variables that are
  84. # used to specify the search location(s) for prc files at runtime.
  85. # These are space-separated lists of environment variable names.
  86. # Specify empty string for either one of these to disable the
  87. # feature. For instance, redefining PRC_DIR_ENVVARS here to
  88. # PRC_DIR would cause the environment variable $PRC_DIR
  89. # to be consulted at startup instead of the default value of
  90. # $PANDA_PRC_DIR.
  91. set(PRC_DIR_ENVVARS "PANDA_PRC_DIR" CACHE STRING
  92. "The compiled-in name of the environment variable(s) that contain
  93. the name of a single directory in which to search for prc files.")
  94. set(PRC_PATH_ENVVARS "PANDA_PRC_PATH" CACHE STRING
  95. "The compiled-in name of the environment variable(s) that contain
  96. the name of multiple directories, separated by DEFAULT_PATHSEP, in
  97. which to search for prc files.")
  98. # You can specify the name of the file(s) to search for in the above
  99. # paths to be considered a config file. This should be a
  100. # space-separated list of filename patterns. This is *.prc by
  101. # default; normally there's no reason to change this.
  102. set(PRC_PATTERNS "*.prc" CACHE STRING
  103. "The filename(s) to search for in the above paths. Normally this is
  104. *.prc.")
  105. # You can optionally encrypt your prc file(s) to help protect them
  106. # from curious eyes. You have to specify the encryption key, which
  107. # gets hard-coded into the executable. (This feature provides mere
  108. # obfuscation, not real security, since the encryption key can
  109. # potentially be extracted by a hacker.) This requires building with
  110. # OpenSSL.
  111. set(PRC_ENCRYPTED_PATTERNS "*.prc.pe" CACHE STRING
  112. "The filename(s) for encrypted prc files.")
  113. set(PRC_ENCRYPTION_KEY "" CACHE STRING
  114. "The encryption key used to decrypt any encrypted prc files
  115. identified by PRC_ENCRYPTED_PATTERNS.")
  116. # One unusual feature of config is the ability to execute one or more
  117. # of the files it discovers as if it were a program, and then treat
  118. # the output of this program as a prc file. If you want to use this
  119. # feature, define this variable to the filename pattern or patterns
  120. # for such executable-style config programs (e.g. *prc.exe). This
  121. # can be the same as the above if you like this sort of ambiguity; in
  122. # that case, config will execute the file if it appears to be
  123. # executable; otherwise, it will simply read it.
  124. set(PRC_EXECUTABLE_PATTERNS "" CACHE STRING
  125. "The filename(s) to search for, and execute, in the above paths.
  126. Normally this is empty.")
  127. # If you do use the above feature, you'll need another environment
  128. # variable that specifies additional arguments to pass to the
  129. # executable programs. The default definition, given here, makes
  130. # that variable be $PANDA_PRC_XARGS. Sorry, the same arguments
  131. # must be supplied to all executables in a given runtime session.
  132. set(PRC_EXECUTABLE_ARGS_ENVVAR "PANDA_PRC_XARGS" CACHE STRING
  133. "The environment variable that defines optional args to pass to
  134. executables found that match one of the above patterns.")
  135. # You can implement signed prc files, if you require this advanced
  136. # feature. This allows certain config variables to be set only by a
  137. # prc file that has been provided by a trusted source. To do this,
  138. # first install and compile Dtool with OpenSSL and run the program
  139. # make-prc-key, and then specify here the output filename generated
  140. # by that program, and then recompile Dtool.
  141. set(PRC_PUBLIC_KEYS_FILENAME "" CACHE STRING "")
  142. # By default, the signed-prc feature, above, is enabled only for a
  143. # release build. In a normal development environment, any prc file
  144. # can set any config variable, whether or not it is signed. Set
  145. # this variable true or false to explicitly enable or disable this
  146. # feature.
  147. #XXX For which build types should this be enabled?
  148. if(CMAKE_BUILD_TYPE STREQUAL "Release")
  149. set(DEFAULT_PRC_RESPECT_TRUST_LEVEL ON)
  150. else()
  151. set(DEFAULT_PRC_RESPECT_TRUST_LEVEL OFF)
  152. endif()
  153. option(PRC_RESPECT_TRUST_LEVEL
  154. "Define if we want to enable the trust_level feature of prc config
  155. variables. This requires OpenSSL and PRC_PUBLIC_KEYS_FILENAME,
  156. above." ${DEFAULT_PRC_RESPECT_TRUST_LEVEL})
  157. # If trust level is in effect, this specifies the default trust level
  158. # for any legacy (Dconfig) config variables (that is, variables
  159. # created using the config.GetBool(), etc. interface, rather than the
  160. # newer ConfigVariableBool interface).
  161. set(PRC_DCONFIG_TRUST_LEVEL "0" CACHE STRING
  162. "The trust level value for any legacy (DConfig) variables.")
  163. # If trust level is in effect, you may globally increment the
  164. # (mis)trust level of all variables by the specified amount.
  165. # Incrementing this value by 1 will cause all variables to require at
  166. # least a level 1 signature.
  167. set(PRC_INC_TRUST_LEVEL "0" CACHE STRING
  168. "The amount by which we globally increment the trust level.")
  169. # Similarly, the descriptions are normally saved only in a
  170. # development build, not in a release build. Set this value true to
  171. # explicitly save them anyway.
  172. per_config_option(PRC_SAVE_DESCRIPTIONS
  173. "Define if you want to save the descriptions for ConfigVariables."
  174. Debug Standard)
  175. mark_as_advanced(DEFAULT_PRC_DIR PRC_DIR_ENVVARS PRC_PATH_ENVVARS
  176. PRC_PATTERNS PRC_ENCRYPTED_PATTERNS PRC_ENCRYPTION_KEY
  177. PRC_EXECUTABLE_PATTERNS PRC_EXECUTABLE_ARGS_ENVVAR
  178. PRC_PUBLIC_KEYS_FILENAME PRC_RESPECT_TRUST_LEVEL
  179. PRC_DCONFIG_TRUST_LEVEL PRC_INC_TRUST_LEVEL PRC_SAVE_DESCRIPTIONS)
  180. #
  181. # This is the end of the PRC variable customization section. The
  182. # remaining variables are of general interest to everyone.
  183. #
  184. # The following options relate to interrogate, the tool that is
  185. # used to generate bindings for non-C++ languages.
  186. cmake_dependent_option(INTERROGATE_PYTHON_INTERFACE
  187. "Do you want to generate a Python-callable interrogate interface?
  188. This is only necessary if you plan to make calls into Panda from a
  189. program written in Python. This is done only if HAVE_PYTHON is also
  190. true." ON "HAVE_PYTHON" OFF)
  191. set(INTERROGATE_C_INTERFACE
  192. "Do you want to generate a C-callable interrogate interface? This
  193. generates an interface similar to the Python interface above, with
  194. a C calling convention. It should be useful for most other kinds
  195. of scripting language; the VR Studio used to use this to make calls
  196. into Panda from Squeak." OFF)
  197. set(INTERROGATE_OPTIONS "-fnames;-string;-refcount;-assert" CACHE STRING
  198. "What additional options should be passed to interrogate when
  199. generating either of the above two interfaces? Generally, you
  200. probably don't want to mess with this.")
  201. option(INTERROGATE_VERBOSE
  202. "Set this if you would like interrogate to generate advanced
  203. debugging information." OFF)
  204. set(_default_build_interrogate OFF)
  205. if (INTERROGATE_C_INTERFACE OR INTERROGATE_PYTHON_INTERFACE)
  206. set(_default_build_interrogate ON)
  207. endif()
  208. option(BUILD_INTERROGATE
  209. "Do you want to build interrogate from source? This is necessary
  210. if you wish to build Python or other bindings around Panda3D's C++
  211. interface. Set this to false if you already have a compatible
  212. version of interrogate installed." ${_default_build_interrogate})
  213. mark_as_advanced(INTERROGATE_OPTIONS)
  214. if(BUILD_INTERROGATE)
  215. include(ExternalProject)
  216. set(_interrogate_dir "${PROJECT_BINARY_DIR}/interrogate")
  217. ExternalProject_Add(
  218. panda3d-interrogate
  219. GIT_REPOSITORY https://github.com/panda3d/interrogate.git
  220. GIT_TAG ccbd5f9d79037a9d53d6dfb1a5e9fdf30f2510c1
  221. PREFIX ${_interrogate_dir}
  222. CMAKE_ARGS
  223. -DHAVE_PYTHON=OFF
  224. -DBUILD_SHARED_LIBS=OFF
  225. -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
  226. EXCLUDE_FROM_ALL ON
  227. BUILD_BYPRODUCTS "${_interrogate_dir}/bin/interrogate"
  228. "${_interrogate_dir}/bin/interrogate_module"
  229. )
  230. add_executable(interrogate IMPORTED GLOBAL)
  231. add_dependencies(interrogate panda3d-interrogate)
  232. set_target_properties(interrogate PROPERTIES IMPORTED_LOCATION "${_interrogate_dir}/bin/interrogate")
  233. add_executable(interrogate_module IMPORTED GLOBAL)
  234. add_dependencies(interrogate_module panda3d-interrogate)
  235. set_target_properties(interrogate_module PROPERTIES IMPORTED_LOCATION "${_interrogate_dir}/bin/interrogate_module")
  236. else()
  237. find_program(INTERROGATE_EXECUTABLE interrogate)
  238. find_program(INTERROGATE_MODULE_EXECUTABLE interrogate_module)
  239. add_executable(interrogate IMPORTED GLOBAL)
  240. if(INTERROGATE_EXECUTABLE)
  241. set_target_properties(interrogate PROPERTIES
  242. IMPORTED_LOCATION "${INTERROGATE_EXECUTABLE}")
  243. elseif(INTERROGATE_PYTHON_INTERFACE OR INTERROGATE_C_INTERFACE)
  244. message(FATAL_ERROR
  245. "Requested interrogate bindings, but interrogate not found. Set "
  246. "BUILD_INTERROGATE to build interrogate from source, or set "
  247. "INTERROGATE_EXECUTABLE to the location of this tool.")
  248. endif()
  249. add_executable(interrogate_module IMPORTED GLOBAL)
  250. if(INTERROGATE_MODULE_EXECUTABLE)
  251. set_target_properties(interrogate_module PROPERTIES
  252. IMPORTED_LOCATION "${INTERROGATE_MODULE_EXECUTABLE}")
  253. elseif(INTERROGATE_PYTHON_INTERFACE)
  254. message(FATAL_ERROR
  255. "Requested interrogate bindings, but interrogate not found. Set "
  256. "BUILD_INTERROGATE to build interrogate from source, or set "
  257. "INTERROGATE_MODULE_EXECUTABLE to the location of this tool.")
  258. endif()
  259. endif()
  260. #
  261. # The following options have to do with optional debugging features.
  262. #
  263. per_config_option(DO_MEMORY_USAGE
  264. "Do you want to compile in support for tracking memory usage? This
  265. enables you to define the variable 'track-memory-usage' at runtime
  266. to help track memory leaks, and also report total memory usage on
  267. PStats. There is some small overhead for having this ability
  268. available, even if it is unused." Debug Standard)
  269. per_config_option(DO_COLLISION_RECORDING
  270. "Do you want to enable debugging features for the collision system?"
  271. Debug Standard)
  272. per_config_option(DO_PSTATS
  273. "Enable support for performance profiling using PStats?"
  274. Debug Standard)
  275. per_config_option(DO_DCAST
  276. "Add safe typecast checking? This adds significant overhead."
  277. Debug Standard)
  278. per_config_option(SIMULATE_NETWORK_DELAY
  279. "This option compiles in support for simulating network delay via
  280. the min-lag and max-lag prc variables. It adds a tiny bit of
  281. overhead even when it is not activated, so it is typically enabled
  282. only in a development build."
  283. Debug)
  284. per_config_option(NOTIFY_DEBUG
  285. "Do you want to include the 'debug' and 'spam' Notify messages?
  286. Normally, these are stripped out when we build for release, but sometimes it's
  287. useful to keep them around. Turn this setting on to achieve that."
  288. Debug Standard)
  289. mark_as_advanced(SIMULATE_NETWORK_DELAY DO_MEMORY_USAGE DO_DCAST)
  290. #
  291. # The following options have to do with the memory allocation system.
  292. #
  293. find_package(MIMALLOC 1.0 QUIET)
  294. package_option(MIMALLOC
  295. "The mimalloc allocator. See also USE_MEMORY_MIMALLOC, which
  296. you will need to use to activate it by default. If you do not set
  297. USE_MEMORY_MIMALLOC, Panda will decide whether to use it."
  298. IMPORTED_AS mimalloc-static)
  299. if (WIN32 AND HAVE_MIMALLOC)
  300. set(_prefer_mimalloc ON)
  301. else()
  302. set(_prefer_mimalloc OFF)
  303. endif()
  304. option(USE_MEMORY_MIMALLOC
  305. "This is an optional memory allocator with good multi-threading
  306. support. It is recommended on Windows, where it gives much better
  307. performance than the built-in malloc. However, it does not appear
  308. to be significantly faster on glibc-based systems." ${_prefer_mimalloc})
  309. option(USE_MEMORY_DLMALLOC
  310. "This is an optional alternative memory-allocation scheme
  311. available within Panda. You can experiment with it to see
  312. if it gives better performance than the system malloc(), but
  313. at the time of this writing, it doesn't appear that it does." OFF)
  314. option(USE_MEMORY_PTMALLOC2
  315. "This is an optional alternative memory-allocation scheme
  316. available within Panda. You can experiment with it to see
  317. if it gives better performance than the system malloc(), but
  318. at the time of this writing, it doesn't appear that it does." OFF)
  319. option(MEMORY_HOOK_DO_ALIGN
  320. "Set this true if you prefer to use the system malloc library even
  321. if 16-byte alignment must be performed on top of it, wasting up to
  322. 30% of memory usage. If you do not set this, and 16-byte alignment
  323. is required and not provided by the system malloc library, then an
  324. alternative malloc system (above) will be used instead." OFF)
  325. if (WIN32 AND NOT HAVE_MIMALLOC)
  326. option(USE_DELETED_CHAIN
  327. "Define this true to use the DELETED_CHAIN macros, which support
  328. fast re-use of existing allocated blocks, minimizing the low-level
  329. calls to malloc() and free() for frequently-created and -deleted
  330. objects. This is significantly better than built-in malloc on Windows
  331. but suffers with multiple threads, where mimalloc performs better, so
  332. it is preferred to get mimalloc instead and turn this OFF." ON)
  333. else()
  334. option(USE_DELETED_CHAIN
  335. "Define this true to use the DELETED_CHAIN macros, which support
  336. fast re-use of existing allocated blocks, minimizing the low-level
  337. calls to malloc() and free() for frequently-created and -deleted
  338. objects. However, modern memory allocators generally perform as good,
  339. especially with threading, so best leave this OFF." OFF)
  340. endif()
  341. mark_as_advanced(USE_MEMORY_DLMALLOC USE_MEMORY_PTMALLOC2
  342. USE_MEMORY_MIMALLOC MEMORY_HOOK_DO_ALIGN USE_DELETED_CHAIN)
  343. if(USE_MEMORY_MIMALLOC)
  344. package_status(MIMALLOC "mimalloc memory allocator")
  345. else()
  346. package_status(MIMALLOC "mimalloc memory allocator (not used)")
  347. endif()
  348. unset(_prefer_mimalloc)
  349. #
  350. # This section relates to mobile-device/phone support and options
  351. #
  352. # iPhone support
  353. set(BUILD_IPHONE "" CACHE STRING
  354. "Panda contains some experimental code to compile for IPhone. This
  355. requires the Apple IPhone SDK, which is currently only available
  356. for OS X platforms. Set this to either 'iPhoneSimulator' or
  357. 'iPhoneOS'. Note that this is still *experimental* and incomplete!
  358. Don't enable this unless you know what you're doing!")
  359. set_property(CACHE BUILD_IPHONE PROPERTY STRINGS "" iPhoneSimulator iPhoneOS)
  360. # Android support
  361. option(BUILD_ANDROID
  362. "Panda contains some experimental code to compile for Android.
  363. This requires the Google Android NDK. Besides BUILD_ANDROID, you'll
  364. also have to set ANDROID_NDK_HOME." OFF)
  365. set(ANDROID_NDK_HOME "" CACHE STRING
  366. "The location of the Android NDK directory. ANDROID_NDK_HOME may
  367. not contain any spaces.")
  368. set(ANDROID_ABI "armeabi-v7a" CACHE STRING
  369. "Can be be set to armeabi-v7a, arm64-v8a, x86, or x86_64,
  370. depending on which architecture should be targeted.")
  371. set_property(CACHE ANDROID_ABI PROPERTY STRINGS
  372. armeabi-v7a arm64-v8a x86 x86_64)
  373. set(ANDROID_STL "c++_shared" CACHE STRING "")
  374. set(ANDROID_PLATFORM "android-14" CACHE STRING "")
  375. set(ANDROID_ARCH "arm" CACHE STRING "")
  376. if(ANDROID_ARCH STREQUAL "arm")
  377. set(ANDROID_TOOLCHAIN "arm-linux-androideabi")
  378. else()
  379. set(ANDROID_TOOLCHAIN "")
  380. endif()
  381. mark_as_advanced(ANDROID_NDK_HOME ANDROID_ABI ANDROID_STL
  382. ANDROID_PLATFORM ANDROID_ARCH)
  383. #
  384. # Now let's check for the presence of various thirdparty libraries.
  385. #
  386. # By default, we'll assume the user only wants to run with Debug
  387. # python if he has to--that is, on Windows when building a debug build.
  388. if(WIN32)
  389. per_config_option(USE_DEBUG_PYTHON "" Debug)
  390. else()
  391. option(USE_DEBUG_PYTHON "" OFF)
  392. endif()
  393. cmake_dependent_option(HAVE_VIDEO4LINUX
  394. "Set this to enable webcam support on Linux." ON
  395. "IS_LINUX" OFF)
  396. # If you are having trouble linking in OpenGL extension functions at
  397. # runtime for some reason, you can set this variable. It also,
  398. # requires you to install the OpenGL header files and compile-time
  399. # libraries appropriate to the version you want to compile against.
  400. set(MIN_GL_VERSION "1 1" CACHE STRING
  401. "The variable is the major, minor version of OpenGL, separated by a
  402. space (instead of a dot). Thus, \"1 1\" means OpenGL version 1.1.
  403. This defines the minimum runtime version of OpenGL that Panda will
  404. require. Setting it to a higher version will compile in hard
  405. references to the extension functions provided by that OpenGL
  406. version and below, which may reduce runtime portability to other
  407. systems, but it will avoid issues with getting extension function
  408. pointers.")
  409. option(SUPPORT_FIXED_FUNCTION
  410. "This option compiles in support for the fixed-function OpenGL pipeline.
  411. It is only really useful to turn this off to save space if you are building
  412. an application that only needs to use an OpenGL 3.2+ context and only uses
  413. custom GLSL shaders." ON)
  414. option(SUPPORT_IMMEDIATE_MODE
  415. "This option compiles in support for immediate-mode OpenGL
  416. rendering. Since this is normally useful only for researching
  417. buggy drivers, and since there is a tiny bit of per-primitive
  418. overhead to have this option available even if it is unused, it is
  419. by default enabled only in a development build. This has no effect
  420. on DirectX rendering." OFF)
  421. mark_as_advanced(SUPPORT_FIXED_FUNCTION)
  422. # Should build tinydisplay?
  423. option(HAVE_TINYDISPLAY
  424. "Builds TinyDisplay, a light software renderer based on TinyGL,
  425. that is built into Panda. TinyDisplay is not as full-featured as Mesa
  426. but is many times faster." ON)
  427. # Is SDL installed, and where?
  428. set(Threads_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  429. set(Eigen3_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  430. set(PythonLibs_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  431. set(PythonInterp_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  432. find_package(SDL QUIET)
  433. package_option(SDL
  434. "The SDL library is useful only for tinydisplay, and is not even
  435. required for that, as tinydisplay is also supported natively on
  436. each supported platform.")
  437. # Cleanup after builtin FindSDL
  438. mark_as_advanced(SDLMAIN_LIBRARY)
  439. mark_as_advanced(SDL_INCLUDE_DIR)
  440. mark_as_advanced(SDL_LIBRARY)
  441. mark_as_advanced(SDL_LIBRARY_TEMP)
  442. if(HAVE_GL AND HAVE_X11 AND NOT APPLE)
  443. option(HAVE_GLX "Enables GLX. Requires OpenGL and X11." ON)
  444. else()
  445. option(HAVE_GLX "Enables GLX. Requires OpenGL and X11." OFF)
  446. endif()
  447. option(LINK_IN_GLXGETPROCADDRESS
  448. "Define this to compile in a reference to the glXGetProcAddress().
  449. This is only relevant from platforms using OpenGL under X."
  450. OFF)
  451. if(WIN32 AND HAVE_GL)
  452. option(HAVE_WGL "Enable WGL. Requires OpenGL on Windows." ON)
  453. else()
  454. option(HAVE_WGL "Enable WGL. Requires OpenGL on Windows." OFF)
  455. endif()
  456. cmake_dependent_option(HAVE_COCOA "Enable Cocoa. Requires Mac OS X." ON
  457. "APPLE" OFF)
  458. #
  459. # Miscellaneous settings
  460. #
  461. option(WANT_NATIVE_NET
  462. "Define this true to build the low-level native network
  463. implementation. Normally this should be set true." ON)
  464. option(HAVE_NET
  465. "Do you want to build the high-level network interface? This layers
  466. on top of the low-level native_net interface, specified above.
  467. Normally, if you build NATIVE_NET, you will also build NET."
  468. ${WANT_NATIVE_NET})
  469. option(HAVE_EGG
  470. "Do you want to build the egg loader? Usually there's no reason to
  471. avoid building this, unless you really want to make a low-footprint
  472. build (such as, for instance, for the iPhone)." ON)
  473. option(HAVE_AUDIO
  474. "Do you want to build the audio interface?" ON)
  475. option(USE_PANDAFILESTREAM
  476. "Enable the PandaFileStream implementation of pfstream etc.?" ON)
  477. # These image formats don't require the assistance of a third-party
  478. # library to read and write, so there's normally no reason to disable
  479. # them int he build, unless you are looking to reduce the memory footprint.
  480. option(HAVE_SGI_RGB "Enable support for loading SGI RGB images." ON)
  481. option(HAVE_TGA "Enable support for loading TGA images." ON)
  482. option(HAVE_IMG "Enable support for loading IMG images." ON)
  483. option(HAVE_SOFTIMAGE_PIC "Enable support for loading SOFTIMAGE PIC images." ON)
  484. option(HAVE_BMP "Enable support for loading BMP images." ON)
  485. option(HAVE_PNM "Enable support for loading PNM images." ON)
  486. option(HAVE_SGI_RGB "" ON)
  487. option(HAVE_TGA "" ON)
  488. option(HAVE_IMG "" ON)
  489. option(HAVE_SOFTIMAGE_PIC "" ON)
  490. option(HAVE_BMP "" ON)
  491. option(HAVE_PNM "" ON)
  492. # How to invoke bison and flex. Panda takes advantage of some
  493. # bison/flex features, and therefore specifically requires bison and
  494. # flex, not some other versions of yacc and lex. However, you only
  495. # need to have these programs if you need to make changes to the
  496. # bison or flex sources (see the next point, below).
  497. find_package(BISON QUIET)
  498. find_package(FLEX QUIET)
  499. # You may not even have bison and flex installed. If you don't, no
  500. # sweat; Panda ships with the pre-generated output of these programs,
  501. # so you don't need them unless you want to make changes to the
  502. # grammars themselves (files named *.yxx or *.lxx).
  503. set(HAVE_BISON ${BISON_FOUND})
  504. set(HAVE_FLEX ${FLEX_FOUND})
  505. ### Configure threading support ###
  506. set(CMAKE_THREAD_PREFER_PTHREAD ON)
  507. set(THREADS_PREFER_PTHREAD_FLAG ON)
  508. find_package(Threads QUIET)
  509. set(THREADS_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
  510. set(HAVE_POSIX_THREADS ${CMAKE_USE_PTHREADS_INIT})
  511. # Add basic use flag for threading
  512. if(EMSCRIPTEN OR WASI)
  513. set(_default_threads OFF)
  514. else()
  515. set(_default_threads ON)
  516. endif()
  517. package_option(THREADS
  518. "If on, compile Panda3D with threading support.
  519. Building in support for threading will enable Panda to take
  520. advantage of multiple CPU's if you have them (and if the OS
  521. supports kernel threads running on different CPU's), but it will
  522. slightly slow down Panda for the single CPU case."
  523. DEFAULT ${_default_threads}
  524. IMPORTED_AS Threads::Threads)
  525. # Configure debug threads
  526. option(DEBUG_THREADS
  527. "If on, enables debugging of thread and sync operations (i.e. mutexes,
  528. deadlocks). Very slow, disabled by default." OFF)
  529. option(SIMPLE_THREADS
  530. "If on, compile with simulated threads. Threads, by default, use
  531. OS-provided threading constructs, which usually allows for full
  532. multithreading support (i.e. the program can use multiple CPU's).
  533. On the other hand, compiling in this full OS-provided support can
  534. impose some substantial runtime overhead, making the application
  535. run slower on a single-CPU machine. This settings avoid the overhead,
  536. but still gain some of the basic functionality of threads." OFF)
  537. option(OS_SIMPLE_THREADS
  538. "If on, OS threading constructs will be used to perform context switches.
  539. A mutex is used to ensure that only one thread runs at a time, so the
  540. normal SIMPLE_THREADS optimizations still apply, and the normal
  541. SIMPLE_THREADS scheduler is used to switch between threads (instead
  542. of the OS scheduler). This may be more portable and more reliable,
  543. but it is a hybrid between user-space threads and os-provided threads." ON)
  544. ### Configure pipelining ###
  545. option(DO_PIPELINING "If on, compile with pipelined rendering." ON)
  546. ### Miscellaneous configuration
  547. option(COMPILE_IN_DEFAULT_FONT
  548. "If on, compiles in a default font, so that every TextNode will always
  549. have a font available without requiring the user to specify one.
  550. When turned off, the generated library will save a few kilobytes." ON)
  551. option(STDFLOAT_DOUBLE
  552. "Define this true to compile a special version of Panda to use a
  553. 'double' floating-precision type for most internal values, such as
  554. positions and transforms, instead of the standard single-precision
  555. 'float' type. This does not affect the default numeric type of
  556. vertices, which is controlled by the runtime config variable
  557. vertices-float64." OFF)