Skip to content

Commit 04fdfff

Browse files
committed
*Improved build system
*Some shadow map and RSM tuning *General improvements
1 parent 4da0cca commit 04fdfff

File tree

132 files changed

+868
-415
lines changed

Some content is hidden

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

132 files changed

+868
-415
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,17 @@
1212
[Rr]elease/
1313
## x64/
1414
#build/
15+
bld/
16+
1517
!/*/[Bb]uild/**
1618
/*/[Bb]uild/**/
17-
bld/
1819
/*/[Bb]in/
1920
[Oo]bj/
2021
[Bb]in[Tt]emp/
2122

23+
*.lrm
24+
*.lrt
25+
2226
*.vsasm
2327
*.psasm
2428

GITechDemo/Build/build_data_win.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import os
2+
import time
3+
import subprocess
4+
import logging
5+
import sys
6+
7+
# Prevent compiling imported .py into .pyc
8+
sys.dont_write_bytecode = True
9+
10+
import utils
11+
12+
13+
14+
def Run():
15+
#################
16+
# Configuration #
17+
#################
18+
19+
# Path to folder with data build scripts (relative to this script's folder)
20+
dataSrcDir = "/../DataSrc/"
21+
22+
# List of scripts to run for building data
23+
dataBuildScript = [
24+
"compile_sponza_model.py",
25+
"compile_utility_textures.py"
26+
]
27+
28+
#################
29+
30+
31+
32+
# Start timer
33+
start = time.clock()
34+
35+
# Compile data
36+
if(dataBuildScript):
37+
logging.info("Starting data build process...")
38+
logging.info("Data source directory: " + os.getcwd() + dataSrcDir)
39+
logging.info("")
40+
for script in dataBuildScript:
41+
logging.info("Running script: \"" + script + "\"")
42+
proc = subprocess.Popen( \
43+
['python.exe', '-u', os.getcwd() + dataSrcDir + script], \
44+
stdout = subprocess.PIPE, \
45+
stderr = subprocess.STDOUT, \
46+
cwd = os.getcwd() + dataSrcDir)
47+
for line in iter(proc.stdout.readline, ""):
48+
logging.info(line.replace('\n', '').replace('\r', ''))
49+
if proc.wait() != 0:
50+
logging.info(script + " has failed!")
51+
exit()
52+
logging.info("")
53+
54+
55+
56+
# Done! Print some info.
57+
logging.info("Done compiling data in " + str(time.clock() - start) + " seconds.")
58+
59+
return 0
60+
61+
########
62+
63+
64+
65+
##############
66+
# Run script #
67+
##############
68+
69+
if __name__ == "__main__":
70+
utils.SetupLogging("DataBuild")
71+
Run()

GITechDemo/Build/build_project_win.py

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
import os
2+
import sys
3+
import time
4+
import logging
5+
import subprocess
6+
7+
# Prevent compiling imported .py into .pyc
8+
sys.dont_write_bytecode = True
9+
10+
import utils
11+
import build_tools_win
12+
import build_data_win
13+
14+
15+
16+
#############################################################################
17+
# Arguments: #
18+
#---------------------------------------------------------------------------#
19+
# 'rebuild' to force rebuilding the solution #
20+
# 'release' to build on the Release configuration (default) #
21+
# 'profile' to build on the Profile configuration #
22+
# 'win32' to build for 32 bit architecture #
23+
# 'x64' to build for 64 bit architecture (default) #
24+
# 'vs20XX' to build against Visual Studio 20XX toolset (default: vs2010) #
25+
#############################################################################
26+
27+
28+
29+
def Run():
30+
#################
31+
# Configuration #
32+
#################
33+
34+
# Name of .sln file for the current project
35+
projectName = "GITechDemo"
36+
37+
defaultForceRebuild = False
38+
defaultBuildConfiguration = "Release"
39+
defaultArchitecture = "x64"
40+
defaultVSBuildTools = "VS100COMNTOOLS"
41+
defaultPlatformToolset = "v100"
42+
43+
#################
44+
45+
46+
47+
########
48+
# Main #
49+
########
50+
51+
#os.system('reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7"')
52+
#os.system('reg delete "HKLM\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v "12.0"')
53+
#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\\\\\"")
54+
55+
# Start timer
56+
start = time.clock()
57+
58+
# Process command arguments
59+
for opt in sys.argv:
60+
if(opt.lower() == "rebuild"):
61+
defaultForceRebuild = True
62+
if(opt.lower() == "release"):
63+
defaultBuildConfiguration = "Release"
64+
if(opt.lower() == "profile"):
65+
defaultBuildConfiguration = "Profile"
66+
if(opt.lower() == "x64"):
67+
defaultArchitecture = "x64"
68+
if(opt.lower() == "win32"):
69+
defaultArchitecture = "Win32"
70+
#if(opt.lower() == "vs2005"):
71+
# defaultVSBuildTools = "VS80COMNTOOLS"
72+
# defaultPlatformToolset = "vs80"
73+
#if(opt.lower() == "vs2008"):
74+
# defaultVSBuildTools = "VS90COMNTOOLS"
75+
# defaultPlatformToolset = "vs90"
76+
if(opt.lower() == "vs2010"):
77+
defaultVSBuildTools = "VS100COMNTOOLS"
78+
defaultPlatformToolset = "vs100"
79+
if(opt.lower() == "vs2012"):
80+
defaultVSBuildTools = "VS110COMNTOOLS"
81+
defaultPlatformToolset = "vs110"
82+
if(opt.lower() == "vs2013"):
83+
defaultVSBuildTools = "VS120COMNTOOLS"
84+
defaultPlatformToolset = "vs120"
85+
if(opt.lower() == "vs2015"):
86+
defaultVSBuildTools = "VS140COMNTOOLS"
87+
defaultPlatformToolset = "vs140"
88+
89+
90+
91+
# Setup build tools
92+
envSetupBat = "VsDevCmd.bat"
93+
if(os.getenv(defaultVSBuildTools)):
94+
pathToTools = os.getenv(defaultVSBuildTools)
95+
if(
96+
defaultVSBuildTools == "VS100COMNTOOLS" or
97+
defaultVSBuildTools == "VS90COMNTOOLS" or
98+
defaultVSBuildTools == "VS80COMNTOOLS"
99+
):
100+
envSetupBat = "vsvars32.bat"
101+
elif(os.getenv("VS140COMNTOOLS")): # Visual Studio 2015
102+
pathToTools = os.getenv("VS140COMNTOOLS")
103+
defaultPlatformToolset = "vs140"
104+
elif(os.getenv("VS120COMNTOOLS")): # Visual Studio 2013
105+
pathToTools = os.getenv("VS120COMNTOOLS")
106+
defaultPlatformToolset = "vs120"
107+
elif(os.getenv("VS110COMNTOOLS")): # Visual Studio 2012
108+
pathToTools = os.getenv("VS110COMNTOOLS")
109+
defaultPlatformToolset = "vs110"
110+
elif(os.getenv("VS100COMNTOOLS")): # Visual Studio 2010
111+
pathToTools = os.getenv("VS100COMNTOOLS")
112+
defaultPlatformToolset = "vs100"
113+
envSetupBat = "vsvars32.bat"
114+
#elif(os.getenv("VS90COMNTOOLS")): # Visual Studio 2008
115+
# pathToTools = os.getenv("VS90COMNTOOLS")
116+
# defaultPlatformToolset = "vs90"
117+
# envSetupBat = "vsvars32.bat"
118+
#elif(os.getenv("VS80COMNTOOLS")): # Visual Studio 2005
119+
# pathToTools = os.getenv("VS80COMNTOOLS")
120+
# defaultPlatformToolset = "vs80"
121+
# envSetupBat = "vsvars32.bat"
122+
else:
123+
logging.error("No compatible version of Visual Studio found!")
124+
exit()
125+
126+
127+
128+
# Compile code (tools too, if required)
129+
build_tools_win.Run()
130+
logging.info("")
131+
132+
logging.info("Starting project build process...")
133+
logging.info("Force rebuild: " + str(defaultForceRebuild))
134+
logging.info("Build configuration: " + defaultBuildConfiguration)
135+
logging.info("Architecture: " + defaultArchitecture)
136+
logging.info("Platform toolset: " + defaultPlatformToolset)
137+
logging.info("")
138+
139+
startProjectBuild = time.clock()
140+
if utils.BuildSLN(projectName, pathToTools, defaultPlatformToolset, envSetupBat, defaultArchitecture, defaultBuildConfiguration, defaultForceRebuild) != 0:
141+
logging.error("Could not complete project build process")
142+
exit()
143+
else:
144+
logging.info( \
145+
"Done building " + projectName + \
146+
" (" + defaultBuildConfiguration + "|" + defaultArchitecture + ") in " + \
147+
str(time.clock() - startProjectBuild) + " seconds.")
148+
logging.info("")
149+
150+
151+
152+
# Compile data
153+
build_data_win.Run()
154+
logging.info("")
155+
156+
157+
158+
# Copy and organize build files
159+
logging.info("Configuring build:")
160+
161+
# Create directory structure
162+
logging.info("Creating directory structure...")
163+
rootBuildDir = "Windows/" + projectName
164+
utils.MakeDir(rootBuildDir + "/bin/" +
165+
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration + "/")) +
166+
defaultArchitecture)
167+
utils.MakeDir(rootBuildDir + "/data")
168+
169+
# Copy binaries
170+
logging.info("Copying binaries...")
171+
pathToBinaries = [
172+
"../Bin/" + defaultArchitecture + "/" + defaultBuildConfiguration + "/" + projectName + "/",
173+
rootBuildDir + "/bin/" +
174+
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration + "/")) +
175+
defaultArchitecture
176+
]
177+
utils.CopyFiles(pathToBinaries[0], pathToBinaries[1], "*.exe")
178+
utils.CopyFiles(pathToBinaries[0], pathToBinaries[1], "*.dll")
179+
180+
# Copy data
181+
logging.info("Copying data...")
182+
utils.CopyTree("../Data/", rootBuildDir + "/data")
183+
184+
# Create batch file
185+
logging.info("Creating batch file...")
186+
startBat = open(
187+
rootBuildDir + "/run_" +
188+
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration.lower() + "_")) +
189+
defaultArchitecture.lower() + ".bat", "w"
190+
)
191+
192+
startBat.write("\
193+
@echo off\n\
194+
:A\n\
195+
cls\n\
196+
cd %~dp0/data\n\
197+
start %1../bin/" +
198+
("" if (defaultBuildConfiguration == "Release") else (defaultBuildConfiguration + "/")) +
199+
defaultArchitecture + "/" +
200+
projectName + ".exe\n\
201+
exit"
202+
)
203+
startBat.close()
204+
205+
logging.info("")
206+
207+
208+
209+
# Done! Print some info.
210+
logging.info(
211+
"Done building project " + projectName +
212+
" (" + defaultBuildConfiguration + "|" + defaultArchitecture + ") in " +
213+
str(time.clock() - start) + " seconds."
214+
)
215+
216+
return 0
217+
218+
########
219+
220+
221+
222+
##############
223+
# Run script #
224+
##############
225+
226+
if __name__ == "__main__":
227+
utils.SetupLogging("ProjectBuild")
228+
Run()

0 commit comments

Comments
 (0)