4
4
import errno
5
5
import sys
6
6
7
+ # Arguments:
8
+ # 'rebuild' to force rebuilding the solution
9
+ # 'profile' to build on the Profile configuration
10
+
7
11
PROJECT_NAME = "GITechDemo"
8
12
DEFAULT_VSCOMNTOOLS = "VS120COMNTOOLS"
9
13
FORCE_REBUILD = False
14
+ BUILD_CONFIGURATION = "Release"
10
15
11
16
def copyfiles (srcdir , dstdir , filepattern ):
12
17
def failed (exc ):
@@ -50,9 +55,9 @@ def copytree(src, dst, symlinks = False, ignore = None):
50
55
else :
51
56
shutil .copy2 (s , d )
52
57
53
- def buildsln (pathToTools , platform ):
58
+ def buildsln (pathToTools , platform , buildConfig ):
54
59
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
56
61
if (FORCE_REBUILD ):
57
62
cmd += " /t:rebuild "
58
63
else :
@@ -66,8 +71,11 @@ def buildsln(pathToTools, platform):
66
71
#os.system('reg delete "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "12.0"')
67
72
#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\\\\\"")
68
73
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"
71
79
72
80
print ("\n Starting build process...\n " )
73
81
@@ -89,31 +97,32 @@ def buildsln(pathToTools, platform):
89
97
print ("No compatible version of Visual Studio found!\n " )
90
98
91
99
if (pathToTools ):
92
- buildsln (pathToTools , "x86" )
93
- buildsln (pathToTools , "x64" )
100
+ buildsln (pathToTools , "x86" , BUILD_CONFIGURATION )
101
+ buildsln (pathToTools , "x64" , BUILD_CONFIGURATION )
94
102
95
- print ("\n Configuring build...\n " );
103
+ print ("\n Configuring build...\n " )
96
104
97
105
# Create directory structure
106
+ rootBuildDir = "Windows/" + BUILD_CONFIGURATION + "/" + PROJECT_NAME
98
107
makedir ("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" )
103
112
104
113
# 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" )
107
116
108
117
# 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" )
111
120
112
121
# Copy data
113
- copytree ("../Data/" , "./Windows /data" )
122
+ copytree ("../Data/" , rootBuildDir + " /data" )
114
123
115
124
# Create x64 batch files
116
- x64bat = open ("./Windows /run_x64.bat" , "w" )
125
+ x64bat = open (rootBuildDir + " /run_x64.bat" , "w" )
117
126
x64bat .write ("\
118
127
@echo off\n \
119
128
:A\n \
@@ -124,7 +133,7 @@ def buildsln(pathToTools, platform):
124
133
x64bat .close ()
125
134
126
135
# Create x86 batch files
127
- x86bat = open ("./Windows /run_x86.bat" , "w" )
136
+ x86bat = open (rootBuildDir + " /run_x86.bat" , "w" )
128
137
x86bat .write ("\
129
138
@echo off\n \
130
139
:A\n \
@@ -134,4 +143,4 @@ def buildsln(pathToTools, platform):
134
143
exit" )
135
144
x86bat .close ()
136
145
137
- print ("DONE!" );
146
+ print ("DONE!" )
0 commit comments