compilerSettings.pp 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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 /OPT:REF
  18. #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.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. #define STL_ALLOCATOR VC6
  39. #elif $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]]
  40. #define COMPILER cl
  41. #define LINKER link
  42. #define LIBBER lib
  43. #if $[eq $[USE_COMPILER], MSVC7]
  44. // What is the syntax of the STL allocator declaration? See
  45. // LocalSetup.pp for allowable values.
  46. #define STL_ALLOCATOR MODERN
  47. #else
  48. // until I figure out how to get rid of 'rebind' vc7.1 C4346 build errors
  49. #define STL_ALLOCATOR UNKNOWN
  50. #endif
  51. #if $[eq $[NO_CROSSOBJ_OPT],]
  52. #define DO_CROSSOBJ_OPT 1
  53. #endif
  54. #if $[DO_CROSSOBJ_OPT]
  55. #define OPT4FLAGS /GL
  56. #define LDFLAGS_OPT4 /LTCG
  57. #if $[>= $[OPTIMIZE],4]
  58. #define LIBBER $[LIBBER] /LTCG
  59. #endif
  60. #endif
  61. #define CDEFINES_OPT1
  62. #define CDEFINES_OPT2
  63. #define CDEFINES_OPT3
  64. #define CDEFINES_OPT4
  65. // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
  66. #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
  67. #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
  68. #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
  69. #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
  70. #define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope
  71. // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
  72. #define REGULAR_OPTFLAGS /O2 /Ob2 /G6 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
  73. #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL /G6,$[REGULAR_OPTFLAGS]]
  74. // #define OPT1FLAGS /RTCsu /GS removing /RTCu because it crashes in dxgsg with internal compiler bug
  75. #define OPT1FLAGS /RTCs /GS
  76. #define WARNING_LEVEL_FLAG /W3 // WL
  77. //#define WARNING_LEVEL_FLAG /Wall
  78. //#define WARNING_LEVEL_FLAG /W4 /WX
  79. // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead
  80. #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb, $[target]]]"
  81. // if LINK_FORCE_STATIC_C_RUNTIME is defined, it always links with static c runtime (release version
  82. // for both Opt1 and Opt4!) instead of the msvcrt dlls
  83. #defer DEBUGFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MDd] $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS]
  84. #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
  85. #define MAPINFOFLAGS /MAPINFO:EXPORTS /MAPINFO:LINES
  86. #if $[ENABLE_PROFILING]
  87. #define PROFILE_FLAG /FIXED:NO
  88. #else
  89. #define PROFILE_FLAG
  90. #endif
  91. #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
  92. #defer EXTRA_CDEFS $[EXTRA_CDEFS] $[if $[OPT_MINSIZE],,FORCE_INLINING]
  93. #endif
  94. // Note: all Opts will link w/debug info now
  95. #define LINKER_FLAGS /DEBUG $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304
  96. // Added to avoid old iostream reference problems
  97. #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
  98. // in case we have mixed intel/msvc build
  99. // #define EXTRA_LIBPATH /ia32/lib
  100. // #define EXTRA_INCPATH /ia32/include
  101. // ensure pdbs are copied to install dir
  102. #define build_pdbs yes
  103. #elif $[eq $[USE_COMPILER], INTEL]
  104. #define COMPILER icl
  105. #define LINKER xilink
  106. #define LIBBER xilib
  107. #define COMMONFLAGS /DHAVE_DINKUM /Gi- /Qwd985 /Qvc7 /G6
  108. // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead
  109. #defer DEBUGPDBFLAGS /Zi /Qinline_debug_info /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]"
  110. // Oy- needed for MS debugger
  111. #defer DEBUGFLAGS /Oy- /MDd $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS]
  112. #define RELEASEFLAGS /MD
  113. #define WARNING_LEVEL_FLAG /W3
  114. #if $[DO_CROSSOBJ_OPT]
  115. #define OPT4FLAGS /Qipo
  116. #define LDFLAGS_OPT4 /Qipo
  117. #endif
  118. // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
  119. #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
  120. #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
  121. #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF
  122. #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
  123. // #define OPTFLAGS /O3 /Qipo /QaxW /Qvec_report1
  124. #define OPTFLAGS /O3 /Qip
  125. // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
  126. #define OPTFLAGS $[OPTFLAGS] $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
  127. #define OPT1FLAGS /GZ /Od
  128. // We assume the Intel compiler installation dir is mounted as /ia32.
  129. #define EXTRA_LIBPATH /ia32/lib
  130. #define EXTRA_INCPATH /ia32/include
  131. #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
  132. #define EXTRA_CDEFS FORCE_INLINING $[EXTRA_CDEFS]
  133. #endif
  134. // Note: all Opts will link w/debug info now
  135. #define LINKER_FLAGS /DEBUG /DEBUGTYPE:CV $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304
  136. // Added to avoid old iostream reference problems
  137. #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
  138. // ensure pdbs are copied to install dir
  139. #define build_pdbs yes
  140. #elif $[eq $[USE_COMPILER], BOUNDS] // NuMega BoundsChecker
  141. #define COMPILER nmcl
  142. #define LINKER nmlink
  143. #define LIBBER lib
  144. #define COMMONFLAGS
  145. #define OPTFLAGS /O2 /Ogity /G6
  146. #define OPT1FLAGS /GZ
  147. #defer DEBUGPDBFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]"
  148. #define RELEASEFLAGS /MD
  149. #define EXTRA_LIBPATH
  150. #define EXTRA_INCPATH
  151. #if $[BOUNDS_TRUETIME] // NuMega BoundsChecker 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 $[COMPILER] /NMttOn
  156. #define LINKER $[LINKER] /NMttOn
  157. #endif
  158. #elif $[eq $[USE_COMPILER], TRUETIME] // NuMega TrueTime Profiler
  159. // This may look like a bad thing (to extend the compiler
  160. // and linker with a switch), but I think it's the right
  161. // thing to do in this case -- skyler.
  162. #define COMPILER nmcl /NMttOn
  163. #define LINKER nmlink /NMttOn
  164. #define LIBBER lib
  165. #define COMMONFLAGS
  166. #define OPTFLAGS /O2 /Ogity /G6
  167. #define OPT1FLAGS /GZ
  168. #defer DEBUGPDBFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[patsubst %.obj,%.pdb,$[target]]]"
  169. #define RELEASEFLAGS /MD
  170. #define EXTRA_LIBPATH
  171. #define EXTRA_INCPATH
  172. #else
  173. #error Invalid value specified for USE_COMPILER.
  174. #endif
  175. #if $[CHECK_SYNTAX_ONLY]
  176. #define END_CFLAGS $[END_CFLAGS] /Zs
  177. #endif
  178. #if $[GEN_ASSEMBLY]
  179. // Note: Opt4 /GL will cause /FAs to not generate .asm! Must remove /GL for /FAs to work!
  180. #define END_CFLAGS $[END_CFLAGS] /FAs
  181. #endif
  182. #if $[PREPROCESSOR_OUTPUT]
  183. #define END_CFLAGS $[END_CFLAGS] /E
  184. #endif