Global.pp 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787
  1. //
  2. // Global.pp
  3. //
  4. // This file is read in before any of the individual Sources.pp files
  5. // are read. It defines a few global variables that are useful to all
  6. // different kinds of build_types.
  7. //
  8. // We start off by defining a number of map variables. These are
  9. // special variables that can be used to look up a particular named
  10. // scope according to a key (that is, according to the value of some
  11. // variable defined within the scope).
  12. // A named scope is defined using the #begin name .. #end name
  13. // sequence. In general, we use these sequences in the various
  14. // Sources.pp files to define the various targets to build. Each
  15. // named scope carries around its set of variable declarations. The
  16. // named scopes are associated with the dirname of the directory in
  17. // which the Sources.pp file was found.
  18. // The first map variable lets us look up a particular library target
  19. // by its target name. The syntax here indicates that we are
  20. // declaring a map variable called "all_libs" whose key is the
  21. // variable $[TARGET] as defined in each instance of a named scope
  22. // called "static_lib_target," "lib_target," and so on in every
  23. // Sources.pp file. (The */ refers to all the Sources.pp files. We
  24. // could also identify a particular file by its directory name, or
  25. // omit the slash to refer to our own Sources.pp file.)
  26. // After defining this map variable, we can look up other variables
  27. // that are defined for the corresponding target. For instances,
  28. // $[all_libs $[SOURCES],dconfig] will return the value of the SOURCES
  29. // variable as set for the dconfig library (that is, the expression
  30. // $[SOURCES] is evaluated within the named scope whose key is
  31. // "dconfig"--whose variable $[TARGET] was defined to be "dconfig").
  32. #map all_libs TARGET(*/static_lib_target */ss_lib_target */lib_target */noinst_lib_target */test_lib_target */metalib_target)
  33. // This map variable allows us to look up global variables that might
  34. // be defined in a particular Sources.pp, e.g. in the "toplevel" file.
  35. #map dir_type DIR_TYPE(*/)
  36. // These allow us to determine whether a particular local library is a
  37. // static or a dynamic library. If the library name appears in the
  38. // static_libs map, it is a static library (i.e. libname.a);
  39. // otherwise, it is a dynamic library (libname.so). The target
  40. // ss_lib_target is a special case: these libraries are dynamic where
  41. // it's easy to make them so (e.g. on Unix platforms), and static on
  42. // platforms where dynamic libraries aren't quite so robust (e.g. on
  43. // Windows).
  44. #if $[WINDOWS_PLATFORM]
  45. #map static_libs TARGET(*/static_lib_target */ss_lib_target)
  46. #map dynamic_libs TARGET(*/lib_target */noinst_lib_target */test_lib_target */metalib_target)
  47. #else
  48. #map static_libs TARGET(*/static_lib_target)
  49. #map dynamic_libs TARGET(*/lib_target */ss_lib_target */noinst_lib_target */test_lib_target */metalib_target)
  50. #endif
  51. // This lets us identify which metalib, if any, is including each
  52. // named library. That is, $[module $[TARGET],name] will return
  53. // the name of the metalib that includes library name.
  54. #map module COMPONENT_LIBS(*/metalib_target)
  55. // This lets up look up components of a particular metalib.
  56. #map components TARGET(*/lib_target */noinst_lib_target */test_lib_target)
  57. // And this lets us look up source directories by dirname.
  58. #map dirnames DIRNAME(*/)
  59. // This is used by Template.models.pp.
  60. #if $[HAVE_SOFTIMAGE]
  61. #define SOFT2EGG soft -D libsoftegg soft2egg
  62. #else
  63. // We used to use the old converter from pre-Panda days. Now this
  64. // is no longer supported.
  65. // #define SOFT2EGG soft2egg
  66. #define SOFT2EGG soft -D libsoftegg soft2egg
  67. #endif
  68. // Define some various compile flags, derived from the variables set
  69. // in Config.pp.
  70. #set INTERROGATE_PYTHON_INTERFACE $[and $[HAVE_PYTHON],$[INTERROGATE_PYTHON_INTERFACE]]
  71. #define run_interrogate $[HAVE_INTERROGATE]
  72. #define stl_ipath $[wildcard $[STL_IPATH]]
  73. #define stl_lpath $[wildcard $[STL_LPATH]]
  74. #define stl_cflags $[STL_CFLAGS]
  75. #define stl_libs $[STL_LIBS]
  76. #if $[HAVE_PYTHON]
  77. #define python_ipath $[wildcard $[PYTHON_IPATH]]
  78. #define python_lpath $[wildcard $[PYTHON_LPATH]]
  79. #define python_fpath $[wildcard $[PYTHON_FPATH]]
  80. #define python_cflags $[PYTHON_CFLAGS]
  81. #define python_lflags $[PYTHON_LFLAGS]
  82. #define python_libs $[PYTHON_LIBS]
  83. #define python_framework $[PYTHON_FRAMEWORK]
  84. #endif
  85. #if $[HAVE_THREADS]
  86. #define threads_ipath $[wildcard $[THREADS_IPATH]]
  87. #define threads_lpath $[wildcard $[THREADS_LPATH]]
  88. #define threads_cflags $[THREADS_CFLAGS]
  89. #define threads_libs $[THREADS_LIBS]
  90. #define threads_framework $[THREADS_FRAMEWORK]
  91. #endif
  92. #if $[HAVE_OPENSSL]
  93. #define openssl_ipath $[wildcard $[OPENSSL_IPATH]]
  94. #define openssl_lpath $[wildcard $[OPENSSL_LPATH]]
  95. #define openssl_cflags $[OPENSSL_CFLAGS]
  96. #define openssl_libs $[OPENSSL_LIBS]
  97. #endif
  98. #if $[HAVE_ZLIB]
  99. #define zlib_ipath $[wildcard $[ZLIB_IPATH]]
  100. #define zlib_lpath $[wildcard $[ZLIB_LPATH]]
  101. #define zlib_cflags $[ZLIB_CFLAGS]
  102. #define zlib_libs $[ZLIB_LIBS]
  103. #endif
  104. #if $[HAVE_GL]
  105. #define gl_ipath $[wildcard $[GL_IPATH]]
  106. #define gl_lpath $[wildcard $[GL_LPATH]]
  107. #define gl_cflags $[GL_CFLAGS]
  108. #define gl_libs $[GL_LIBS] $[if $[HAVE_GLU],$[GLU_LIBS]]
  109. #define gl_framework $[GL_FRAMEWORK]
  110. #endif
  111. #if $[HAVE_MESA]
  112. #define mesa_ipath $[wildcard $[MESA_IPATH]]
  113. #define mesa_lpath $[wildcard $[MESA_LPATH]]
  114. #define mesa_cflags $[MESA_CFLAGS]
  115. #define mesa_libs $[MESA_LIBS]
  116. #endif
  117. #if $[HAVE_CHROMIUM]
  118. #define chromium_ipath $[wildcard $[CHROMIUM_IPATH]]
  119. #define chromium_lpath $[wildcard $[CHROMIUM_LPATH]]
  120. #define chromium_cflags $[CHROMIUM_CFLAGS]
  121. #define chromium_libs $[CHROMIUM_LIBS]
  122. #endif
  123. #if $[HAVE_GLX]
  124. #define glx_ipath $[wildcard $[GLX_IPATH]]
  125. #define glx_lpath $[wildcard $[GLX_LPATH]]
  126. #define glx_cflags $[GLX_CFLAGS]
  127. #define glx_libs $[GLX_LIBS]
  128. #endif
  129. #if $[HAVE_GLUT]
  130. #define glut_ipath $[wildcard $[GLUT_IPATH]]
  131. #define glut_lpath $[wildcard $[GLUT_LPATH]]
  132. #define glut_cflags $[GLUT_CFLAGS]
  133. #define glut_libs $[GLUT_LIBS]
  134. #endif
  135. #if $[HAVE_DX8]
  136. #define dx8_ipath $[wildcard $[DX8_IPATH]]
  137. #define dx8_lpath $[wildcard $[DX8_LPATH]]
  138. #define dx8_cflags $[DX8_CFLAGS]
  139. #define dx8_libs $[DX8_LIBS]
  140. #endif
  141. #if $[HAVE_DX9]
  142. #define dx9_ipath $[wildcard $[DX9_IPATH]]
  143. #define dx9_lpath $[wildcard $[DX9_LPATH]]
  144. #define dx9_cflags $[DX9_CFLAGS]
  145. #define dx9_libs $[DX9_LIBS]
  146. #endif
  147. #if $[HAVE_OPENCV]
  148. #define opencv_ipath $[wildcard $[OPENCV_IPATH]]
  149. #define opencv_lpath $[wildcard $[OPENCV_LPATH]]
  150. #define opencv_cflags $[OPENCV_CFLAGS]
  151. #define opencv_libs $[OPENCV_LIBS]
  152. #endif
  153. #if $[HAVE_FFMPEG]
  154. #define ffmpeg_ipath $[wildcard $[FFMPEG_IPATH]]
  155. #define ffmpeg_lpath $[wildcard $[FFMPEG_LPATH]]
  156. #define ffmpeg_cflags $[FFMPEG_CFLAGS]
  157. #define ffmpeg_libs $[FFMPEG_LIBS]
  158. #endif
  159. #if $[HAVE_ODE]
  160. #define ode_ipath $[wildcard $[ODE_IPATH]]
  161. #define ode_lpath $[wildcard $[ODE_LPATH]]
  162. #define ode_cflags $[ODE_CFLAGS]
  163. #define ode_libs $[ODE_LIBS]
  164. #endif
  165. #if $[HAVE_JPEG]
  166. #define jpeg_ipath $[wildcard $[JPEG_IPATH]]
  167. #define jpeg_lpath $[wildcard $[JPEG_LPATH]]
  168. #define jpeg_cflags $[JPEG_CFLAGS]
  169. #define jpeg_libs $[JPEG_LIBS]
  170. #endif
  171. #if $[HAVE_PNG]
  172. #define png_ipath $[wildcard $[PNG_IPATH]]
  173. #define png_lpath $[wildcard $[PNG_LPATH]]
  174. #define png_cflags $[PNG_CFLAGS]
  175. #define png_libs $[PNG_LIBS]
  176. #endif
  177. #if $[HAVE_TIFF]
  178. #define tiff_ipath $[wildcard $[TIFF_IPATH]]
  179. #define tiff_lpath $[wildcard $[TIFF_LPATH]]
  180. #define tiff_cflags $[TIFF_CFLAGS]
  181. #define tiff_libs $[TIFF_LIBS]
  182. #endif
  183. #if $[HAVE_TAR]
  184. #define tar_ipath $[wildcard $[TAR_IPATH]]
  185. #define tar_lpath $[wildcard $[TAR_LPATH]]
  186. #define tar_cflags $[TAR_CFLAGS]
  187. #define tar_libs $[TAR_LIBS]
  188. #endif
  189. #if $[HAVE_FFTW]
  190. #define fftw_ipath $[wildcard $[FFTW_IPATH]]
  191. #define fftw_lpath $[wildcard $[FFTW_LPATH]]
  192. #define fftw_cflags $[FFTW_CFLAGS]
  193. #define fftw_libs $[FFTW_LIBS]
  194. #endif
  195. #if $[HAVE_BDB]
  196. #define bdb_ipath $[wildcard $[BDB_IPATH]]
  197. #define bdb_lpath $[wildcard $[BDB_LPATH]]
  198. #define bdb_cflags $[BDB_CFLAGS]
  199. #define bdb_libs $[BDB_LIBS]
  200. #endif
  201. #if $[HAVE_CG]
  202. #define cg_ipath $[wildcard $[CG_IPATH]]
  203. #define cg_lpath $[wildcard $[CG_LPATH]]
  204. #define cg_cflags $[CG_CFLAGS]
  205. #define cg_libs $[CG_LIBS]
  206. #define cg_framework $[CG_FRAMEWORK]
  207. #endif
  208. #if $[HAVE_CGGL]
  209. #define cggl_ipath $[wildcard $[CGGL_IPATH]]
  210. #define cggl_lpath $[wildcard $[CGGL_LPATH]]
  211. #define cggl_cflags $[CGGL_CFLAGS]
  212. #define cggl_libs $[CGGL_LIBS]
  213. #define cggl_framework $[CGGL_FRAMEWORK]
  214. #endif
  215. #if $[HAVE_CGDX8]
  216. #define cgdx8_ipath $[wildcard $[CGDX8_IPATH]]
  217. #define cgdx8_lpath $[wildcard $[CGDX8_LPATH]]
  218. #define cgdx8_cflags $[CGDX8_CFLAGS]
  219. #define cgdx8_libs $[CGDX8_LIBS]
  220. #endif
  221. #if $[HAVE_CGDX9]
  222. #define cgdx9_ipath $[wildcard $[CGDX9_IPATH]]
  223. #define cgdx9_lpath $[wildcard $[CGDX9_LPATH]]
  224. #define cgdx9_cflags $[CGDX9_CFLAGS]
  225. #define cgdx9_libs $[CGDX9_LIBS]
  226. #endif
  227. #if $[HAVE_CGDX10]
  228. #define cgdx10_ipath $[wildcard $[CGDX10_IPATH]]
  229. #define cgdx10_lpath $[wildcard $[CGDX10_LPATH]]
  230. #define cgdx10_cflags $[CGDX10_CFLAGS]
  231. #define cgdx10_libs $[CGDX10_LIBS]
  232. #endif
  233. #if $[HAVE_VRPN]
  234. #define vrpn_ipath $[wildcard $[VRPN_IPATH]]
  235. #define vrpn_lpath $[wildcard $[VRPN_LPATH]]
  236. #define vrpn_cflags $[VRPN_CFLAGS]
  237. #define vrpn_libs $[VRPN_LIBS]
  238. #endif
  239. #if $[HAVE_HELIX]
  240. #define helix_ipath $[wildcard $[HELIX_IPATH]]
  241. #define helix_lpath $[wildcard $[HELIX_LPATH]]
  242. #define helix_cflags $[HELIX_CFLAGS]
  243. #define helix_libs $[HELIX_LIBS]
  244. #endif
  245. #if $[HAVE_MIKMOD]
  246. #define mikmod_ipath $[wildcard $[MIKMOD_IPATH]]
  247. #define mikmod_lpath $[wildcard $[MIKMOD_LPATH]]
  248. #define mikmod_cflags $[MIKMOD_CFLAGS]
  249. #define mikmod_libs $[MIKMOD_LIBS]
  250. #endif
  251. #if $[HAVE_GTK]
  252. #define gtk_ipath $[wildcard $[GTK_IPATH]]
  253. #define gtk_lpath $[wildcard $[GTK_LPATH]]
  254. #define gtk_cflags $[GTK_CFLAGS]
  255. #define gtk_libs $[GTK_LIBS]
  256. #endif
  257. #if $[HAVE_FREETYPE]
  258. #define freetype_ipath $[wildcard $[FREETYPE_IPATH]]
  259. #define freetype_lpath $[wildcard $[FREETYPE_LPATH]]
  260. #define freetype_cflags $[FREETYPE_CFLAGS]
  261. #define freetype_libs $[FREETYPE_LIBS]
  262. #define freetype_framework $[FREETYPE_FRAMEWORK]
  263. #endif
  264. #if $[and $[HAVE_MAYA],$[MAYA_LOCATION]]
  265. #define maya_ipath $[MAYA_LOCATION]/include
  266. #define maya_lpath $[MAYA_LOCATION]/lib
  267. #define maya_ld $[wildcard $[MAYA_LOCATION]/bin/mayald]
  268. #define maya_libs $[MAYA_LIBS]
  269. #endif
  270. #if $[and $[HAVE_SOFTIMAGE],$[SOFTIMAGE_LOCATION]]
  271. #define softimage_ipath $[SOFTIMAGE_LOCATION]/h
  272. #define softimage_lpath $[SOFTIMAGE_LOCATION]/dso
  273. #define softimage_libs $[SOFTIMAGE_LIBS]
  274. #endif
  275. #if $[HAVE_NET]
  276. #define net_ipath $[wildcard $[NET_IPATH]]
  277. #define net_lpath $[wildcard $[NET_LPATH]]
  278. #define net_libs $[NET_LIBS]
  279. #endif
  280. #if $[WANT_NATIVE_NET]
  281. #define native_net_ipath $[wildcard $[NATIVE_NET_IPATH]]
  282. #define native_net_lpath $[wildcard $[NATIVE_NET_LPATH]]
  283. #define native_net_libs $[NATIVE_NET_LIBS]
  284. #endif
  285. #if $[HAVE_RAD_MSS]
  286. #define rad_mss_ipath $[wildcard $[RAD_MSS_IPATH]]
  287. #define rad_mss_lpath $[wildcard $[RAD_MSS_LPATH]]
  288. #define rad_mss_libs $[RAD_MSS_LIBS]
  289. #endif
  290. #if $[HAVE_FMODEX]
  291. #define fmodex_ipath $[wildcard $[FMODEX_IPATH]]
  292. #define fmodex_lpath $[wildcard $[FMODEX_LPATH]]
  293. #define fmodex_cflags $[FMODEX_CFLAGS]
  294. #define fmodex_libs $[FMODEX_LIBS]
  295. #endif
  296. #if $[HAVE_CHROMIUM]
  297. #define chromium_ipath $[wildcard $[CHROMIUM_IPATH]]
  298. #define chromium_lpath $[wildcard $[CHROMIUM_LPATH]]
  299. #define chromium_libs $[CHROMIUM_LIBS]
  300. #endif
  301. // We define these two variables true here in the global scope; a
  302. // particular Sources.pp file can redefine these to be false to
  303. // prevent a particular directory or target from being built in
  304. // certain circumstances.
  305. #define BUILD_DIRECTORY 1
  306. #define BUILD_TARGET 1
  307. // This is the default extension for a Maya file. It might be
  308. // overridden within a maya_char_egg rule to convert a .ma file
  309. // instead.
  310. #define MAYA_EXTENSION .mb
  311. // This variable, when evaluated in the scope of a particular directory,
  312. // will indicate true (i.e. nonempty) when the directory is truly built,
  313. // or false (empty) when the directory is not to be built.
  314. #defer build_directory $[BUILD_DIRECTORY]
  315. // It maps to a direct evaluation of the user-set variable,
  316. // BUILD_DIRECTORY, for historical reasons. This also allows us to
  317. // reserve the right to extend this variable to test other conditions
  318. // as well, should the need arise.
  319. // This variable, when evaluated in the scope of a particular target,
  320. // will indicated true when the target should be built, or false when
  321. // the target is not to be built.
  322. #defer build_target $[BUILD_TARGET]
  323. // If we have USE_TAU but not TAU_MAKEFILE, we invoke the tau
  324. // instrumentor and compiler directly.
  325. #define direct_tau $[and $[USE_TAU],$[not $[TAU_MAKEFILE]]]
  326. #if $[and $[USE_TAU],$[TAU_MAKEFILE]]
  327. // Use the makefile-based rules to run the tau instrumentor.
  328. #defer compile_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C] $[TAU_CFLAGS]
  329. #defer compile_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  330. #defer link_bin_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C] $[TAU_CFLAGS]
  331. #defer link_bin_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  332. #defer shared_lib_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C] $[TAU_CFLAGS]
  333. #defer shared_lib_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  334. #else
  335. #defer compile_c $[COMPILE_C]
  336. #defer compile_c++ $[COMPILE_C++]
  337. #defer link_bin_c $[LINK_BIN_C]
  338. #defer link_bin_c++ $[LINK_BIN_C++]
  339. #defer shared_lib_c $[SHARED_LIB_C]
  340. #defer shared_lib_c++ $[SHARED_LIB_C++]
  341. #endif // USE_TAU
  342. // This takes advantage of the above two variables to get the actual
  343. // list of local libraries we are to link with, eliminating those that
  344. // won't be built.
  345. #defer active_local_libs \
  346. $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[LOCAL_LIBS]]
  347. #defer active_component_libs \
  348. $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[COMPONENT_LIBS]]
  349. #defer active_libs $[active_local_libs] $[active_component_libs]
  350. // We define $[complete_local_libs] as the full set of libraries (from
  351. // within this tree) that we must link a particular target with. It
  352. // is the transitive closure of our dependent libs: the libraries we
  353. // depend on, plus the libraries *those* libraries depend on, and so on.
  354. #defer complete_local_libs $[unique $[closure all_libs,$[active_libs]]]
  355. // And $[complete_ipath] is the list of directories (from within this
  356. // tree) we should add to our -I list. It's basically just one for
  357. // each directory named in the $[complete_local_libs], above, plus
  358. // whatever else the user might have explicitly named in
  359. // $[LOCAL_INCS]. LOCAL_INCS MUST be a ppremake src dir! (RELDIR only
  360. // checks those) To add an arbitrary extra include dir, define
  361. // EXTRA_IPATH in the Sources.pp
  362. #defer complete_ipath $[all_libs $[RELDIR],$[complete_local_libs]] $[RELDIR($[LOCAL_INCS:%=%/])] $[EXTRA_IPATH]
  363. // This variable, when evaluated within a target, will either be empty
  364. // string if the target is not to be built, or the target name if it
  365. // is.
  366. #defer active_target $[if $[build_target],$[TARGET]]
  367. #defer get_combined_sources $[COMBINED_SOURCES]
  368. // This subroutine will set up the sources variable to reflect the
  369. // complete set of sources for this target, and also set the
  370. // alt_cflags, alt_libs, etc. as appropriate according to how the
  371. // various USE_* flags are set for the current target.
  372. // This variable returns the complete set of sources for the current
  373. // target.
  374. #defer get_sources \
  375. $[SOURCES] \
  376. $[if $[or $[NO_COMBINED_SOURCES],$[USE_TAU]], $[INCLUDED_SOURCES], $[get_combined_sources]]
  377. #defer included_sources $[INCLUDED_SOURCES]
  378. // This variable returns the set of sources that are to be
  379. // interrogated for the current target.
  380. #defer get_igatescan \
  381. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  382. $[if $[eq $[IGATESCAN], all], \
  383. $[filter-out %.I %.T %.lxx %.yxx %.N %_src.cxx,$[get_sources]], \
  384. $[IGATESCAN]]]
  385. // This variable returns the name of the interrogate database file
  386. // that will be generated for a particular target, or empty string if
  387. // the target is not to be interrogated.
  388. #defer get_igatedb \
  389. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  390. $[ODIR]/lib$[TARGET]$[dllext].in]
  391. // This variable returns the name of the interrogate code file
  392. // that will be generated for a particular target, or empty string if
  393. // the target is not to be interrogated.
  394. #defer get_igateoutput \
  395. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  396. $[ODIR]/lib$[TARGET]_igate.cxx]
  397. // This variable is the set of .in files generated by all of our
  398. // component libraries. If it is nonempty, then we do need to
  399. // generate a module, and $[get_igatemout] is the name of the .cxx file
  400. // that interrogate will produce to make this module.
  401. #defer get_igatemscan $[components $[get_igatedb:%=$[RELDIR]/%],$[active_component_libs]]
  402. #defer get_igatemout $[if $[get_igatemscan],$[ODIR]/lib$[TARGET]_module.cxx]
  403. // This variable returns the set of external packages used by this
  404. // target, and by all the components shared by this target.
  405. #defer use_packages $[unique $[USE_PACKAGES] $[all_libs $[USE_PACKAGES],$[active_component_libs] $[complete_local_libs]]]
  406. // This function returns the appropriate cflags for the target, based
  407. // on the various external packages this particular target claims to
  408. // require.
  409. #defun get_cflags
  410. // hack to add stl,python. should be removed
  411. #define alt_cflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_cflags] $[python_cflags]]
  412. #foreach package $[use_packages]
  413. #set alt_cflags $[alt_cflags] $[$[package]_cflags]
  414. #end package
  415. $[alt_cflags]
  416. #end get_cflags
  417. // This function returns the appropriate lflags for the target, based
  418. // on the various external packages this particular target claims to
  419. // require.
  420. #defun get_lflags
  421. // hack to add stl,python. should be removed
  422. #define alt_lflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lflags] $[python_lflags]]
  423. #foreach package $[use_packages]
  424. #set alt_lflags $[alt_lflags] $[$[package]_lflags]
  425. #end package
  426. $[alt_lflags]
  427. #end get_lflags
  428. // This function returns the appropriate include path for the target,
  429. // based on the various external packages this particular target
  430. // claims to require. This returns a space-separated set of directory
  431. // names only; the -I switch is not included here.
  432. #defun get_ipath
  433. // hack to add stl,python. should be removed
  434. #define alt_ipath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_ipath] $[python_ipath]]
  435. #foreach package $[use_packages]
  436. #set alt_ipath $[alt_ipath] $[$[package]_ipath]
  437. #end package
  438. $[alt_ipath]
  439. #end get_ipath
  440. // This function returns the appropriate library search path for the
  441. // target, based on the various external packages this particular
  442. // target claims to require. This returns a space-separated set of
  443. // directory names only; the -L switch is not included here.
  444. #defun get_lpath
  445. #define alt_lpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lpath] $[python_lpath]]
  446. #if $[WINDOWS_PLATFORM]
  447. #set alt_lpath $[WIN32_PLATFORMSDK_LIBPATH] $[alt_lpath]
  448. #endif
  449. #foreach package $[use_packages]
  450. #set alt_lpath $[alt_lpath] $[$[package]_lpath]
  451. #end package
  452. $[alt_lpath]
  453. #end get_lpath
  454. // This function returns the appropriate framework search path for the
  455. // target, based on the various external frameworks this particular
  456. // target claims to require. This returns a space-separated set of
  457. // directory names only; the -F switch is not included here.
  458. #defun get_fpath
  459. #define alt_fpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_fpath] $[python_fpath]]
  460. #foreach package $[use_packages]
  461. #set alt_fpath $[alt_fpath] $[$[package]_fpath]
  462. #end package
  463. $[alt_fpath]
  464. #end get_fpath
  465. // This function returns the appropriate framework for the
  466. // target, based on the various external frameworks this particular
  467. // target claims to require. This returns a space-separated set of
  468. // framework names only; the -framework switch is not included here.
  469. #defun get_frameworks
  470. #define alt_frameworks $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_framework] $[python_framework]]
  471. #if $[OSX_PLATFORM]
  472. #set alt_frameworks $[alt_frameworks] $[OSX_SYS_FRAMEWORKS]
  473. #endif
  474. #foreach package $[use_packages]
  475. #set alt_frameworks $[alt_frameworks] $[$[package]_framework]
  476. #end package
  477. $[alt_frameworks]
  478. #end get_frameworks
  479. // This function returns the appropriate set of library names to link
  480. // with for the target, based on the various external packages this
  481. // particular target claims to require. This returns a
  482. // space-separated set of library names only; the -l switch is not
  483. // included here.
  484. #defun get_libs
  485. #define alt_libs $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_libs] $[python_libs]]
  486. #define alt_libs $[alt_libs] $[EXTRA_LIBS]
  487. #if $[WINDOWS_PLATFORM]
  488. #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_libs] $[transitive_link]]
  489. #elif $[OSX_PLATFORM]
  490. #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_libs] $[transitive_link]]
  491. #else
  492. #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_libs] $[transitive_link]]
  493. #endif
  494. #foreach package $[use_packages]
  495. #set alt_libs $[alt_libs] $[$[package]_libs]
  496. #end package
  497. $[alt_libs]
  498. #end get_libs
  499. // This function returns the appropriate value for ld for the target.
  500. #defun get_ld
  501. #if $[filter maya,$[use_packages]]
  502. $[maya_ld]
  503. #endif
  504. #end get_ld
  505. // This function determines the set of files a given source file
  506. // depends on. It is based on the setting of the $[filename]_sources
  507. // variable to indicate the sources for composite files, etc.
  508. #defun get_depends source
  509. #if $[$[source]_sources]
  510. #if $[ne $[$[source]_sources],none]
  511. $[$[source]_sources] $[dependencies $[$[source]_sources]]
  512. #endif
  513. #else
  514. $[dependencies $[source]]
  515. #endif
  516. #end get_depends
  517. // This function determines the set of libraries our various targets
  518. // depend on. This is a complicated definition. It is the union of
  519. // all of our targets' dependencies, except:
  520. // If a target is part of a metalib, it depends (a) directly on all of
  521. // its normal library dependencies that are part of the same metalib,
  522. // and (b) indirectly on all of the metalibs that every other library
  523. // dependency is part of. If a target is not part of a metalib, it is
  524. // the same as case (b) above.
  525. #defun get_depend_libs
  526. #define depend_libs
  527. #forscopes lib_target noinst_lib_target test_lib_target
  528. #define metalib $[module $[TARGET],$[TARGET]]
  529. #if $[ne $[metalib],]
  530. // This library is included on a metalib.
  531. #foreach depend $[LOCAL_LIBS]
  532. #define depend_metalib $[module $[TARGET],$[depend]]
  533. #if $[eq $[depend_metalib],$[metalib]]
  534. // Here's a dependent library in the *same* metalib.
  535. #set depend_libs $[depend_libs] $[depend]
  536. #elif $[ne $[depend_metalib],]
  537. // This dependent library is in a *different* metalib.
  538. #set depend_libs $[depend_libs] $[depend_metalib]
  539. #else
  540. // This dependent library is not in any metalib.
  541. #set depend_libs $[depend_libs] $[depend]
  542. #endif
  543. #end depend
  544. #else
  545. // This library is *not* included on a metalib.
  546. #foreach depend $[LOCAL_LIBS]
  547. #define depend_metalib $[module $[TARGET],$[depend]]
  548. #if $[ne $[depend_metalib],]
  549. // This dependent library is on a metalib.
  550. #set depend_libs $[depend_libs] $[depend_metalib]
  551. #else
  552. // This dependent library is not in any metalib.
  553. #set depend_libs $[depend_libs] $[depend]
  554. #endif
  555. #end depend
  556. #endif
  557. #end lib_target noinst_lib_target test_lib_target
  558. // These will never be part of a metalib.
  559. #forscopes static_lib_target ss_lib_target bin_target noinst_bin_target metalib_target
  560. #foreach depend $[LOCAL_LIBS]
  561. #define depend_metalib $[module $[TARGET],$[depend]]
  562. #if $[ne $[depend_metalib],]
  563. // This dependent library is on a metalib.
  564. #if $[eq $[depend_metalib],$[TARGET]]
  565. #print Warning: $[TARGET] circularly depends on $[depend].
  566. #else
  567. #set depend_libs $[depend_libs] $[depend_metalib]
  568. #endif
  569. #else
  570. // This dependent library is not in any metalib.
  571. #set depend_libs $[depend_libs] $[depend]
  572. #endif
  573. #end depend
  574. #end static_lib_target ss_lib_target bin_target noinst_bin_target metalib_target
  575. // In case we're defining any metalibs, these depend directly on
  576. // their components as well.
  577. #set depend_libs $[depend_libs] $[COMPONENT_LIBS(metalib_target)]
  578. $[depend_libs]
  579. #end get_depend_libs
  580. // dtool/pptempl/Global.pp
  581. // Define a few directories that will be useful.
  582. #define install_dir $[$[upcase $[PACKAGE]]_INSTALL]
  583. #if $[eq $[install_dir],]
  584. #error Variable $[upcase $[PACKAGE]]_INSTALL is not set! Cannot install!
  585. #endif
  586. #define other_trees
  587. #define other_trees_lib
  588. #define other_trees_include
  589. #foreach tree $[NEEDS_TREES]
  590. #define tree_install $[$[upcase $[tree]]_INSTALL]
  591. #if $[eq $[tree_install],]
  592. Warning: Variable $[upcase $[tree]]_INSTALL is not set!
  593. #else
  594. #set other_trees $[other_trees] $[tree_install]
  595. #set other_trees_lib $[other_trees_lib] $[tree_install]/lib
  596. #set other_trees_include $[other_trees_include] $[tree_install]/include
  597. #endif
  598. #end tree
  599. #define install_lib_dir $[or $[INSTALL_LIB_DIR],$[install_dir]/lib]
  600. #define other_trees_lib $[or $[INSTALL_LIB_DIR],$[other_trees_lib]]
  601. #define install_headers_dir $[or $[INSTALL_HEADERS_DIR],$[install_dir]/include]
  602. #define other_trees_include $[or $[INSTALL_HEADERS_DIR],$[other_trees_include]]
  603. #define install_bin_dir $[or $[INSTALL_BIN_DIR],$[install_dir]/bin]
  604. #define install_data_dir $[or $[INSTALL_DATA_DIR],$[install_dir]/shared]
  605. #define install_igatedb_dir $[or $[INSTALL_IGATEDB_DIR],$[install_dir]/etc]
  606. #define install_config_dir $[or $[INSTALL_CONFIG_DIR],$[install_dir]/etc]
  607. #defer install_py_dir $[install_lib_dir]/$[PACKAGE]/$[DIRNAME]
  608. #defer install_py_package_dir $[install_lib_dir]/$[PACKAGE]
  609. #if $[ne $[DTOOL_INSTALL],]
  610. #define install_parser_inc_dir $[DTOOL_INSTALL]/include/parser-inc
  611. #else
  612. #define install_parser_inc_dir $[install_headers_dir]/parser-inc
  613. #endif
  614. // Set up the correct interrogate options.
  615. // $[dllext] is redefined in the Windows Global.platform.pp files to
  616. // the string _d if we are building a debug tree. This is inserted
  617. // into the .dll and .in filenames before the extension to make a
  618. // runtime distinction between debug and non-debug builds. For now,
  619. // we make a global definition to empty string, since non-Windows
  620. // platforms will leave this empty.
  621. #define dllext
  622. // $[obj_prefix] defines the prefix that is prepended to the name of
  623. // the object files. It can be used to avoid potential collisions
  624. // when a source file is used by multiple targets but with different
  625. // compile options for each.
  626. //
  627. // $[obj_prefix] may be redefined by one of the Global.platform.pp
  628. // files.
  629. #defer obj_prefix $[TARGET]_
  630. // Caution! interrogate_ipath might be redefined in the
  631. // Global.platform.pp file.
  632. #defer interrogate_ipath $[install_parser_inc_dir:%=-S%] $[target_ipath:%=-I%]
  633. #defer interrogate_options \
  634. -DCPPPARSER -D__STDC__=1 -D__cplusplus $[SYSTEM_IGATE_FLAGS] \
  635. $[interrogate_ipath] \
  636. $[CDEFINES_OPT$[OPTIMIZE]:%=-D%] \
  637. $[filter -D%,$[C++FLAGS]] \
  638. $[INTERROGATE_OPTIONS] \
  639. $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \
  640. $[if $[INTERROGATE_C_INTERFACE],-c] \
  641. $[if $[TRACK_IN_INTERPRETER],-track-interpreter] \
  642. $[if $[<= $[OPTIMIZE], 1],-spam]
  643. #defer interrogate_module_options \
  644. $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \
  645. $[if $[INTERROGATE_C_INTERFACE],-c] \
  646. $[if $[TRACK_IN_INTERPRETER],-track-interpreter]
  647. // The language stuff is used by model builds only.
  648. // Set language_filters to be "%_english %_castillian %_japanese %_german" etc.
  649. #if $[LANGUAGES]
  650. #define language_filters $[subst <pct>,%,$[LANGUAGES:%=<pct>_%]]
  651. #print Using language $[LANGUAGE]
  652. #else
  653. #define language_filters
  654. #endif
  655. #define language_egg_filters $[language_filters:%=%.egg]
  656. #define language_dna_filters $[language_filters:%=%.dna]
  657. // This is used for evaluating SoftImage unpack rules in Template.models.pp.
  658. #defer soft_scene_files $[matrix $[DATABASE]/SCENES/$[SCENE_PREFIX],$[MODEL] $[ANIMS],.1-0.dsc]
  659. // Include the global definitions for this particular build_type, if
  660. // the file is there.
  661. #sinclude $[GLOBAL_TYPE_FILE]