Browse Source

brotli: add link to libbrotlicommon for static lib. (#1089)

Refer to https://github.com/xmake-io/xmake-repo/pull/1074
Chen Yufei 3 years ago
parent
commit
85c7897197
1 changed files with 10 additions and 2 deletions
  1. 10 2
      packages/b/brotli/port/xmake.lua

+ 10 - 2
packages/b/brotli/port/xmake.lua

@@ -12,7 +12,11 @@ end
 target("brotlienc")
     set_kind("$(kind)")
     add_deps("brotlicommon")
-    add_rules("utils.install.pkgconfig_importfiles", {filename = "libbrotlienc.pc"})
+    local links = {"brotlienc"}
+    if is_kind("static") then
+        table.insert(links, "brotlicommon")
+    end
+    add_rules("utils.install.pkgconfig_importfiles", {filename = "libbrotlienc.pc", links = links})
     add_includedirs("c/include", {public = true})
     add_files("c/enc/*.c")
     if is_kind("shared") and is_plat("windows") then
@@ -23,7 +27,11 @@ target("brotlienc")
 target("brotlidec")
     set_kind("$(kind)")
     add_deps("brotlicommon")
-    add_rules("utils.install.pkgconfig_importfiles", {filename = "libbrotlidec.pc"})
+    local links = {"brotlidec"}
+    if is_kind("static") then
+        table.insert(links, "brotlicommon")
+    end
+    add_rules("utils.install.pkgconfig_importfiles", {filename = "libbrotlidec.pc", links = links})
     add_includedirs("c/include", {public = true})
     add_files("c/dec/*.c")
     if is_kind("shared") and is_plat("windows") then