Explorar el Código

add ispc, fxdiv and pthreadpool (#1093)

* add ispc

* remove version prefix

* add fxdiv and pthreadpool

* fix pthreadpool
Hoildkv hace 3 años
padre
commit
424c353c44
Se han modificado 3 ficheros con 76 adiciones y 0 borrados
  1. 19 0
      packages/f/fxdiv/xmake.lua
  2. 25 0
      packages/i/ispc/xmake.lua
  3. 32 0
      packages/p/pthreadpool/xmake.lua

+ 19 - 0
packages/f/fxdiv/xmake.lua

@@ -0,0 +1,19 @@
+package("fxdiv")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/Maratyszcza/FXdiv")
+    set_description("C99/C++ header-only library for division via fixed-point multiplication by inverse")
+    set_license("MIT")
+
+    add_urls("https://github.com/Maratyszcza/FXdiv.git")
+    add_versions("2020.12.09", "63058eff77e11aa15bf531df5dd34395ec3017c8")
+
+    add_deps("cmake")
+    on_install("windows", "macosx", "linux", function (package)
+        local configs = {"-DFXDIV_BUILD_TESTS=OFF", "-DFXDIV_BUILD_BENCHMARKS=OFF"}
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("fxdiv_init_uint32_t", {includes = "fxdiv.h"}))
+    end)

+ 25 - 0
packages/i/ispc/xmake.lua

@@ -0,0 +1,25 @@
+package("ispc")
+
+    set_kind("toolchain")
+    set_homepage("https://ispc.github.io/")
+    set_description("Intel® Implicit SPMD Program Compiler")
+    set_license("BSD-3-Clause")
+
+    if is_host("windows") then
+        add_urls("https://github.com/ispc/ispc/releases/download/v$(version)/ispc-v$(version)-windows.zip")
+        add_versions("1.17.0", "e9a7cc98f69357482985bcbf69fa006632cee7b3606069b4d5e16dc62092d660")
+    elseif is_host("macosx") then
+        add_urls("https://github.com/ispc/ispc/releases/download/v$(version)/ispc-v$(version)-macOS.tar.gz")
+        add_versions("1.17.0", "e7fdcdbd5c272955249148c452ccd7295d7cf77b35ca1dec377e72b49c847bff")
+    elseif is_host("linux") then
+        add_urls("https://github.com/ispc/ispc/releases/download/v$(version)/ispc-v$(version)-linux.tar.gz")
+        add_versions("1.17.0", "6acc5df75efdce437f79b1b6489be8567c6d009e19dcc4851b9b37012afce1f7")
+    end
+
+    on_install("@windows", "@macosx", "@linux", function (package)
+        os.cp("*", package:installdir())
+    end)
+
+    on_test(function (package)
+        os.vrun("ispc --version")
+    end)

+ 32 - 0
packages/p/pthreadpool/xmake.lua

@@ -0,0 +1,32 @@
+package("pthreadpool")
+
+    set_homepage("https://github.com/Maratyszcza/pthreadpool")
+    set_description("Portable (POSIX/Windows/Emscripten) thread pool for C/C++")
+    set_license("BSD-2-Clause")
+
+    add_urls("https://github.com/Maratyszcza/pthreadpool.git")
+    add_versions("2021.05.08", "1787867f6183f056420e532eec640cba25efafea")
+
+    if is_plat("windows") then
+        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+    end
+
+    add_deps("cmake", "fxdiv")
+    if is_plat("linux") then
+        add_syslinks("pthread")
+    end
+    on_install("windows", "macosx", "linux", function (package)
+        io.gsub("CMakeLists.txt", "IF%(NOT TARGET fxdiv%).-ENDIF%(%)", "add_library(fxdiv INTERFACE)\ntarget_include_directories(fxdiv INTERFACE \"${FXDIV_SOURCE_DIR}/include\")")
+        local configs = {"-DPTHREADPOOL_BUILD_TESTS=OFF", "-DPTHREADPOOL_BUILD_BENCHMARKS=OFF"}
+        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"))
+        local fxdiv = package:dep("fxdiv")
+        if fxdiv and not fxdiv:is_system() then
+            table.insert(configs, "-DFXDIV_SOURCE_DIR=" .. fxdiv:installdir())
+        end
+        import("package.tools.cmake").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("pthreadpool_create", {includes = "pthreadpool.h"}))
+    end)