瀏覽代碼

fix static link to opencc (#481)

Shiwei Wang 4 年之前
父節點
當前提交
309e355b63
共有 1 個文件被更改,包括 8 次插入0 次删除
  1. 8 0
      packages/o/opencc/xmake.lua

+ 8 - 0
packages/o/opencc/xmake.lua

@@ -17,6 +17,9 @@ package("opencc")
         if package:is_plat("linux", "mingw") and not package:config("shared") then
         if package:is_plat("linux", "mingw") and not package:config("shared") then
             package:add("links", "opencc", "marisa")
             package:add("links", "opencc", "marisa")
         end
         end
+        if not package:config("shared") then
+            package:add("defines", "Opencc_BUILT_AS_STATIC")
+        end
         package:addenv("PATH", "bin")
         package:addenv("PATH", "bin")
     end)
     end)
 
 
@@ -29,4 +32,9 @@ package("opencc")
 
 
     on_test("windows", "mingw@windows,msys", "linux", "macosx", "bsd", function (package)
     on_test("windows", "mingw@windows,msys", "linux", "macosx", "bsd", function (package)
         assert(package:has_cfuncs("opencc_open", {includes = "opencc/opencc.h"}))
         assert(package:has_cfuncs("opencc_open", {includes = "opencc/opencc.h"}))
+        assert(package:check_cxxsnippets({test = [[
+            void test() {
+                opencc::Config config;
+            }
+        ]]}, {includes = {"opencc/Config.hpp"}}))
     end)
     end)