xmake.lua 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. add_rules("mode.debug", "mode.release")
  2. if is_plat("mingw") then
  3. add_syslinks("advapi32", "dbghelp", "psapi")
  4. end
  5. target("injector")
  6. set_kind("$(kind)")
  7. set_languages("c")
  8. add_headerfiles("include/(*.h)")
  9. add_includedirs("include", {public = true})
  10. if is_arch("arm.*") then
  11. add_defines("__arm__")
  12. if is_arch("arm") then
  13. add_defines("_M_ARMT")
  14. elseif is_arch("arm64") then
  15. add_defines("__arm64__", "__aarch64__", "_M_ARM64")
  16. end
  17. elseif is_arch("x86_64") then
  18. add_defines("__x86_64__")
  19. elseif is_arch("x86") then
  20. add_defines("__i386__", "_M_IX86")
  21. elseif is_arch("x64") then
  22. add_defines("_M_AMD64")
  23. end
  24. if is_plat("windows", "mingw") then
  25. add_files("src/windows/*.c")
  26. if is_plat("windows") then
  27. add_defines("_WIN32")
  28. end
  29. elseif is_plat("macosx") then
  30. add_headerfiles("src/macos/*.h")
  31. add_files("src/macos/*.c")
  32. elseif is_plat("linux") then
  33. add_files("src/linux/*.c", "src/linux/*.S")
  34. add_defines("__linux__")
  35. end
  36. on_config(function (target)
  37. if target:has_tool("gcc", "gxx") then
  38. target:add("defines", "__USE_GNU")
  39. end
  40. end)