[PATCH] D84219: [gn build] mac: use frameworks instead of libs where appropriate

Mark Mentovai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 21:16:40 PDT 2020


markmentovai created this revision.
markmentovai added a reviewer: thakis.
Herald added a reviewer: JDevlieghere.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As of GN 3028c6a426a4, the hack that transformed "libs" ending in
".framework" from -l arguments to -framework arguments has been removed.
Instead, "frameworks" must be used, and the toolchain must provide
support.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84219

Files:
  llvm/utils/gn/build/toolchain/BUILD.gn
  llvm/utils/gn/secondary/llvm/tools/dsymutil/BUILD.gn


Index: llvm/utils/gn/secondary/llvm/tools/dsymutil/BUILD.gn
===================================================================
--- llvm/utils/gn/secondary/llvm/tools/dsymutil/BUILD.gn
+++ llvm/utils/gn/secondary/llvm/tools/dsymutil/BUILD.gn
@@ -30,6 +30,6 @@
     "dsymutil.cpp",
   ]
   if (host_os == "mac") {
-    libs = [ "CoreFoundation.framework" ]
+    frameworks = [ "CoreFoundation.framework" ]
   }
 }
Index: llvm/utils/gn/build/toolchain/BUILD.gn
===================================================================
--- llvm/utils/gn/build/toolchain/BUILD.gn
+++ llvm/utils/gn/build/toolchain/BUILD.gn
@@ -73,7 +73,7 @@
     tool("solink") {
       outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
       if (current_os == "mac") {
-        command = "$ld -shared {{ldflags}} -o $outfile {{inputs}} {{libs}}"
+        command = "$ld -shared {{ldflags}} -o $outfile {{inputs}} {{libs}} {{frameworks}}"
         default_output_extension = ".dylib"
       } else {
         command = "$ld -shared {{ldflags}} -Wl,-z,defs -Wl,-soname,{{target_output_name}}{{output_extension}} -o $outfile {{inputs}} {{libs}}"
@@ -89,7 +89,7 @@
     tool("solink_module") {
       outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
       if (current_os == "mac") {
-        command = "$ld -shared {{ldflags}} -Wl,-flat_namespace -Wl,-undefined,suppress -o $outfile {{inputs}} {{libs}}"
+        command = "$ld -shared {{ldflags}} -Wl,-flat_namespace -Wl,-undefined,suppress -o $outfile {{inputs}} {{libs}} {{frameworks}}"
         default_output_extension = ".dylib"
       } else {
         command = "$ld -shared {{ldflags}} -Wl,-soname,{{target_output_name}}{{output_extension}} -o $outfile {{inputs}} {{libs}}"
@@ -104,7 +104,8 @@
     tool("link") {
       outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}"
       if (current_os == "mac") {
-        command = "$ld {{ldflags}} -o $outfile {{inputs}} {{libs}}"
+        command =
+            "$ld {{ldflags}} -o $outfile {{inputs}} {{libs}} {{frameworks}}"
       } else {
         command = "$ld {{ldflags}} -o $outfile -Wl,--start-group {{inputs}} -Wl,--end-group {{libs}}"
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84219.279396.patch
Type: text/x-patch
Size: 2191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200721/0dd47855/attachment-0001.bin>


More information about the llvm-commits mailing list