microsoft-apsi: add package (#5804)

* microsoft-apsi: add package

* disable shared

* add check

* disable x86
pull/5733/merge
star9029 20 hours ago committed by GitHub
parent 01f5ddee30
commit 3486564e4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      packages/f/flatbuffers/xmake.lua
  2. 9
      packages/l/log4cplus/xmake.lua
  3. 69
      packages/m/microsoft-apsi/xmake.lua
  4. 5
      packages/m/microsoft-seal/xmake.lua

@ -15,6 +15,7 @@ package("flatbuffers")
add_deps("cmake") add_deps("cmake")
on_install(function(package) on_install(function(package)
io.replace("CMakeLists.txt", "/MT", "", {plain = true})
io.replace("CMakeLists.txt", io.replace("CMakeLists.txt",
"RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}", "RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}",
"RUNTIME DESTINATION bin", {plain = true}) "RUNTIME DESTINATION bin", {plain = true})
@ -36,9 +37,7 @@ package("flatbuffers")
import("package.tools.cmake").install(package, configs) import("package.tools.cmake").install(package, configs)
if package:is_plat("windows") and package:is_debug() then if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib") os.trymv(package:installdir("lib/flatc.pdb"), package:installdir("bin"))
os.trycp(path.join(package:buildir(), "flatc.pdb"), package:installdir("bin"))
os.trycp(path.join(package:buildir(), "flatbuffers.pdb"), dir)
end end
end) end)

@ -23,10 +23,17 @@ package("log4cplus")
if package:config("unicode") then if package:config("unicode") then
package:add("defines", "UNICODE") package:add("defines", "UNICODE")
end end
if package:is_plat("windows") and package:config("shared") then
package:add("defines", "LOG4CPLUS_BUILD_DLL")
end
end) end)
on_install(function (package) on_install(function (package)
local configs = {"-DLOG4CPLUS_BUILD_TESTING=OFF", "-DWITH_UNIT_TESTS=OFF"} local configs = {
"-DLOG4CPLUS_BUILD_TESTING=OFF",
"-DWITH_UNIT_TESTS=OFF",
"-DLOG4CPLUS_ENABLE_DECORATED_LIBRARY_NAME=OFF",
}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DUNICODE=" .. (package:config("unicode") and "ON" or "OFF")) table.insert(configs, "-DUNICODE=" .. (package:config("unicode") and "ON" or "OFF"))

@ -0,0 +1,69 @@
package("microsoft-apsi")
set_homepage("https://github.com/microsoft/APSI")
set_description("APSI is a C++ library for Asymmetric (unlabeled or labeled) Private Set Intersection.")
set_license("MIT")
add_urls("https://github.com/microsoft/APSI.git")
add_versions("v0.12.0", "b967a126b4e1c682b039afc2d76a98ea2c993230")
add_configs("log4cplus", {description = "Use Log4cplus for logging", default = false, type = "boolean"})
add_configs("cppzmq", {description = "Use ZeroMQ for networking", default = false, type = "boolean"})
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
add_deps("cmake")
add_deps("microsoft-seal", {configs = {ms_gsl = true, zstd = true, throw_tran = false}})
add_deps("microsoft-kuku", "flatbuffers", "jsoncpp")
if on_check then
on_check(function (package)
-- TODO: To support cross-compilation, need host flatc tool and target flatbuffers library
-- Remove cmake try_run, replace check_cxx_source_runs to check_cxx_source_compiles
if not package:is_arch64() or package:is_cross() then
raise("package(microsoft-apsi) unsupported cross-compilation")
end
end)
end
on_load(function (package)
if package:config("log4cplus") then
package:add("deps", "log4cplus", {configs = {unicode = false}})
end
if package:config("cppzmq") then
package:add("deps", "cppzmq")
end
local version = package:version()
if version then
package:add("includedirs", format("include/APSI-%s.%s", version:major(), version:minor()))
else
package:add("includedirs", "include/APSI-0.12")
end
end)
on_install("windows", "linux", "macosx", "bsd", function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:is_plat("windows") then
table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
end
table.insert(configs, "-DAPSI_USE_LOG4CPLUS=" .. (package:config("log4cplus") and "ON" or "OFF"))
table.insert(configs, "-DAPSI_USE_ZMQ=" .. (package:config("cppzmq") and "ON" or "OFF"))
local opt = {}
if package:has_tool("cxx", "cl") then
opt.cxflags = {"/utf-8", "/EHsc"}
end
import("package.tools.cmake").install(package, configs, opt)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
using namespace apsi;
void test() {
ThreadPoolMgr::SetThreadCount(4);
}
]]}, {configs = {languages = "c++17"}, includes = {"apsi/sender.h"}}))
end)

@ -86,11 +86,6 @@ package("microsoft-seal")
table.insert(configs, "-DSEAL_USE_ALIGNED_ALLOC=OFF") table.insert(configs, "-DSEAL_USE_ALIGNED_ALLOC=OFF")
end end
import("package.tools.cmake").install(package, configs) import("package.tools.cmake").install(package, configs)
if package:is_plat("windows") and package:is_debug() then
local dir = package:installdir(package:config("shared") and "bin" or "lib")
os.vcp(path.join(package:buildir(), "**.pdb"), dir)
end
end) end)
on_test(function (package) on_test(function (package)

Loading…
Cancel
Save