xmake.lua 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package("infoware")
  2. set_homepage("https://github.com/ThePhD/infoware")
  3. set_description("C++ Library for pulling system and hardware information, without hitting the command line.")
  4. set_license("CC0-1.0")
  5. add_urls("https://github.com/ThePhD/infoware.git")
  6. add_versions("2023.04.12", "d64a0c948593c0555115f60c79225c0b9ae09510")
  7. add_configs("x11", {description = "Use X11 for display detection", default = false, type = "boolean"})
  8. add_configs("d3d", {description = "Use D3D for GPU detection", default = false, type = "boolean"})
  9. add_configs("opencl", {description = "Use OpenCL for GPU detection", default = false, type = "boolean"})
  10. add_configs("opengl", {description = "Use OpenGL for GPU detection", default = false, type = "boolean"})
  11. if is_plat("windows") then
  12. add_syslinks("gdi32", "version", "ole32", "oleaut32", "wbemuuid", "ntdll")
  13. end
  14. add_deps("cmake")
  15. on_load(function (package)
  16. if package:config("x11") then
  17. package:add("deps", "libx11")
  18. end
  19. if package:config("opencl") then
  20. package:add("deps", "opencl")
  21. end
  22. end)
  23. on_install("windows|x64", "windows|x86", "linux", "macosx", "bsd", "mingw|x86_64", "msys", function (package)
  24. local configs = {}
  25. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  26. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  27. table.insert(configs, "-DINFOWARE_USE_X11=" .. (package:config("x11") and "ON" or "OFF"))
  28. table.insert(configs, "-DINFOWARE_USE_D3D=" .. (package:config("d3d") and "ON" or "OFF"))
  29. table.insert(configs, "-DINFOWARE_USE_OPENCL=" .. (package:config("opencl") and "ON" or "OFF"))
  30. table.insert(configs, "-DINFOWARE_USE_OPENGL=" .. (package:config("opengl") and "ON" or "OFF"))
  31. import("package.tools.cmake").install(package, configs)
  32. end)
  33. on_test(function (package)
  34. assert(package:check_cxxsnippets({test = [[
  35. #include <infoware/cpu.hpp>
  36. void test() {
  37. auto quantities = iware::cpu::quantities();
  38. }
  39. ]]}, {configs = {languages = "c++14"}}))
  40. end)