xmake.lua 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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("v2.0.1", "7ce1f1dfb8821d0116eccf425b3558e6d4b28d192f4efb6e6bdb3d916d853574")
  8. add_deps("cmake")
  9. on_install("windows|x64", function (package)
  10. local configs = {}
  11. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  12. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  13. import("package.tools.cmake").install(package, configs)
  14. if package:config("shared") then
  15. os.mv(path.join(package:installdir("lib"), "*.dll"), package:installdir("bin"))
  16. end
  17. end)
  18. on_test("windows|x64", function (package)
  19. assert(package:check_cxxsnippets({test = [[
  20. static void test() {
  21. IDXGIFactory4* dxgi_factory;
  22. CreateDXGIFactory2(0, IID_PPV_ARGS(&dxgi_factory));
  23. IDXGIAdapter* adapter;
  24. dxgi_factory->EnumWarpAdapter(IID_PPV_ARGS(&adapter));
  25. ID3D12Device* device;
  26. D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_1, IID_PPV_ARGS(&device));
  27. D3D12MA::ALLOCATOR_DESC allocatorDesc = {};
  28. allocatorDesc.pDevice = device;
  29. allocatorDesc.pAdapter = adapter;
  30. D3D12MA::Allocator* allocator;
  31. D3D12MA::CreateAllocator(&allocatorDesc, &allocator);
  32. }
  33. ]]}, {configs = {languages = "c++17"}, includes = "D3D12MemAlloc.h"}))
  34. end)