compilerSettings.pp 8.5 KB

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