Config.cmake 28 KB

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