Skip to content

Commit 8fb2738

Browse files
committed
GITechDemo:
*reduced included Python distribution to the bare minimum required by the project *modified build scripts so as not to depend on the current working directory
1 parent e4c0605 commit 8fb2738

File tree

948 files changed

+64
-309093
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

948 files changed

+64
-309093
lines changed

GITechDemo/Build/build_data_win.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,17 @@ def Run():
6565

6666
# Compile data
6767
if(dataBuildScript):
68+
absDataSrcDir = os.path.realpath(utils.GetScriptAbsolutePath() + dataSrcDir)
6869
logging.info("Starting data build process...")
69-
logging.info("Data source directory: " + os.getcwd() + dataSrcDir)
70+
logging.info("Data source directory: " + absDataSrcDir)
7071
logging.info("")
7172
for script in dataBuildScript:
7273
logging.info("Running script: \"" + script + "\"")
7374
proc = subprocess.Popen( \
74-
['python.exe', '-u', os.getcwd() + dataSrcDir + script] + sys.argv[1:], \
75+
['python.exe', '-u', absDataSrcDir + "/" + script] + sys.argv[1:], \
7576
stdout = subprocess.PIPE, \
7677
stderr = subprocess.STDOUT, \
77-
cwd = os.getcwd() + dataSrcDir)
78+
cwd = absDataSrcDir)
7879
for line in iter(proc.stdout.readline, ""):
7980
logging.info(line.replace('\n', '').replace('\r', ''))
8081
if proc.wait() != 0:

GITechDemo/Build/build_project_win.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,18 @@ def Run():
146146

147147

148148

149-
# Compile code (tools too, if required)
149+
# Compile tools, if required
150150
build_tools_win.Run()
151151
logging.info("")
152-
152+
153+
154+
155+
# Compile data, if required
156+
build_data_win.Run()
157+
logging.info("")
158+
159+
160+
# Compile project
153161
logging.info("Starting project build process...")
154162
logging.info("Force rebuild: " + str(defaultForceRebuild))
155163
logging.info("Build configuration: " + defaultBuildConfiguration)
@@ -167,30 +175,25 @@ def Run():
167175
" (" + defaultBuildConfiguration + "|" + defaultArchitecture + ") in " + \
168176
str(time.clock() - startProjectBuild) + " seconds.")
169177
logging.info("")
170-
171-
172-
173-
# Compile data
174-
build_data_win.Run()
175-
logging.info("")
176-
177-
178-
178+
179+
180+
179181
# Copy and organize build files
180182
logging.info("Configuring build:")
181183

182184
# Create directory structure
183185
logging.info("Creating directory structure...")
184-
rootBuildDir = "Windows/" + projectName
186+
rootBuildDir = os.path.realpath(utils.GetScriptAbsolutePath() + "/Windows/" + projectName)
185187
utils.MakeDir(rootBuildDir + "/bin/" +
186188
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration + "/")) +
187189
defaultArchitecture)
188190
utils.MakeDir(rootBuildDir + "/data")
189-
191+
190192
# Copy binaries
191193
logging.info("Copying binaries...")
192194
pathToBinaries = [
193-
"../Bin/" + defaultArchitecture + "/" + defaultBuildConfiguration + "/" + projectName + "/",
195+
utils.GetScriptAbsolutePath() +
196+
"/../Bin/" + defaultArchitecture + "/" + defaultBuildConfiguration + "/" + projectName + "/",
194197
rootBuildDir + "/bin/" +
195198
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration + "/")) +
196199
defaultArchitecture
@@ -200,7 +203,7 @@ def Run():
200203

201204
# Copy data
202205
logging.info("Copying data...")
203-
utils.CopyTree("../Data/", rootBuildDir + "/data")
206+
utils.CopyTree(utils.GetScriptAbsolutePath() + "/../Data/", rootBuildDir + "/data")
204207

205208
# Create batch file
206209
logging.info("Creating batch file...")

GITechDemo/Build/utils.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ def CopyTree(src, dst, symlinks = False, ignore = None):
7979

8080

8181

