Browse Source

optimize single processor build

cxgeorge 24 years ago
parent
commit
333c645f06

+ 3 - 3
dtool/pptempl/Global.gmsvc.pp

@@ -6,10 +6,10 @@
 // Template.gmsvc.pp.
 // Template.gmsvc.pp.
 //
 //
 
 
-#define REQUIRED_VERSION 1.00
+#define REQUIRED_PPREMAKE_VERSION 1.02
 
 
-#if $[< $[PPREMAKE_VERSION],$[REQUIRED_VERSION]]
-  #error You need at least ppremake version $[REQUIRED_VERSION] to use BUILD_TYPE gmsvc.
+#if $[< $[PPREMAKE_VERSION],$[REQUIRED_PPREMAKE_VERSION]]
+  #error You need at least ppremake version $[REQUIRED_PPREMAKE_VERSION] to use BUILD_TYPE gmsvc.
 #endif
 #endif
 
 
 #defun get_metalibs target,complete_libs
 #defun get_metalibs target,complete_libs

+ 4 - 2
dtool/pptempl/Global.msvc.pp

@@ -6,8 +6,10 @@
 // Template.msvc.pp.
 // Template.msvc.pp.
 //
 //
 
 
-#if $[< $[PPREMAKE_VERSION],1.00]
-  #error You need at least ppremake version 1.00 to use BUILD_TYPE msvc.
+#define REQUIRED_PPREMAKE_VERSION 1.02
+
+#if $[< $[PPREMAKE_VERSION],$[REQUIRED_PPREMAKE_VERSION]]
+  #error You need at least ppremake version $[REQUIRED_PPREMAKE_VERSION] to use BUILD_TYPE msvc.
 #endif
 #endif
 
 
 #defun get_metalibs target,complete_libs
 #defun get_metalibs target,complete_libs

+ 11 - 4
dtool/pptempl/Global.pp

@@ -283,6 +283,13 @@
 // is.
 // is.
 #defer active_target $[if $[build_target],$[TARGET]]
 #defer active_target $[if $[build_target],$[TARGET]]
 
 
+#if $[and $[eq $[NUMBER_OF_PROCESSORS],1], $[eq $[NO_COMBINED_SOURCES],]]
+ // for non-composite dirs, want to avoid returning the composite default name
+#defer get_combined_sources $[if $[ne $[COMBINED_SOURCES],], $[TARGET]_composite.cxx,]
+#else
+#defer get_combined_sources $[COMBINED_SOURCES]
+#endif
+
 // This subroutine will set up the sources variable to reflect the
 // This subroutine will set up the sources variable to reflect the
 // complete set of sources for this target, and also set the
 // complete set of sources for this target, and also set the
 // alt_cflags, alt_libs, etc. as appropriate according to how the
 // alt_cflags, alt_libs, etc. as appropriate according to how the
@@ -294,7 +301,7 @@
 #defer get_sources \
 #defer get_sources \
   $[SOURCES] \
   $[SOURCES] \
   $[PRECOMPILED_HEADER] \
   $[PRECOMPILED_HEADER] \
-  $[if $[ne $[NO_COMBINED_SOURCES],], $[INCLUDED_SOURCES], $[COMBINED_SOURCES]] \  
+  $[if $[ne $[NO_COMBINED_SOURCES],], $[INCLUDED_SOURCES], $[get_combined_sources]] \  
   $[if $[HAVE_CRYPTO],$[IF_CRYPTO_SOURCES]] \
   $[if $[HAVE_CRYPTO],$[IF_CRYPTO_SOURCES]] \
   $[if $[HAVE_JPEG],$[IF_JPEG_SOURCES]] \
   $[if $[HAVE_JPEG],$[IF_JPEG_SOURCES]] \
   $[if $[HAVE_TIFF],$[IF_TIFF_SOURCES]] \
   $[if $[HAVE_TIFF],$[IF_TIFF_SOURCES]] \
@@ -308,7 +315,7 @@
 #defer all_sources \
 #defer all_sources \
   $[SOURCES] \
   $[SOURCES] \
   $[PRECOMPILED_HEADER] \
   $[PRECOMPILED_HEADER] \
-  $[if $[ne $[NO_COMBINED_SOURCES],], $[INCLUDED_SOURCES], $[COMBINED_SOURCES]] \
+  $[if $[ne $[NO_COMBINED_SOURCES],], $[INCLUDED_SOURCES], $[get_combined_sources]] \
   $[IF_CRYPTO_SOURCES] \
   $[IF_CRYPTO_SOURCES] \
   $[IF_JPEG_SOURCES] \
   $[IF_JPEG_SOURCES] \
   $[IF_TIFF_SOURCES] \
   $[IF_TIFF_SOURCES] \
