2
0

xmake.lua 1.3 KB

12345678910111213141516171819202122232425262728293031
  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_versions("v0.7.0", "df80d9439abf741c7d2fdcdfd2d26528b136e6c52976be8bd0cd5e45a27262c0")
  9. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  10. add_deps("cmake")
  11. on_install("windows|x64", "windows|x86", "linux", "macosx", "android", function (package)
  12. local configs = {"-DBUILD_TESTING=OFF"}
  13. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  14. if package:is_plat("linux") then
  15. table.insert(configs, "-DBUILD_PIC=ON")
  16. end
  17. import("package.tools.cmake").install(package, configs)
  18. package:addenv("PATH", "bin")
  19. end)
  20. on_test(function (package)
  21. if not package:is_cross() then
  22. os.vrun("list_cpu_features")
  23. end
  24. assert(package:has_ctypes("CacheLevelInfo", {includes = "cpu_features/cpu_features_cache_info.h"}))
  25. end)