compilerSettings.pp 8.7 KB

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