2
0

xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. package("pe-parse")
  2. set_homepage("https://github.com/trailofbits/pe-parse")
  3. set_description("Principled, lightweight C/C++ PE parser")
  4. set_license("MIT")
  5. add_urls("https://github.com/trailofbits/pe-parse/archive/f2f0ee91f3b6dee41f75b2f775e82015f2b72007.tar.gz",
  6. "https://github.com/trailofbits/pe-parse.git")
  7. add_versions("2024.06.04", "f20594916452f868a55928ef99945dbbd416387e320101b1bf63f9dcff4af628")
  8. add_configs("tools", {description = "Build tools", default = false, type = "boolean"})
  9. add_deps("cmake")
  10. on_install(function (package)
  11. io.replace("cmake/compilation_flags.cmake", "-Werror", "", {plain = true})
  12. if package:is_plat("windows") and package:is_arch("arm.*") then
  13. io.replace("CMakeLists.txt", "find_package(Filesystem COMPONENTS Experimental Final REQUIRED)", "", {plain = true})
  14. end
  15. local configs = {}
  16. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  17. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  18. table.insert(configs, "-DBUILD_COMMAND_LINE_TOOLS=" .. (package:config("tools") and "ON" or "OFF"))
  19. import("package.tools.cmake").install(package, configs)
  20. end)
  21. on_test(function (package)
  22. assert(package:check_cxxsnippets({test = [[
  23. void test() {
  24. std::string str = peparse::GetPEErrString();
  25. }
  26. ]]}, {configs = {languages = "c++17"}, includes = "pe-parse/parse.h"}))
  27. end)