Fix win-scons CI (#531)

* 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
This commit is contained in:
2025-01-22 08:14:24 -06:00
committed by GitHub
parent 37640bf349
commit f6be98acfb
2 changed files with 20 additions and 3 deletions

View File

@@ -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')
@@ -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
@@ -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=[]):

View File

@@ -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")