xmake.lua 1.1 KB

12345678910111213141516171819202122232425262728
  1. package("cpu-features")
  2. set_homepage("https://github.com/google/cpu_features")
  3. set_description("A cross platform C99 library to get cpu features at runtime.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/google/cpu_features/archive/$(version).tar.gz",
  6. "https://github.com/google/cpu_features.git")
  7. add_versions("v0.6.0", "95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932")
  8. add_deps("cmake")
  9. on_install("windows", "linux", "macosx", "android", function (package)
  10. local configs = {"-DBUILD_TESTING=OFF"}
  11. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  12. if package:is_plat("linux") then
  13. table.insert(configs, "-DBUILD_PIC=ON")
  14. end
  15. import("package.tools.cmake").install(package, configs)
  16. package:addenv("PATH", "bin")
  17. end)
  18. on_test(function (package)
  19. if package:is_plat(os.host()) then
  20. os.vrun("list_cpu_features")
  21. end
  22. assert(package:has_ctypes("CacheLevelInfo", {includes = "cpu_features/cpu_features_cache_info.h"}))
  23. end)