From db80bdab38713b5055e90312d907ba2daa140437 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 8 Oct 2023 12:49:59 +0300 Subject: [PATCH] aedi: append arguments to cmake flags variables instead of overwriting them --- aedi/target/base.py | 13 ++++++++----- aedi/target/main.py | 10 +++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/aedi/target/base.py b/aedi/target/base.py index a95ac023..5581976e 100644 --- a/aedi/target/base.py +++ b/aedi/target/base.py @@ -411,15 +411,18 @@ class CMakeTarget(BuildTarget): args = [ 'cmake', '-DCMAKE_BUILD_TYPE=Release', - f'-DCMAKE_C_FLAGS="-ffile-prefix-map={state.source}/="', - f'-DCMAKE_CXX_FLAGS="-ffile-prefix-map={state.source}/="', f'-DCMAKE_INSTALL_PREFIX={state.install_path}', f'-DCMAKE_PREFIX_PATH={state.prefix_path}', ] + prefix_map = f'-ffile-prefix-map={state.source}/=' + opts = state.options + opts['CMAKE_C_FLAGS'] += prefix_map + opts['CMAKE_CXX_FLAGS'] += prefix_map + if ldflags := self.extra_linker_flags(): - args.append(f'-DCMAKE_EXE_LINKER_FLAGS={ldflags}') - args.append(f'-DCMAKE_SHARED_LINKER_FLAGS={ldflags}') + opts['CMAKE_EXE_LINKER_FLAGS'] += ldflags + opts['CMAKE_SHARED_LINKER_FLAGS'] += ldflags if state.xcode: args.append('-GXcode') @@ -444,7 +447,7 @@ class CMakeTarget(BuildTarget): if os_version: args.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=' + str(os_version)) - args += state.options.to_list(CommandLineOptions.CMAKE_RULES) + args += opts.to_list(CommandLineOptions.CMAKE_RULES) args.append(state.source / self.src_root) subprocess.run(args, check=True, cwd=state.build_path, env=state.environment) diff --git a/aedi/target/main.py b/aedi/target/main.py index f119f636..6183fae6 100644 --- a/aedi/target/main.py +++ b/aedi/target/main.py @@ -298,7 +298,7 @@ class PrBoomPlusTarget(CMakeMainTarget): def configure(self, state: BuildState): opts = state.options opts['CMAKE_C_FLAGS'] = '-D_FILE_OFFSET_BITS=64' - opts['CMAKE_EXE_LINKER_FLAGS'] = state.run_pkg_config('--libs', 'SDL2_mixer', 'SDL2_image') + opts['CMAKE_EXE_LINKER_FLAGS'] += state.run_pkg_config('--libs', 'SDL2_mixer', 'SDL2_image') opts['CMAKE_POLICY_DEFAULT_CMP0056'] = 'NEW' self._force_cross_compilation(state) @@ -319,7 +319,7 @@ class ChocolateDoomBaseTarget(CMakeMainTarget): super().__init__(name) def configure(self, state: BuildState): - state.options['CMAKE_EXE_LINKER_FLAGS'] = state.run_pkg_config('--libs', 'SDL2_mixer') + state.options['CMAKE_EXE_LINKER_FLAGS'] += state.run_pkg_config('--libs', 'SDL2_mixer') super().configure(state) def _fill_outputs(self, exe_prefix: str): @@ -393,7 +393,7 @@ class Doom64EXTarget(CMakeMainTarget): def configure(self, state: BuildState): opts = state.options opts['ENABLE_SYSTEM_FLUIDSYNTH'] = 'YES' - opts['CMAKE_EXE_LINKER_FLAGS'] = state.run_pkg_config('--libs', 'SDL2', 'fluidsynth') + opts['CMAKE_EXE_LINKER_FLAGS'] += state.run_pkg_config('--libs', 'SDL2', 'fluidsynth') super().configure(state) @@ -406,7 +406,7 @@ class DevilutionXTarget(CMakeMainTarget): state.checkout_git('https://github.com/diasurgical/devilutionX.git') def configure(self, state: BuildState): - state.options['CMAKE_EXE_LINKER_FLAGS'] = state.run_pkg_config('--libs', 'SDL2_mixer', 'SDL2_ttf') + state.options['CMAKE_EXE_LINKER_FLAGS'] += state.run_pkg_config('--libs', 'SDL2_mixer', 'SDL2_ttf') super().configure(state) # Remove version file that is included erroneously because of case-insensitive file system @@ -482,7 +482,7 @@ class QuakespasmExpTarget(CMakeMainTarget): def configure(self, state: BuildState): opts = state.options - opts['CMAKE_EXE_LINKER_FLAGS'] = state.run_pkg_config('--libs', 'ogg', 'SDL2') + opts['CMAKE_EXE_LINKER_FLAGS'] += state.run_pkg_config('--libs', 'ogg', 'SDL2') opts['QUAKE_MACOS_BUNDLE'] = 'OFF' opts['QUAKE_MACOS_MOUSE_ACCELERATION'] = 'ON'