82+
def GetScriptPath():
83+
return os.path.dirname(os.path.realpath(sys.argv[0]))
84+
85+
def GetScriptAbsolutePath():
86+
return os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
87+
88+
89+
8290
def BuildSLN(slnName, pathToTools, platformToolset, envSetupBat, platform, buildConfig, forceRebuild):
8391
os.environ["PATH"] += os.pathsep + pathToTools
8492
cmd = \
@@ -90,7 +98,7 @@ def BuildSLN(slnName, pathToTools, platformToolset, envSetupBat, platform, build
9098
cmd += " /t:rebuild "
9199
else:
92100
cmd += " "
93-
cmd += "\"" + os.getcwd() + "/../Code/Solutions/"
101+
cmd += "\"" + os.path.realpath(GetScriptAbsolutePath() + "/../Code/Solutions/") + "/"
94102
cmd += slnName + ".sln\""
95103

96104
proc = subprocess.Popen( \
@@ -105,9 +113,10 @@ def BuildSLN(slnName, pathToTools, platformToolset, envSetupBat, platform, build
105113

106114

107115
def SetupLogging(logName):
108-
MakeDir("Logs")
116+
logDirPath = GetScriptAbsolutePath() + "/Logs/"
117+
MakeDir(logDirPath)
109118
logging.basicConfig( \
110-
filename = "Logs/" + logName + "_" + \
119+
filename = logDirPath + logName + "_" + \
111120
"{:%Y%m%d%H%M%S}".format(datetime.datetime.now()) + \
112121
".log", level = logging.INFO, \
113122
format = '%(asctime)s - %(levelname)s: %(message)s', \

GITechDemo/Code/AppMain/GITechDemo.vcxproj

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@
137137
<CustomBuildStep />
138138
<CustomBuildStep />
139139
<PostBuildEvent>
140-
<Command>cd "$(SolutionDir)..\..\Build\"
141-
echo.
142-
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
140+
<Command>call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
143141
echo.
144142
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_data_win.py" $(Platform)
145143
echo.
@@ -172,9 +170,7 @@ xcopy /y /d "$(SolutionDir)..\External\Synesthesia3D\External\DX9\utils\$(Platfo
172170
<CustomBuildStep />
173171
<CustomBuildStep />
174172
<PostBuildEvent>
175-
<Command>cd "$(SolutionDir)..\..\Build\"
176-
echo.
177-
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
173+
<Command>call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
178174
echo.
179175
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_data_win.py" $(Platform)
180176
echo.
@@ -213,9 +209,7 @@ xcopy /y /d "$(SolutionDir)..\External\Synesthesia3D\External\DX9\utils\$(Platfo
213209
<CustomBuildStep />
214210
<CustomBuildStep />
215211
<PostBuildEvent>
216-
<Command>cd "$(SolutionDir)..\..\Build\"
217-
echo.
218-
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
212+
<Command>call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
219213
echo.
220214
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_data_win.py" $(Platform)
221215
echo.
@@ -252,9 +246,7 @@ xcopy /y /d "$(SolutionDir)..\External\Synesthesia3D\External\DX9\utils\$(Platfo
252246
<CustomBuildStep />
253247
<CustomBuildStep />
254248
<PostBuildEvent>
255-
<Command>cd "$(SolutionDir)..\..\Build\"
256-
echo.
257-
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
249+
<Command>call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
258250
echo.
259251
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_data_win.py" $(Platform)
260252
echo.
@@ -292,9 +284,7 @@ xcopy /y /d "$(SolutionDir)..\External\Synesthesia3D\External\DX9\utils\$(Platfo
292284
<CustomBuildStep />
293285
<CustomBuildStep />
294286
<PostBuildEvent>
295-
<Command>cd "$(SolutionDir)..\..\Build\"
296-
echo.
297-
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
287+
<Command>call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
298288
echo.
299289
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_data_win.py" $(Platform)
300290
echo.
@@ -332,9 +322,7 @@ xcopy /y /d "$(SolutionDir)..\External\Synesthesia3D\External\DX9\utils\$(Platfo
332322
<CustomBuildStep />
333323
<CustomBuildStep />
334324
<PostBuildEvent>
335-
<Command>cd "$(SolutionDir)..\..\Build\"
336-
echo.
337-
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
325+
<Command>call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_tools_win.py" $(Platform)
338326
echo.
339327
call "$(SolutionDir)..\External\Python27\python.exe" "$(SolutionDir)..\..\Build\build_data_win.py" $(Platform)
340328
echo.

0 commit comments

Comments
 (0)