Global.pp 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  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_NSPR]
  86. #define nspr_ipath $[wildcard $[NSPR_IPATH]]
  87. #define nspr_lpath $[wildcard $[NSPR_LPATH]]
  88. #define nspr_cflags $[NSPR_CFLAGS]
  89. #define nspr_libs $[NSPR_LIBS]
  90. #define nspr_framework $[NSPR_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_DX]
  136. #define dx_ipath $[wildcard $[DX_IPATH]]
  137. #define dx_lpath $[wildcard $[DX_LPATH]]
  138. #define dx_cflags $[DX_CFLAGS]
  139. #define dx_libs $[DX_LIBS]
  140. #endif
  141. #if $[HAVE_OPENCV]
  142. #define opencv_ipath $[wildcard $[OPENCV_IPATH]]
  143. #define opencv_lpath $[wildcard $[OPENCV_LPATH]]
  144. #define opencv_cflags $[OPENCV_CFLAGS]
  145. #define opencv_libs $[OPENCV_LIBS]
  146. #endif
  147. #if $[HAVE_FFMPEG]
  148. #define ffmpeg_ipath $[wildcard $[FFMPEG_IPATH]]
  149. #define ffmpeg_lpath $[wildcard $[FFMPEG_LPATH]]
  150. #define ffmpeg_cflags $[FFMPEG_CFLAGS]
  151. #define ffmpeg_libs $[FFMPEG_LIBS]
  152. #endif
  153. #if $[HAVE_JPEG]
  154. #define jpeg_ipath $[wildcard $[JPEG_IPATH]]
  155. #define jpeg_lpath $[wildcard $[JPEG_LPATH]]
  156. #define jpeg_cflags $[JPEG_CFLAGS]
  157. #define jpeg_libs $[JPEG_LIBS]
  158. #endif
  159. #if $[HAVE_PNG]
  160. #define png_ipath $[wildcard $[PNG_IPATH]]
  161. #define png_lpath $[wildcard $[PNG_LPATH]]
  162. #define png_cflags $[PNG_CFLAGS]
  163. #define png_libs $[PNG_LIBS]
  164. #endif
  165. #if $[HAVE_TIFF]
  166. #define tiff_ipath $[wildcard $[TIFF_IPATH]]
  167. #define tiff_lpath $[wildcard $[TIFF_LPATH]]
  168. #define tiff_cflags $[TIFF_CFLAGS]
  169. #define tiff_libs $[TIFF_LIBS]
  170. #endif
  171. #if $[HAVE_FFTW]
  172. #define fftw_ipath $[wildcard $[FFTW_IPATH]]
  173. #define fftw_lpath $[wildcard $[FFTW_LPATH]]
  174. #define fftw_cflags $[FFTW_CFLAGS]
  175. #define fftw_libs $[FFTW_LIBS]
  176. #endif
  177. #if $[HAVE_BDB]
  178. #define bdb_ipath $[wildcard $[BDB_IPATH]]
  179. #define bdb_lpath $[wildcard $[BDB_LPATH]]
  180. #define bdb_cflags $[BDB_CFLAGS]
  181. #define bdb_libs $[BDB_LIBS]
  182. #endif
  183. #if $[HAVE_CG]
  184. #define cg_ipath $[wildcard $[CG_IPATH]]
  185. #define cg_lpath $[wildcard $[CG_LPATH]]
  186. #define cg_cflags $[CG_CFLAGS]
  187. #define cg_libs $[CG_LIBS]
  188. #define cg_framework $[CG_FRAMEWORK]
  189. #endif
  190. #if $[HAVE_CGGL]
  191. #define cggl_ipath $[wildcard $[CGGL_IPATH]]
  192. #define cggl_lpath $[wildcard $[CGGL_LPATH]]
  193. #define cggl_cflags $[CGGL_CFLAGS]
  194. #define cggl_libs $[CGGL_LIBS]
  195. #define cggl_framework $[CGGL_FRAMEWORK]
  196. #endif
  197. #if $[HAVE_CGDX8]
  198. #define cgdx8_ipath $[wildcard $[CGDX8_IPATH]]
  199. #define cgdx8_lpath $[wildcard $[CGDX8_LPATH]]
  200. #define cgdx8_cflags $[CGDX8_CFLAGS]
  201. #define cgdx8_libs $[CGDX8_LIBS]
  202. #endif
  203. #if $[HAVE_CGDX9]
  204. #define cgdx9_ipath $[wildcard $[CGDX9_IPATH]]
  205. #define cgdx9_lpath $[wildcard $[CGDX9_LPATH]]
  206. #define cgdx9_cflags $[CGDX9_CFLAGS]
  207. #define cgdx9_libs $[CGDX9_LIBS]
  208. #endif
  209. #if $[HAVE_CGDX10]
  210. #define cgdx10_ipath $[wildcard $[CGDX10_IPATH]]
  211. #define cgdx10_lpath $[wildcard $[CGDX10_LPATH]]
  212. #define cgdx10_cflags $[CGDX10_CFLAGS]
  213. #define cgdx10_libs $[CGDX10_LIBS]
  214. #endif
  215. #if $[HAVE_VRPN]
  216. #define vrpn_ipath $[wildcard $[VRPN_IPATH]]
  217. #define vrpn_lpath $[wildcard $[VRPN_LPATH]]
  218. #define vrpn_cflags $[VRPN_CFLAGS]
  219. #define vrpn_libs $[VRPN_LIBS]
  220. #endif
  221. #if $[HAVE_HELIX]
  222. #define helix_ipath $[wildcard $[HELIX_IPATH]]
  223. #define helix_lpath $[wildcard $[HELIX_LPATH]]
  224. #define helix_cflags $[HELIX_CFLAGS]
  225. #define helix_libs $[HELIX_LIBS]
  226. #endif
  227. #if $[HAVE_MIKMOD]
  228. #define mikmod_ipath $[wildcard $[MIKMOD_IPATH]]
  229. #define mikmod_lpath $[wildcard $[MIKMOD_LPATH]]
  230. #define mikmod_cflags $[MIKMOD_CFLAGS]
  231. #define mikmod_libs $[MIKMOD_LIBS]
  232. #endif
  233. #if $[HAVE_GTK]
  234. #define gtk_ipath $[wildcard $[GTK_IPATH]]
  235. #define gtk_lpath $[wildcard $[GTK_LPATH]]
  236. #define gtk_cflags $[GTK_CFLAGS]
  237. #define gtk_libs $[GTK_LIBS]
  238. #endif
  239. #if $[HAVE_FREETYPE]
  240. #define freetype_ipath $[wildcard $[FREETYPE_IPATH]]
  241. #define freetype_lpath $[wildcard $[FREETYPE_LPATH]]
  242. #define freetype_cflags $[FREETYPE_CFLAGS]
  243. #define freetype_libs $[FREETYPE_LIBS]
  244. #define freetype_framework $[FREETYPE_FRAMEWORK]
  245. #endif
  246. #if $[and $[HAVE_MAYA],$[MAYA_LOCATION]]
  247. #define maya_ipath $[MAYA_LOCATION]/include
  248. #define maya_lpath $[MAYA_LOCATION]/lib
  249. #define maya_ld $[wildcard $[MAYA_LOCATION]/bin/mayald]
  250. #define maya_libs $[MAYA_LIBS]
  251. #endif
  252. #if $[and $[HAVE_SOFTIMAGE],$[SOFTIMAGE_LOCATION]]
  253. #define softimage_ipath $[SOFTIMAGE_LOCATION]/h
  254. #define softimage_lpath $[SOFTIMAGE_LOCATION]/dso
  255. #define softimage_libs $[SOFTIMAGE_LIBS]
  256. #endif
  257. #if $[HAVE_NET]
  258. #define net_ipath $[wildcard $[NET_IPATH]]
  259. #define net_lpath $[wildcard $[NET_LPATH]]
  260. #define net_libs $[NET_LIBS]
  261. #endif
  262. #if $[HAVE_RAD_MSS]
  263. #define rad_mss_ipath $[wildcard $[RAD_MSS_IPATH]]
  264. #define rad_mss_lpath $[wildcard $[RAD_MSS_LPATH]]
  265. #define rad_mss_libs $[RAD_MSS_LIBS]
  266. #endif
  267. #if $[HAVE_FMODEX]
  268. #define fmodex_ipath $[wildcard $[FMODEX_IPATH]]
  269. #define fmodex_lpath $[wildcard $[FMODEX_LPATH]]
  270. #define fmodex_cflags $[FMODEX_CFLAGS]
  271. #define fmodex_libs $[FMODEX_LIBS]
  272. #endif
  273. #if $[HAVE_CHROMIUM]
  274. #define chromium_ipath $[wildcard $[CHROMIUM_IPATH]]
  275. #define chromium_lpath $[wildcard $[CHROMIUM_LPATH]]
  276. #define chromium_libs $[CHROMIUM_LIBS]
  277. #endif
  278. // We define these two variables true here in the global scope; a
  279. // particular Sources.pp file can redefine these to be false to
  280. // prevent a particular directory or target from being built in
  281. // certain circumstances.
  282. #define BUILD_DIRECTORY 1
  283. #define BUILD_TARGET 1
  284. // This is the default extension for a Maya file. It might be
  285. // overridden within a maya_char_egg rule to convert a .ma file
  286. // instead.
  287. #define MAYA_EXTENSION .mb
  288. // This variable, when evaluated in the scope of a particular directory,
  289. // will indicate true (i.e. nonempty) when the directory is truly built,
  290. // or false (empty) when the directory is not to be built.
  291. #defer build_directory $[BUILD_DIRECTORY]
  292. // It maps to a direct evaluation of the user-set variable,
  293. // BUILD_DIRECTORY, for historical reasons. This also allows us to
  294. // reserve the right to extend this variable to test other conditions
  295. // as well, should the need arise.
  296. // This variable, when evaluated in the scope of a particular target,
  297. // will indicated true when the target should be built, or false when
  298. // the target is not to be built.
  299. #defer build_target $[BUILD_TARGET]
  300. // If we have USE_TAU but not TAU_MAKEFILE, we invoke the tau
  301. // instrumentor and compiler directly.
  302. #define direct_tau $[and $[USE_TAU],$[not $[TAU_MAKEFILE]]]
  303. #if $[and $[USE_TAU],$[TAU_MAKEFILE]]
  304. // Use the makefile-based rules to run the tau instrumentor.
  305. #defer compile_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C] $[TAU_CFLAGS]
  306. #defer compile_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[COMPILE_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  307. #defer link_bin_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C] $[TAU_CFLAGS]
  308. #defer link_bin_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[LINK_BIN_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  309. #defer shared_lib_c $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C] $[TAU_CFLAGS]
  310. #defer shared_lib_c++ $(TAU_COMPILER) $[TAU_OPTS] $[if $[SELECT_TAU],-optTauSelectFile=$[SELECT_TAU]] $[SHARED_LIB_C++] $[TAU_CFLAGS] $[TAU_C++FLAGS]
  311. #else
  312. #defer compile_c $[COMPILE_C]
  313. #defer compile_c++ $[COMPILE_C++]
  314. #defer link_bin_c $[LINK_BIN_C]
  315. #defer link_bin_c++ $[LINK_BIN_C++]
  316. #defer shared_lib_c $[SHARED_LIB_C]
  317. #defer shared_lib_c++ $[SHARED_LIB_C++]
  318. #endif // USE_TAU
  319. // This takes advantage of the above two variables to get the actual
  320. // list of local libraries we are to link with, eliminating those that
  321. // won't be built.
  322. #defer active_local_libs \
  323. $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[LOCAL_LIBS]]
  324. #defer active_component_libs \
  325. $[all_libs $[if $[and $[build_directory],$[build_target]],$[TARGET]],$[COMPONENT_LIBS]]
  326. #defer active_libs $[active_local_libs] $[active_component_libs]
  327. // This variable, when evaluated within a target, will either be empty
  328. // string if the target is not to be built, or the target name if it
  329. // is.
  330. #defer active_target $[if $[build_target],$[TARGET]]
  331. #defer get_combined_sources $[COMBINED_SOURCES]
  332. // This subroutine will set up the sources variable to reflect the
  333. // complete set of sources for this target, and also set the
  334. // alt_cflags, alt_libs, etc. as appropriate according to how the
  335. // various USE_* flags are set for the current target.
  336. // This variable returns the complete set of sources for the current
  337. // target.
  338. #defer get_sources \
  339. $[SOURCES] \
  340. $[if $[or $[NO_COMBINED_SOURCES],$[USE_TAU]], $[INCLUDED_SOURCES], $[get_combined_sources]]
  341. #defer included_sources $[INCLUDED_SOURCES]
  342. // This variable returns the set of sources that are to be
  343. // interrogated for the current target.
  344. #defer get_igatescan \
  345. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  346. $[if $[eq $[IGATESCAN], all], \
  347. $[filter-out %.I %.T %.lxx %.yxx %.N %_src.cxx,$[get_sources]], \
  348. $[IGATESCAN]]]
  349. // This variable returns the name of the interrogate database file
  350. // that will be generated for a particular target, or empty string if
  351. // the target is not to be interrogated.
  352. #defer get_igatedb \
  353. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  354. $[ODIR]/lib$[TARGET]$[dllext].in]
  355. // This variable returns the name of the interrogate code file
  356. // that will be generated for a particular target, or empty string if
  357. // the target is not to be interrogated.
  358. #defer get_igateoutput \
  359. $[if $[and $[run_interrogate],$[IGATESCAN]], \
  360. $[ODIR]/lib$[TARGET]_igate.cxx]
  361. // This variable is the set of .in files generated by all of our
  362. // component libraries. If it is nonempty, then we do need to
  363. // generate a module, and $[get_igatemout] is the name of the .cxx file
  364. // that interrogate will produce to make this module.
  365. #defer get_igatemscan $[components $[get_igatedb:%=$[RELDIR]/%],$[active_component_libs]]
  366. #defer get_igatemout $[if $[get_igatemscan],$[ODIR]/lib$[TARGET]_module.cxx]
  367. // This variable returns the set of external packages used by this
  368. // target, and by all the components shared by this target.
  369. #defer use_packages $[sort $[USE_PACKAGES] $[components $[USE_PACKAGES],$[active_component_libs]]]
  370. // This function returns the appropriate cflags for the target, based
  371. // on the various external packages this particular target claims to
  372. // require.
  373. #defun get_cflags
  374. // hack to add stl,nspr,python. should be removed
  375. #define alt_cflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_cflags] $[nspr_cflags] $[python_cflags]]
  376. #foreach package $[use_packages]
  377. #set alt_cflags $[alt_cflags] $[$[package]_cflags]
  378. #end package
  379. $[alt_cflags]
  380. #end get_cflags
  381. // This function returns the appropriate lflags for the target, based
  382. // on the various external packages this particular target claims to
  383. // require.
  384. #defun get_lflags
  385. // hack to add stl,nspr,python. should be removed
  386. #define alt_lflags $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lflags] $[nspr_lflags] $[python_lflags]]
  387. #foreach package $[use_packages]
  388. #set alt_lflags $[alt_lflags] $[$[package]_lflags]
  389. #end package
  390. $[alt_lflags]
  391. #end get_lflags
  392. // This function returns the appropriate include path for the target,
  393. // based on the various external packages this particular target
  394. // claims to require. This returns a space-separated set of directory
  395. // names only; the -I switch is not included here.
  396. #defun get_ipath
  397. // hack to add stl,nspr,python. should be removed
  398. #define alt_ipath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_ipath] $[nspr_ipath] $[python_ipath]]
  399. #foreach package $[use_packages]
  400. #set alt_ipath $[alt_ipath] $[$[package]_ipath]
  401. #end package
  402. $[alt_ipath]
  403. #end get_ipath
  404. // This function returns the appropriate library search path for the
  405. // target, based on the various external packages this particular
  406. // target claims to require. This returns a space-separated set of
  407. // directory names only; the -L switch is not included here.
  408. #defun get_lpath
  409. #define alt_lpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_lpath] $[nspr_lpath] $[python_lpath]]
  410. #if $[WINDOWS_PLATFORM]
  411. #set alt_lpath $[WIN32_PLATFORMSDK_LIBPATH] $[alt_lpath]
  412. #endif
  413. #foreach package $[use_packages]
  414. #set alt_lpath $[alt_lpath] $[$[package]_lpath]
  415. #end package
  416. $[alt_lpath]
  417. #end get_lpath
  418. // This function returns the appropriate framework search path for the
  419. // target, based on the various external frameworks this particular
  420. // target claims to require. This returns a space-separated set of
  421. // directory names only; the -F switch is not included here.
  422. #defun get_fpath
  423. #define alt_fpath $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_fpath] $[nspr_fpath] $[python_fpath]]
  424. #foreach package $[use_packages]
  425. #set alt_fpath $[alt_fpath] $[$[package]_fpath]
  426. #end package
  427. $[alt_fpath]
  428. #end get_fpath
  429. // This function returns the appropriate framework for the
  430. // target, based on the various external frameworks this particular
  431. // target claims to require. This returns a space-separated set of
  432. // framework names only; the -framework switch is not included here.
  433. #defun get_frameworks
  434. #define alt_frameworks $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_framework] $[nspr_framework] $[python_framework]]
  435. #if $[OSX_PLATFORM]
  436. #set alt_frameworks $[alt_frameworks] $[OSX_SYS_FRAMEWORKS]
  437. #endif
  438. #foreach package $[use_packages]
  439. #set alt_frameworks $[alt_frameworks] $[$[package]_framework]
  440. #end package
  441. $[alt_frameworks]
  442. #end get_frameworks
  443. // This function returns the appropriate set of library names to link
  444. // with for the target, based on the various external packages this
  445. // particular target claims to require. This returns a
  446. // space-separated set of library names only; the -l switch is not
  447. // included here.
  448. #defun get_libs
  449. #define alt_libs $[if $[IGNORE_LIB_DEFAULTS_HACK],,$[stl_libs] $[nspr_libs] $[python_libs]]
  450. #define alt_libs $[alt_libs] $[EXTRA_LIBS]
  451. #if $[WINDOWS_PLATFORM]
  452. #set alt_libs $[alt_libs] $[WIN_SYS_LIBS] $[components $[WIN_SYS_LIBS],$[active_libs] $[transitive_link]]
  453. #elif $[OSX_PLATFORM]
  454. #set alt_libs $[alt_libs] $[OSX_SYS_LIBS] $[components $[OSX_SYS_LIBS],$[active_libs] $[transitive_link]]
  455. #else
  456. #set alt_libs $[alt_libs] $[UNIX_SYS_LIBS] $[components $[UNIX_SYS_LIBS],$[active_libs] $[transitive_link]]
  457. #endif
  458. #foreach package $[use_packages]
  459. #set alt_libs $[alt_libs] $[$[package]_libs]
  460. #end package
  461. $[alt_libs]
  462. #end get_libs
  463. // This function returns the appropriate value for ld for the target.
  464. #defun get_ld
  465. #if $[filter maya,$[use_packages]]
  466. $[maya_ld]
  467. #endif
  468. #end get_ld
  469. // This function determines the set of files a given source file
  470. // depends on. It is based on the setting of the $[filename]_sources
  471. // variable to indicate the sources for composite files, etc.
  472. #defun get_depends source
  473. #if $[$[source]_sources]
  474. #if $[ne $[$[source]_sources],none]
  475. $[$[source]_sources] $[dependencies $[$[source]_sources]]
  476. #endif
  477. #else
  478. $[dependencies $[source]]
  479. #endif
  480. #end get_depends
  481. // This function determines the set of libraries our various targets
  482. // depend on. This is a complicated definition. It is the union of
  483. // all of our targets' dependencies, except:
  484. // If a target is part of a metalib, it depends (a) directly on all of
  485. // its normal library dependencies that are part of the same metalib,
  486. // and (b) indirectly on all of the metalibs that every other library
  487. // dependency is part of. If a target is not part of a metalib, it is
  488. // the same as case (b) above.
  489. #defun get_depend_libs
  490. #define depend_libs
  491. #forscopes lib_target noinst_lib_target test_lib_target
  492. #define metalib $[module $[TARGET],$[TARGET]]
  493. #if $[ne $[metalib],]
  494. // This library is included on a metalib.
  495. #foreach depend $[LOCAL_LIBS]
  496. #define depend_metalib $[module $[TARGET],$[depend]]
  497. #if $[eq $[depend_metalib],$[metalib]]
  498. // Here's a dependent library in the *same* metalib.
  499. #set depend_libs $[depend_libs] $[depend]
  500. #elif $[ne $[depend_metalib],]
  501. // This dependent library is in a *different* metalib.
  502. #set depend_libs $[depend_libs] $[depend_metalib]
  503. #else
  504. // This dependent library is not in any metalib.
  505. #set depend_libs $[depend_libs] $[depend]
  506. #endif
  507. #end depend
  508. #else
  509. // This library is *not* included on a metalib.
  510. #foreach depend $[LOCAL_LIBS]
  511. #define depend_metalib $[module $[TARGET],$[depend]]
  512. #if $[ne $[depend_metalib],]
  513. // This dependent library is on a metalib.
  514. #set depend_libs $[depend_libs] $[depend_metalib]
  515. #else
  516. // This dependent library is not in any metalib.
  517. #set depend_libs $[depend_libs] $[depend]
  518. #endif
  519. #end depend
  520. #endif
  521. #end lib_target noinst_lib_target test_lib_target
  522. // These will never be part of a metalib.
  523. #forscopes static_lib_target ss_lib_target bin_target noinst_bin_target metalib_target
  524. #foreach depend $[LOCAL_LIBS]
  525. #define depend_metalib $[module $[TARGET],$[depend]]
  526. #if $[ne $[depend_metalib],]
  527. // This dependent library is on a metalib.
  528. #if $[eq $[depend_metalib],$[TARGET]]
  529. #print Warning: $[TARGET] circularly depends on $[depend].
  530. #else
  531. #set depend_libs $[depend_libs] $[depend_metalib]
  532. #endif
  533. #else
  534. // This dependent library is not in any metalib.
  535. #set depend_libs $[depend_libs] $[depend]
  536. #endif
  537. #end depend
  538. #end static_lib_target ss_lib_target bin_target noinst_bin_target metalib_target
  539. // In case we're defining any metalibs, these depend directly on
  540. // their components as well.
  541. #set depend_libs $[depend_libs] $[COMPONENT_LIBS(metalib_target)]
  542. $[depend_libs]
  543. #end get_depend_libs
  544. // dtool/pptempl/Global.pp
  545. // Define a few directories that will be useful.
  546. #define install_dir $[$[upcase $[PACKAGE]]_INSTALL]
  547. #if $[eq $[install_dir],]
  548. #error Variable $[upcase $[PACKAGE]]_INSTALL is not set! Cannot install!
  549. #endif
  550. #define other_trees
  551. #define other_trees_lib
  552. #define other_trees_include
  553. #foreach tree $[NEEDS_TREES]
  554. #define tree_install $[$[upcase $[tree]]_INSTALL]
  555. #if $[eq $[tree_install],]
  556. Warning: Variable $[upcase $[tree]]_INSTALL is not set!
  557. #else
  558. #set other_trees $[other_trees] $[tree_install]
  559. #set other_trees_lib $[other_trees_lib] $[tree_install]/lib
  560. #set other_trees_include $[other_trees_include] $[tree_install]/include
  561. #endif
  562. #end tree
  563. #define install_lib_dir $[or $[INSTALL_LIB_DIR],$[install_dir]/lib]
  564. #define other_trees_lib $[or $[INSTALL_LIB_DIR],$[other_trees_lib]]
  565. #define install_headers_dir $[or $[INSTALL_HEADERS_DIR],$[install_dir]/include]
  566. #define other_trees_include $[or $[INSTALL_HEADERS_DIR],$[other_trees_include]]
  567. #define install_bin_dir $[or $[INSTALL_BIN_DIR],$[install_dir]/bin]
  568. #define install_data_dir $[or $[INSTALL_DATA_DIR],$[install_dir]/shared]
  569. #define install_igatedb_dir $[or $[INSTALL_IGATEDB_DIR],$[install_dir]/etc]
  570. #define install_config_dir $[or $[INSTALL_CONFIG_DIR],$[install_dir]/etc]
  571. #defer install_py_dir $[install_lib_dir]/$[PACKAGE]/$[DIRNAME]
  572. #defer install_py_package_dir $[install_lib_dir]/$[PACKAGE]
  573. #if $[ne $[DTOOL_INSTALL],]
  574. #define install_parser_inc_dir $[DTOOL_INSTALL]/include/parser-inc
  575. #else
  576. #define install_parser_inc_dir $[install_headers_dir]/parser-inc
  577. #endif
  578. // Set up the correct interrogate options.
  579. // $[dllext] is redefined in the Windows Global.platform.pp files to
  580. // the string _d if we are building a debug tree. This is inserted
  581. // into the .dll and .in filenames before the extension to make a
  582. // runtime distinction between debug and non-debug builds. For now,
  583. // we make a global definition to empty string, since non-Windows
  584. // platforms will leave this empty.
  585. #define dllext
  586. // $[obj_prefix] defines the prefix that is prepended to the name of
  587. // the object files. It can be used to avoid potential collisions
  588. // when a source file is used by multiple targets but with different
  589. // compile options for each.
  590. //
  591. // $[obj_prefix] may be redefined by one of the Global.platform.pp
  592. // files.
  593. #defer obj_prefix $[TARGET]_
  594. // Caution! interrogate_ipath might be redefined in the
  595. // Global.platform.pp file.
  596. #defer interrogate_ipath $[target_ipath:%=-I%]
  597. #defer interrogate_spath $[install_parser_inc_dir:%=-S%] -S/usr/include
  598. #defer interrogate_options \
  599. -DCPPPARSER -D__STDC__=1 -D__cplusplus $[SYSTEM_IGATE_FLAGS] \
  600. $[interrogate_spath] $[interrogate_ipath] \
  601. $[CDEFINES_OPT$[OPTIMIZE]:%=-D%] \
  602. $[filter -D%,$[C++FLAGS]] \
  603. $[INTERROGATE_OPTIONS] \
  604. $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \
  605. $[if $[INTERROGATE_C_INTERFACE],-c] \
  606. $[if $[TRACK_IN_INTERPRETER],-track-interpreter] \
  607. $[if $[<= $[OPTIMIZE], 1],-spam]
  608. #defer interrogate_module_options \
  609. $[if $[INTERROGATE_PYTHON_INTERFACE],$[if $[PYTHON_NATIVE],-python-native,-python]] \
  610. $[if $[INTERROGATE_C_INTERFACE],-c] \
  611. $[if $[TRACK_IN_INTERPRETER],-track-interpreter]
  612. // The language stuff is used by model builds only.
  613. // Set language_filters to be "%_english %_castillian %_japanese %_german" etc.
  614. #if $[LANGUAGES]
  615. #define language_filters $[subst <pct>,%,$[LANGUAGES:%=<pct>_%]]
  616. #print Using language $[LANGUAGE]
  617. #else
  618. #define language_filters
  619. #endif
  620. #define language_egg_filters $[language_filters:%=%.egg]
  621. #define language_dna_filters $[language_filters:%=%.dna]
  622. // This is used for evaluating SoftImage unpack rules in Template.models.pp.
  623. #defer soft_scene_files $[matrix $[DATABASE]/SCENES/$[SCENE_PREFIX],$[MODEL] $[ANIMS],.1-0.dsc]
  624. // Include the global definitions for this particular build_type, if
  625. // the file is there.
  626. #sinclude $[GLOBAL_TYPE_FILE]