2
0

xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233
  1. package("pseudo-double-cpp")
  2. set_homepage("https://github.com/royward/pseudo-double")
  3. set_description("A relatively fast C and C++ 64 bit floating point library written using only integer operations for cross platform consistency. Tested with gcc/clang/Visual Studio, on x86-64/ARMv8 (64 bit)")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/royward/pseudo-double.git")
  6. add_versions("2024.01.17", "275b244eee40b987a209927d7942d4bf83d91c95")
  7. add_configs("pseudo_double_exp_bits", {description = "This sets the number of bits in the exponent, defaulting to 16 if not set.", default = "16", type = "string", values = {"8", "16", "32"}})
  8. add_configs("pd_error_check", {description = "This enables error checking in the library, defaulting to true if not set.", default = true, type = "boolean"})
  9. on_load(function (package)
  10. package:add("deps", "pseudo-double-c", {configs = {shared = package:config("shared"), pseudo_double_exp_bits = package:config("pseudo_double_exp_bits"), pd_error_check = package:config("pd_error_check")}})
  11. end)
  12. on_install("windows|x64", "linux|x86_64", "bsd", "android|arm64*", function (package)
  13. io.replace("PseudoDouble.h", "#include <stdexcept>", "#include <stdexcept>\n#include <string>", {plain = true})
  14. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  15. local configs = {}
  16. configs.pseudo_double_exp_bits = package:config("pseudo_double_exp_bits")
  17. configs.pd_error_check = package:config("pd_error_check")
  18. import("package.tools.xmake").install(package, configs)
  19. end)
  20. on_test(function (package)
  21. assert(package:check_cxxsnippets({test = [[
  22. #include <PseudoDouble.h>
  23. void test() {
  24. PseudoDouble a_2 = PD_create_fixed10(3,-1);
  25. }
  26. ]]}))
  27. end)