Fixed .sln generation (a little) and changed config to create one .pdb per target.

This commit is contained in:
Patrick Wuttke
2025-09-12 09:56:26 +02:00
parent e19f6115be
commit 07c2496342
3 changed files with 40 additions and 44 deletions

View File

@@ -529,6 +529,8 @@ def _build_target(target: _Target):
new_kwargs = target.kwargs.copy()
if 'target' in new_kwargs: # there should always be a target, right?
new_kwargs['target'] = f"{new_kwargs['target']}-{build_type}"
if os.name == 'nt' and 'PDB' not in new_kwargs:
new_kwargs['PDB'] = f'{new_kwargs["target"]}.pdb'
target.target = target.builder(*target.args, **new_kwargs)
def _version_to_string(version) -> str:
@@ -641,52 +643,33 @@ def _generate_project(project_type: str) -> None:
return result
root_path = pathlib.Path(env.Dir('#').abspath)
def _make_entry(target, type, prefix, suffix) -> str:
def _full_path(build_type) -> str:
trgt = _target_entry(target.kwargs['target'])
full_path = pathlib.Path(trgt.abspath).relative_to(root_path)
full_path = full_path.parent / f'{env.subst(prefix)}{full_path.name}-{build_type}{env.subst(suffix)}'
return str(full_path)
return {
'name': target.name,
'filename': _full_path,
'target': target,
'type': type,
'module': target.module
}
def _get_executables() -> list:
result = []
for target in env['SPP_TARGETS']:
if target.target_type == TargetType.PROGRAM:
trgt = _target_entry(target.kwargs['target'])
def _exe_path(build_type) -> str:
exe_path = pathlib.Path(trgt.abspath).relative_to(root_path)
exe_path = exe_path.parent / f'{env.subst("$PROGPREFIX")}{exe_path.name}-{build_type}{env.subst("$PROGSUFFIX")}'
return str(exe_path)
result.append({
'name': target.name,
'filename': _exe_path,
'target': target,
'type': 'executable',
'module': target.module
})
result.append(_make_entry(target, 'executable', '$PROGPREFIX', '$PROGSUFFIX'))
return result
def _get_libraries() -> list:
result = []
for target in env['SPP_TARGETS']:
if target.target_type == TargetType.STATIC_LIBRARY:
trgt = _target_entry(target.kwargs['target'])
def _lib_path(build_type) -> str:
lib_path = pathlib.Path(trgt.abspath).relative_to(root_path)
lib_path = lib_path.parent / f'{env.subst("$LIBPREFIX")}{lib_path.name}-{build_type}{env.subst("$LIBSUFFIX")}'
return str(lib_path)
result.append({
'name': target.name,
'filename': _lib_path,
'target': target,
'type': 'static_library',
'module': target.module
})
result.append(_make_entry(target, 'executable', '$LIBPREFIX', '$LIBSUFFIX'))
elif target.target_type == TargetType.SHARED_LIBRARY:
trgt = _target_entry(target.kwargs['target'])
def _lib_path(build_type) -> str:
lib_path = pathlib.Path(trgt.abspath).relative_to(root_path)
lib_path = lib_path.parent / f'{env.subst("$SHLIBPREFIX")}{lib_path.name}-{build_type}{env.subst("$SHLIBSUFFIX")}'
return str(lib_path)
result.append({
'name': target.name,
'filename': _lib_path,
'target': target,
'type': 'static_library',
'module': target.module
})
result.append(_make_entry(target, 'executable', '$SHLIBPREFIX', '$SHLIBSUFFIX'))
return result
def _get_modules() -> list:
result = []
@@ -1303,13 +1286,13 @@ elif env['COMPILER_FAMILY'] == 'cl':
if env['SHOW_INCLUDES']:
env.Append(CCFLAGS = ['/showIncludes'])
if build_type == 'debug':
env['PDB'] = env.File('#bin/full.pdb')
#env['PDB'] = env.File('#bin/full.pdb')
env.Append(CCFLAGS = ['/Od', '/MDd'], LINKFLAGS = ' /DEBUG')
env.Append(CPPDEFINES = ['_DEBUG', '_ITERATOR_DEBUG_LEVEL=2'])
env.Append(DEPS_CXXFLAGS = ['/MDd', '/Zi', '/D_DEBUG', '/D_ITERATOR_DEBUG_LEVEL=2'])
env.Append(DEPS_LINKFLAGS = ['/DEBUG'])
elif build_type == 'release_debug' or build_type == 'profile':
env['PDB'] = env.File('#bin/full.pdb')
#env['PDB'] = env.File('#bin/full.pdb')
env.Append(CCFLAGS = ['/O2', '/MD'], LINKFLAGS = ' /DEBUG')
env.Append(DEPS_CXXFLAGS = ['/Zi', '/MD'])
env.Append(DEPS_LINKFLAGS = ['/DEBUG'])