Browse Source

libevent: fix build for shared or static lib. (#1100)

* libevent: fix build for shared or static lib.

* libevent: add_syslink ws2_32 for windows.

* libevent: add_syslink advapi32 for windows.
Chen Yufei 3 years ago
parent
commit
d0fca1a8d3
1 changed files with 6 additions and 1 deletions
  1. 6 1
      packages/l/libevent/xmake.lua

+ 6 - 1
packages/l/libevent/xmake.lua

@@ -12,6 +12,11 @@ package("libevent")
     add_configs("mbedtls", {description = "Build with mbedtls library.", default = false, type = "boolean"})
 
     add_deps("cmake")
+
+    if is_plat("windows") then
+        add_syslinks("ws2_32", "advapi32")
+    end
+
     on_load(function (package)
         if package:config("openssl") then
             package:add("deps", "openssl")
@@ -25,7 +30,7 @@ package("libevent")
         io.replace("CMakeLists.txt", "advapi32", "advapi32 crypt32", {plain = true})
         local configs = {"-DEVENT__DISABLE_TESTS=ON", "-DEVENT__DISABLE_REGRESS=ON", "-DEVENT__DISABLE_SAMPLES=ON"}
         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
-        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DEVENT__LIBRARY_TYPE=" .. (package:config("shared") and "SHARED" or "STATIC"))
         table.insert(configs, "-DEVENT__DISABLE_OPENSSL=" .. (package:config("openssl") and "OFF" or "ON"))
         table.insert(configs, "-DEVENT__DISABLE_MBEDTLS=" .. (package:config("mbedtls") and "OFF" or "ON"))
         if package:is_plat("windows") then