@@ -318,9 +325,9 @@
   $[if $[HAVE_NET], $[IF_NET_SOURCES] $[if $[ne $[NO_COMBINED_SOURCES],], $[IF_NET_INCLUDED_SOURCES], $[IF_NET_COMBINED_SOURCES]]] \    
   $[if $[HAVE_NET], $[IF_NET_SOURCES] $[if $[ne $[NO_COMBINED_SOURCES],], $[IF_NET_INCLUDED_SOURCES], $[IF_NET_COMBINED_SOURCES]]] \    
   $[IF_IPC_SOURCES] \
   $[IF_IPC_SOURCES] \
   $[IF_PYTHON_SOURCES]
   $[IF_PYTHON_SOURCES]
-  
-#defer included_sources $[INCLUDED_SOURCES] $[if $[HAVE_ZLIB],$[IF_ZLIB_INCLUDED_SOURCES]] $[if $[HAVE_NET],$[IF_NET_INCLUDED_SOURCES]]
 
 
+#defer included_sources $[INCLUDED_SOURCES] $[if $[HAVE_ZLIB],$[IF_ZLIB_INCLUDED_SOURCES]] $[if $[HAVE_NET],$[IF_NET_INCLUDED_SOURCES]] $[if $[and $[eq $[NUMBER_OF_PROCESSORS],1], $[eq $[NO_COMBINED_SOURCES],]], $[COMBINED_SOURCES]]
+  
 // This variable returns the set of sources that are to be
 // This variable returns the set of sources that are to be
 // interrogated for the current target.
 // interrogated for the current target.
 #defer get_igatescan \
 #defer get_igatescan \

+ 1 - 0
dtool/pptempl/System.pp

@@ -32,6 +32,7 @@
   #define TEMPLATE_FILE $[THISDIRPREFIX]Template.$[BUILD_TYPE].pp
   #define TEMPLATE_FILE $[THISDIRPREFIX]Template.$[BUILD_TYPE].pp
 #endif
 #endif
 
 
+
 #if $[eq $[DEPENDENCY_CACHE_FILENAME],]
 #if $[eq $[DEPENDENCY_CACHE_FILENAME],]
   #define DEPENDENCY_CACHE_FILENAME pp.dep
   #define DEPENDENCY_CACHE_FILENAME pp.dep
 #endif
 #endif

+ 24 - 6
dtool/pptempl/Template.gmsvc.pp

@@ -120,6 +120,7 @@
 
 
 #endif
 #endif
 
 
+
 // This map variable gets us all the various source files from all the
 // This map variable gets us all the various source files from all the
 // targets in this directory.  We need it to look up the context in
 // targets in this directory.  We need it to look up the context in
 // which to build a particular source file, since some targets may
 // which to build a particular source file, since some targets may
@@ -169,6 +170,23 @@
 // And $[libs] is the set of libraries we will link with.
 // And $[libs] is the set of libraries we will link with.
 #defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]]
 #defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]]
 
 
+// for single-processor builds, write out *_composite.cxx files that include all composite
+// files into 1 in order to speed the build of our heavily templated source
+#forscopes lib_target bin_target static_lib_target
+#if $[and $[eq $[NUMBER_OF_PROCESSORS],1], $[eq $[NO_COMBINED_SOURCES],], $[ne $[COMBINED_SOURCES],]]
+#output $[TARGET]_composite.cxx
+#format collapse
+/* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */
+/* ################################# DO NOT EDIT ########################### */
+
+#foreach file $[COMBINED_SOURCES]
+##include "$[file]"
+#end file
+
+#end $[TARGET]_composite.cxx
+#endif
+#end lib_target bin_target static_lib_target
+
 // Okay, we're ready.  Start outputting the Makefile now.
 // Okay, we're ready.  Start outputting the Makefile now.
 #output Makefile
 #output Makefile
 #format makefile
 #format makefile
@@ -206,9 +224,8 @@ $[TAB] rm -rf $[so_dir]
 #if $[st_sources]
 #if $[st_sources]
 $[TAB] rm -rf $[st_dir]
 $[TAB] rm -rf $[st_dir]
 #endif
 #endif
-$[TAB] rm -f *.pyc *.pyo  // Also scrub out old generated Python code.
-
-
+$[TAB] rm -f *.pyc *.pyo // Also scrub out old generated Python code.
+                         
 // 'cleanall' is not much more thorough than 'clean': At the moment,
 // 'cleanall' is not much more thorough than 'clean': At the moment,
 // it also cleans up the bison and flex output, as well as the
 // it also cleans up the bison and flex output, as well as the
 // dependency cache file.
 // dependency cache file.
