xmake.lua 1.8 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("memorymodulepp")
  2. set_homepage("https://github.com/bb107/MemoryModulePP")
  3. set_description("MemoryModulePP, used to load a DLL from memory. MemoryModulePP is compatible with Win32 API and supports exception handling.")
  4. set_license("MIT")
  5. add_urls("https://github.com/bb107/MemoryModulePP.git")
  6. add_versions("2024.11.7", "79f258b672f81c6ebbee1454335c4a4309d07ccb")
  7. add_deps("microsoft-detours")
  8. on_install("windows|x86", "windows|x64", function (package)
  9. io.replace("MemoryModule/stdafx.h", '../3rdparty/phnt/include/phnt_windows.h', '3rdparty/phnt/include/phnt_windows.h', {plain = true})
  10. io.replace("MemoryModule/stdafx.h", '../3rdparty/phnt/include/phnt.h', '3rdparty/phnt/include/phnt.h', {plain = true})
  11. io.replace("MemoryModule/MmpDotNet.cpp", '3rdparty/Detours/detours.h', 'detours.h', {plain = true})
  12. io.replace("MemoryModule/MmpTls.cpp", '3rdparty/Detours/detours.h', 'detours.h', {plain = true})
  13. io.writefile("xmake.lua", [[
  14. add_rules("mode.debug", "mode.release")
  15. add_requires("microsoft-detours")
  16. target("memorymodulepp")
  17. add_packages("microsoft-detours")
  18. set_kind("$(kind)")
  19. add_files("MemoryModule/*.cpp")
  20. add_files("MemoryModule/*.c")
  21. add_files("MemoryModule/MemoryModulePP.def")
  22. add_headerfiles("MemoryModule/*.h", {prefixdir = "MemoryModule"})
  23. add_headerfiles("3rdparty/phnt/include/*.h", {prefixdir = "3rdparty/phnt/include"})
  24. add_includedirs(".")
  25. ]])
  26. import("package.tools.xmake").install(package)
  27. end)
  28. on_test(function (package)
  29. assert(package:has_cxxfuncs("LdrLoadDllMemoryExW", {includes = "MemoryModule/stdafx.h"}))
  30. end)