xmake.lua 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package("zasm")
  2. set_homepage("https://github.com/zyantific/zasm")
  3. set_description("x86-64 Assembler based on Zydis")
  4. set_urls("https://github.com/zyantific/zasm.git")
  5. add_versions("2023.6.21", "19a642518eccbb1740865642eaf3ce79d5d5b884")
  6. add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
  7. add_deps("zydis v4.0.0")
  8. on_install("windows", "macosx", "linux", "bsd", "cross", "mingw", "android", function (package)
  9. local configs = {}
  10. io.writefile("xmake.lua", [[
  11. add_rules("mode.debug", "mode.release")
  12. add_requires("zydis v4.0.0")
  13. target("zasm")
  14. set_kind("$(kind)")
  15. set_languages("c++17")
  16. add_files("src/zasm/**.cpp")
  17. add_includedirs("include", "src/zasm/src")
  18. add_headerfiles("include/(**.hpp)")
  19. if is_plat("windows") then
  20. add_cxxflags("/bigobj", "/MP", "/W3", "/permissive-")
  21. if is_kind("shared") then
  22. add_rules("utils.symbols.export_all", {export_classes = true})
  23. end
  24. end
  25. add_packages("zydis")
  26. ]])
  27. if package:config("shared") then
  28. configs.kind = "shared"
  29. end
  30. import("package.tools.xmake").install(package, configs)
  31. end)
  32. on_test(function (package)
  33. assert(package:check_cxxsnippets({test = [[
  34. #include <zasm/serialization/serializer.hpp>
  35. #include <zasm/zasm.hpp>
  36. using namespace zasm;
  37. void test() {
  38. Program program(MachineMode::AMD64);
  39. }
  40. ]]}, {configs = {languages = "c++17"}}))
  41. end)