Browse Source

now supports MSVC9

Chris Brunner 17 years ago
parent
commit
9fd6e46051
1 changed files with 90 additions and 3 deletions
  1. 90 3
      dtool/pptempl/compilerSettings.pp

+ 90 - 3
dtool/pptempl/compilerSettings.pp

@@ -1,3 +1,4 @@
+#print Generating for $[USE_COMPILER]
 
 
 #if $[eq $[USE_COMPILER], MSVC]
 #if $[eq $[USE_COMPILER], MSVC]
   #define COMPILER cl
   #define COMPILER cl
@@ -47,8 +48,7 @@
   // ensure pdbs are copied to install dir
   // ensure pdbs are copied to install dir
   #define build_pdbs yes
   #define build_pdbs yes
 
 
-#elif $[or $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]], &[eq $[USE_COMPILER],MSVC8]]
-
+#elif $[or $[or $[eq $[USE_COMPILER], MSVC7], $[eq $[USE_COMPILER], MSVC7_1]], $[eq $[USE_COMPILER],MSVC8]]
   #define COMPILER cl
   #define COMPILER cl
   #define LINKER link
   #define LINKER link
   #define LIBBER lib
   #define LIBBER lib
@@ -123,7 +123,94 @@
   // Added to avoid old iostream reference problems
   // Added to avoid old iostream reference problems
   #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
   #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
   // Added to make pandatool function in VS 8
   // Added to make pandatool function in VS 8
-  #if $[eq $[USE_COMPILER],MSVC8]
+  #if $[or $[eq $[USE_COMPILER],MSVC8], $[eq $[USE_COMPILER],MSVC9]]
+    #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc
+  #endif
+//  #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcprt.lib
+
+// in case we have mixed intel/msvc build
+//  #define EXTRA_LIBPATH /ia32/lib
+//  #define EXTRA_INCPATH /ia32/include
+
+  // ensure pdbs are copied to install dir
+  #define build_pdbs yes
+
+#elif $[eq $[USE_COMPILER], MSVC9]
+  #define COMPILER cl
+  #define LINKER link
+  #define LIBBER lib
+
+  #if $[eq $[NO_CROSSOBJ_OPT],]
+     #define DO_CROSSOBJ_OPT 1
+  #endif
+
+  #if $[DO_CROSSOBJ_OPT]
+     #define OPT4FLAGS /GL
+     #define LDFLAGS_OPT4 /LTCG
+     #if $[>= $[OPTIMIZE],4]
+        #define LIBBER $[LIBBER] /LTCG
+     #endif
+  #endif
+
+  #define CDEFINES_OPT1
+  #define CDEFINES_OPT2
+  #define CDEFINES_OPT3
+  #define CDEFINES_OPT4
+
+  // NODEFAULTLIB ensures static libs linked in will connect to the correct msvcrt, so no debug/release mixing occurs
+
+  #define LDFLAGS_OPT1 /NODEFAULTLIB:MSVCRT.LIB
+  #define LDFLAGS_OPT2 /NODEFAULTLIB:MSVCRT.LIB
+  #define LDFLAGS_OPT3 /NODEFAULTLIB:MSVCRTD.LIB /NODEFAULTLIB:LIBCMT.LIB /OPT:REF
+  #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /NODEFAULTLIB:LIBCMT.LIB /OPT:REF $[LDFLAGS_OPT4]
+//  #define LDFLAGS_OPT4 /NODEFAULTLIB:MSVCRTD.LIB /OPT:REF $[LDFLAGS_OPT4]
+
+  #define COMMONFLAGS /DHAVE_DINKUM /Zc:forScope
+
+  // use "unsafe" QIfist flt->int rounding only if FAST_FLT_TO_INT is defined
+  #define REGULAR_OPTFLAGS /O2 /Ob2 $[if $[ne $[FAST_FLT_TO_INT],], /QIfist,]
+
+  #defer OPTFLAGS $[if $[OPT_MINSIZE],/Ox /Og /Ob1 /Oi /Os /Oy /GL,$[REGULAR_OPTFLAGS]]
+
+  //  #define OPT1FLAGS /RTCsu /GS  removing /RTCu because it crashes in dxgsg with internal compiler bug
+  #define OPT1FLAGS /RTCs /GS
+
+  #define WARNING_LEVEL_FLAG /W3   // WL
+  //#define WARNING_LEVEL_FLAG /Wall
+  //#define WARNING_LEVEL_FLAG /W4 /WX
+
+  // Note: Zi cannot be used on multiproc builds with precomp hdrs, Z7 must be used instead
+  #defer DEBUGPDBFLAGS /Zi /Fd"$[osfilename $[patsubst %.obj,%.pdb, $[target]]]"
+
+  // 2007/05  THIS IS ACTUALLY BROKEN and for a very long time!!! if you try setting it in Sources/Config.pp
+  //
+  // if LINK_FORCE_STATIC_C_RUNTIME is defined, it always links with static c runtime (release version
+  // for both Opt1 and Opt4!) instead of the msvcrt dlls
+  //
+  // 2007/05  THIS IS ACTUALLY BROKEN and for a very long time!!! if you try setting it in Sources/Config.pp
+
+  #defer DEBUGFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MTd, /MDd] $[BROWSEINFO_FLAG] $[DEBUGINFOFLAGS] $[DEBUGPDBFLAGS]
+  #defer RELEASEFLAGS $[if $[ne $[LINK_FORCE_STATIC_RELEASE_C_RUNTIME],],/MT, /MD]
+
+  #define MAPINFOFLAGS /MAPINFO:EXPORTS
+
+  #if $[ENABLE_PROFILING]
+    #define PROFILE_FLAG /FIXED:NO
+  #else
+    #define PROFILE_FLAG
+  #endif
+
+  #if $[or $[ne $[FORCE_INLINING],],$[>= $[OPTIMIZE],2]]
+      #defer EXTRA_CDEFS $[EXTRA_CDEFS] $[if $[OPT_MINSIZE],,FORCE_INLINING]
+  #endif
+
+  // Note: all Opts will link w/debug info now
+  #define LINKER_FLAGS /DEBUG $[PROFILE_FLAG] /MAP $[MAPINFOFLAGS] /fixed:no /incremental:no /stack:4194304
+
+  // Added to avoid old iostream reference problems
+  #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB
+  // Added to make pandatool function in VS 8
+  #if $[or $[eq $[USE_COMPILER],MSVC8], $[eq $[USE_COMPILER],MSVC9]]
     #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc
     #define LINKER_FLAGS $[LINKER_FLAGS] /NOD:MFC80.LIB /NOD:libcmtd /NOD:libc
   #endif
   #endif
 //  #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcprt.lib
 //  #define LINKER_FLAGS $[LINKER_FLAGS] /NODEFAULTLIB:LIBCI.LIB /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcprt.lib