From 309e355b63a9678938c33471008060cf99a3878a Mon Sep 17 00:00:00 2001 From: Shiwei Wang <4977975+wsw0108@users.noreply.github.com> Date: Sat, 10 Jul 2021 15:34:53 +0800 Subject: [PATCH] fix static link to opencc (#481) --- packages/o/opencc/xmake.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/o/opencc/xmake.lua b/packages/o/opencc/xmake.lua index cd9635a06..dcab264c4 100644 --- a/packages/o/opencc/xmake.lua +++ b/packages/o/opencc/xmake.lua @@ -17,6 +17,9 @@ package("opencc") if package:is_plat("linux", "mingw") and not package:config("shared") then package:add("links", "opencc", "marisa") end + if not package:config("shared") then + package:add("defines", "Opencc_BUILT_AS_STATIC") + end package:addenv("PATH", "bin") end) @@ -29,4 +32,9 @@ package("opencc") on_test("windows", "mingw@windows,msys", "linux", "macosx", "bsd", function (package) 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)