compilerSettings.pp 9.2 KB

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