add libcpuid (#846)

* add libcpuid

* Update xmake.lua

* Update xmake.lua
pull/848/head
ruki 3 years ago committed by GitHub
parent 47fe591117
commit 646221290b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      packages/l/libcpuid/xmake.lua

@ -0,0 +1,24 @@
package("libcpuid")
set_homepage("https://github.com/anrieff/libcpuid")
set_description("a small C library for x86 CPU detection and feature extraction")
add_urls("https://github.com/anrieff/libcpuid/archive/refs/tags/$(version).tar.gz",
"https://github.com/anrieff/libcpuid.git")
add_versions("v0.5.1", "36d62842ef43c749c0ba82237b10ede05b298d79a0e39ef5fd1115ba1ff8e126")
add_deps("cmake")
on_install("windows", "macosx", "linux", "mingw", function (package)
local configs = {}
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"))
io.replace("CMakeLists.txt", "add_subdirectory(tests)", "", {plain = true})
if package:is_plat("windows") then
table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("cpuid_get_vendor", {includes = "libcpuid/libcpuid.h"}))
end)
Loading…
Cancel
Save