Config.cmake 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  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 subpackes 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. # The character used to separate components of an OS-specific
  55. # directory name depends on the platform (it is '/' on Unix, '\' on
  56. # Windows). That character selection is hardcoded into Panda and
  57. # cannot be changed here. (Note that an internal Panda filename
  58. # always uses the forward slash, '/', to separate the components of a
  59. # directory name.)
  60. # There's a different character used to separate the complete
  61. # directory names in a search path specification. On Unix, the
  62. # normal convention is ':', on Windows, it has to be ';', because the
  63. # colon is already used to mark the drive letter. This character is
  64. # selectable here. Most users won't want to change this. If
  65. # multiple characters are placed in this string, any one of them may
  66. # be used as a separator character.
  67. if(WIN32)
  68. set(DEFAULT_PATHSEP ";")
  69. else()
  70. set(DEFAULT_PATHSEP ":")
  71. endif()
  72. # Panda uses prc files for runtime configuration. There are many
  73. # compiled-in options to customize the behavior of the prc config
  74. # system; most users won't need to change any of them. Feel free to
  75. # skip over all of the PRC_* variables defined here.
  76. # The default behavior is to search for files names *.prc in the
  77. # directory specified by the PRC_DIR environment variable, and then
  78. # to search along all of the directories named by the PRC_PATH
  79. # environment variable. Either of these variables might be
  80. # undefined; if both of them are undefined, the default is to search
  81. # in the directory named here by DEFAULT_PRC_DIR.
  82. # By default, we specify the <auto>/etc dir, which is a special
  83. # syntax that causes it to automatically search up the directory
  84. # tree starting at the location of libpandaexpress.dll for any
  85. # directories called 'etc'.
  86. set(DEFAULT_PRC_DIR "<auto>etc" CACHE STRING
  87. "The compiled-in default directory to look for the Config.prc file,
  88. in the absence of the PRC_DIR environment variable set, and in
  89. the absence of anything specified via the configpath directive.")
  90. # You can specify the names of the environment variables that are
  91. # used to specify the search location(s) for prc files at runtime.
  92. # These are space-separated lists of environment variable names.
  93. # Specify empty string for either one of these to disable the
  94. # feature. For instance, redefining PRC_DIR_ENVVARS here to
  95. # PRC_DIR would cause the environment variable $PRC_DIR
  96. # to be consulted at startup instead of the default value of
  97. # $PANDA_PRC_DIR.
  98. set(PRC_DIR_ENVVARS "PANDA_PRC_DIR" CACHE STRING
  99. "The compiled-in name of the environment variable(s) that contain
  100. the name of a single directory in which to search for prc files.")
  101. set(PRC_PATH_ENVVARS "PANDA_PRC_PATH" CACHE STRING
  102. "The compiled-in name of the environment variable(s) that contain
  103. the name of multiple directories, separated by DEFAULT_PATHSEP, in
  104. which to search for prc files.")
  105. # You can specify the name of the file(s) to search for in the above
  106. # paths to be considered a config file. This should be a
  107. # space-separated list of filename patterns. This is *.prc by
  108. # default; normally there's no reason to change this.
  109. set(PRC_PATTERNS "*.prc" CACHE STRING
  110. "The filename(s) to search for in the above paths. Normally this is
  111. *.prc.")
  112. # You can optionally encrypt your prc file(s) to help protect them
  113. # from curious eyes. You have to specify the encryption key, which
  114. # gets hard-coded into the executable. (This feature provides mere
  115. # obfuscation, not real security, since the encryption key can
  116. # potentially be extracted by a hacker.) This requires building with
  117. # OpenSSL.
  118. set(PRC_ENCRYPTED_PATTERNS "*.prc.pe" CACHE STRING
  119. "The filename(s) for encrypted prc files.")
  120. set(PRC_ENCRYPTION_KEY "" CACHE STRING
  121. "The encryption key used to decrypt any encrypted prc files
  122. identified by PRC_ENCRYPTED_PATTERNS.")
  123. # One unusual feature of config is the ability to execute one or more
  124. # of the files it discovers as if it were a program, and then treat
  125. # the output of this program as a prc file. If you want to use this
  126. # feature, define this variable to the filename pattern or patterns
  127. # for such executable-style config programs (e.g. *prc.exe). This
  128. # can be the same as the above if you like this sort of ambiguity; in
  129. # that case, config will execute the file if it appears to be
  130. # executable; otherwise, it will simply read it.
  131. set(PRC_EXECUTABLE_PATTERNS "" CACHE STRING
  132. "The filename(s) to search for, and execute, in the above paths.
  133. Normally this is empty.")
  134. # If you do use the above feature, you'll need another environment
  135. # variable that specifies additional arguments to pass to the
  136. # executable programs. The default definition, given here, makes
  137. # that variable be $PANDA_PRC_XARGS. Sorry, the same arguments
  138. # must be supplied to all executables in a given runtime session.
  139. set(PRC_EXECUTABLE_ARGS_ENVVAR "PANDA_PRC_XARGS" CACHE STRING
  140. "The environment variable that defines optional args to pass to
  141. executables found that match one of the above patterns.")
  142. # You can implement signed prc files, if you require this advanced
  143. # feature. This allows certain config variables to be set only by a
  144. # prc file that has been provided by a trusted source. To do this,
  145. # first install and compile Dtool with OpenSSL and run the program
  146. # make-prc-key, and then specify here the output filename generated
  147. # by that program, and then recompile Dtool.
  148. set(PRC_PUBLIC_KEYS_FILENAME "" CACHE STRING "")
  149. # By default, the signed-prc feature, above, is enabled only for a
  150. # release build. In a normal development environment, any prc file
  151. # can set any config variable, whether or not it is signed. Set
  152. # this variable true or false to explicitly enable or disable this
  153. # feature.
  154. #XXX For which build types should this be enabled?
  155. if(CMAKE_BUILD_TYPE STREQUAL "Release")
  156. set(DEFAULT_PRC_RESPECT_TRUST_LEVEL ON)
  157. else()
  158. set(DEFAULT_PRC_RESPECT_TRUST_LEVEL OFF)
  159. endif()
  160. option(PRC_RESPECT_TRUST_LEVEL
  161. "Define if we want to enable the trust_level feature of prc config
  162. variables. This requires OpenSSL and PRC_PUBLIC_KEYS_FILENAME,
  163. above." ${DEFAULT_PRC_RESPECT_TRUST_LEVEL})
  164. # If trust level is in effect, this specifies the default trust level
  165. # for any legacy (Dconfig) config variables (that is, variables
  166. # created using the config.GetBool(), etc. interface, rather than the
  167. # newer ConfigVariableBool interface).
  168. set(PRC_DCONFIG_TRUST_LEVEL "0" CACHE STRING
  169. "The trust level value for any legacy (DConfig) variables.")
  170. # If trust level is in effect, you may globally increment the
  171. # (mis)trust level of all variables by the specified amount.
  172. # Incrementing this value by 1 will cause all variables to require at
  173. # least a level 1 signature.
  174. set(PRC_INC_TRUST_LEVEL "0" CACHE STRING
  175. "The amount by which we globally increment the trust level.")
  176. # Similarly, the descriptions are normally saved only in a
  177. # development build, not in a release build. Set this value true to
  178. # explicitly save them anyway.
  179. #XXX only for release-release builds
  180. option(PRC_SAVE_DESCRIPTIONS
  181. "Define if you want to save the descriptions for ConfigVariables."
  182. ON)
  183. mark_as_advanced(DEFAULT_PRC_DIR PRC_DIR_ENVVARS PRC_PATH_ENVVARS
  184. PRC_PATTERNS PRC_ENCRYPTED_PATTERNS PRC_ENCRYPTION_KEY
  185. PRC_EXECUTABLE_PATTERNS PRC_EXECUTABLE_ARGS_ENVVAR
  186. PRC_PUBLIC_KEYS_FILENAME PRC_RESPECT_TRUST_LEVEL
  187. PRC_DCONFIG_TRUST_LEVEL PRC_INC_TRUST_LEVEL PRC_SAVE_DESCRIPTIONS)
  188. #
  189. # This is the end of the PRC variable customization section. The
  190. # remaining variables are of general interest to everyone.
  191. #
  192. option(HAVE_P3D_PLUGIN
  193. "You may define this to build or develop the plugin." OFF)
  194. option(HAVE_P3D_RTDIST
  195. "You may define this to build or develop the Panda3D rtdist,
  196. the environment packaged up for distribution with the plugin."
  197. OFF)
  198. if(HAVE_P3D_RTDIST)
  199. set(PANDA_PACKAGE_VERSION "local_dev" CACHE STRING "")
  200. set(PANDA_PACKAGE_HOST_URL "http://localhost/" CACHE STRING "")
  201. endif()
  202. mark_as_advanced(HAVE_P3D_RTDIST PANDA_PACKAGE_VERSION PANDA_PACKAGE_HOST)
  203. # The following options relate to interrogate, the tool that is
  204. # used to generate bindings for non-C++ languages.
  205. option(INTERROGATE_PYTHON_INTERFACE
  206. "Do you want to generate a Python-callable interrogate interface?
  207. This is only necessary if you plan to make calls into Panda from a
  208. program written in Python. This is done only if HAVE_PYTHON is also
  209. true." ON)
  210. set(PYTHON_NATIVE
  211. "Define this true to use the new interrogate feature to generate
  212. Python-native objects directly, rather than requiring a separate
  213. FFI step. This loads and runs much more quickly than the original
  214. mechanism. Define this false (that is, empty) to use the original
  215. interfaces." ON)
  216. set(INTERROGATE_C_INTERFACE
  217. "Do you want to generate a C-callable interrogate interface? This
  218. generates an interface similar to the Python interface above, with
  219. a C calling convention. It should be useful for most other kinds
  220. of scripting language; the VR Studio used to use this to make calls
  221. into Panda from Squeak." OFF)
  222. option(HAVE_INTERROGATE
  223. "Do you even want to build interrogate at all? This is the program
  224. that reads our C++ source files and generates one of the above
  225. interfaces. If you won't be building the interfaces, you don't
  226. need the program." ON)
  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. set(INTERROGATE "interrogate" CACHE STRING
  235. "What's the name of the interrogate binary to run? The default
  236. specified is the one that is built as part of DTOOL. If you have a
  237. prebuilt binary standing by (for instance, if you are cross-compiling
  238. and cannot run the built version), specify its name instead.")
  239. set(INTERROGATE_MODULE "interrogate_module" CACHE STRING
  240. "Same as INTERROGATE, except for the interrogate_module binary.")
  241. mark_as_advanced(PYTHON_NATIVE INTERROGATE_OPTIONS)
  242. if(NOT CMAKE_CROSSCOMPILING)
  243. mark_as_advanced(INTERROGATE INTERROGATE_MODULE)
  244. endif()
  245. #
  246. # The following options have to do with the memory allocation system
  247. # that will be used by Panda3D.
  248. #
  249. option(DO_MEMORY_USAGE
  250. "Do you want to compile in support for tracking memory usage? This
  251. enables you to define the variable 'track-memory-usage' at runtime
  252. to help track memory leaks, and also report total memory usage on
  253. PStats. There is some small overhead for having this ability
  254. available, even if it is unused." ${IS_DEBUG_BUILD})
  255. option(SIMULATE_NETWORK_DELAY
  256. "This option compiles in support for simulating network delay via
  257. the min-lag and max-lag prc variables. It adds a tiny bit of
  258. overhead even when it is not activated, so it is typically enabled
  259. only in a development build." ${IS_DEBUG_BUILD})
  260. option(SUPPORT_IMMEDIATE_MODE
  261. "This option compiles in support for immediate-mode OpenGL
  262. rendering. Since this is normally useful only for researching
  263. buggy drivers, and since there is a tiny bit of per-primitive
  264. overhead to have this option available even if it is unused, it is
  265. by default enabled only in a development build. This has no effect
  266. on DirectX rendering." ${IS_DEBUG_BUILD})
  267. option(USE_MEMORY_DLMALLOC
  268. "This is an optional alternative memory-allocation scheme
  269. available within Panda. You can experiment with it to see
  270. if it gives better performance than the system malloc(), but
  271. at the time of this writing, it doesn't appear that it does." OFF)
  272. option(USE_MEMORY_PTMALLOC2
  273. "This is an optional alternative memory-allocation scheme
  274. available within Panda. You can experiment with it to see
  275. if it gives better performance than the system malloc(), but
  276. at the time of this writing, it doesn't appear that it does." OFF)
  277. option(MEMORY_HOOK_DO_ALIGN
  278. "Set this true if you prefer to use the system malloc library even
  279. if 16-byte alignment must be performed on top of it, wasting up to
  280. 30% of memory usage. If you do not set this, and 16-byte alignment
  281. is required and not provided by the system malloc library, then an
  282. alternative malloc system (above) will be used instead." OFF)
  283. option(ALTERNATIVE_MALLOC
  284. "Do you want to use one of the alternative malloc implementations?"
  285. OFF)
  286. option(USE_DELETED_CHAIN
  287. "Define this true to use the DELETED_CHAIN macros, which support
  288. fast re-use of existing allocated blocks, minimizing the low-level
  289. calls to malloc() and free() for frequently-created and -deleted
  290. objects. There's usually no reason to set this false, unless you
  291. suspect a bug in Panda's memory management code." ON)
  292. mark_as_advanced(DO_MEMORY_USAGE SIMULATE_NETWORK_DELAY
  293. SUPPORT_IMMEDIATE_MODE USE_MEMORY_DLMALLOC USE_MEMORY_PTMALLOC2
  294. MEMORY_HOOK_DO_ALIGN ALTERNATIVE_MALLOC USE_DELETED_CHAIN)
  295. #
  296. # This section relates to mobile-device/phone support and options
  297. #
  298. # iPhone support
  299. set(BUILD_IPHONE "" CACHE STRING
  300. "Panda contains some experimental code to compile for IPhone. This
  301. requires the Apple IPhone SDK, which is currently only available
  302. for OS X platforms. Set this to either 'iPhoneSimulator' or
  303. 'iPhoneOS'. Note that this is still *experimental* and incomplete!
  304. Don't enable this unless you know what you're doing!")
  305. set_property(CACHE BUILD_IPHONE PROPERTY STRINGS "" iPhoneSimulator iPhoneOS)
  306. # Android support
  307. option(BUILD_ANDROID
  308. "Panda contains some experimental code to compile for Android.
  309. This requires the Google Android NDK. Besides BUILD_ANDROID, you'll
  310. also have to set ANDROID_NDK_HOME." OFF)
  311. set(ANDROID_NDK_HOME "" CACHE STRING
  312. "The location of the Android NDK directory. ANDROID_NDK_HOME may
  313. not contain any spaces.")
  314. set(ANDROID_ABI "armeabi" CACHE STRING
  315. "Can be be set to armeabi, armeabi-v7a, x86, or mips,
  316. depending on which architecture should be targeted.")
  317. set_property(CACHE ANDROID_ABI PROPERTY STRINGS
  318. armeabi armeabi-v7a x86 mips)
  319. set(ANDROID_STL "gnustl_shared" CACHE STRING "")
  320. set(ANDROID_PLATFORM "android-9" CACHE STRING "")
  321. set(ANDROID_ARCH "arm" CACHE STRING "")
  322. if(ANDROID_ARCH STREQUAL "arm")
  323. set(ANDROID_TOOLCHAIN "arm-linux-androideabi")
  324. else()
  325. set(ANDROID_TOOLCHAIN "")
  326. endif()
  327. mark_as_advanced(ANDROID_NDK_HOME ANDROID_ABI ANDROID_STL
  328. ANDROID_PLATFORM ANDROID_ARCH)
  329. #
  330. # Now let's check for the presence of various thirdparty libraries.
  331. #
  332. # Is Eigen installed, and should Eigen replace internal linmath?
  333. find_package(Eigen3)
  334. package_option(EIGEN
  335. "Enables experimental support for the Eigen linear algebra library.
  336. If this is provided, Panda will use this library as the fundamental
  337. implementation of its own linmath library; otherwise, it will use
  338. its own internal implementation. The primary advantage of using
  339. Eigen is SSE2 support, which is only activated if LINMATH_ALIGN
  340. is also enabled."
  341. LICENSE "MPL-2")
  342. option(LINMATH_ALIGN
  343. "This is required for activating SSE2 support using Eigen.
  344. Activating this does constrain most objects in Panda to 16-byte
  345. alignment, which could impact memory usage on very-low-memory
  346. platforms. Currently experimental." ON)
  347. # Is Python installed, and should Python interfaces be generated?
  348. find_package(PythonLibs 2.5)
  349. find_package(PythonInterp 2.5)
  350. set(PYTHON_FOUND ${PYTHONLIBS_FOUND})
  351. package_option(PYTHON DEFAULT ON
  352. "Enables support for Python. If INTERROGATE_PYTHON_INTERFACE
  353. is also enabled, Python bindings will be generated.")
  354. # Also detect the optimal install paths:
  355. if(HAVE_PYTHON)
  356. execute_process(
  357. COMMAND ${PYTHON_EXECUTABLE}
  358. -c "from distutils.sysconfig import get_python_lib; print get_python_lib(False)"
  359. OUTPUT_VARIABLE _LIB_DIR
  360. OUTPUT_STRIP_TRAILING_WHITESPACE)
  361. execute_process(
  362. COMMAND ${PYTHON_EXECUTABLE}
  363. -c "from distutils.sysconfig import get_python_lib; print get_python_lib(True)"
  364. OUTPUT_VARIABLE _ARCH_DIR
  365. OUTPUT_STRIP_TRAILING_WHITESPACE)
  366. set(PYTHON_LIB_INSTALL_DIR "${_LIB_DIR}" CACHE STRING
  367. "Path to the Python architecture-independent package directory.")
  368. set(PYTHON_ARCH_INSTALL_DIR "${_ARCH_DIR}" CACHE STRING
  369. "Path to the Python architecture-dependent package directory.")
  370. # Always include Python, because we include it pretty much everywhere
  371. # though we don't usually want to link it in as well.
  372. include_directories(${PYTHON_INCLUDE_DIRS})
  373. endif()
  374. # By default, we'll assume the user only wants to run with Debug
  375. # python if he has to--that is, on Windows when building a debug build.
  376. if(WIN32 AND IS_DEBUG_BUILD)
  377. set(USE_DEBUG_PYTHON ON)
  378. else()
  379. set(USE_DEBUG_PYTHON OFF)
  380. endif()
  381. set(GENPYCODE_LIBS
  382. "libpandaexpress;libpanda;libpandaphysics;libp3direct;libpandafx;libp3vision;libpandaode;libp3vrpn"
  383. CACHE STRING
  384. "Define the default set of libraries to be instrumented by
  385. genPyCode. You may wish to add to this list to add your own
  386. libraries, or if you want to use some of the more obscure
  387. interfaces like libpandaegg and libpandafx.")
  388. mark_as_advanced(GENPYCODE_LIBS)
  389. option(INSTALL_PYTHON_SOURCE
  390. "Normally, Python source files are copied into the CMake library
  391. install directory, along with the compiled C++ library objects, when
  392. you make install. If you prefer not to copy these Python source
  393. files, but would rather run them directly out of the source
  394. directory (presumably so you can develop them and make changes
  395. without having to reinstall), comment out this definition and put
  396. your source directory on your PYTHONPATH.")
  397. # Is OpenSSL installed, and where?
  398. find_package(OpenSSL COMPONENTS ssl crypto)
  399. package_option(OPENSSL DEFAULT ON
  400. "Enable OpenSSL support")
  401. option(REPORT_OPENSSL_ERRORS
  402. "Define this true to include the OpenSSL code to report verbose
  403. error messages when they occur." ${IS_DEBUG_BUILD})
  404. # Is libjpeg installed, and where?
  405. find_package(JPEG)
  406. package_option(JPEG DEFAULT ON
  407. "Enable support for loading .jpg images.")
  408. # Some versions of libjpeg did not provide jpegint.h. Redefine this
  409. # to false if you lack this header file.
  410. #set(PHAVE_JPEGINT_H TRUE)
  411. option(HAVE_VIDEO4LINUX
  412. "Set this to enable webcam support on Linux." ${IS_LINUX})
  413. # Is libpng installed, and where?
  414. find_package(PNG)
  415. package_option(PNG DEFAULT ON
  416. "Enable support for loading .png images.")
  417. # Is libtiff installed, and where?
  418. find_package(TIFF)
  419. package_option(TIFF
  420. "Enable support for loading .tif images.")
  421. # Is libtar installed, and where?
  422. find_package(Tar)
  423. package_option(TAR
  424. "This is used to optimize patch generation against tar files.")
  425. # TODO: FFTW2
  426. # Is libfftw installed, and where?
  427. #find_package(FFTW2)
  428. #package_option(FFTW
  429. # "This enables support for lossless compression of animations in
  430. #.bam files. This is rarely used, and you probably don't need it.")
  431. #TODO PHAVE_DRFFTW_H
  432. # Is libsquish installed, and where?
  433. find_package(Squish)
  434. package_option(SQUISH
  435. "Enables support for automatic compression of DXT textures.")
  436. # Is Cg installed, and where?
  437. find_package(Cg QUIET)
  438. package_option(CG
  439. "Enable support for Nvidia Cg Shading Language"
  440. LICENSE "Nvidia")
  441. package_option(CGGL
  442. "Enable support for Nvidia Cg's OpenGL API."
  443. LICENSE "Nvidia")
  444. package_option(CGDX8 "Enable support for Nvidia Cg's DX8 API."
  445. LICENSE "Nvidia")
  446. package_option(CGDX9 "Enable support for Nvidia Cg's DX9 API."
  447. LICENSE "Nvidia")
  448. package_option(CGDX10 "Enable support for Nvidia Cg's DX10 API."
  449. LICENSE "Nvidia")
  450. # Is VRPN installed, and where?
  451. find_package(VRPN)
  452. package_option(VRPN
  453. "Enables support for connecting to VRPN servers.")
  454. # TODO: Helix
  455. # Is HELIX installed, and where?
  456. #find_package(Helix)
  457. #package_option(HELIX
  458. # "Enables support for Helix media playback.")
  459. # Is ZLIB installed, and where?
  460. find_package(ZLIB)
  461. package_option(ZLIB DEFAULT ON
  462. "Enables support for compression of Panda assets.")
  463. # Is FFMPEG installed, and where?
  464. find_package(FFMPEG)
  465. find_package(SWScale)
  466. find_package(SWResample)
  467. package_option(FFMPEG
  468. "Enables support for audio- and video-decoding using the FFMPEG library.")
  469. package_option(SWSCALE
  470. "Enables support for FFMPEG's libswscale for video rescaling.")
  471. package_option(SWRESAMPLE
  472. "Enables support for FFMPEG's libresample for audio resampling.")
  473. # Is ODE installed, and where?
  474. find_package(ODE)
  475. package_option(ODE
  476. "Enables support for ridid-body physics using the Open Dynamics Engine.")
  477. # Is OpenGL installed, and where?
  478. find_package(OpenGL QUIET)
  479. set(GL_FOUND ${OPENGL_FOUND})
  480. package_option(GL "Enable OpenGL support.")
  481. # If you are having trouble linking in OpenGL extension functions at
  482. # runtime for some reason, you can set this variable. It also,
  483. # requires you to install the OpenGL header files and compile-time
  484. # libraries appropriate to the version you want to compile against.
  485. set(MIN_GL_VERSION "1 1" CACHE STRING
  486. "The variable is the major, minor version of OpenGL, separated by a
  487. space (instead of a dot). Thus, \"1 1\" means OpenGL version 1.1.
  488. This defines the minimum runtime version of OpenGL that Panda will
  489. require. Setting it to a higher version will compile in hard
  490. references to the extension functions provided by that OpenGL
  491. version and below, which may reduce runtime portability to other
  492. systems, but it will avoid issues with getting extension function
  493. pointers.")
  494. # Is Mesa installed separately from OpenGL? Mesa is an open-source
  495. # software-only OpenGL renderer. Panda can link with it
  496. # independently from OpenGL (and if Mesa is built statically, and/or
  497. # with -DUSE_MGL_NAMESPACE declared to rename gl* to mgl*, it can
  498. # switch between the system OpenGL implementation and the Mesa
  499. # implementation at runtime).
  500. # Also, Mesa includes some core libraries (in libOSMesa.so) that
  501. # allow totally headless rendering, handy if you want to run a
  502. # renderer as a batch service, and you don't want to insist that a
  503. # user be logged on to the desktop or otherwise deal with X11 or
  504. # Windows.
  505. # TODO: Mesa
  506. #find_package(Mesa)
  507. #package_option(MESA
  508. # "When set, will build libmesadisplay, which can be used in lieu of
  509. #libpandagl or libpandadx to do rendering. However, for most
  510. #applications, you don't need to do this, since (a) if you have
  511. #hardware rendering capability, you probably don't want to use Mesa,
  512. #since it's software-only, and (b) if you don't have hardware
  513. #rendering, you can install Mesa as the system's OpenGL
  514. #implementation, so you can just use the normal libpandagl.
  515. #You only need to define HAVE_MESA if you want to run totally headless,
  516. #or if you want to be able to easily switch between Mesa and the
  517. #system OpenGL implementation at runtime. If you compiled Mesa with
  518. #USE_MGL_NAMESPACE defined, define MESA_MGL here.")
  519. set(MIN_MESA_VERSION "1 1" CACHE STRING
  520. "Similar to MIN_GL_VERSION, above.")
  521. # Should build tinydisplay?
  522. option(HAVE_TINYDISPLAY
  523. "Builds TinyDisplay, a light software renderer based on TinyGL,
  524. that is built into Panda. TinyDisplay is not as full-featured as Mesa
  525. but is many times faster." ${IS_NOT_MINSIZE_BUILD})
  526. # TODO: OpenGL ES
  527. # Is OpenGL ES 1.x installed, and where?
  528. #find_package(OpenGLES)
  529. #package_option(GLES
  530. # "Enable OpenGL ES 1.x support, a minimal subset of
  531. #OpenGL for mobile devices.")
  532. # Is OpenGL ES 2.x installed, and where?
  533. #find_package(OpenGLES)
  534. #package_option(GLES2
  535. # "Enable OpenGL ES 2.x support, a version of OpenGL ES but without
  536. #fixed-function pipeline - everything is programmable there.")
  537. # Is EGL installed, and where?
  538. #package_option(EGL
  539. # "Enable EGL support. EGL is like GLX, but for OpenGL ES.")
  540. # Is SDL installed, and where?
  541. set(Threads_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  542. set(Eigen3_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  543. set(PythonLibs_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  544. set(PythonInterp_FIND_QUIETLY TRUE) # Fix for builtin FindSDL
  545. find_package(SDL QUIET)
  546. package_option(SDL
  547. "The SDL library is useful only for tinydisplay, and is not even
  548. required for that, as tinydisplay is also supported natively on
  549. each supported platform.")
  550. # Cleanup after builtin FindSDL
  551. mark_as_advanced(SDLMAIN_LIBRARY)
  552. mark_as_advanced(SDL_INCLUDE_DIR)
  553. mark_as_advanced(SDL_LIBRARY)
  554. mark_as_advanced(SDL_LIBRARY_TEMP)
  555. # Is X11 insalled, and where?
  556. find_package(X11)
  557. package_option(X11
  558. "Provides X-server support on Unix platforms. X11 may need to be linked
  559. against for tinydisplay, but probably only on a Linux platform.")
  560. if(NOT UNIX AND HAVE_X11)
  561. message(SEND_ERROR
  562. "X11 support is only supported on Unix platforms:
  563. ie. Linux, BSD, OS X, Cygwin, etc...")
  564. endif()
  565. # TODO: XF86DGA
  566. # This defines if we have XF86DGA installed.
  567. #find_package(XF86DGA QUIET)
  568. #package_option(XF86DGA
  569. # "This enables smooth FPS-style mouse in x11display,
  570. #when mouse mode M_relative is used.")
  571. # TODO: XRANDR
  572. #find_package(Xrandr QUIET)
  573. #package_option(XRANDR
  574. # "This enables resolution switching in x11display.")
  575. # TODO: XCURSOR
  576. #find_package(Xcursor QUIET)
  577. #package_option(XCURSOR
  578. # "This enables custom cursor support in x11display.")
  579. if(HAVE_GL AND HAVE_X11)
  580. option(HAVE_GLX "Enables GLX. Requires OpenGL and X11." ON)
  581. else()
  582. option(HAVE_GLX "Enables GLX. Requires OpenGL and X11." OFF)
  583. endif()
  584. option(LINK_IN_GLXGETPROCADDRESS
  585. "Define this to compile in a reference to the glXGetProcAddress().
  586. This is only relevant from platforms using OpenGL under X."
  587. OFF)
  588. if(WIN32 AND HAVE_GL)
  589. option(HAVE_WGL "Enable WGL. Requires OpenGL on Windows." ON)
  590. else()
  591. option(HAVE_WGL "Enable WGL. Requires OpenGL on Windows." OFF)
  592. endif()
  593. if(IS_OSX)
  594. option(HAVE_COCOA "Enable Cocoa. Requires Mac OS X." ON)
  595. option(HAVE_CARBON "Enable Carbon. Requires Mac OS X." ON)
  596. else()
  597. option(HAVE_COCOA "Enable Cocoa. Requires Mac OS X." OFF)
  598. option(HAVE_CARBON "Enable Carbon. Requires Mac OS X." OFF)
  599. endif()
  600. #
  601. # <<<<<< Insert the rest of the Config.pp
  602. # port of third-party libs here <<<<<<<
  603. #
  604. #
  605. # Miscellaneous settings
  606. #
  607. option(HAVE_WIN_TOUCHINPUT
  608. "Define this if you are building on Windows 7 or better, and you
  609. want your Panda build to run only on Windows 7 or better, and you
  610. need to use the Windows touchinput interfaces." OFF)
  611. option(WANT_NATIVE_NET
  612. "Define this true to build the low-level native network
  613. implementation. Normally this should be set true." ON)
  614. option(HAVE_NET
  615. "Do you want to build the high-level network interface? This layers
  616. on top of the low-level native_net interface, specified above.
  617. Normally, if you build NATIVE_NET, you will also build NET."
  618. ${WANT_NATIVE_NET})
  619. option(HAVE_EGG
  620. "Do you want to build the egg loader? Usually there's no reason to
  621. avoid building this, unless you really want to make a low-footprint
  622. build (such as, for instance, for the iPhone)." ON)
  623. option(HAVE_AUDIO
  624. "Do you want to build the audio interface?" ON)
  625. option(DO_PSTATS
  626. "Enable the pstats client?" ON)
  627. # These image formats don't require the assistance of a third-party
  628. # library to read and write, so there's normally no reason to disable
  629. # them int he build, unless you are looking to reduce the memory footprint.
  630. option(HAVE_SGI_RGB "Enable support for loading SGI RGB images."
  631. ${IS_NOT_MINSIZE_BUILD})
  632. option(HAVE_TGA "Enable support for loading TGA images."
  633. ${IS_NOT_MINSIZE_BUILD})
  634. option(HAVE_IMG "Enable support for loading IMG images."
  635. ${IS_NOT_MINSIZE_BUILD})
  636. option(HAVE_SOFTIMAGE_PIC
  637. "Enable support for loading SOFTIMAGE PIC images."
  638. ${IS_NOT_MINSIZE_BUILD})
  639. option(HAVE_BMP "Enable support for loading BMP images."
  640. ${IS_NOT_MINSIZE_BUILD})
  641. option(HAVE_PNM "Enable support for loading PNM images."
  642. ${IS_NOT_MINSIZE_BUILD})
  643. mark_as_advanced(HAVE_SGI_RGB HAVE_TGA
  644. HAVE_IMG HAVE_SOFTIMAGE_PIC HAVE_BMP HAVE_PNM)
  645. #
  646. # <<<<< Insert the rest of the Config.pp
  647. # port of miscellaneous settings here <<<<<
  648. #
  649. # How to invoke bison and flex. Panda takes advantage of some
  650. # bison/flex features, and therefore specifically requires bison and
  651. # flex, not some other versions of yacc and lex. However, you only
  652. # need to have these programs if you need to make changes to the
  653. # bison or flex sources (see the next point, below).
  654. find_package(BISON QUIET)
  655. find_package(FLEX QUIET)
  656. # You may not even have bison and flex installed. If you don't, no
  657. # sweat; Panda ships with the pre-generated output of these programs,
  658. # so you don't need them unless you want to make changes to the
  659. # grammars themselves (files named *.yxx or *.lxx).
  660. set(HAVE_BISON ${BISON_FOUND})
  661. set(HAVE_FLEX ${FLEX_FOUND})
  662. #
  663. # >>>>> Below is entirely temporary config information
  664. # until the port of Config.pp is finished.
  665. # It should be re-arranged for above. >>>>>>
  666. #
  667. ### Configure threading support ###
  668. find_package(Threads)
  669. # Add basic use flag for threading
  670. if(THREADS_FOUND)
  671. option(HAVE_THREADS
  672. "If on, compile Panda3D with threading support.
  673. Building in support for threading will enable Panda to take
  674. advantage of multiple CPU's if you have them (and if the OS
  675. supports kernel threads running on different CPU's), but it will
  676. slightly slow down Panda for the single CPU case." ON)
  677. else()
  678. option(HAVE_THREADS
  679. "If on, compile Panda3D with threading support.
  680. Building in support for threading will enable Panda to take
  681. advantage of multiple CPU's if you have them (and if the OS
  682. supports kernel threads running on different CPU's), but it will
  683. slightly slow down Panda for the single CPU case." OFF)
  684. endif()
  685. # Configure debug threads
  686. if(CMAKE_BUILD_TYPE MATCHES "Debug")
  687. option(DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" ON)
  688. else()
  689. option(DEBUG_THREADS "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)" OFF)
  690. endif()
  691. if(HAVE_THREADS)
  692. set(HAVE_POSIX_THREADS ${CMAKE_USE_PTHREADS_INIT})
  693. if(HAVE_POSIX_THREADS)
  694. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
  695. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pthread")
  696. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pthread")
  697. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -pthread")
  698. set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -pthread")
  699. endif()
  700. endif()
  701. option(SIMPLE_THREADS
  702. "If on, compile with simulated threads. Threads, by default, use
  703. OS-provided threading constructs, which usually allows for full
  704. multithreading support (i.e. the program can use multiple CPU's).
  705. On the other hand, compiling in this full OS-provided support can
  706. impose some substantial runtime overhead, making the application
  707. run slower on a single-CPU machine. This settings avoid the overhead,
  708. but still gain some of the basic functionality of threads." OFF)
  709. option(OS_SIMPLE_THREADS
  710. "If on, OS threading constructs will be used to perform context switches.
  711. A mutex is used to ensure that only one thread runs at a time, so the
  712. normal SIMPLE_THREADS optimizations still apply, and the normal
  713. SIMPLE_THREADS scheduler is used to switch between threads (instead
  714. of the OS scheduler). This may be more portable and more reliable,
  715. but it is a hybrid between user-space threads and os-provided threads." ON)
  716. ### Configure pipelining ###
  717. option(DO_PIPELINING "If on, compile with pipelined rendering." ON)
  718. ### Report on threading and pipelining status ###
  719. if(SIMPLE_THREADS)
  720. message(STATUS "Compilation will include simulated threading support.")
  721. elseif(HAVE_THREADS)
  722. if(DO_PIPELINING)
  723. message(STATUS "Compilation will include full, pipelined threading support.")
  724. else()
  725. message(STATUS "Compilation will include nonpipelined threading support.")
  726. endif()
  727. else(NOT SIMPLE_THREADS)
  728. message(STATUS "Configuring Panda without threading support.")
  729. endif()
  730. message(STATUS "")
  731. message(STATUS "See dtool_config.h for more details about the specified configuration.\n")
  732. ### Miscellaneous configuration
  733. option(COMPILE_IN_DEFAULT_FONT
  734. "If on, compiles in a default font, so that every TextNode will always
  735. have a font available without requiring the user to specify one.
  736. When turned off, the generated library will save a few kilobytes."
  737. ${IS_NOT_MINSIZE_BUILD})
  738. option(STDFLOAT_DOUBLE
  739. "Define this true to compile a special version of Panda to use a
  740. 'double' floating-precision type for most internal values, such as
  741. positions and transforms, instead of the standard single-precision
  742. 'float' type. This does not affect the default numeric type of
  743. vertices, which is controlled by the runtime config variable
  744. vertices-float64." OFF)