Config.cmake 24 KB

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