From ef229794b60b6243f1c6c4b778b9de5aff9ebf4d Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 31 Oct 2023 22:36:32 +0800 Subject: [PATCH 1/5] libfacedetection: add package --- packages/l/libfacedetection/xmake.lua | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 packages/l/libfacedetection/xmake.lua diff --git a/packages/l/libfacedetection/xmake.lua b/packages/l/libfacedetection/xmake.lua new file mode 100644 index 00000000000..fecf3920830 --- /dev/null +++ b/packages/l/libfacedetection/xmake.lua @@ -0,0 +1,31 @@ +package("libfacedetection") + set_homepage("https://github.com/ShiqiYu/libfacedetection") + set_description("An open source library for face detection in images. The face detection speed can reach 1000FPS. ") + set_license("BSD-3-Clause") + + add_urls("https://github.com/ShiqiYu/libfacedetection/archive/refs/tags/$(version).tar.gz", + "https://github.com/ShiqiYu/libfacedetection.git") + + add_versions("v3.0", "66dc6b47b11db4bf4ef73e8b133327aa964dbd8b2ce9e0ef4d1e94ca08d40b6a") + + add_configs("neon", {description = "Use neon", default = false, type = "boolean"}) + add_configs("avx512", {description = "Use avx512", default = false, type = "boolean"}) + add_configs("avx2", {description = "Use avx2", default = false, type = "boolean"}) + add_configs("openmp", {description = "Use openmp", default = false, type = "boolean"}) + + add_deps("cmake") + + on_install(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")) + table.insert(configs, "-DENABLE_NEON=" .. (package:config("neon") and "ON" or "OFF")) + table.insert(configs, "-DENABLE_=AVX512" .. (package:config("avx512") and "ON" or "OFF")) + table.insert(configs, "-DENABLE_=AVX2" .. (package:config("avx2") and "ON" or "OFF")) + table.insert(configs, "-DUSE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cxxfuncs("facedetect_cnn", {includes = "facedetection/facedetectcnn.h", configs = {languages = "c++11"}})) + end) From 9d8bab3529339517e195c29bc5139f3e2becb917 Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 31 Oct 2023 23:15:59 +0800 Subject: [PATCH 2/5] fix arm --- packages/l/libfacedetection/xmake.lua | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/l/libfacedetection/xmake.lua b/packages/l/libfacedetection/xmake.lua index fecf3920830..06c2f521377 100644 --- a/packages/l/libfacedetection/xmake.lua +++ b/packages/l/libfacedetection/xmake.lua @@ -8,9 +8,12 @@ package("libfacedetection") add_versions("v3.0", "66dc6b47b11db4bf4ef73e8b133327aa964dbd8b2ce9e0ef4d1e94ca08d40b6a") - add_configs("neon", {description = "Use neon", default = false, type = "boolean"}) - add_configs("avx512", {description = "Use avx512", default = false, type = "boolean"}) - add_configs("avx2", {description = "Use avx2", default = false, type = "boolean"}) + if is_arch("arm.*") then + add_configs("neon", {description = "Use neon", default = true, type = "boolean"}) + else + add_configs("avx512", {description = "Use avx512", default = false, type = "boolean"}) + add_configs("avx2", {description = "Use avx2", default = true, type = "boolean"}) + end add_configs("openmp", {description = "Use openmp", default = false, type = "boolean"}) add_deps("cmake") @@ -19,9 +22,12 @@ package("libfacedetection") 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")) - table.insert(configs, "-DENABLE_NEON=" .. (package:config("neon") and "ON" or "OFF")) - table.insert(configs, "-DENABLE_=AVX512" .. (package:config("avx512") and "ON" or "OFF")) - table.insert(configs, "-DENABLE_=AVX2" .. (package:config("avx2") and "ON" or "OFF")) + if package:is_arch("arm.*") then + table.insert(configs, "-DENABLE_NEON=" .. (package:config("neon") and "ON" or "OFF")) + else + table.insert(configs, "-DENABLE_AVX512=" .. (package:config("avx512") and "ON" or "OFF")) + table.insert(configs, "-DENABLE_AVX2=" .. (package:config("avx2") and "ON" or "OFF")) + end table.insert(configs, "-DUSE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF")) import("package.tools.cmake").install(package, configs) end) From 8e3b483a399bb9301be96e489c5bcf0b2e86888f Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 31 Oct 2023 23:22:34 +0800 Subject: [PATCH 3/5] fix arm --- packages/l/libfacedetection/xmake.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/l/libfacedetection/xmake.lua b/packages/l/libfacedetection/xmake.lua index 06c2f521377..730d54ea50d 100644 --- a/packages/l/libfacedetection/xmake.lua +++ b/packages/l/libfacedetection/xmake.lua @@ -24,7 +24,10 @@ package("libfacedetection") table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) if package:is_arch("arm.*") then table.insert(configs, "-DENABLE_NEON=" .. (package:config("neon") and "ON" or "OFF")) + table.insert(configs, "-DENABLE_AVX512=OFF") + table.insert(configs, "-DENABLE_AVX2=OFF") else + table.insert(configs, "-DENABLE_NEON=OFF") table.insert(configs, "-DENABLE_AVX512=" .. (package:config("avx512") and "ON" or "OFF")) table.insert(configs, "-DENABLE_AVX2=" .. (package:config("avx2") and "ON" or "OFF")) end From 20e5d9f7c62db68ffb176c4fcc1bb6393ea4c06f Mon Sep 17 00:00:00 2001 From: star9029 Date: Tue, 31 Oct 2023 23:39:41 +0800 Subject: [PATCH 4/5] improve configs --- packages/l/libfacedetection/xmake.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/l/libfacedetection/xmake.lua b/packages/l/libfacedetection/xmake.lua index 730d54ea50d..bb49604cb3e 100644 --- a/packages/l/libfacedetection/xmake.lua +++ b/packages/l/libfacedetection/xmake.lua @@ -8,12 +8,9 @@ package("libfacedetection") add_versions("v3.0", "66dc6b47b11db4bf4ef73e8b133327aa964dbd8b2ce9e0ef4d1e94ca08d40b6a") - if is_arch("arm.*") then - add_configs("neon", {description = "Use neon", default = true, type = "boolean"}) - else - add_configs("avx512", {description = "Use avx512", default = false, type = "boolean"}) - add_configs("avx2", {description = "Use avx2", default = true, type = "boolean"}) - end + add_configs("neon", {description = "Use neon", default = is_arch("arm.*"), type = "boolean"}) + add_configs("avx512", {description = "Use avx512", default = false, type = "boolean"}) + add_configs("avx2", {description = "Use avx2", default = not is_arch("arm.*"), type = "boolean"}) add_configs("openmp", {description = "Use openmp", default = false, type = "boolean"}) add_deps("cmake") From 177a6634584048b68f0fe3fe62a2c71c836cb807 Mon Sep 17 00:00:00 2001 From: star9029 Date: Wed, 1 Nov 2023 07:45:55 +0800 Subject: [PATCH 5/5] disable plat --- packages/l/libfacedetection/xmake.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/l/libfacedetection/xmake.lua b/packages/l/libfacedetection/xmake.lua index bb49604cb3e..df262062142 100644 --- a/packages/l/libfacedetection/xmake.lua +++ b/packages/l/libfacedetection/xmake.lua @@ -15,7 +15,7 @@ package("libfacedetection") add_deps("cmake") - on_install(function (package) + on_install("windows", "linux", "macosx", "bsd", "mingw", "msys", "android", "iphoneos", 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"))