compilerSettings.pp 7.8 KB

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