@@ -219,6 +236,9 @@ $[TAB] rm -f $[patsubst %.yxx %.lxx,%.cxx,$[yxx_so_sources] $[yxx_st_sources] $[
 #if $[ne $[DEPENDENCY_CACHE_FILENAME],]
 #if $[ne $[DEPENDENCY_CACHE_FILENAME],]
 $[TAB] rm -f $[DEPENDENCY_CACHE_FILENAME]
 $[TAB] rm -f $[DEPENDENCY_CACHE_FILENAME]
 #endif
 #endif
+#if $[eq $[NUMBER_OF_PROCESSORS],1]
+$[TAB] rm -f *_composite.cxx  // eliminate generated *_composite.cxx files for uniprocessor builds
+#endif
 
 
 clean-igate :
 clean-igate :
 #forscopes metalib_target lib_target ss_lib_target
 #forscopes metalib_target lib_target ss_lib_target
@@ -758,6 +778,7 @@ $[TAB] $[COMPILE_C]
 #define source $[file]
 #define source $[file]
 #define ipath $[file_ipath]
 #define ipath $[file_ipath]
 #define flags $[c++flags] $[CFLAGS_SHARED] $[all_sources $[building_var:%=/D%],$[file]]
 #define flags $[c++flags] $[CFLAGS_SHARED] $[all_sources $[building_var:%=/D%],$[file]]
+
 // Yacc must run before some files can be compiled, so all files
 // Yacc must run before some files can be compiled, so all files
 // depend on yacc having run.
 // depend on yacc having run.
 $[target] : $[source] $[dependencies $[file]] $[yxx_so_sources:%.yxx=%.cxx] $[so_dir]/stamp
 $[target] : $[source] $[dependencies $[file]] $[yxx_so_sources:%.yxx=%.cxx] $[so_dir]/stamp
@@ -901,10 +922,8 @@ $[DEPENDENCY_CACHE_FILENAME] : $[dep_sources]
 $[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME]
 $[TAB] @ppremake -D $[DEPENDENCY_CACHE_FILENAME]
 #endif
 #endif
 
 
-
 #end Makefile
 #end Makefile
 
 
-
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 #elif $[eq $[DIR_TYPE], group]
 #elif $[eq $[DIR_TYPE], group]
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
@@ -1027,7 +1046,6 @@ $[TAB] cp -f $[local] $[dest]
 #sinclude $[TOPDIRPREFIX]LocalSetup.pp
 #sinclude $[TOPDIRPREFIX]LocalSetup.pp
 
 
 
 
-
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////
 #elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]]
 #elif $[or $[eq $[DIR_TYPE], models],$[eq $[DIR_TYPE], models_toplevel],$[eq $[DIR_TYPE], models_group]]
 //////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////

+ 20 - 0
dtool/pptempl/Template.msvc.pp

@@ -175,6 +175,23 @@
 // And $[libs] is the set of libraries we will link with.
 // And $[libs] is the set of libraries we will link with.
 #defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]]
 #defer libs $[unique $[actual_local_libs:%=%$[dllext]] $[patsubst %:c,,%:m %,%$[dllext],$[OTHER_LIBS]] $[get_libs]]
 
 
+// for single-processor builds, write out *_composite.cxx files that include all composite
+// files into 1 in order to speed the build of our heavily templated source
+#forscopes lib_target bin_target static_lib_target
+#if $[and $[eq $[NUMBER_OF_PROCESSORS],1], $[eq $[NO_COMBINED_SOURCES],], $[ne $[COMBINED_SOURCES],]]
+#output $[TARGET]_composite.cxx
+#format collapse
+/* Generated automatically by $[PPREMAKE] $[PPREMAKE_VERSION] from $[SOURCEFILE]. */
+/* ################################# DO NOT EDIT ########################### */
+
+#foreach file $[COMBINED_SOURCES]
+##include "$[file]"
+#end file
+
+#end $[TARGET]_composite.cxx
+#endif
+#end lib_target bin_target static_lib_target
+
 // Okay, we're ready.  Start outputting the Makefile now.
 // Okay, we're ready.  Start outputting the Makefile now.
 #output Makefile
 #output Makefile
 #format makefile
 #format makefile
@@ -219,6 +236,9 @@ $[TAB] -del /f $[patsubst %.yxx %.lxx,%.cxx,$[yxx_so_sources] $[yxx_st_sources]
 #if $[ne $[DEPENDENCY_CACHE_FILENAME],]
 #if $[ne $[DEPENDENCY_CACHE_FILENAME],]
 $[TAB] -del /f $[DEPENDENCY_CACHE_FILENAME]
 $[TAB] -del /f $[DEPENDENCY_CACHE_FILENAME]
 #endif
 #endif
+#if $[eq $[NUMBER_OF_PROCESSORS],1]
+$[TAB] rm -f *_composite.cxx  // eliminate generated *_composite.cxx files for uniprocessor builds
+#endif
 
 
 clean-igate :
 clean-igate :
 #forscopes metalib_target lib_target ss_lib_target
 #forscopes metalib_target lib_target ss_lib_target