Compare commits

...

4 Commits

Author SHA1 Message Date
Patrick Wuttke
7fc8518db4 Merge branch 'master' of https://git.mewin.de/mewin/scons-plus-plus 2025-07-14 18:51:46 +02:00
Patrick Wuttke
8b5d66dbec Forward CCFLAGS to Visual Studio project for IntelliSense. 2025-07-14 18:51:41 +02:00
Patrick Wuttke
6326454729 Fixed how C++ standard is passed to VS/IntelliSense. 2025-07-08 16:50:59 +02:00
Patrick Wuttke
18293fdcf7 Fixed target info dumping. 2025-07-08 16:50:06 +02:00
2 changed files with 21 additions and 11 deletions

View File

@ -535,8 +535,6 @@ def _version_to_string(version) -> str:
return '.'.join([str(v) for v in version])
def _finalize(env: Environment):
if dump is not None:
_dump()
if generate_project:
_generate_project(generate_project)
Exit(0)
@ -559,6 +557,8 @@ def _finalize(env: Environment):
}
}, f)
if dump is not None:
_dump()
for target in env['SPP_TARGETS']:
_build_target(target)
@ -744,8 +744,14 @@ def _generate_project(project_type: str) -> None:
def _get_target_property(build_type: str, target: str, path: str) -> Any:
import subprocess
output = subprocess.check_output((shutil.which('scons'), '--silent', f'--build_type={build_type}', '--dump=targets', '--dump_format=json', f'--dump_path={target}/{path}'), text=True).strip()
return json.loads(output)
cmd = (shutil.which('scons'), '--silent', f'--build_type={build_type}', '--dump=targets', '--dump_format=json', f'--dump_path={target}/{path}')
output = subprocess.check_output(cmd, text=True).strip()
try:
return json.loads(output)
except json.JSONDecodeError as e:
env.Warn(f'Command: {cmd}')
env.Warn(f'Output: {output}')
raise e
executables = _get_executables()
@ -901,7 +907,10 @@ def _dump() -> None:
'args': target.args,
# 'kwargs': kwargs, <- circular dependency here and the json encoder doesn't like that
'CPPDEFINES': kwargs.get('CPPDEFINES', env['CPPDEFINES']),
'CPPPATH': kwargs.get('CPPPATH', env['CPPPATH'])
'CPPPATH': kwargs.get('CPPPATH', env['CPPPATH']),
'CFLAGS': kwargs.get('CFLAGS', env['CFLAGS']),
'CCFLAGS': kwargs.get('CCFLAGS', env['CCFLAGS']),
'CXXFLAGS': kwargs.get('CXXFLAGS', env['CXXFLAGS'])
}
return result
@ -1148,6 +1157,7 @@ env.Append(CXXFLAGS = [])
env.Append(CPPPATH = [])
env.Append(CPPDEFINES = [])
env.Append(LINKFLAGS = [])
env.Append(LIBS = [])
# init SPP environment variables
env['SPP_DIR'] = _spp_dir.abspath

View File

@ -1,9 +1,9 @@
{%- set ms_cxx_standard = {
'c++14': 'stdcpp14',
'c++17': 'stdcpp17',
'c++20': 'stdcpp20',
'c++23': 'stdcpplatest',
'c++26': 'stdcpplatest'}[project.cxx_standard] | default('stdcpp14')
'c++14': 'c++14',
'c++17': 'c++17',
'c++20': 'c++20',
'c++23': 'c++latest',
'c++26': 'c++latest'}[project.cxx_standard] | default('c++14')
-%}
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="17.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
@ -59,7 +59,7 @@
<GenerateDebugInformation>{{ build_type != 'release' and 'true' or 'false' }}</GenerateDebugInformation>
<AdditionalIncludeDirectories>{{ get_target_property(build_type, target.name, 'CPPPATH') | join(';') }};%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<MsExtensions>false</MsExtensions>
<CppLanguageStd>{{ ms_cxx_standard }}</CppLanguageStd>
<AdditionalOptions>{{ get_target_property(build_type, target.name, 'CCFLAGS') | join(' ') }}</AdditionalOptions> {# + get_target_property(build_type, target.name, 'CXXFLAGS')) #}
</ClCompile>
</ItemDefinitionGroup>
{%- endfor %}