xmake.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. add_rules("mode.debug", "mode.release")
  2. set_languages("c++17")
  3. add_requires("capstone", "keystone")
  4. target("libmem")
  5. set_kind("$(kind)")
  6. if is_plat("windows") and is_kind("shared") then
  7. add_rules("utils.symbols.export_all", {export_classes = true, export_filter = function (symbol)
  8. if symbol:find("libmem", 1, true) then
  9. return true
  10. end
  11. end})
  12. end
  13. if is_plat("windows") or is_kind("shared") then
  14. add_defines("LM_EXPORT")
  15. end
  16. add_packages("capstone", "keystone")
  17. add_headerfiles("include/(libmem/*.h)")
  18. add_headerfiles("include/(libmem/*.hpp)")
  19. add_includedirs("include")
  20. add_includedirs(
  21. "external/llvm/include",
  22. "src/common",
  23. "internal",
  24. "src"
  25. )
  26. add_files(
  27. "src/common/*.c",
  28. "src/common/*.cpp",
  29. "src/common/arch/*.c",
  30. "internal/demangler/*.cpp",
  31. "external/llvm/lib/Demangle/*.cpp"
  32. )
  33. if is_plat("linux", "bsd") then
  34. add_syslinks("dl", "stdc++", "m")
  35. if is_plat("bsd") then
  36. add_syslinks("kvm", "procstat", "elf")
  37. end
  38. add_files("internal/posixutils/*.c")
  39. add_files("internal/elfutils/*.c")
  40. local arch = (is_arch("x86_64", "x64") and "x64" or "x86")
  41. local prefix = path.join("src", is_plat("linux") and "linux" or "freebsd")
  42. add_files(path.join(prefix, "ptrace", "*.c"))
  43. add_files(path.join(prefix, "*.c"))
  44. add_files(path.join(prefix, "ptrace", arch, "*.c"))
  45. elseif is_plat("windows", "mingw") then
  46. add_syslinks("user32", "psapi", "ntdll", "shell32", "ole32")
  47. if is_plat("mingw") then
  48. add_syslinks("uuid")
  49. end
  50. add_files("internal/winutils/*.c")
  51. add_files("src/win/*.c")
  52. end