Global.pp 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922
  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 */dynamic_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. #map libs TARGET(*/lib_target */static_lib_target */dynamic_lib_target */ss_lib_target */noinst_lib_target */test_lib_target */metalib_target)
  37. // This lets us identify which metalib, if any, is including each
  38. // named library. That is, $[module $[TARGET],name] will return
  39. // the name of the metalib that includes library name.
  40. #map module COMPONENT_LIBS(*/metalib_target)
  41. // This lets up look up components of a particular metalib.
  42. #map components TARGET(*/lib_target */noinst_lib_target */test_lib_target)
  43. // And this lets us look up source directories by dirname.
  44. #map dirnames DIRNAME(*/)
  45. // This is used by Template.models.pp.
  46. #if $[HAVE_SOFTIMAGE]
  47. #define SOFT2EGG soft -D libsoftegg soft2egg
  48. #else
  49. // We used to use the old converter from pre-Panda days. Now this
  50. // is no longer supported.
  51. // #define SOFT2EGG soft2egg
  52. #define SOFT2EGG soft -D libsoftegg soft2egg
  53. #endif
  54. // Define some various compile flags, derived from the variables set
  55. // in Config.pp.
  56. #set INTERROGATE_PYTHON_INTERFACE $[and $[HAVE_PYTHON],$[INTERROGATE_PYTHON_INTERFACE]]
  57. #define run_interrogate $[HAVE_INTERROGATE]
  58. #define stl_ipath $[wildcard $[STL_IPATH]]
  59. #define stl_lpath $[wildcard $[STL_LPATH]]
  60. #define stl_cflags $[STL_CFLAGS]
  61. #define stl_libs $[STL_LIBS]
  62. #if $[HAVE_PYTHON]
  63. #define python_ipath $[wildcard $[PYTHON_IPATH]]
  64. #define python_lpath $[wildcard $[PYTHON_LPATH]]
  65. #define python_fpath $[wildcard $[PYTHON_FPATH]]
  66. #define python_cflags $[PYTHON_CFLAGS]
  67. #define python_lflags $[PYTHON_LFLAGS]
  68. #define python_libs $[PYTHON_LIBS]
  69. #define python_framework $[PYTHON_FRAMEWORK]
  70. #endif
  71. #if $[HAVE_THREADS]
  72. #define threads_ipath $[wildcard $[THREADS_IPATH]]
  73. #define threads_lpath $[wildcard $[THREADS_LPATH]]
  74. #define threads_cflags $[THREADS_CFLAGS]
  75. #define threads_libs $[THREADS_LIBS]
  76. #define threads_framework $[THREADS_FRAMEWORK]
  77. #endif
  78. #if $[HAVE_OPENSSL]
  79. #define openssl_ipath $[wildcard $[OPENSSL_IPATH]]
  80. #define openssl_lpath $[wildcard $[OPENSSL_LPATH]]
  81. #define openssl_cflags $[OPENSSL_CFLAGS]
  82. #define openssl_libs $[OPENSSL_LIBS]
  83. #endif
  84. #if $[HAVE_ZLIB]
  85. #define zlib_ipath $[wildcard $[ZLIB_IPATH]]
  86. #define zlib_lpath $[wildcard $[ZLIB_LPATH]]
  87. #define zlib_cflags $[ZLIB_CFLAGS]
  88. #define zlib_libs $[ZLIB_LIBS]
  89. #endif
  90. #if $[HAVE_GL]
  91. #define gl_ipath $[wildcard $[GL_IPATH]]
  92. #define gl_lpath $[wildcard $[GL_LPATH]]
  93. #define gl_cflags $[GL_CFLAGS]
  94. #define gl_libs $[GL_LIBS] $[if $[HAVE_GLU],$[GLU_LIBS]]
  95. #define gl_framework $[GL_FRAMEWORK]
  96. #endif
  97. #if $[HAVE_GLES]
  98. #define gles_ipath $[wildcard $[GLES_IPATH]]
  99. #define gles_lpath $[wildcard $[GLES_LPATH]]
  100. #define gles_cflags $[GLES_CFLAGS]
  101. #define gles_libs $[GLES_LIBS]
  102. #endif
  103. #if $[HAVE_GLES2]
  104. #define gles2_ipath $[wildcard $[GLES2_IPATH]]
  105. #define gles2_lpath $[wildcard $[GLES2_LPATH]]
  106. #define gles2_cflags $[GLES2_CFLAGS]
  107. #define gles2_libs $[GLES2_LIBS]
  108. #endif
  109. #if $[HAVE_SDL]
  110. #define sdl_ipath $[wildcard $[SDL_IPATH]]
  111. #define sdl_lpath $[wildcard $[SDL_LPATH]]
  112. #define sdl_cflags $[SDL_CFLAGS]
  113. #define sdl_libs $[SDL_LIBS]
  114. #define sdl_framework $[SDL_FRAMEWORK]
  115. #endif
  116. #if $[HAVE_X11]
  117. #define x11_ipath $[wildcard $[X11_IPATH]]
  118. #define x11_lpath $[wildcard $[X11_LPATH]]
  119. #define x11_cflags $[X11_CFLAGS]
  120. #define x11_libs $[X11_LIBS]
  121. #define x11_framework $[X11_FRAMEWORK]
  122. #endif
  123. #if $[HAVE_XF86DGA]
  124. #define xf86dga_ipath $[wildcard $[XF86DGA_IPATH]]
  125. #define xf86dga_lpath $[wildcard $[XF86DGA_LPATH]]
  126. #define xf86dga_cflags $[XF86DGA_CFLAGS]
  127. #define xf86dga_libs $[XF86DGA_LIBS]
  128. #endif
  129. #if $[HAVE_MESA]
  130. #define mesa_ipath $[wildcard $[MESA_IPATH]]
  131. #define mesa_lpath $[wildcard $[MESA_LPATH]]
  132. #define mesa_cflags $[MESA_CFLAGS]
  133. #define mesa_libs $[MESA_LIBS]
  134. #endif
  135. #if $[HAVE_CHROMIUM]
  136. #define chromium_ipath $[wildcard $[CHROMIUM_IPATH]]
  137. #define chromium_lpath $[wildcard $[CHROMIUM_LPATH]]
  138. #define chromium_cflags $[CHROMIUM_CFLAGS]
  139. #define chromium_libs $[CHROMIUM_LIBS]
  140. #endif
  141. #if $[HAVE_GLX]
  142. #define glx_ipath $[wildcard $[GLX_IPATH]]
  143. #define glx_lpath $[wildcard $[GLX_LPATH]]
  144. #define glx_cflags $[GLX_CFLAGS]
  145. #define glx_libs $[GLX_LIBS]
  146. #endif
  147. #if $[HAVE_EGL]
  148. #define egl_ipath $[wildcard $[EGL_IPATH]]
  149. #define egl_lpath $[wildcard $[EGL_LPATH]]
  150. #define egl_cflags $[EGL_CFLAGS]
  151. #define egl_libs $[EGL_LIBS]
  152. #endif
  153. #if $[HAVE_GLUT]
  154. #define glut_ipath $[wildcard $[GLUT_IPATH]]
  155. #define glut_lpath $[wildcard $[GLUT_LPATH]]
  156. #define glut_cflags $[GLUT_CFLAGS]
  157. #define glut_libs $[GLUT_LIBS]
  158. #endif
  159. #if $[HAVE_DX8]
  160. #define dx8_ipath $[wildcard $[DX8_IPATH]]
  161. #define dx8_lpath $[wildcard $[DX8_LPATH]]
  162. #define dx8_cflags $[DX8_CFLAGS]
  163. #define dx8_libs $[DX8_LIBS]
  164. #endif
  165. #if $[HAVE_DX9]
  166. #define dx9_ipath $[wildcard $[DX9_IPATH]]
  167. #define dx9_lpath $[wildcard $[DX9_LPATH]]
  168. #define dx9_cflags $[DX9_CFLAGS]
  169. #define dx9_libs $[DX9_LIBS]
  170. #endif
  171. #if $[HAVE_OPENCV]
  172. #define opencv_ipath $[wildcard $[OPENCV_IPATH]]
  173. #define opencv_lpath $[wildcard $[OPENCV_LPATH]]
  174. #define opencv_cflags $[OPENCV_CFLAGS]
  175. #define opencv_libs $[OPENCV_LIBS]
  176. #endif
  177. #if $[HAVE_FFMPEG]
  178. #define ffmpeg_ipath $[wildcard $[FFMPEG_IPATH]]
  179. #define ffmpeg_lpath $[wildcard $[FFMPEG_LPATH]]
  180. #define ffmpeg_cflags $[FFMPEG_CFLAGS]
  181. #define ffmpeg_libs $[FFMPEG_LIBS]
  182. #endif
  183. #if $[HAVE_ODE]
  184. #define ode_ipath $[wildcard $[ODE_IPATH]]
  185. #define ode_lpath $[wildcard $[ODE_LPATH]]
  186. #define ode_cflags $[ODE_CFLAGS]
  187. #define ode_libs $[ODE_LIBS]
  188. #endif
  189. #if $[HAVE_AWESOMIUM]
  190. #define awesomium_ipath $[wildcard $[AWESOMIUM_IPATH]]
  191. #define awesomium_lpath $[wildcard $[AWESOMIUM_LPATH]]
  192. #define awesomium_libs $[AWESOMIUM_LIBS]
  193. #define awesomium_framework $[AWESOMIUM_FRAMEWORK]
  194. #endif
  195. #if $[HAVE_NPAPI]
  196. #define npapi_ipath $[wildcard $[NPAPI_IPATH]]
  197. #define npapi_lpath $[wildcard $[NPAPI_LPATH]]
  198. #define npapi_cflags $[NPAPI_CFLAGS]
  199. #define npapi_libs $[NPAPI_LIBS]
  200. #define npapi_framework $[NPAPI_FRAMEWORK]
  201. #endif
  202. #if $[HAVE_JPEG]
  203. #define jpeg_ipath $[wildcard $[JPEG_IPATH]]
  204. #define jpeg_lpath $[wildcard $[JPEG_LPATH]]
  205. #define jpeg_cflags $[JPEG_CFLAGS]
  206. #define jpeg_libs $[JPEG_LIBS]
  207. #endif
  208. #if $[HAVE_PNG]
  209. #define png_ipath $[wildcard $[PNG_IPATH]]
  210. #define png_lpath $[wildcard $[PNG_LPATH]]
  211. #define png_cflags $[PNG_CFLAGS]
  212. #define png_libs $[PNG_LIBS]
  213. #endif
  214. #if $[HAVE_TIFF]
  215. #define tiff_ipath $[wildcard $[TIFF_IPATH]]
  216. #define tiff_lpath $[wildcard $[TIFF_LPATH]]
  217. #define tiff_cflags $[TIFF_CFLAGS]
  218. #define tiff_libs $[TIFF_LIBS]
  219. #endif
  220. #if $[HAVE_TAR]
  221. #define tar_ipath $[wildcard $[TAR_IPATH]]
  222. #define tar_lpath $[wildcard $[TAR_LPATH]]
  223. #define tar_cflags $[TAR_CFLAGS]
  224. #define tar_libs $[TAR_LIBS]
  225. #endif
  226. #if $[HAVE_FFTW]
  227. #define fftw_ipath $[wildcard $[FFTW_IPATH]]
  228. #define fftw_lpath $[wildcard $[FFTW_LPATH]]
  229. #define fftw_cflags $[FFTW_CFLAGS]
  230. #define fftw_libs $[FFTW_LIBS]
  231. #endif
  232. #if $[HAVE_SQUISH]
  233. #define squish_ipath $[wildcard $[SQUISH_IPATH]]
  234. #define squish_lpath $[wildcard $[SQUISH_LPATH]]
  235. #define squish_cflags $[SQUISH_CFLAGS]
  236. #define squish_libs $[SQUISH_LIBS]
  237. #endif
  238. #if $[HAVE_BDB]
  239. #define bdb_ipath $[wildcard $[BDB_IPATH]]
  240. #define bdb_lpath $[wildcard $[BDB_LPATH]]
  241. #define bdb_cflags $[BDB_CFLAGS]
  242. #define bdb_libs $[BDB_LIBS]
  243. #endif
  244. #if $[HAVE_CG]
  245. #define cg_ipath $[wildcard $[CG_IPATH]]
  246. #define cg_lpath $[wildcard $[CG_LPATH]]
  247. #define cg_cflags $[CG_CFLAGS]
  248. #define cg_libs $[CG_LIBS]
  249. #define cg_framework $[CG_FRAMEWORK]
  250. #endif
  251. #if $[HAVE_CGGL]
  252. #define cggl_ipath $[wildcard $[CGGL_IPATH]]
  253. #define cggl_lpath $[wildcard $[CGGL_LPATH]]
  254. #define cggl_cflags $[CGGL_CFLAGS]
  255. #define cggl_libs $[CGGL_LIBS]
  256. #define cggl_framework $[CGGL_FRAMEWORK]
  257. #endif
  258. #if $[HAVE_CGDX8]
  259. #define cgdx8_ipath $[wildcard $[CGDX8_IPATH]]
  260. #define cgdx8_lpath $[wildcard $[CGDX8_LPATH]]
  261. #define cgdx8_cflags $[CGDX8_CFLAGS]
  262. #define cgdx8_libs $[CGDX8_LIBS]
  263. #endif
  264. #if $[HAVE_CGDX9]
  265. #define cgdx9_ipath $[wildcard $[CGDX9_IPATH]]
  266. #define cgdx9_lpath $[wildcard $[CGDX9_LPATH]]
  267. #define cgdx9_cflags $[CGDX9_CFLAGS]
  268. #define cgdx9_libs $[CGDX9_LIBS]
  269. #endif
  270. #if $[HAVE_CGDX10]
  271. #define cgdx10_ipath $[wildcard $[CGDX10_IPATH]]
  272. #define cgdx10_lpath $[wildcard $[CGDX10_LPATH]]
  273. #define cgdx10_cflags $[CGDX10_CFLAGS]
  274. #define cgdx10_libs $[CGDX10_LIBS]
  275. #endif
  276. #if $[HAVE_VRPN]
  277. #define vrpn_ipath $[wildcard $[VRPN_IPATH]]
  278. #define vrpn_lpath $[wildcard $[VRPN_LPATH]]
  279. #define vrpn_cflags $[VRPN_CFLAGS]
  280. #define vrpn_libs $[VRPN_LIBS]
  281. #endif
  282. #if $[HAVE_HELIX]
  283. #define helix_ipath $[wildcard $[HELIX_IPATH]]
  284. #define helix_lpath $[wildcard $[HELIX_LPATH]]
  285. #define helix_cflags $[HELIX_CFLAGS]
  286. #define helix_libs $[HELIX_LIBS]
  287. #endif
  288. #if $[HAVE_MIKMOD]
  289. #define mikmod_ipath $[wildcard $[MIKMOD_IPATH]]
  290. #define mikmod_lpath $[wildcard $[MIKMOD_LPATH]]
  291. #define mikmod_cflags $[MIKMOD_CFLAGS]
  292. #define mikmod_libs $[MIKMOD_LIBS]
  293. #endif
  294. #if $[HAVE_GTK]
  295. #define gtk_ipath $[wildcard $[GTK_IPATH]]
  296. #define gtk_lpath $[wildcard $[GTK_LPATH]]
  297. #define gtk_cflags $[GTK_CFLAGS]
  298. #define gtk_libs $[GTK_LIBS]
  299. #endif
  300. #if $[HAVE_FREETYPE]
  301. #define freetype_ipath $[wildcard $[FREETYPE_IPATH]]
  302. #define freetype_lpath $[wildcard $[FREETYPE_LPATH]]
  303. #define freetype_cflags $[FREETYPE_CFLAGS]
  304. #define freetype_libs $[FREETYPE_LIBS]
  305. #define freetype_framework $[FREETYPE_FRAMEWORK]
  306. #endif
  307. #if $[HAVE_WX]
  308. #define wx_ipath $[wildcard $[WX_IPATH]]
  309. #define wx_lpath $[wildcard $[WX_LPATH]]
  310. #define wx_cflags $[WX_CFLAGS]
  311. #define wx_lflags $[WX_LFLAGS]
  312. #define wx_libs $[WX_LIBS]
  313. #define wx_framework $[WX_FRAMEWORK]
  314. #endif
  315. #if $[and $[HAVE_MAYA],$[MAYA_LOCATION]]
  316. #define maya_ipath $[MAYA_LOCATION]/include
  317. #define maya_lpath $[MAYA_LOCATION]/lib
  318. #define maya_ld $[wildcard $[MAYA_LOCATION]/bin/mayald]
  319. #define maya_libs $[MAYA_LIBS]
  320. #endif
  321. #if $[and $[HAVE_SOFTIMAGE],$[SOFTIMAGE_LOCATION]]
  322. #define softimage_ipath $[SOFTIMAGE_LOCATION]/h
  323. #define softimage_lpath $[SOFTIMAGE_LOCATION]/dso
  324. #define softimage_libs $[SOFTIMAGE_LIBS]
  325. #endif
  326. #if $[HAVE_NET]
  327. #define net_ipath $[wildcard $[NET_IPATH]]
  328. #define net_lpath $[wildcard $[NET_LPATH]]
  329. #define net_libs $[NET_LIBS]
  330. #endif
  331. #if $[WANT_NATIVE_NET]
  332. #define native_net_ipath $[wildcard $[NATIVE_NET_IPATH]]
  333. #define native_net_lpath $[wildcard $[NATIVE_NET_LPATH]]
  334. #define native_net_libs $[NATIVE_NET_LIBS]
  335. #endif
  336. #if $[HAVE_RAD_MSS]
  337. #define rad_mss_ipath $[wildcard $[RAD_MSS_IPATH]]
  338. #define rad_mss_lpath $[wildcard $[RAD_MSS_LPATH]]
  339. #define rad_mss_libs $[RAD_MSS_LIBS]
  340. #endif
  341. #if $[HAVE_FMODEX]
  342. #define fmodex_ipath $[wildcard $[FMODEX_IPATH]]
  343. #define fmodex_lpath $[wildcard $[FMODEX_LPATH]]
  344. #define fmodex_cflags $[FMODEX_CFLAGS]
  345. #define fmodex_libs $[FMODEX_LIBS]
  346. #endif
  347. #if $[HAVE_OPENAL]
  348. #define openal_ipath $[wildcard $[OPENAL_IPATH]]
  349. #define openal_lpath $[wildcard $[OPENAL_LPATH]]
  350. #define openal_libs $[OPENAL_LIBS]
  351. #define openal_framework $[OPENAL_FRAMEWORK]
  352. #endif
  353. #if $[HAVE_PHYSX]
  354. #define physx_ipath $[wildcard $[PHYSX_IPATH]]
  355. #define physx_lpath $[wildcard $[PHYSX_LPATH]]
  356. #define physx_libs $[PHYSX_LIBS]
  357. #endif
  358. #if $[HAVE_TINYXML]
  359. #define tinyxml_ipath $[wildcard $[TINYXML_IPATH]]
  360. #define tinyxml_lpath $[wildcard $[TINYXML_LPATH]]
  361. #define tinyxml_libs $[TINYXML_LIBS]
  362. #endif
  363. #if $[HAVE_CHROMIUM]
  364. #define chromium_ipath $[wildcard $[CHROMIUM_IPATH]]
  365. #define chromium_lpath $[wildcard $[CHROMIUM_LPATH]]
  366. #define chromium_libs $[CHROMIUM_LIBS]
  367. #endif
  368. #if $[HAVE_FCOLLADA]
  369. #define fcollada_ipath $[wildcard $[FCOLLADA_IPATH]]
  370. #define fcollada_lpath $[wildcard $[FCOLLADA_LPATH]]
  371. #define fcollada_libs $[FCOLLADA_LIBS]
  372. #endif
  373. #if $[HAVE_ARTOOLKIT]
  374. #define artoolkit_ipath $[wildcard $[ARTOOLKIT_IPATH]]
  375. #define artoolkit_lpath $[wildcard $[ARTOOLKIT_LPATH]]
  376. #define artoolkit_libs $[ARTOOLKIT_LIBS]
  377. #endif
  378. // We define these two variables true here in the global scope; a
  379. // particular Sources.pp file can redefine these to be false to
  380. // prevent a particular directory or target from being built in
  381. // certain circumstances.
  382. #define BUILD_DIRECTORY 1
  383. #define BUILD_TARGET 1
  384. // This is the default extension for a Maya file. It might be
  385. // overridden within a maya_char_egg rule to convert a .ma file
  386. // instead.
  387. #define MAYA_EXTENSION .mb
  388. // This variable, when evaluated in the scope of a particular directory,
  389. // will indicate true (i.e. nonempty) when the directory is truly built,
  390. // or false (empty) when the directory is not to be built.
  391. #defer build_directory $[BUILD_DIRECTORY]
  392. // It maps to a direct evaluation of the user-set variable,
  393. // BUILD_DIRECTORY, for historical reasons. This also allows us to
  394. // reserve the right to extend this variable to test other conditions
  395. // as well, should the need arise.
  396. // This variable, when evaluated in the scope of a particular target,
  397. // will indicated true when the target should be built, or false when
  398. // the target is not to be built.
  399. #defer build_target $[BUILD_TARGET]
  400. // If we have USE_TAU but not TAU_MAKEFILE, we invoke the tau
  401. // instrumentor and compiler directly.
  402. #define direct_tau $[and $[USE_TAU],$[not $[TAU_MAKEFILE]]]
  403. #if $[and $[USE_TAU],$[TAU_MAKEFILE]]
  404. // Use the makefile-based rules to run the tau instrumentor.
  405. #defer compile_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C] $[TAU_CFLAGS]
  406. #defer compile_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  407. #defer link_bin_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C] $[TAU_CFLAGS]
  408. #defer link_bin_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  409. #defer shared_lib_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C] $[TAU_CFLAGS]
  410. #defer shared_lib_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  411. #else
  412. #defer compile_c $[COMPILE_C]
  413. #defer compile_c++ $[COMPILE_C++]
  414. #defer link_bin_c $[LINK_BIN_C]
  415. #defer link_bin_c++ $[LINK_BIN_C++]
  416. #defer shared_lib_c $[SHARED_LIB_C]
  417. #defer shared_lib_c++ $[SHARED_LIB_C++]
  418. #endif // USE_TAU
  419. #defer static_lib_c $[STATIC_LIB_C]
  420. #defer static_lib_c++ $[STATIC_LIB_C++]
  421. #defer bundle_lib_c $[BUNDLE_LIB_C++]
  422. #defer bundle_lib_c++ $[BUNDLE_LIB_C++]
  423. // "lib" is the default prefix applied to every generated library.
  424. // This comes from Unix convention. This can be redefined on a
  425. // per-target basis.
  426. #define LIB_PREFIX lib
  427. #defer lib_prefix $[LIB_PREFIX]
  428. // OSX has a "bundle" concept. This is kind of like a dylib, but not
  429. // quite. Sometimes you might want to link a library *as* a bundle
  430. // instead of as a dylib; sometimes you might want to link a library
  431. // into a dylib *and* a bundle.
  432. #defer bundle_ext $[BUNDLE_EXT]
  433. #defer link_as_bundle $[and $[OSX_PLATFORM],$[LINK_AS_BUNDLE]]
  434. // On OSX 10.4, we need to have both a .dylib and an .so file.
  435. #defer link_extra_bundle $[and $[OSX_PLATFORM],$[or $[LINK_EXTRA_BUNDLE],$[BUNDLE_EXT]],$[not $[LINK_AS_BUNDLE]],$[not $[LINK_ALL_STATIC]],$[not $[lib_is_static]]]
  436. // The default library extension various based on the OS.
  437. #defer dynamic_lib_ext $[DYNAMIC_LIB_EXT]
  438. #defer static_lib_ext $[STATIC_LIB_EXT]
  439. #defer lib_ext $[if $[link_as_bundle],$[bundle_ext],$[if $[lib_is_static],$[static_lib_ext],$[dynamic_lib_ext]]]
  440. #defer link_lib_c $[if $[link_as_bundle],$[bundle_lib_c],$[if $[lib_is_static],$[static_lib_c],$[shared_lib_c]]]
  441. #defer link_lib_c++ $[if $[link_as_bundle],$[bundle_lib_c++],$[if $[lib_is_static],$[static_lib_c++],$[shared_lib_c++]]]
  442. // If BUILD_COMPONENTS is not true, we don't actually build all the
  443. // libraries. In particular, we don't build any libraries that are
  444. // listed on a metalib. This variable can be evaluated within a
  445. // library's scope to determine whether it should be built according
  446. // to this rule.
  447. #defer build_lib $[or $[BUILD_COMPONENTS],$[eq $[module $[TARGET],$[TARGET]],]]
  448. // This variable is true if the lib has an associated pdb (Windows
  449. // only). It appears that pdb's are generated only for dll's, not for
  450. // static libs.
  451. #defer has_pdb $[and $[build_pdbs],$[not $[lib_is_static]]]
  452. // This takes advantage of the above two variables to get the actual
  453. // list of local libraries we are to link with, eliminating those that
  454. // won't be built.
  455. #defer active_local_libs \
  456. $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[LOCAL_LIBS]]
  457. #defer active_component_libs \
  458. $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[COMPONENT_LIBS]]
  459. #defer active_libs $[active_local_libs] $[active_component_libs]
  460. // We define $[complete_local_libs] as the full set of libraries (from
  461. // within this tree) that we must link a particular target with. It
  462. // is the transitive closure of our dependent libs: the libraries we
  463. // depend on, plus the libraries *those* libraries depend on, and so on.
  464. #defer nonunique_complete_local_libs $[closure all_libs,$[active_libs]]
  465. #defer complete_local_libs $[unique $[nonunique_complete_local_libs]]
  466. // And $[complete_ipath] is the list of directories (from within this
  467. // tree) we should add to our -I list. It's basically just one for
  468. // each directory named in the $[complete_local_libs], above, plus
  469. // whatever else the user might have explicitly named in
  470. // $[LOCAL_INCS]. LOCAL_INCS MUST be a ppremake src dir! (RELDIR only
  471. // checks those) To add an arbitrary extra include dir, define
  472. // EXTRA_IPATH in the Sources.pp
  473. #defer complete_ipath $[all_libs $[RELDIR],$[complete_local_libs]] $[RELDIR($[LOCAL_INCS:%=%/])] $[EXTRA_IPATH]
  474. // This variable, when evaluated within a target, will either be empty
  475. // string if the target is not to be built, or the target name if it
  476. // is.
  477. #defer active_target $[if $[build_target],$[TARGET]]
  478. #defer active_target_libprefext $[if $[build_target],$[lib_prefix]$[TARGET]$[lib_ext]]
  479. #defer active_target_bundleext $[if $[and $[build_target],$[link_extra_bundle]],$[lib_prefix]$[TARGET]$[bundle_ext]]
  480. #defer get_combined_sources $[COMBINED_SOURCES]
  481. // This subroutine will set up the sources variable to reflect the
  482. // complete set of sources for this target, and also set the
  483. // alt_cflags, alt_libs, etc. as appropriate according to how the
  484. // various USE_* flags are set for the current target.
  485. // This variable returns the complete set of sources for the current
  486. // target.
  487. #defer get_sources \
  488. $[SOURCES] \
  489. $[if $[or $[NO_COMBINED_SOURCES],$[USE_TAU]], $[INCLUDED_SOURCES], $[get_combined_sources]]
  490. #defer included_sources $[INCLUDED_SOURCES]
  491. // This variable returns the set of sources that are to be
  492. // interrogated for the current target.
  493. #defer get_igatescan \
  494. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  495. $[if $[eq $[IGATESCAN], all], \
  496. $[filter-out %.I %.T %.lxx %.yxx %.N %_src.cxx,$[get_sources]], \
  497. $[IGATESCAN]]]
  498. // This variable returns the name of the interrogate database file
  499. // that will be generated for a particular target, or empty string if
  500. // the target is not to be interrogated.
  501. #defer get_igatedb \
  502. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  503. $[ODIR]/lib$[TARGET]$[dllext].in]
  504. // This variable returns the name of the interrogate code file
  505. // that will be generated for a particular target, or empty string if
  506. // the target is not to be interrogated.
  507. #defer get_igateoutput \
  508. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  509. $[ODIR]/lib$[TARGET]_igate.cxx]
  510. // This variable is the set of .in files generated by all of our
  511. // component libraries. If it is nonempty, then we do need to
  512. // generate a module, and $[get_igatemout] is the name of the .cxx file
  513. // that interrogate will produce to make this module.
  514. #defer get_igatemscan $[components $[get_igatedb:%=$[RELDIR]/%],$[active_component_libs]] $[if $[not $[module $[TARGET],$[TARGET]]],$[get_igatedb]]
  515. #defer get_igatemout $[if $[get_igatemscan],$[ODIR]/lib$[TARGET]_module.cxx]
  516. // This variable returns the set of external packages used by this
  517. // target, and by all the components shared by this target.
  518. #defer use_packages $[unique $[USE_PACKAGES] $[all_libs $[USE_PACKAGES],$[active_component_libs] $[complete_local_libs]]]
  519. // This function returns the appropriate cflags for the target, based
  520. // on the various external packages this particular target claims to
  521. // require.
  522. #defun get_cflags
  523. // hack to add stl,python. should be removed
  524. #define alt_cflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_cflags] $[python_cflags]]
  525. #foreach package $[use_packages]
  526. #set alt_cflags $[alt_cflags] $[$[package]_cflags]
  527. #end package
  528. $[alt_cflags]
  529. #end get_cflags
  530. // This function returns the appropriate lflags for the target, based
  531. // on the various external packages this particular target claims to
  532. // require.
  533. #defun get_lflags
  534. // hack to add stl,python. should be removed
  535. #define alt_lflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lflags] $[python_lflags]]
  536. #foreach package $[use_packages]
  537. #set alt_lflags $[alt_lflags] $[$[package]_lflags]
  538. #end package
  539. $[alt_lflags]
  540. #end get_lflags
  541. // This function returns the appropriate include path for the target,
  542. // based on the various external packages this particular target
  543. // claims to require. This returns a space-separated set of directory
  544. // names only; the -I switch is not included here.
  545. #defun get_ipath
  546. // hack to add stl,python. should be removed
  547. #define alt_ipath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_ipath] $[python_ipath]]
  548. #foreach package $[use_packages]
  549. #set alt_ipath $[alt_ipath] $[$[package]_ipath]
  550. #end package
  551. $[alt_ipath]
  552. #end get_ipath
  553. // This function returns the appropriate library search path for the
  554. // target, based on the various external packages this particular
  555. // target claims to require. This returns a space-separated set of
  556. // directory names only; the -L switch is not included here.
  557. #defun get_lpath
  558. #define alt_lpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lpath] $[python_lpath]]
  559. #if $[WINDOWS_PLATFORM]
  560. #set alt_lpath $[WIN32_PLATFORMSDK_LIBPATH] $[alt_lpath]
  561. #endif
  562. #foreach package $[use_packages]
  563. #set alt_lpath $[alt_lpath] $[$[package]_lpath]
  564. #end package
  565. $[alt_lpath]
  566. #end get_lpath
  567. // This function returns the appropriate framework search path for the
  568. // target, based on the various external frameworks this particular
  569. // target claims to require. This returns a space-separated set of
  570. // directory names only; the -F switch is not included here.
  571. #defun get_fpath
  572. #define alt_fpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_fpath] $[python_fpath]]
  573. #foreach package $[use_packages]
  574. #set alt_fpath $[alt_fpath] $[$[package]_fpath]
  575. #end package
  576. $[alt_fpath]
  577. #end get_fpath
  578. // This function returns the appropriate framework for the
  579. // target, based on the various external frameworks this particular
  580. // target claims to require. This returns a space-separated set of
  581. // framework names only; the -framework switch is not included here.
  582. #defun get_frameworks
  583. #define alt_frameworks $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_framework] $[python_framework]]
  584. #if $[OSX_PLATFORM]
  585. #set alt_frameworks $[alt_frameworks] $[OSX_SYS_FRAMEWORKS]
  586. #endif
  587. #foreach package $[use_packages]
  588. #set alt_frameworks $[alt_frameworks] $[$[package]_framework]
  589. #end package
  590. $[alt_frameworks]
  591. #end get_frameworks
  592. // This function returns the appropriate set of library names to link
  593. // with for the target, based on the various external packages this
  594. // particular target claims to require. This returns a
  595. // space-separated set of library names only; the -l switch is not
  596. // included here.
  597. #defun get_libs
  598. #define alt_libs $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_libs] $[python_libs]]
  599. #define alt_libs $[alt_libs] $[EXTRA_LIBS]
  600. #if $[WINDOWS_PLATFORM]
  601. #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_libs] $[transitive_link]]
  602. #elif $[OSX_PLATFORM]
  603. #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_libs] $[transitive_link]]
  604. #else
  605. #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_libs] $[transitive_link]]
  606. #endif
  607. #foreach package $[use_packages]
  608. #set alt_libs $[alt_libs] $[$[package]_libs]
  609. #end package
  610. $[alt_libs]
  611. #end get_libs
  612. // This function returns the appropriate value for ld for the target.
  613. #defun get_ld
  614. #if $[filter maya,$[use_packages]]
  615. $[maya_ld]
  616. #endif
  617. #end get_ld
  618. // This function determines the set of files a given source file
  619. // depends on. It is based on the setting of the $[filename]_sources
  620. // variable to indicate the sources for composite files, etc.
  621. #defun get_depends source
  622. #if $[$[source]_sources]
  623. #if $[ne $[$[source]_sources],none]
  624. $[$[source]_sources] $[dependencies $[$[source]_sources]]
  625. #endif
  626. #else
  627. $[dependencies $[source]]
  628. #endif
  629. #end get_depends
  630. // This function determines the set of libraries our various targets
  631. // depend on. This is a complicated definition. It is the union of
  632. // all of our targets' dependencies, except:
  633. // If a target is part of a metalib, it depends (a) directly on all of
  634. // its normal library dependencies that are part of the same metalib,
  635. // and (b) indirectly on all of the metalibs that every other library
  636. // dependency is part of. If a target is not part of a metalib, it is
  637. // the same as case (b) above.
  638. #defun get_depend_libs
  639. #define depend_libs
  640. #forscopes lib_target noinst_lib_target test_lib_target
  641. #define metalib $[module $[TARGET],$[TARGET]]
  642. #if $[ne $[metalib],]
  643. // This library is included on a metalib.
  644. #foreach depend $[LOCAL_LIBS]
  645. #define depend_metalib $[module $[TARGET],$[depend]]
  646. #if $[eq $[depend_metalib],$[metalib]]
  647. // Here's a dependent library in the *same* metalib.
  648. #set depend_libs $[depend_libs] $[depend]
  649. #elif $[ne $[depend_metalib],]
  650. // This dependent library is in a *different* metalib.
  651. #set depend_libs $[depend_libs] $[depend_metalib]
  652. #else
  653. // This dependent library is not in any metalib.
  654. #set depend_libs $[depend_libs] $[depend]
  655. #endif
  656. #end depend
  657. #else
  658. // This library is *not* included on a metalib.
  659. #foreach depend $[LOCAL_LIBS]
  660. #define depend_metalib $[module $[TARGET],$[depend]]
  661. #if $[ne $[depend_metalib],]
  662. // This dependent library is on a metalib.
  663. #set depend_libs $[depend_libs] $[depend_metalib]
  664. #else
  665. // This dependent library is not in any metalib.
  666. #set depend_libs $[depend_libs] $[depend]
  667. #endif
  668. #end depend
  669. #endif
  670. #end lib_target noinst_lib_target test_lib_target
  671. // These will never be part of a metalib.
  672. #forscopes static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target metalib_target
  673. #foreach depend $[LOCAL_LIBS]
  674. #define depend_metalib $[module $[TARGET],$[depend]]
  675. #if $[ne $[depend_metalib],]
  676. // This dependent library is on a metalib.
  677. #if $[eq $[depend_metalib],$[TARGET]]
  678. #print Warning: $[TARGET] circularly depends on $[depend].
  679. #else
  680. #set depend_libs $[depend_libs] $[depend_metalib]
  681. #endif
  682. #else
  683. // This dependent library is not in any metalib.
  684. #set depend_libs $[depend_libs] $[depend]
  685. #endif
  686. #end depend
  687. #end static_lib_target dynamic_lib_target ss_lib_target bin_target noinst_bin_target metalib_target
  688. // In case we're defining any metalibs, these depend directly on
  689. // their components as well.
  690. #set depend_libs $[depend_libs] $[COMPONENT_LIBS(metalib_target)]
  691. $[depend_libs]
  692. #end get_depend_libs
  693. // dtool/pptempl/Global.pp
  694. // Define a few directories that will be useful.
  695. #define install_dir $[$[upcase $[PACKAGE]]_INSTALL]
  696. #if $[eq $[install_dir],]
  697. #error Variable $[upcase $[PACKAGE]]_INSTALL is not set! Cannot install!
  698. #endif
  699. #define other_trees
  700. #define other_trees_lib
  701. #define other_trees_include
  702. #foreach tree $[NEEDS_TREES]
  703. #define tree_install $[$[upcase $[tree]]_INSTALL]
  704. #if $[eq $[tree_install],]
  705. Warning: Variable $[upcase $[tree]]_INSTALL is not set!
  706. #else
  707. #set other_trees $[other_trees] $[tree_install]
  708. #set other_trees_lib $[other_trees_lib] $[tree_install]/lib
  709. #set other_trees_include $[other_trees_include] $[tree_install]/include
  710. #endif
  711. #end tree
  712. #define install_lib_dir $[or $[INSTALL_LIB_DIR],$[install_dir]/lib]
  713. #define other_trees_lib $[or $[INSTALL_LIB_DIR],$[other_trees_lib]]
  714. #define install_headers_dir $[or $[INSTALL_HEADERS_DIR],$[install_dir]/include]
  715. #define other_trees_include $[or $[INSTALL_HEADERS_DIR],$[other_trees_include]]
  716. #define install_bin_dir $[or $[INSTALL_BIN_DIR],$[install_dir]/bin]
  717. #define install_data_dir $[or $[INSTALL_DATA_DIR],$[install_dir]/shared]
  718. #define install_igatedb_dir $[or $[INSTALL_IGATEDB_DIR],$[install_dir]/etc]
  719. #define install_config_dir $[or $[INSTALL_CONFIG_DIR],$[install_dir]/etc]
  720. #defer install_py_dir $[install_lib_dir]/$[PACKAGE]/$[DIRNAME]
  721. #defer install_py_package_dir $[install_lib_dir]/$[PACKAGE]
  722. #if $[ne $[DTOOL_INSTALL],]
  723. #define install_parser_inc_dir $[DTOOL_INSTALL]/include/parser-inc
  724. #else
  725. #define install_parser_inc_dir $[install_headers_dir]/parser-inc
  726. #endif
  727. // Set up the correct interrogate options.
  728. // $[dllext] is redefined in the Windows Global.platform.pp files to
  729. // the string _d if we are building a debug tree. This is inserted
  730. // into the .dll and .in filenames before the extension to make a
  731. // runtime distinction between debug and non-debug builds. For now,
  732. // we make a global definition to empty string, since non-Windows
  733. // platforms will leave this empty.
  734. #define dllext
  735. // $[obj_prefix] defines the prefix that is prepended to the name of
  736. // the object files. It can be used to avoid potential collisions
  737. // when a source file is used by multiple targets but with different
  738. // compile options for each.
  739. //
  740. // $[obj_prefix] may be redefined by one of the Global.platform.pp
  741. // files.
  742. #defer obj_prefix $[TARGET]_
  743. // Caution! interrogate_ipath might be redefined in the
  744. // Global.platform.pp file.
  745. #defer interrogate_ipath $[install_parser_inc_dir:%=-S%] $[target_ipath:%=-I%]
  746. #defer interrogate_options \
  747. -DCPPPARSER -D__STDC__=1 -D__cplusplus $[SYSTEM_IGATE_FLAGS] \
  748. $[interrogate_ipath] \
  749. $[CDEFINES_OPT$[OPTIMIZE]:%=-D%] \
  750. $[filter -D%,$[C++FLAGS]] \
  751. $[INTERROGATE_OPTIONS] \
  752. $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \
  753. $[if $[INTERROGATE_C_INTERFACE],-c] \
  754. $[if $[<= $[OPTIMIZE], 1],-spam]
  755. #defer interrogate_module_options \
  756. $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \
  757. $[if $[INTERROGATE_C_INTERFACE],-c]
  758. // The language stuff is used by model builds only.
  759. // Set language_filters to be "%_english %_castillian %_japanese %_german" etc.
  760. #if $[LANGUAGES]
  761. #define language_filters $[subst <pct>,%,$[LANGUAGES:%=<pct>_%]]
  762. #print Using language $[LANGUAGE]
  763. #else
  764. #define language_filters
  765. #endif
  766. #define language_egg_filters $[language_filters:%=%.egg]
  767. #define language_dna_filters $[language_filters:%=%.dna]
  768. // This is used for evaluating SoftImage unpack rules in Template.models.pp.
  769. #defer soft_scene_files $[matrix $[DATABASE]/SCENES/$[SCENE_PREFIX],$[MODEL] $[ANIMS],.1-0.dsc]
  770. // Include the global definitions for this particular build_type, if
  771. // the file is there.
  772. #sinclude $[GLOBAL_TYPE_FILE]