44import errno
55import sys
66
7+ # Arguments:
8+ # 'rebuild' to force rebuilding the solution
9+ # 'profile' to build on the Profile configuration
10+
711PROJECT_NAME = "GITechDemo"
812DEFAULT_VSCOMNTOOLS = "VS120COMNTOOLS"
913FORCE_REBUILD = False
14+ BUILD_CONFIGURATION = "Release"
1015
1116def copyfiles (srcdir , dstdir , filepattern ):
1217 def failed (exc ):
@@ -50,9 +55,9 @@ def copytree(src, dst, symlinks = False, ignore = None):
5055 else :
5156 shutil .copy2 (s , d )
5257
53- def buildsln (pathToTools , platform ):
58+ def buildsln (pathToTools , platform , buildConfig ):
5459 cmd = "\" " + pathToTools + "VsDevCmd.bat\" && "
55- cmd += "MSBuild.exe /maxcpucount /p:Configuration=Release /p:Platform=" + platform
60+ cmd += "MSBuild.exe /maxcpucount /p:Configuration=" + buildConfig + " /p:Platform=" + platform
5661 if (FORCE_REBUILD ):
5762 cmd += " /t:rebuild "
5863 else :
@@ -66,8 +71,11 @@ def buildsln(pathToTools, platform):
6671#os.system('reg delete "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "12.0"')
6772#os.system("reg add \"HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7\" /v \"12.0\" /t REG_SZ /d \"C:\Program Files (x86)\Microsoft Visual Studio 12.0\\\\\"")
6873
69- if (len (sys .argv ) > 1 and sys .argv [1 ] == "rebuild" ):
70- FORCE_REBUILD = True ;
74+ for opt in sys .argv :
75+ if (opt == "rebuild" ):
76+ FORCE_REBUILD = True
77+ if (opt == "profile" ):
78+ BUILD_CONFIGURATION = "Profile"
7179
7280print ("\n Starting build process...\n " )
7381
@@ -89,31 +97,32 @@ def buildsln(pathToTools, platform):
8997 print ("No compatible version of Visual Studio found!\n " )
9098
9199if (pathToTools ):
92- buildsln (pathToTools , "x86" )
93- buildsln (pathToTools , "x64" )
100+ buildsln (pathToTools , "x86" , BUILD_CONFIGURATION )
101+ buildsln (pathToTools , "x64" , BUILD_CONFIGURATION )
94102
95- print ("\n Configuring build...\n " );
103+ print ("\n Configuring build...\n " )
96104
97105# Create directory structure
106+ rootBuildDir = "Windows/" + BUILD_CONFIGURATION + "/" + PROJECT_NAME
98107makedir ("Windows" )
99- makedir ("Windows /bin" )
100- makedir ("Windows /bin/x64" )
101- makedir ("Windows /bin/x86" )
102- makedir ("Windows /data" )
108+ makedir (rootBuildDir + " /bin" )
109+ makedir (rootBuildDir + " /bin/x64" )
110+ makedir (rootBuildDir + " /bin/x86" )
111+ makedir (rootBuildDir + " /data" )
103112
104113# Copy 64bit binaries
105- copyfiles ("../Bin/x64/Release/" + PROJECT_NAME + "/" , "./Windows /bin/x64" , "*.exe" )
106- copyfiles ("../Bin/x64/Release/" + PROJECT_NAME + "/" , "./Windows /bin/x64" , "*.dll" )
114+ copyfiles ("../Bin/x64/Release/" + PROJECT_NAME + "/" , rootBuildDir + " /bin/x64" , "*.exe" )
115+ copyfiles ("../Bin/x64/Release/" + PROJECT_NAME + "/" , rootBuildDir + " /bin/x64" , "*.dll" )
107116
108117# Copy 32bit binaries
109- copyfiles ("../Bin/Win32/Release/" + PROJECT_NAME + "/" , "./Windows /bin/x86" , "*.exe" )
110- copyfiles ("../Bin/Win32/Release/" + PROJECT_NAME + "/" , "./Windows /bin/x86" , "*.dll" )
118+ copyfiles ("../Bin/Win32/Release/" + PROJECT_NAME + "/" , rootBuildDir + " /bin/x86" , "*.exe" )
119+ copyfiles ("../Bin/Win32/Release/" + PROJECT_NAME + "/" , rootBuildDir + " /bin/x86" , "*.dll" )
111120
112121# Copy data
113- copytree ("../Data/" , "./Windows /data" )
122+ copytree ("../Data/" , rootBuildDir + " /data" )
114123
115124# Create x64 batch files
116- x64bat = open ("./Windows /run_x64.bat" , "w" )
125+ x64bat = open (rootBuildDir + " /run_x64.bat" , "w" )
117126x64bat .write ("\
118127 @echo off\n \
119128 :A\n \
@@ -124,7 +133,7 @@ def buildsln(pathToTools, platform):
124133x64bat .close ()
125134
126135# Create x86 batch files
127- x86bat = open ("./Windows /run_x86.bat" , "w" )
136+ x86bat = open (rootBuildDir + " /run_x86.bat" , "w" )
128137x86bat .write ("\
129138 @echo off\n \
130139 :A\n \
@@ -134,4 +143,4 @@ def buildsln(pathToTools, platform):
134143 exit" )
135144x86bat .close ()
136145
137- print ("DONE!" );
146+ print ("DONE!" )
0 commit comments