diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/export-xcconfig.py | 20 | ||||
-rw-r--r-- | scripts/main.mk | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/scripts/export-xcconfig.py b/scripts/export-xcconfig.py new file mode 100755 index 0000000000..75fe933e24 --- /dev/null +++ b/scripts/export-xcconfig.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import sys, ast, re + +ILLEGAL_CHAR_RE = re.compile(r"\W") + +def main(): + with open(sys.argv[1], "r") as in_file, open(sys.argv[2], "w") as out_file: + config = ast.literal_eval(in_file.read()) + variables = ["// Do not edit -- generated by export-xcconfig.py\n"] + assert(type(config) is dict) + assert(type(config["variables"]) is dict) + for variable, flags in config["variables"].iteritems(): + variable = ILLEGAL_CHAR_RE.sub("_", variable.rstrip("%")) + flags = " ".join('"%s"' % flag for flag in flags) + variables.append("%s = %s\n" % (variable, flags)) + out_file.writelines(variables) + +if __name__ == '__main__': + main() diff --git a/scripts/main.mk b/scripts/main.mk index 51879c23a1..0c86f39a8d 100644 --- a/scripts/main.mk +++ b/scripts/main.mk @@ -79,6 +79,8 @@ Makefile/__project__: $(PLATFORM_CONFIG_OUTPUT) .PHONY: Xcode/__project__ Xcode/__project__: $(PLATFORM_CONFIG_OUTPUT) + @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Exporting gyp variables to xcconfig...$(FORMAT_END)\n" + $(ENV) ./scripts/export-xcconfig.py $(PLATFORM_CONFIG_OUTPUT) $(PLATFORM_OUTPUT)/mbgl.xcconfig @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" $(ENV) deps/run_gyp platform/$(PLATFORM)/platform.gyp $(GYP_FLAGS) -f xcode$(GYP_FLAVOR_SUFFIX) |