[commit] r1768 - in trunk: GME Install/Build

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Jan 4 14:35:27 CST 2012


Author: ksmyth
Date: Wed Jan  4 14:35:27 2012
New Revision: 1768

Log:
Add PGO to build.py

Modified:
   trunk/GME/regPGO.bat
   trunk/Install/Build/build.py
   trunk/Install/Build/tools.py

Modified: trunk/GME/regPGO.bat
==============================================================================
--- trunk/GME/regPGO.bat	Wed Jan  4 14:35:14 2012	(r1767)
+++ trunk/GME/regPGO.bat	Wed Jan  4 14:35:27 2012	(r1768)
@@ -15,6 +15,11 @@
 if errorlevel 1 goto errorlabel
 echo    OK
 
+echo Meta.dll:
+regsvr32 /s "%~dp0%1\Release_PGO\Meta.dll"
+if errorlevel 1 goto errorlabel
+echo    OK
+
 goto eof
 
 :errorlabel

Modified: trunk/Install/Build/build.py
==============================================================================
--- trunk/Install/Build/build.py	Wed Jan  4 14:35:14 2012	(r1767)
+++ trunk/Install/Build/build.py	Wed Jan  4 14:35:27 2012	(r1768)
@@ -91,11 +91,38 @@
     "Compile GME core components"
     sln_file = os.path.join(GME_ROOT, "GME", "GME.sln");
     tools.build_VS( sln_file, "Release" )
-    sln_file = os.path.join(GME_ROOT, "GME", "GMEDecorators.sln");
+    sln_file = os.path.join(GME_ROOT, "GME", "GMEDecorators.sln")
     tools.build_VS( sln_file, "Release" )
-    cmd_dir = os.path.join(GME_ROOT, "GME");
+    cmd_dir = os.path.join(GME_ROOT, "GME")
+    if prefs['arch'] == 'x64':
+        # Need x86 Console on x64 to be able to run the tests, since we use 32bit out-of-proc activation for ScriptHost
+        tools.build_VS(os.path.join(GME_ROOT, 'GME', 'Console', 'Console.vcxproj'), 'Release', 'Win32')
     tools.system( ['call', 'regrelease.bat'] + (['x64'] if prefs['arch'] == 'x64' else []) + ['<NUL'], cmd_dir)
 
+def compile_GME_PGO_Instrument():
+    "Compile GME core components (PGO Instrument)"
+    sln_file = os.path.join(GME_ROOT, "GME", "GME.sln")
+    tools.build_VS(sln_file, "Release_PGO_Instrument")
+    cmd_dir = os.path.join(GME_ROOT, "GME")
+    tools.system( ['call', 'regPGO.bat'] + (['x64'] if prefs['arch'] == 'x64' else []) + ['<NUL'], cmd_dir)
+    import shutil
+    if prefs['arch'] == 'x64':
+        shutil.copyfile(r"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\pgort100.dll", os.path.join(GME_ROOT, 'GME', 'x64', 'Release', 'pgort100.dll'))
+    else:
+        shutil.copyfile(r"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\pgort100.dll", os.path.join(GME_ROOT, 'GME', 'Release', 'pgort100.dll'))
+
+def compile_GME_PGO_Optimize():
+    "Compile GME core components (PGO Optimize)"
+    sln_file = os.path.join(GME_ROOT, "GME", "GME.sln")
+    tools.build_VS( sln_file, "Release_PGO_Optimize" )
+
+def PGO_train():
+    "Run tests/Create training data for the PGO binaries"
+    import glob
+    for file in glob.glob(GME_ROOT + '\\GME' + ('\\x64' if prefs['arch'] == 'x64' else '') + '\\Release_PGO\\*.pgc'):
+        os.remove(file)
+    import subprocess
+    subprocess.check_call([sys.executable, '-m', 'GPyUnit.__main__', '-x'] + (['-a', 'x64'] if prefs['arch'] == 'x64' else []), cwd=os.path.join(GME_ROOT, 'Tests'))
 
 def compile_meta():
     "Compile MetaGME components"
@@ -273,6 +300,9 @@
     zip_scriptSDK, 
     generate_meta_files,
     generate_sample_files, 
+    compile_GME_PGO_Instrument,
+    PGO_train,
+    compile_GME_PGO_Optimize,
     build_msms,
     build_msi,
     zip_pdb,

Modified: trunk/Install/Build/tools.py
==============================================================================
--- trunk/Install/Build/tools.py	Wed Jan  4 14:35:14 2012	(r1767)
+++ trunk/Install/Build/tools.py	Wed Jan  4 14:35:27 2012	(r1768)
@@ -109,7 +109,7 @@
     toolmsg("Trying to create VisualStudio.DTE object")
     win32com.client.Dispatch("VisualStudio.DTE.10.0")
 
-def build_VS(sln_path, config_name):
+def build_VS(sln_path, config_name, arch=None):
     """
     Builds a Microsoft Visual Studio 2010 project or entire solution.
     It cleans the project/solution before building it if the global 'clean' preference
@@ -121,10 +121,12 @@
     msg = "Cleaning and " * prefs['clean']
     msg += "Compiling " + sln_path + "(" + config_name + ") "
     toolmsg(msg)
+    arch = arch or prefs['arch']
 
     import subprocess
     # , '/fl', '/flp:Verbosity=diagnostic'
-    args = ['msbuild', sln_path, '/t:' + ("Clean;" * prefs['clean']) + 'Build', '/p:Configuration=' + config_name + (';Platform=x64' if prefs['arch'] == 'x64' else '') ]
+    # , '/m'
+    args = ['msbuild', sln_path, '/t:' + ("Clean;" * prefs['clean']) + 'Build', '/p:Configuration=' + config_name + (';Platform=x64' if arch == 'x64' else '') ]
     with open(os.devnull, "w") as nulfp:
         # n.b. stderr=subprocess.STDOUT fails mysteriously
         import sys


More information about the gme-commit mailing list