Config.cmake 23 KB

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