diff --git a/dtool/pptempl/Global.gmsvc.pp b/dtool/pptempl/Global.gmsvc.pp index b09dcb05c3..9ce4e4d172 100644 --- a/dtool/pptempl/Global.gmsvc.pp +++ b/dtool/pptempl/Global.gmsvc.pp @@ -85,20 +85,15 @@ // and currently every cxx generates its own separate pdb // to avoid write file conflict in multi-proc build -#if $[NO_PCH] -// different .pdb for every .obj -#defer DEBUG_TYPE_FLAGS /Zi /Fd"$[osfilename $[target:%.obj=%.pdb]]" -#elif $[eq $[NUMBER_OF_PROCESSORS],1] -// no multi-proc, so can use same .pdb file for each compile -#defer DEBUG_TYPE_FLAGS /Zi /Fd"$[osfilename $[pdb_filename].pdb]" -#else -// puts dbg info inside first .obj -#defer DEBUG_TYPE_FLAGS /Z7 +#include $[THISDIRPREFIX]compilerSettings.pp + +#if $[and $[DO_PCH],$[>= $[NUMBER_OF_PROCESSORS],2]] +// multi-proc case +// single-processor case will act like nmake, conditionally renaming .pdb each file in Template.gmsvc.pp +#defer DEBUGFLAGS $[patsubst /Fd%,,$[subst /Zi,/Z7, $[DEBUGFLAGS]]] #define NO_PDB 1 #endif -#include $[THISDIRPREFIX]compilerSettings.pp - #define WARNING_LEVEL_FLAG /W3 #if $[TEST_INLINING] diff --git a/dtool/pptempl/Template.gmsvc.pp b/dtool/pptempl/Template.gmsvc.pp index c9198092d2..cc27d3de5a 100644 --- a/dtool/pptempl/Template.gmsvc.pp +++ b/dtool/pptempl/Template.gmsvc.pp @@ -130,8 +130,7 @@ // We define $[complete_local_libs] as the full set of libraries (from // within this tree) that we must link a particular target with. It // is the transitive closure of our dependent libs: the libraries we -// depend on, plus the libraries *those* libraries depend on, and so -// on. +// depend on, plus the libraries *those* libraries depend on, and so on. #defer complete_local_libs $[unique $[closure all_libs,$[active_libs]]] #defer actual_local_libs $[get_metalibs $[TARGET],$[complete_local_libs]] @@ -772,8 +771,6 @@ $[TAB] $[COMPILE_C++] #define source $[file] #define ipath $[file_ipath] -#define pdb_filename $[st_dir]/$[TARGET(lib_target)] - #if $[DO_PCH] // best way to find out if file use pch (and needs /Yu) is to check dependencies // these must be defined before flags (or could defer them) @@ -783,7 +780,12 @@ $[TAB] $[COMPILE_C++] #define flags $[c++flags] $[all_sources $[building_var:%=/D%],$[file]] #if $[target_pch] -#define COMPILE_LINE $[COMPILE_C_WITH_PCH] + #if $[eq $[NUMBER_OF_PROCESSORS],1] + #define pdb_filename $[osfilename $[st_dir]/$[TARGET(lib_target)]] // assumes pch only occurs in lib_target scope, not metalib_target or in interrogate + #define COMPILE_LINE $[patsubst /Fd%, /Fd"$[pdb_filename].pdb",$[COMPILE_C_WITH_PCH]] + #else + #define COMPILE_LINE $[COMPILE_C_WITH_PCH] + #endif #else #define COMPILE_LINE $[COMPILE_C++] #endif @@ -798,13 +800,15 @@ $[TAB] $[COMPILE_LINE] #foreach file $[pch_header_source] #define target_pch $[patsubst %.h,$[st_dir]/%.pch,$[file]] #define target_obj $[patsubst %.h,$[st_dir]/%.obj,$[file]] -#define pdb_filename $[st_dir]/$[TARGET(lib_target)] #define target $[target_obj] #define source $[file] #define ipath $[file_ipath] #define flags $[c++flags] $[CFLAGS_SHARED] $[all_sources $[building_var:%=/D%],$[file]] +#define pdb_filename $[osfilename $[st_dir]/$[TARGET(lib_target)]] // assumes pch only occurs in lib_target scope, not metalib_target or in interrogate +#define COMPILE_CXXSTYLE_PCH $[patsubst /Fd%, /Fd"$[pdb_filename].pdb",$[COMPILE_CXXSTYLE_PCH]] + // Yacc must run before some files can be compiled, so all files // depend on yacc having run. $[target_obj] : $[source] $[dependencies $[file]] $[st_dir]/stamp diff --git a/dtool/pptempl/compilerSettings.pp b/dtool/pptempl/compilerSettings.pp index 50dcbe224e..89f22867ec 100644 --- a/dtool/pptempl/compilerSettings.pp +++ b/dtool/pptempl/compilerSettings.pp @@ -8,7 +8,7 @@ #define OPT1FLAGS /GZ // #defer DEBUGFLAGS /MDd $[BROWSEINFO_FLAG] $[DEBUG_TYPE_FLAGS] - #defer DEBUGFLAGS /MDd /Zi $[BROWSEINFO_FLAG] /Fd"$[osfilename $[target:%.obj=%.pdb]]" + #defer DEBUGFLAGS /MDd $[BROWSEINFO_FLAG] /Zi /Fd"$[osfilename $[target:%.obj=%.pdb]]" #define RELEASEFLAGS /MD // in case we have mixed intel/msvc build