diff options
-rw-r--r-- | AUTHORS | 3 | ||||
-rw-r--r-- | tools_webrtc/ios/generate_modulemap.py | 32 | ||||
-rw-r--r-- | webrtc.gni | 36 |
3 files changed, 69 insertions, 2 deletions
@@ -97,4 +97,5 @@ Wire Swiss GmbH <*@wire.com> Miguel Paris <mparisdiaz@gmail.com> Vewd Software AS <*@vewd.com> Highfive, Inc. <*@highfive.com> -CoSMo Software Consulting, Pte Ltd <*@cosmosoftware.io>
\ No newline at end of file +CoSMo Software Consulting, Pte Ltd <*@cosmosoftware.io> +Tuple, LLC <*@tuple.app> diff --git a/tools_webrtc/ios/generate_modulemap.py b/tools_webrtc/ios/generate_modulemap.py new file mode 100644 index 0000000000..45bd3d875e --- /dev/null +++ b/tools_webrtc/ios/generate_modulemap.py @@ -0,0 +1,32 @@ +# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. +# +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file in the root of the source +# tree. An additional intellectual property rights grant can be found +# in the file PATENTS. All contributing project authors may +# be found in the AUTHORS file in the root of the source tree. + +import argparse +import sys + +def GenerateModulemap(): + parser = argparse.ArgumentParser(description='Generate modulemap') + parser.add_argument("-o", "--out", type=str, help="Output file.") + parser.add_argument("-n", "--name", type=str, help="Name of binary.") + + args = parser.parse_args() + + with open(args.out, "w") as outfile: + module_template = 'framework module %s {\n' \ + ' umbrella header "%s.h"\n' \ + '\n' \ + ' export *\n' \ + ' module * { export * }\n' \ + '}\n' % (args.name, args.name) + outfile.write(module_template) + return 0 + + +if __name__ == '__main__': + sys.exit(GenerateModulemap()) + diff --git a/webrtc.gni b/webrtc.gni index 6ecf859ba1..71c830e2bc 100644 --- a/webrtc.gni +++ b/webrtc.gni @@ -649,6 +649,8 @@ if (is_ios) { } } + # TODO: Generate module.modulemap file to enable use in Swift + # projects. See "mac_framework_bundle_with_umbrella_header". template("ios_framework_bundle_with_umbrella_header") { forward_variables_from(invoker, [ "output_name" ]) umbrella_header_path = @@ -699,12 +701,17 @@ if (is_mac) { forward_variables_from(invoker, [ "output_name" ]) this_target_name = target_name umbrella_header_path = "$target_gen_dir/umbrella_header/$output_name.h" + modulemap_path = "$target_gen_dir/Modules/module.modulemap" mac_framework_bundle(target_name) { forward_variables_from(invoker, "*", []) framework_version = "A" - framework_contents = [ "Headers" ] + framework_contents = [ + "Headers", + "Modules", + "Resources", + ] ldflags = [ "-all_load", @@ -714,7 +721,9 @@ if (is_mac) { deps += [ ":copy_framework_headers_$this_target_name", + ":copy_modulemap_$this_target_name", ":copy_umbrella_header_$this_target_name", + ":modulemap_$this_target_name", ":umbrella_header_$this_target_name", ] } @@ -727,6 +736,31 @@ if (is_mac) { ] } + action("modulemap_$this_target_name") { + script = "//tools_webrtc/ios/generate_modulemap.py" + args = [ + "--out", + rebase_path(modulemap_path, root_build_dir), + "--name", + output_name, + ] + outputs = [ + modulemap_path, + ] + } + + bundle_data("copy_modulemap_$this_target_name") { + sources = [ + modulemap_path, + ] + outputs = [ + "{{bundle_contents_dir}}/Modules/module.modulemap", + ] + deps = [ + ":modulemap_$this_target_name", + ] + } + action("umbrella_header_$this_target_name") { forward_variables_from(invoker, [ "sources" ]) |