浏览代码

bmf: add package

star9029 1 年之前
父节点
当前提交
8e2eeeadd2
共有 4 个文件被更改,包括 129 次插入3 次删除
  1. 6 3
      packages/b/backward-cpp/xmake.lua
  2. 89 0
      packages/b/bmf/xmake.lua
  3. 31 0
      packages/d/dlpack/xmake.lua
  4. 3 0
      packages/s/spdlog/xmake.lua

+ 6 - 3
packages/b/backward-cpp/xmake.lua

@@ -1,5 +1,5 @@
 package("backward-cpp")
-
+    set_kind("library", {headeronly = true})
     set_homepage("https://github.com/bombela/backward-cpp")
     set_description("Backward is a beautiful stack trace pretty printer for C++.")
     set_license("MIT")
@@ -33,11 +33,14 @@ package("backward-cpp")
         end
         local configs = {"-DBACKWARD_TESTS=OFF"}
         table.insert(configs, "-DBACKWARD_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
+        end
         import("package.tools.cmake").install(package, configs)
-        os.mv(package:installdir("include/*.hpp"), package:installdir("include/backward"))
+        os.vcp(package:installdir("include/*.hpp"), package:installdir("include/backward"))
+        os.vcp(package:installdir("include/*.hpp"), package:installdir("lib/backward"))
     end)
 
     on_test(function (package)
         assert(package:has_cxxtypes("backward::SignalHandling", {configs = {languages = "c++11"}, includes = "backward/backward.hpp"}))
     end)
-

+ 89 - 0
packages/b/bmf/xmake.lua

@@ -0,0 +1,89 @@
+package("bmf")
+    set_homepage("https://babitmf.github.io/")
+    set_description("Cross-platform, customizable multimedia/video processing framework.  With strong GPU acceleration, heterogeneous design, multi-language support, easy to use, multi-framework compatible and high performance, the framework is ideal for transcoding, AI inference, algorithm integration, live video streaming, and more.")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/BabitMF/bmf/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/BabitMF/bmf.git")
+
+    add_versions("v0.0.10", "9d24fc909a626730518dc8f9f4dc02d76345ea38445166b116b3f10ef9adb691")
+
+    add_configs("breakpad", {description = "Enable build with breakpad support", default = false, type = "boolean"})
+    add_configs("cuda", {description = "Enable CUDA support", default = false, type = "boolean"})
+    add_configs("glog", {description = "Enable build with glog support", default = false, type = "boolean"})
+    add_configs("ffmpeg", {description = "Enable build with ffmpeg support", default = false, type = "boolean"})
+    add_configs("mobile", {description = "Enable build for mobile platform", default = false, type = "boolean"})
+
+    add_deps("cmake")
+    add_deps("nlohmann_json", {configs = {cmake = true}})
+    add_deps("spdlog", {configs = {header_only = false}})
+    add_deps("fmt <=8.0.0", "dlpack", "backward-cpp")
+    if is_plat("windows") then
+        add_deps("dlfcn-win32")
+    elseif is_plat("linux") then
+        add_syslinks("pthread")
+    end
+
+    on_load(function (package)
+        if package:config("breakpad") then
+            package:add("deps", "breakpad")
+        end
+        if package:config("cuda") then
+            package:add("deps", "cuda")
+        end
+        if package:config("glog") then
+            package:add("deps", "glog")
+        end
+        if package:config("ffmpeg") then
+            package:add("deps", "ffmpeg")
+        end
+    end)
+
+    on_install("!windows", function (package)
+        io.replace("cmake/dependencies.cmake", "find_package(pybind11 REQUIRED)", "", {plain = true})
+        io.replace("bmf/hml/cmake/dependencies.cmake", "find_package(GTest REQUIRED)", "", {plain = true})
+        io.replace("bmf/hml/cmake/dependencies.cmake", "add_library(gtest ALIAS GTest::gtest)", "", {plain = true})
+        io.replace("bmf/hml/cmake/dependencies.cmake", "add_library(gtest_main ALIAS GTest::gtest_main)", "", {plain = true})
+        io.replace("bmf/hml/cmake/dependencies.cmake", "find_package(benchmark REQUIRED)", "", {plain = true})
+        -- io.replace("bmf/hml/src/core/logging.cpp", "backward.hpp", "backward/backward.hpp", {plain = true})
+
+        if package:is_plat("windows") then
+            for _, file in ipairs(os.files("bmf/**.cpp", "bmf/**.h")) do
+                io.replace(file, "#include <unistd.h>", "", {plain = true})
+            end
+        end
+
+        local configs = {
+            "-DBMF_LOCAL_DEPENDENCIES=OFF",
+            "-DBMF_ENABLE_PYTHON=OFF",
+            "-DBMF_ENABLE_TEST=OFF",
+        }
+        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"))
+
+        local ver = package:version()
+        if ver then
+            table.insert(configs, "-DBMF_BUILD_VERSION=" .. ver)
+        end
+
+        table.insert(configs, "-DBMF_ENABLE_BREAKPAD=" .. (package:config("breakpad") and "ON" or "OFF"))
+        table.insert(configs, "-DBMF_ENABLE_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
+        table.insert(configs, "-DBMF_ENABLE_GLOG=" .. (package:config("glog") and "ON" or "OFF"))
+        table.insert(configs, "-DBMF_ENABLE_FFMPEG=" .. (package:config("ffmpeg") and "ON" or "OFF"))
+        table.insert(configs, "-DBMF_ENABLE_MOBILE=" .. (package:config("mobile") and "ON" or "OFF"))
+
+        local envs = import("package.tools.cmake").buildenvs(package)
+        if package:is_plat("windows") then
+            envs.SCRIPT_EXEC_MODE = "win"
+        end
+        import("package.tools.cmake").install(package, configs, {envs = envs})
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <audio_frame.h>
+            void test() {
+                AudioFrame x();
+            }
+        ]]}, {configs = {languages = "c++11"}}))
+    end)

