Config.cmake 25 KB

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