xmake.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package("d3d12-memory-allocator")
  2. set_homepage("https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator")
  3. set_description("Easy to integrate memory allocation library for Direct3D 12")
  4. set_license("MIT")
  5. add_urls("https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git")
  7. add_versions("v3.0.1", "5182c59068e31183490f5c28b7257e6d46bdeb91c215eb54eb88b2ed4683f4a2")
  8. add_versions("v2.0.1", "7ce1f1dfb8821d0116eccf425b3558e6d4b28d192f4efb6e6bdb3d916d853574")
  9. add_deps("cmake")
  10. on_install("windows|x64", function (package)
  11. local configs = {}
  12. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  13. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  14. import("package.tools.cmake").install(package, configs)
  15. if package:config("shared") then
  16. os.mv(path.join(package:installdir("lib"), "*.dll"), package:installdir("bin"))
  17. end
  18. end)
  19. on_test("windows|x64", function (package)
  20. assert(package:check_cxxsnippets({test = [[
  21. static void test() {
  22. IDXGIFactory4* dxgi_factory;
  23. CreateDXGIFactory2(0, IID_PPV_ARGS(&dxgi_factory));
  24. IDXGIAdapter* adapter;
  25. dxgi_factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter));
  26. ID3D12Device* device;
  27. D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_1, IID_PPV_ARGS(&device));
  28. D3D12MA::ALLOCATOR_DESC allocatorDesc = {};
  29. allocatorDesc.pDevice = device;
  30. allocatorDesc.pAdapter = adapter;
  31. D3D12MA::Allocator* allocator;
  32. D3D12MA::CreateAllocator(&allocatorDesc, &allocator);
  33. }
  34. ]]}, {configs = {languages = "c++17"}, includes = "D3D12MemAlloc.h"}))
  35. end)