aedi: append arguments to cmake flags variables instead of overwriting them

This commit is contained in:
alexey.lysiuk 2023-10-08 12:49:59 +03:00
parent 3de1c19ebf
commit db80bdab38
2 changed files with 13 additions and 10 deletions

View file

@ -411,15 +411,18 @@ class CMakeTarget(BuildTarget):
args = [ args = [
'cmake', 'cmake',
'-DCMAKE_BUILD_TYPE=Release', '-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_INSTALL_PREFIX={state.install_path}',
f'-DCMAKE_PREFIX_PATH={state.prefix_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(): if ldflags := self.extra_linker_flags():
args.append(f'-DCMAKE_EXE_LINKER_FLAGS={ldflags}') opts['CMAKE_EXE_LINKER_FLAGS'] += ldflags
args.append(f'-DCMAKE_SHARED_LINKER_FLAGS={ldflags}') opts['CMAKE_SHARED_LINKER_FLAGS'] += ldflags
if state.xcode: if state.xcode:
args.append('-GXcode') args.append('-GXcode')
@ -444,7 +447,7 @@ class CMakeTarget(BuildTarget):
if os_version: if os_version:
args.append('-DCMAKE_OSX_DEPLOYMENT_TARGET=' + str(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) args.append(state.source / self.src_root)
subprocess.run(args, check=True, cwd=state.build_path, env=state.environment) subprocess.run(args, check=True, cwd=state.build_path, env=state.environment)

View file

@ -298,7 +298,7 @@ class PrBoomPlusTarget(CMakeMainTarget):
def configure(self, state: BuildState): def configure(self, state: BuildState):
opts = state.options opts = state.options
opts['CMAKE_C_FLAGS'] = '-D_FILE_OFFSET_BITS=64' 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' opts['CMAKE_POLICY_DEFAULT_CMP0056'] = 'NEW'
self._force_cross_compilation(state) self._force_cross_compilation(state)
@ -319,7 +319,7 @@ class ChocolateDoomBaseTarget(CMakeMainTarget):
super().__init__(name) super().__init__(name)
def configure(self, state: BuildState): 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) super().configure(state)
def _fill_outputs(self, exe_prefix: str): def _fill_outputs(self, exe_prefix: str):
@ -393,7 +393,7 @@ class Doom64EXTarget(CMakeMainTarget):
def configure(self, state: BuildState): def configure(self, state: BuildState):
opts = state.options opts = state.options
opts['ENABLE_SYSTEM_FLUIDSYNTH'] = 'YES' 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) super().configure(state)
@ -406,7 +406,7 @@ class DevilutionXTarget(CMakeMainTarget):
state.checkout_git('https://github.com/diasurgical/devilutionX.git') state.checkout_git('https://github.com/diasurgical/devilutionX.git')
def configure(self, state: BuildState): 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) super().configure(state)
# Remove version file that is included erroneously because of case-insensitive file system # 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): def configure(self, state: BuildState):
opts = state.options 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_BUNDLE'] = 'OFF'
opts['QUAKE_MACOS_MOUSE_ACCELERATION'] = 'ON' opts['QUAKE_MACOS_MOUSE_ACCELERATION'] = 'ON'