Skip to content

Commit

Permalink
Fix win-scons CI (#531)
Browse files Browse the repository at this point in the history
* scons follow reference to c++ compiler
* don't worry about testing C compiler
* on failure, compile test program
* fix windows DEBUG definition flag
* add source file to win-scons SConscript

This fixes #514
  • Loading branch information
NQNStudios authored Jan 22, 2025
1 parent 37640bf commit f6be98a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 19 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ if platform not in ("darwin", "win32", "posix"):
Exit(1)
print('Building for:', platform)
print('Using toolchain:', toolset)
print('C++ compiler:', env['CXX'])
cxx = env.subst(env['CXX'])
print('C++ compiler:', cxx)

env.VariantDir('#build/obj', 'src')
env.VariantDir('#build/obj/test', 'test')
Expand All @@ -89,7 +90,7 @@ if not env['release']:
if platform in ['posix', 'darwin']:
env.Append(CCFLAGS=['-g','-O0', '-D' 'DEBUG=1'])
elif platform == 'win32':
env.Append(CCFLAGS=['/Zi', '/Od', '/D', 'DEBUG=1'])
env.Append(CCFLAGS=['/Zi', '/Od', '/DDEBUG'])
env.Append(LINKFLAGS=['/DEBUG'])

# This command generates the header with git revision information
Expand Down Expand Up @@ -327,8 +328,23 @@ bundled_libs = []
if not env.GetOption('clean'):
conf = Configure(env)

if not conf.CheckCC() or not conf.CheckCXX():
if not conf.CheckCXX():
print("There's a problem with your compiler!")

test_command = env.subst(env['CXXCOM'])
print('Working directory:', os.getcwd())
print('Compiling test program: ' + test_command)

with open('test.cpp', 'w') as test_file:
test_file.writelines([
'int main(void)\n',
'{\n',
'return 0;\n',
'}\n',
])
import subprocess
for line in test_command.split('\n'):
subprocess.run(line.split(' ') + ['test.cpp'])
Exit(1)

def check_lib(lib, disp, suffixes=[], versions=[], msvc_versions=[]):
Expand Down
1 change: 1 addition & 0 deletions src/tools/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if str(platform) == "darwin":
tools.extend(Glob("*.mac.*"))
elif str(platform) == "win32":
tools.extend(Glob("*.win.cpp"))
tools.extend(Glob("../fileio/*.win.cpp"))
elif str(platform) == "posix":
tools.extend(Glob("*.linux.cpp"))
tools.append("prefs.win.cpp")
Expand Down

0 comments on commit f6be98a

Please sign in to comment.