This commit is contained in:
Peter 2019-08-18 23:07:18 +03:00
parent 3236ce247d
commit 3d7ece927d
41 changed files with 1871 additions and 219 deletions

View file

@ -1,18 +0,0 @@
SHARED_CONFIGS = {
'IPHONEOS_DEPLOYMENT_TARGET': '8.0', # common target version
'SDKROOT': 'iphoneos', # platform
'GCC_OPTIMIZATION_LEVEL': '0', # clang optimization
'SWIFT_OPTIMIZATION_LEVEL': '-Onone', # swiftc optimization
'SWIFT_WHOLE_MODULE_OPTIMIZATION': 'NO', # for build performance
'ONLY_ACTIVE_ARCH': 'YES',
'LD_RUNPATH_SEARCH_PATHS': '@executable_path/Frameworks', # To allow source files in binary
}
LIB_SPECIFIC_CONFIG = {
'SKIP_INSTALL': 'YES',
}
EXTENSION_LIB_SPECIFIC_CONFIG = {
'SKIP_INSTALL': 'YES',
'APPLICATION_EXTENSION_API_ONLY': 'YES',
}

13
tools/defs.bzl Normal file
View file

@ -0,0 +1,13 @@
XCODE_BINARY_CONFIG = {
'IPHONEOS_DEPLOYMENT_TARGET': '8.0',
'SDKROOT': 'iphoneos',
'GCC_OPTIMIZATION_LEVEL': '0',
'SWIFT_OPTIMIZATION_LEVEL': '-Onone',
'SWIFT_WHOLE_MODULE_OPTIMIZATION': 'NO',
'ONLY_ACTIVE_ARCH': 'YES',
'LD_RUNPATH_SEARCH_PATHS': '@executable_path/Frameworks',
}
XCODE_STATIC_LIBRARY_CONFIG = {
'SKIP_INSTALL': 'YES',
}

0
tools/targets.bzl Normal file
View file

View file

@ -1,10 +1,5 @@
OTHER_LINKER_FLAGS_KEY = 'OTHER_LDFLAGS'
# Either appends or assigns `other_linker_flags` to `config` under `config_key`.
# Params:
# - config: A dictionary of config names and their values
# - additional_linker_flags: A string-representable value of additional linker flags
# - config_key: The key to which to append or assign the additional linker flags
def config_with_updated_linker_flags(config, other_linker_flags, config_key=OTHER_LINKER_FLAGS_KEY):
new_config = { }
config_key_found = False
@ -21,8 +16,8 @@ def config_with_updated_linker_flags(config, other_linker_flags, config_key=OTHE
return new_config
# Creates a dictionary where the top level keys are the supported build configurations and the value of each key is `config`.
def configs_with_config(config):
def xcode_configs(config):
return {
"Debug": config,
"Profile": config,
@ -42,19 +37,11 @@ def merge_maps(dicts):
result.update(d)
return result
def basename(p):
"""Returns the basename (i.e., the file portion) of a path.
Note that if `p` ends with a slash, this function returns an empty string.
This matches the behavior of Python's `os.path.basename`, but differs from
the Unix `basename` command (which would return the path segment preceding
the final slash).
Args:
p: The path whose basename should be returned.
Returns:
The basename of the path, which includes the extension.
"""
return p.rpartition("/")[-1]
def glob_map(glob_results):
result = dict()
for path in glob_results:
@ -64,6 +51,7 @@ def glob_map(glob_results):
result[file_name] = path
return result
def glob_sub_map(prefix, glob_specs):
result = dict()
for path in native.glob(glob_specs):
@ -75,6 +63,7 @@ def glob_sub_map(prefix, glob_specs):
result[file_key] = path
return result
def gen_header_targets(header_paths, prefix, flavor, source_rule, source_path):
result = dict()
for header_path in header_paths:
@ -87,6 +76,7 @@ def gen_header_targets(header_paths, prefix, flavor, source_rule, source_path):
result[header_path] = ':' + name + flavor
return result
def lib_basename(name):
result = name
if result.startswith('lib'):
@ -95,12 +85,14 @@ def lib_basename(name):
result = result[:-2]
return result
def combined_config(dicts):
result = dict()
for d in dicts:
result.update(d)
return result
valid_build_variants = ['project', 'release']
def get_build_variant():