1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-27 18:13:15 +00:00

build: add all configure flags as conditional flags to Swift compiler

This commit is contained in:
der richter 2019-04-13 15:14:59 +02:00 committed by Jan Ekström
parent f7f5bd80bb
commit bc014f2ad4

View File

@ -10,6 +10,15 @@ def __write_config_h__(ctx):
__cp_to_variant__(ctx, ctx.options.variant, 'config.h')
ctx.end_msg("config.h", "PINK")
def __add_swift_defines__(ctx):
if ctx.dependency_satisfied("swift"):
ctx.start_msg("Adding conditional Swift flags:")
from waflib.Tools.c_config import DEFKEYS, INCKEYS
for define in ctx.env[DEFKEYS]:
if ctx.is_defined(define) and ctx.get_define(define) == "1":
ctx.env.SWIFT_FLAGS.extend(["-D", define])
ctx.end_msg("yes")
# Approximately escape the string as C string literal
def __escape_c_string(s):
return s.replace("\"", "\\\"").replace("\n", "\\n")
@ -32,4 +41,5 @@ def __add_mpv_defines__(ctx):
def configure(ctx):
__add_mpv_defines__(ctx)
__add_swift_defines__(ctx)
__write_config_h__(ctx)