xmake.lua 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package("libfacedetection")
  2. set_homepage("https://github.com/ShiqiYu/libfacedetection")
  3. set_description("An open source library for face detection in images. The face detection speed can reach 1000FPS. ")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/ShiqiYu/libfacedetection/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ShiqiYu/libfacedetection.git")
  7. add_versions("v3.0", "66dc6b47b11db4bf4ef73e8b133327aa964dbd8b2ce9e0ef4d1e94ca08d40b6a")
  8. add_configs("neon", {description = "Use neon", default = is_arch("arm.*"), type = "boolean"})
  9. add_configs("avx512", {description = "Use avx512", default = false, type = "boolean"})
  10. add_configs("avx2", {description = "Use avx2", default = not is_arch("arm.*"), type = "boolean"})
  11. add_configs("openmp", {description = "Use openmp", default = false, type = "boolean"})
  12. add_deps("cmake")
  13. on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", function (package)
  14. local configs = {}
  15. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  16. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  17. if package:is_arch("arm.*") then
  18. table.insert(configs, "-DENABLE_NEON=" .. (package:config("neon") and "ON" or "OFF"))
  19. table.insert(configs, "-DENABLE_AVX512=OFF")
  20. table.insert(configs, "-DENABLE_AVX2=OFF")
  21. else
  22. table.insert(configs, "-DENABLE_NEON=OFF")
  23. table.insert(configs, "-DENABLE_AVX512=" .. (package:config("avx512") and "ON" or "OFF"))
  24. table.insert(configs, "-DENABLE_AVX2=" .. (package:config("avx2") and "ON" or "OFF"))
  25. end
  26. table.insert(configs, "-DUSE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
  27. import("package.tools.cmake").install(package, configs)
  28. end)
  29. on_test(function (package)
  30. assert(package:has_cxxfuncs("facedetect_cnn", {includes = "facedetection/facedetectcnn.h", configs = {languages = "c++11"}}))
  31. end)