2
0

compilerSettings.pp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. #print Generating for $[USE_COMPILER]
  2. //////////////////////////////
  3. // MICROSOFT VISUAL C++ 6.0 //
  4. //////////////////////////////
  5. #if $[eq $[USE_COMPILER], MSVC]
  6. #define COMPILER cl
  7. #define LINKER link
  8. #define LIBBER lib
  9. #define COMMONFLAGS /Gi-
  10. // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
  11. #define OPTFLAGS /O2 /Ob1 /G7 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
  12. #define OPT1FLAGS /GZ
  13. // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead
  14. #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]"
  15. #defer DEBUGFLAGS /MDd $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS]
  16. #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
  17. #define WARNING_LEVEL_FLAG /Wall
  18. // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
  19. #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
  20. #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
  21. #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
  22. #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
  23. #define MAPINFOFLAGS /MAPINFO:EXPORTS /MAPINFO:FIXUPS /MAPINFO:LINES
  24. #if $[ENABLE_PROFILING]
  25. // note according to docs, this should force /PDB:none /DEBUGTYPE:cv, so no pdb file is generated for debug?? (doesnt seem to be true)
  26. #define PROFILE_FLAG /PROFILE
  27. #else
  28. #define PROFILE_FLAG
  29. #endif
  30. // Note: all Opts will link w/debug info now
  31. #define LINKER_FLAGS /DEBUG /DEBUGTYPE:CV $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304 /WARN:3
  32. // Added to avoid old iostream reference problems
  33. #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
  34. // for mixed intel/msvc build, add these
  35. // #define EXTRA_LIBPATH /ia32/lib
  36. // #define EXTRA_INCPATH /ia32/include
  37. #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
  38. #define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS]
  39. #endif
  40. // ensure pdbs are copied to install dir
  41. #define build_pdbs yes
  42. ////////////////////////////////////////////////////////////////////
  43. // MICROSOFT VISUAL C++ 7.0, 7.1, & 8.0 (.NET, .NET 2003, & 2005) //
  44. ////////////////////////////////////////////////////////////////////
  45. #elif $[or $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]], $[eq $[USE_COMPILER],MSVC8]]
  46. #define COMPILER cl
  47. #define LINKER link
  48. #define LIBBER lib
  49. #if $[eq $[NO_CROSSOBJ_OPT],]
  50. #define DO_CROSSOBJ_OPT 1
  51. #endif
  52. #if $[DO_CROSSOBJ_OPT]
  53. #define OPT4FLAGS /GL
  54. #define LDFLAGS_OPT4 /LTCG
  55. #if $[>= $[OPTIMIZE],4]
  56. #define LIBBER $[LIBBER] /LTCG
  57. #endif
  58. #endif
  59. #define CDEFINES_OPT1
  60. #define CDEFINES_OPT2
  61. #define CDEFINES_OPT3
  62. #define CDEFINES_OPT4
  63. // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
  64. #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
  65. #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
  66. #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
  67. #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
  68. #define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope
  69. // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
  70. #if $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]]
  71. #define REGULAR_OPTFLAGS /O2 /Ob2 /G7 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
  72. #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL /G7,$[REGULAR_OPTFLAGS]]
  73. #else
  74. #define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
  75. #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL,$[REGULAR_OPTFLAGS]]
  76. #endif
  77. // #define OPT1FLAGS /RTCsu /GS removing /RTCu because it crashes in dxgsg with internal compiler bug
  78. #define OPT1FLAGS /RTCs /GS
  79. #define WARNING_LEVEL_FLAG /W3 // WL
  80. //#define WARNING_LEVEL_FLAG /Wall
  81. //#define WARNING_LEVEL_FLAG /W4 /WX
  82. // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead
  83. #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb, $[target]]]"
  84. // if LINK_FORCE_STATIC_C_RUNTIME is defined, it always links with static c runtime (release version
  85. // for both Opt1 and Opt4!) instead of the msvcrt dlls
  86. #defer DEBUGFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MTd, /MDd] $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS]
  87. #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
  88. #if $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]]
  89. #define MAPINFOFLAGS /MAPINFO:EXPORTS /MAPINFO:LINES
  90. #else
  91. #define MAPINFOFLAGS /MAPINFO:EXPORTS
  92. #endif
  93. #if $[ENABLE_PROFILING]
  94. #define PROFILE_FLAG /FIXED:NO
  95. #else
  96. #define PROFILE_FLAG
  97. #endif
  98. #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
  99. #defer EXTRA_CDEFS $[EXTRA_CDEFS] $[if $[OPT_MINSIZE],,FORCE_INLINING]
  100. #endif
  101. // Note: all Opts will link w/debug info now
  102. #define LINKER_FLAGS /DEBUG $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304
  103. // Added to avoid old iostream reference problems
  104. #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
  105. #if $[eq $[USE_COMPILER],MSVC8]
  106. #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc
  107. #endif
  108. // #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcprt.lib
  109. // in case we have mixed intel/msvc build
  110. // #define EXTRA_LIBPATH /ia32/lib
  111. // #define EXTRA_INCPATH /ia32/include
  112. // ensure pdbs are copied to install dir
  113. #define build_pdbs yes
  114. /////////////////////////////////////
  115. // MICROSOFT VISUAL C++ 9.0 (2008) //
  116. /////////////////////////////////////
  117. #elif $[eq $[USE_COMPILER], MSVC9]
  118. #define COMPILER cl
  119. #define LINKER link
  120. #define LIBBER lib
  121. #define MT_BIN mt
  122. #if $[eq $[NO_CROSSOBJ_OPT],]
  123. #define DO_CROSSOBJ_OPT 1
  124. #endif
  125. #if $[DO_CROSSOBJ_OPT]
  126. #define OPT4FLAGS /GL
  127. #define LDFLAGS_OPT4 /LTCG
  128. #if $[>= $[OPTIMIZE],4]
  129. #define LIBBER $[LIBBER] /LTCG
  130. #endif
  131. #endif
  132. #define CDEFINES_OPT1
  133. #define CDEFINES_OPT2
  134. #define CDEFINES_OPT3
  135. #define CDEFINES_OPT4
  136. // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
  137. #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
  138. #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
  139. #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
  140. #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
  141. #define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope
  142. // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
  143. #define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
  144. #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL,$[REGULAR_OPTFLAGS]]
  145. // #define OPT1FLAGS /RTCsu /GS removing /RTCu because it crashes in dxgsg with internal compiler bug
  146. #define OPT1FLAGS /RTCs /GS
  147. #define WARNING_LEVEL_FLAG /W3 // WL
  148. // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead
  149. #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb, $[target]]]"
  150. // if LINK_FORCE_STATIC_C_RUNTIME is defined, it always links with static c runtime (release version
  151. // for both Opt1 and Opt4!) instead of the msvcrt dlls
  152. #defer DEBUGFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MTd, /MDd] $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS]
  153. #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
  154. #define MAPINFOFLAGS /MAPINFO:EXPORTS
  155. #if $[ENABLE_PROFILING]
  156. #define PROFILE_FLAG /FIXED:NO
  157. #else
  158. #define PROFILE_FLAG
  159. #endif
  160. #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
  161. #defer EXTRA_CDEFS $[EXTRA_CDEFS] $[if $[OPT_MINSIZE],,FORCE_INLINING]
  162. #endif
  163. // Note: all Opts will link w/debug info now
  164. #define LINKER_FLAGS /DEBUG $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304
  165. // Added to avoid old iostream reference problems
  166. #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
  167. // Added to make pandatool function in VS 9
  168. #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:MFC90.LIB /NOD:libcmtd /NOD:libc
  169. // ensure pdbs are copied to install dir
  170. #define build_pdbs yes
  171. ////////////////////
  172. // INTEL COMPILER //
  173. ////////////////////
  174. #elif $[eq $[USE_COMPILER], INTEL]
  175. #define COMPILER icl
  176. #define LINKER xilink
  177. #define LIBBER xilib
  178. #define COMMONFLAGS /DHAVE_DINKUM /Gi- /Qwd985 /Qvc7 /G6
  179. // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead
  180. #defer DEBUGPDBFLAGS /Zi /Qinline_debug_info /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]"
  181. // Oy- needed for MS debugger
  182. #defer DEBUGFLAGS /Oy- /MDd $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS]
  183. #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
  184. #define WARNING_LEVEL_FLAG /W3
  185. #if $[DO_CROSSOBJ_OPT]
  186. #define OPT4FLAGS /Qipo
  187. #define LDFLAGS_OPT4 /Qipo
  188. #endif
  189. // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
  190. #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
  191. #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
  192. #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
  193. #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
  194. // #define OPTFLAGS /O3 /Qipo /QaxW /Qvec_report1
  195. #define OPTFLAGS /O3 /Qip
  196. // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
  197. #define OPTFLAGS $[OPTFLAGS] $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
  198. #define OPT1FLAGS /GZ /Od
  199. // We assume the Intel compiler installation dir is mounted as /ia32.
  200. #define EXTRA_LIBPATH /ia32/lib
  201. #define EXTRA_INCPATH /ia32/include
  202. #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
  203. #define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS]
  204. #endif
  205. // Note: all Opts will link w/debug info now
  206. #define LINKER_FLAGS /DEBUG /DEBUGTYPE:CV $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304
  207. // Added to avoid old iostream reference problems
  208. #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
  209. // ensure pdbs are copied to install dir
  210. #define build_pdbs yes
  211. #elif $[eq $[USE_COMPILER], BOUNDS] // NuMega BoundsChecker
  212. #define COMPILER nmcl
  213. #define LINKER nmlink
  214. #define LIBBER lib
  215. #define COMMONFLAGS
  216. #define OPTFLAGS /O2 /Ogity /G6
  217. #define OPT1FLAGS /GZ
  218. #defer DEBUGPDBFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]"
  219. #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
  220. #define EXTRA_LIBPATH
  221. #define EXTRA_INCPATH
  222. #if $[BOUNDS_TRUETIME] // NuMega BoundsChecker TrueTime Profiler
  223. // This may look like a bad thing (to extend the compiler
  224. // and linker with a switch), but I think it's the right
  225. // thing to do in this case -- skyler.
  226. #define COMPILER $[COMPILER] /NMttOn
  227. #define LINKER $[LINKER] /NMttOn
  228. #endif
  229. #elif $[eq $[USE_COMPILER], TRUETIME] // NuMega TrueTime Profiler
  230. // This may look like a bad thing (to extend the compiler
  231. // and linker with a switch), but I think it's the right
  232. // thing to do in this case -- skyler.
  233. #define COMPILER nmcl /NMttOn
  234. #define LINKER nmlink /NMttOn
  235. #define LIBBER lib
  236. #define COMMONFLAGS
  237. #define OPTFLAGS /O2 /Ogity /G6
  238. #define OPT1FLAGS /GZ
  239. #defer DEBUGPDBFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]"
  240. #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
  241. #define EXTRA_LIBPATH
  242. #define EXTRA_INCPATH
  243. #else
  244. #error Invalid value specified for USE_COMPILER.
  245. #endif
  246. #if $[CHECK_SYNTAX_ONLY]
  247. #define END_CFLAGS $[END_CFLAGS] /Zs
  248. #endif
  249. #if $[GEN_ASSEMBLY]
  250. // Note: Opt4 /GL will cause /FAs to not generate .asm! Must remove /GL for /FAs to work!
  251. #define END_CFLAGS $[END_CFLAGS] /FAs
  252. #endif
  253. #if $[PREPROCESSOR_OUTPUT]
  254. #define END_CFLAGS $[END_CFLAGS] /E
  255. #endif
  256. #defer tau_opts $[decygwin %,-I"%",$[EXTRA_INCPATH] $[ipath] $[WIN32_PLATFORMSDK_INCPATH] $[tau_ipath]] $[building_var:%=-D%]
  257. #defer TAU_MAKE_IL $[PDT_ROOT]/Windows/bin/edgcpfe -o $[il_source] $[tau_opts] $[cdefines:%=-D%] $[C++FLAGS] -DWIN32=1 $[TAU_INSTRUMENTOR_FLAGS] $[source]
  258. #defer TAU_MAKE_PDB $[PDT_ROOT]/Windows/bin/taucpdisp $[il_source] > $[pdb_source]
  259. #defer TAU_MAKE_INST $[TAU_ROOT]/bin/tau_instrumentor $[pdb_source] $[source] -o $[inst_source]