diff options
author | Daniel Seither <[email protected]> | 2015-09-25 14:06:26 +0200 |
---|---|---|
committer | Daniel Seither <[email protected]> | 2015-09-25 14:06:26 +0200 |
commit | 84fc298cce26305f7eae59ce59a82ebd9801a04e (patch) | |
tree | c8dffbe7056e5725c9007c8ba31017af215ae8bc | |
parent | dd743cef685c232ff8b981fec0f01bd8532c2c76 (diff) |
build system: Add framework support for OS X and iOS
On Darwin platforms, there are frameworks that can bundle libraries and
header files in a standardized directory structure. We need to support
linking to them because most of the OS X or iOS-specific APIs are
provided as frameworks.
-rwxr-xr-x | configure.py | 17 | ||||
-rw-r--r-- | src/build-data/cc/clang.txt | 1 |
2 files changed, 15 insertions, 3 deletions
diff --git a/configure.py b/configure.py index 44087b28b..ebde4d9a3 100755 --- a/configure.py +++ b/configure.py @@ -545,7 +545,7 @@ class ModuleInfo(object): lex_me_harder(infofile, self, ['source', 'header:internal', 'header:public', 'requires', 'os', 'arch', 'cc', 'libs', - 'comment', 'warning'], + 'frameworks', 'comment', 'warning'], { 'load_on': 'auto', 'define': [], @@ -584,6 +584,7 @@ class ModuleInfo(object): return result self.libs = convert_lib_list(self.libs) + self.frameworks = convert_lib_list(self.frameworks) def add_dir_name(filename): if filename.count(':') == 0: @@ -769,6 +770,7 @@ class CompilerInfo(object): 'add_include_dir_option': '-I', 'add_lib_dir_option': '-L', 'add_lib_option': '-l', + 'add_framework_option': '-framework ', 'compile_flags_release': '', 'compile_flags_debug': '', 'lib_opt_flags_release': '', @@ -1170,9 +1172,18 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): Figure out what external libraries are needed based on selected modules """ def link_to(): + return do_link_to('libs') + + """ + Figure out what external frameworks are needed based on selected modules + """ + def link_to_frameworks(): + return do_link_to('frameworks') + + def do_link_to(module_member_name): libs = set() for module in modules: - for (osname,link_to) in module.libs.items(): + for (osname,link_to) in getattr(module, module_member_name).items(): if osname == 'all' or osname == osinfo.basename: libs |= set(link_to) else: @@ -1303,7 +1314,7 @@ def create_template_vars(build_config, options, modules, cc, arch, osinfo): 'app_link_cmd': cc.binary_link_command_for(osinfo.basename, options), 'test_link_cmd': cc.binary_link_command_for(osinfo.basename, options), - 'link_to': ' '.join([cc.add_lib_option + lib for lib in link_to()]), + 'link_to': ' '.join([cc.add_lib_option + lib for lib in link_to()] + [cc.add_framework_option + fw for fw in link_to_frameworks()]), 'module_defines': make_cpp_macros(sorted(flatten([m.defines() for m in modules]))), diff --git a/src/build-data/cc/clang.txt b/src/build-data/cc/clang.txt index 0fbc67ce9..129218dcd 100644 --- a/src/build-data/cc/clang.txt +++ b/src/build-data/cc/clang.txt @@ -6,6 +6,7 @@ output_to_option "-o " add_include_dir_option -I add_lib_dir_option -L add_lib_option -l +add_framework_option "-framework " lang_flags "-std=c++11 -D_REENTRANT -fstack-protector" |