2
0

xmake.lua 1.1 KB

123456789101112131415161718192021222324
  1. package("libcpuid")
  2. set_homepage("https://github.com/anrieff/libcpuid")
  3. set_description("a small C library for x86 CPU detection and feature extraction")
  4. add_urls("https://github.com/anrieff/libcpuid/archive/refs/tags/$(version).tar.gz",
  5. "https://github.com/anrieff/libcpuid.git")
  6. add_versions("v0.5.1", "36d62842ef43c749c0ba82237b10ede05b298d79a0e39ef5fd1115ba1ff8e126")
  7. add_deps("cmake")
  8. on_install("windows", "macosx", "linux", "mingw", function (package)
  9. local configs = {}
  10. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  11. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  12. io.replace("CMakeLists.txt", "add_subdirectory(tests)", "", {plain = true})
  13. if package:is_plat("windows") then
  14. table.insert(configs, "-DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON")
  15. end
  16. import("package.tools.cmake").install(package, configs)
  17. end)
  18. on_test(function (package)
  19. assert(package:has_cfuncs("cpuid_get_vendor", {includes = "libcpuid/libcpuid.h"}))
  20. end)