Skip to content

Commit

Permalink
Fix #444: win-scons include Visual Studio debug symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios authored and CelticMinstrel committed Sep 18, 2024
1 parent cc276a6 commit 8a522bd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ if env['debug']:
env.Append(CCFLAGS=['-g','-O0'])
elif platform == 'win32':
env.Append(CCFLAGS=['/Zi', '/Od'])
env.Append(LINKFLAGS=['/DEBUG'])

# This command generates the header with git revision information
# NOTE: Changes made here must also be made in pkg/gitrev.sh!
Expand Down
5 changes: 5 additions & 0 deletions src/game/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ elif str(platform) == "posix":
"""))

boe = env.Program("#build/bin/Blades of Exile", game_sources + party_classes + common_sources)
debug_symbols = None
if str(platform) == "win32" and 'msvc' in env["TOOLS"] and env['debug']:
debug_symbols = boe[0].abspath.replace('.exe', '.pdb')

if str(platform) == "darwin":
boe_info = {
Expand All @@ -55,3 +58,5 @@ else:
boe_info = {}

env.Package(boe, install_dir, boe_info)
if debug_symbols is not None:
env.Install(install_dir, debug_symbols)
5 changes: 5 additions & 0 deletions src/pcedit/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ elif str(platform) == "posix":
"""))

pced = env.Program("#build/bin/BoE Character Editor", pced_sources + party_classes + common_sources)
debug_symbols = None
if str(platform) == "win32" and 'msvc' in env["TOOLS"] and env['debug']:
debug_symbols = pced[0].abspath.replace('.exe', '.pdb')

if str(platform) == "darwin":
pced_info = {
Expand All @@ -39,3 +42,5 @@ else:
pced_info = {}

env.Package(pced, install_dir, pced_info)
if debug_symbols is not None:
env.Install(install_dir, debug_symbols)
5 changes: 5 additions & 0 deletions src/scenedit/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ elif str(platform) == "posix":
"""))

scened = env.Program("#build/bin/BoE Scenario Editor", scened_sources + common_sources)
debug_symbols = None
if str(platform) == "win32" and 'msvc' in env["TOOLS"] and env['debug']:
debug_symbols = scened[0].abspath.replace('.exe', '.pdb')

if str(platform) == "darwin":
scened_info = {
Expand All @@ -43,3 +46,5 @@ else:
scened_info = {}

env.Package(scened, install_dir, scened_info)
if debug_symbols is not None:
env.Install(install_dir, debug_symbols)
10 changes: 9 additions & 1 deletion test/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ test_sources = Glob("""*.cpp""") + Split("""
#build/obj/scenedit/scen.fileio.cpp
""")

debug_symbols = None
if str(platform) == "win32" and 'msvc' in env["TOOLS"]:
test = env.Program("#build/bin/boe_test", party_classes + common_sources + test_sources, LINKFLAGS=f'/nologo /SUBSYSTEM:CONSOLE /MACHINE:X{arch_short}')
link_flags = f'/nologo /SUBSYSTEM:CONSOLE /MACHINE:X{arch_short}'
if env['debug']:
link_flags += ' /DEBUG'
test = env.Program("#build/bin/boe_test", party_classes + common_sources + test_sources, LINKFLAGS=link_flags)
if env['debug']:
debug_symbols = test[0].abspath.replace(".exe", ".pdb")
else:
test = env.Program("#build/bin/boe_test", test_sources + party_classes + common_sources)

Expand All @@ -23,6 +29,8 @@ def run_tests(env,target,source):
open(target[0].abspath,'w').write("PASSED\n")

env.Install("#build/test/", test)
if debug_symbols is not None:
env.Install("#build/test/", debug_symbols)
env.AlwaysBuild(env.Install("#build/test/", Dir("#test/files")))
env.AlwaysBuild(env.Install("#build/rsrc/", Dir("#rsrc/strings")))
env.Command("#build/test/junk/", '', 'mkdir "' + Dir("#build/test/junk").path + '"')
Expand Down

0 comments on commit 8a522bd

Please sign in to comment.