mirror of
https://github.com/ZDoom/zdoom-macos-deps.git
synced 2024-11-10 14:41:43 +00:00
aedi: implement building with static moltenvk
this applies to gzdoom and raze targets only
This commit is contained in:
parent
21e032934d
commit
efe513ec17
2 changed files with 52 additions and 14 deletions
|
@ -55,6 +55,7 @@ class BuildState:
|
|||
self.xcode = False
|
||||
self.verbose = False
|
||||
self.jobs = 1
|
||||
self.static_moltenvk = False
|
||||
|
||||
self.environment = os.environ.copy()
|
||||
self.options = CommandLineOptions()
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from platform import machine
|
||||
|
||||
from ..state import BuildState
|
||||
|
@ -86,7 +87,7 @@ class ZDoomBaseTarget(CMakeMainTarget):
|
|||
|
||||
def configure(self, state: BuildState):
|
||||
opts = state.options
|
||||
opts['CMAKE_EXE_LINKER_FLAGS'] = state.run_pkg_config('--libs', 'fluidsynth', 'libmpg123')
|
||||
opts['CMAKE_EXE_LINKER_FLAGS'] += state.run_pkg_config('--libs', 'fluidsynth', 'libmpg123')
|
||||
opts['PK3_QUIET_ZIPDIR'] = 'YES'
|
||||
opts['DYN_OPENAL'] = 'NO'
|
||||
|
||||
|
@ -100,7 +101,43 @@ class ZDoomVulkanBaseTarget(ZDoomBaseTarget):
|
|||
def __init__(self, name=None):
|
||||
super().__init__(name)
|
||||
|
||||
def configure(self, state: BuildState):
|
||||
if state.static_moltenvk:
|
||||
state.options['CMAKE_EXE_LINKER_FLAGS'] += '-framework Metal -framework IOSurface -lMoltenVK-static'
|
||||
|
||||
# Unset SDK because MoltenVK usually requires the latest one shipped with Xcode
|
||||
state.platform.sdk_path = None
|
||||
|
||||
# Replace volk and update revision files
|
||||
replacement_src_path = state.patch_path / 'static-moltenvk'
|
||||
replacement_files = ('UpdateRevision.cmake', 'volk.c', 'volk.h')
|
||||
|
||||
replacement_dst_volk_subpath = 'common/rendering/vulkan/thirdparty/volk/'
|
||||
replacement_dst_volk_path = Path('src') / replacement_dst_volk_subpath
|
||||
|
||||
if not os.path.exists(state.source / replacement_dst_volk_path):
|
||||
replacement_dst_volk_path = Path('source') / replacement_dst_volk_subpath
|
||||
|
||||
replacement_dst_paths = (
|
||||
'tools/updaterevision',
|
||||
replacement_dst_volk_path,
|
||||
replacement_dst_volk_path
|
||||
)
|
||||
|
||||
for dst_path, filename in zip(replacement_dst_paths, replacement_files):
|
||||
src = replacement_src_path / filename
|
||||
dst = state.source / dst_path / filename
|
||||
|
||||
src_stat = os.stat(src)
|
||||
dst_stat = os.stat(dst)
|
||||
|
||||
if src_stat.st_mtime != dst_stat.st_mtime:
|
||||
shutil.copy2(src, dst)
|
||||
|
||||
super().configure(state)
|
||||
|
||||
def post_build(self, state: BuildState):
|
||||
if not state.static_moltenvk:
|
||||
# Put MoltenVK library into application bundle
|
||||
molten_lib = 'libMoltenVK.dylib'
|
||||
src_path = state.lib_path / molten_lib
|
||||
|
|
Loading…
Reference in a new issue