+ 31 - 0
packages/d/dlpack/xmake.lua

@@ -0,0 +1,31 @@
+package("dlpack")
+    set_homepage("https://dmlc.github.io/dlpack/latest")
+    set_description("common in-memory tensor structure ")
+    set_license("Apache-2.0")
+
+    add_urls("https://github.com/dmlc/dlpack/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/dmlc/dlpack.git")
+
+    add_versions("v0.8", "cf965c26a5430ba4cc53d61963f288edddcd77443aa4c85ce722aaf1e2f29513")
+
+    add_configs("contrib", {description = "Build in progress unstable libraries", default = false, type = "boolean"})
+
+    add_deps("cmake")
+
+    on_load(function (package)
+        if not package:config("contrib") then
+            package:set("kind", "library", {headeronly = true})
+        end
+    end)
+
+    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, "-DBUILD_MOCK=" .. (package:config("contrib") and "ON" or "OFF"))
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_ctypes("DLDevice", {includes = "dlpack/dlpack.h"}))
+    end)

+ 3 - 0
packages/s/spdlog/xmake.lua

@@ -74,6 +74,9 @@ package("spdlog")
         table.insert(configs, "-DSPDLOG_FMT_EXTERNAL_HO=" .. (package:config("fmt_external_ho") and "ON" or "OFF"))
         table.insert(configs, "-DSPDLOG_NO_EXCEPTIONS=" .. (package:config("noexcept") and "ON" or "OFF"))
         table.insert(configs, "-DSPDLOG_WCHAR_SUPPORT=" .. (package:config("wchar") and "ON" or "OFF"))
+        if package:is_plat("windows") then
+            table.insert(configs, "-DCMAKE_COMPILE_PDB_OUTPUT_DIRECTORY=''")
+        end
         import("package.tools.cmake").install(package, configs)
     end)