rsm-bsa: add package (#2452)

* rsm-bsa: add package

* fix syslinks

* disable plat

* try latest version

* Revert "try latest version"

This reverts commit c4bec91115.

* disable plat

* enable linux for directxtex

* enable linux for directxmath

* fix sal.h

* fix sal.h

* enable linux for directx-headers

* directx-headers: fix test

* directx-headers: fix test

* directx-headers: fix test

* directx-headers: fix test

* directx-headers: fix test
pull/2554/head
star9029 1 year ago committed by GitHub
parent 3b46c58f02
commit 406232327b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      packages/d/directx-headers/xmake.lua
  2. 10
      packages/d/directxmath/xmake.lua
  3. 21
      packages/d/directxtex/xmake.lua
  4. 95
      packages/r/rsm-bsa/port/xmake.lua
  5. 50
      packages/r/rsm-bsa/xmake.lua

@ -15,14 +15,20 @@ package("directx-headers")
add_deps("cmake") add_deps("cmake")
if is_plat("mingw") then if is_plat("mingw") then
add_defines("__REQUIRED_RPCNDR_H_VERSION__=475") add_defines("__REQUIRED_RPCNDR_H_VERSION__=475")
elseif is_plat("linux") then
add_includedirs("include", "include/wsl/stubs")
end end
on_install("windows", "mingw", function (package) on_install("windows", "mingw", "linux", function (package)
local configs = {"-DDXHEADERS_BUILD_TEST=OFF", "-DDXHEADERS_BUILD_GOOGLE_TEST=OFF"} local configs = {"-DDXHEADERS_BUILD_TEST=OFF", "-DDXHEADERS_BUILD_GOOGLE_TEST=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
import("package.tools.cmake").install(package, configs) import("package.tools.cmake").install(package, configs)
end) end)
on_test(function (package) on_test(function (package)
assert(package:has_cxxtypes("CD3DX12FeatureSupport", {configs = {languages = "cxx14"}, includes = "directx/d3dx12.h"})) if package:is_plat("windows", "mingw") then
assert(package:has_cxxtypes("CD3DX12FeatureSupport", {configs = {languages = "cxx14"}, includes = "directx/d3dx12.h"}))
else
assert(package:has_cxxincludes("wsl/winadapter.h", {configs = {languages = "cxx14"}}))
end
end) end)

@ -12,9 +12,17 @@ package("directxmath")
add_urls("https://github.com/microsoft/DirectXMath.git") add_urls("https://github.com/microsoft/DirectXMath.git")
add_versions("2022.12", "2ed0ae7d7fe5d11ad11f6d3d9b31ce686024a551cf82ade723de86aa7b4b57e1") add_versions("2022.12", "2ed0ae7d7fe5d11ad11f6d3d9b31ce686024a551cf82ade723de86aa7b4b57e1")
if is_plat("linux") then
add_resources("2022.12", "headers", "https://raw.githubusercontent.com/dotnet/runtime/2201016c1e13bdb9abf49e2e38cadf4ee0568df2/src/coreclr/pal/inc/rt/sal.h", "7dae281adc3a09a691291fb90526f05e4f9ef8b16d7f33d716ba690f7241a492")
end
add_deps("cmake") add_deps("cmake")
add_includedirs("include/directxmath") add_includedirs("include/directxmath")
on_install("windows", "mingw", function (package)
on_install("windows", "mingw", "linux", function (package)
if package:is_plat("linux") then
os.cp("../resources/headers/sal.h", package:installdir("include", "directxmath"))
end
import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"}) import("package.tools.cmake").install(package, {"-DBUILD_TESTING=OFF"})
end) end)

@ -13,16 +13,21 @@ package("directxtex")
add_versions("2023.06", "51f0ff3bee0d1015c110e0c92ebdd9704aa6acd91185328fd92f10b9558f4c62") add_versions("2023.06", "51f0ff3bee0d1015c110e0c92ebdd9704aa6acd91185328fd92f10b9558f4c62")
add_configs("dx11", {description = "Build with DirectX11 Runtime support", default = true, type = "boolean"}) if is_plat("windows") then
add_configs("dx12", {description = "Build with DirectX12 Runtime support", default = true, type = "boolean"}) add_configs("dx11", {description = "Build with DirectX11 Runtime support", default = true, type = "boolean"})
add_configs("dx12", {description = "Build with DirectX12 Runtime support", default = true, type = "boolean"})
add_configs("spectre", {description = "Build using /Qspectre for MSVC", default = false, type = "boolean"})
end
add_configs("openmp", {description = "Build with OpenMP support", default = false, type = "boolean"}) add_configs("openmp", {description = "Build with OpenMP support", default = false, type = "boolean"})
add_configs("spectre", {description = "Build using /Qspectre for MSVC", default = false, type = "boolean"})
add_configs("iterator_debugging", {description = "Disable iterator debugging in Debug configurations with the MSVC CRT", default = false, type = "boolean"}) add_configs("iterator_debugging", {description = "Disable iterator debugging in Debug configurations with the MSVC CRT", default = false, type = "boolean"})
add_configs("code_analysis", {description = "Use Static Code Analysis on build", default = false, type = "boolean"}) add_configs("code_analysis", {description = "Use Static Code Analysis on build", default = false, type = "boolean"})
add_configs("prebuild_shader", {description = "Use externally built HLSL shaders", default = false, type = "boolean"}) add_configs("prebuild_shader", {description = "Use externally built HLSL shaders", default = false, type = "boolean"})
add_configs("openexr", {description = "Build with OpenEXR support", default = false, type = "boolean"}) add_configs("openexr", {description = "Build with OpenEXR support", default = false, type = "boolean"})
add_deps("cmake") add_deps("cmake")
if is_plat("linux") then
add_deps("directxmath", "directx-headers")
end
on_load(function (package) on_load(function (package)
if package:config("openexr") then if package:config("openexr") then
@ -30,14 +35,16 @@ package("directxtex")
end end
end) end)
on_install("windows", function (package) on_install("windows", "linux", function (package)
local configs = {"-DBUILD_TOOLS=OFF", "-DBUILD_SAMPLE=OFF"} local configs = {"-DBUILD_TOOLS=OFF", "-DBUILD_SAMPLE=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_DX11=" .. (package:config("dx11") and "ON" or "OFF")) if package:is_plat("windows") then
table.insert(configs, "-DBUILD_DX12=" .. (package:config("dx12") and "ON" or "OFF")) table.insert(configs, "-DBUILD_DX11=" .. (package:config("dx11") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_DX12=" .. (package:config("dx12") and "ON" or "OFF"))
table.insert(configs, "-DENABLE_SPECTRE_MITIGATION=" .. (package:config("spectre") and "ON" or "OFF"))
end
table.insert(configs, "-DBC_USE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF")) table.insert(configs, "-DBC_USE_OPENMP=" .. (package:config("openmp") and "ON" or "OFF"))
table.insert(configs, "-DENABLE_SPECTRE_MITIGATION=" .. (package:config("spectre") and "ON" or "OFF"))
table.insert(configs, "-DDISABLE_MSVC_ITERATOR_DEBUGGING=" .. (package:config("iterator_debugging") and "ON" or "OFF")) table.insert(configs, "-DDISABLE_MSVC_ITERATOR_DEBUGGING=" .. (package:config("iterator_debugging") and "ON" or "OFF"))
table.insert(configs, "-DENABLE_CODE_ANALYSIS=" .. (package:config("code_analysis") and "ON" or "OFF")) table.insert(configs, "-DENABLE_CODE_ANALYSIS=" .. (package:config("code_analysis") and "ON" or "OFF"))
table.insert(configs, "-DUSE_PREBUILT_SHADERS=" .. (package:config("prebuild_shader") and "ON" or "OFF")) table.insert(configs, "-DUSE_PREBUILT_SHADERS=" .. (package:config("prebuild_shader") and "ON" or "OFF"))

@ -0,0 +1,95 @@
option("xmem", {showmenu = true, description = "build support for the xmem codec proxy", default = false})
option("ver", {showmenu = true, default = ""})
add_rules("mode.debug", "mode.release")
set_languages("c++20")
add_requires("rsm-mmio", "rsm-binary-io", "lz4", "zlib")
if is_plat("windows", "linux") then
add_requires("directxtex")
end
if has_config("ver") then
set_version(get_config("ver"))
local vers = get_config("ver"):split("%.")
major_ver = vers[1] or ""
minor_ver = vers[2] or ""
patch_ver = vers[3] or ""
set_configvar("PROJECT_VERSION_MAJOR", major_ver)
set_configvar("PROJECT_VERSION_MINOR", minor_ver)
set_configvar("PROJECT_VERSION_PATCH", patch_ver)
set_configvar("PROJECT_VERSION", get_config("ver"))
end
if has_config("xmem") then
add_requires("reproc", "expected-lite", "xbyak", "taywee_args")
add_requires("rsm-binary-io~32", {arch = "x86"})
add_requires("rsm-mmio~32", {arch = "x86"})
add_requires("expected-lite~32", {arch = "x86"})
add_requires("xbyak~32", {arch = "x86"})
add_requires("taywee_args~32", {arch = "x86"})
target("rsm-bsa-common")
set_kind("$(kind)")
add_files("extras/xmem/src/bsa/**.cpp")
add_includedirs("extras/xmem/src", {public = true})
add_headerfiles("extras/xmem/src/(bsa/**.hpp)")
add_packages("rsm-binary-io", "rsm-mmio", "expected-lite", "xbyak", {public = true})
if is_plat("windows") and is_kind("shared") then
add_rules("utils.symbols.export_all", {export_classes = true})
end
target("rsm-bsa-common-32")
set_kind("static")
add_files("extras/xmem/src/bsa/**.cpp")
add_includedirs("extras/xmem/src", {public = true})
add_packages("rsm-binary-io~32", "rsm-mmio~32", "expected-lite~32", "xbyak~32", {public = true})
target("xmem")
set_kind("binary")
set_arch("x86")
add_files("extras/xmem/src/main.cpp")
add_files("extras/xmem/src/version.rc")
add_includedirs("include")
add_deps("rsm-bsa-common-32")
add_packages("taywee_args~32")
set_configdir("extras/xmem/src")
add_configfiles("extras/xmem/cmake/version.rc.in", {pattern = "@(.-)@"})
set_configvar("PROJECT_NAME", "bsa")
end
target("rsm-bsa")
set_kind("$(kind)")
add_files("src/**.cpp")
add_includedirs("include", "src")
add_headerfiles("include/(bsa/**.hpp)")
add_installfiles("visualizers/*.natvis", {prefixdir = "include/natvis"})
set_configdir("include/bsa")
add_configfiles("cmake/project_version.hpp.in", {pattern = "@(.-)@"})
add_packages("rsm-mmio", "rsm-binary-io", "lz4", "zlib")
if is_plat("windows", "linux") then
add_packages("directxtex")
if is_plat("windows") then
add_syslinks("ole32")
if is_kind("shared") then
add_rules("utils.symbols.export_all", {export_classes = true})
end
end
end
if has_config("xmem") then
add_deps("rsm-bsa-common")
add_defines("BSA_SUPPORT_XMEM=1")
add_packages("reproc")
end

@ -0,0 +1,50 @@
package("rsm-bsa")
set_homepage("https://github.com/Ryan-rsm-McKenzie/bsa")
set_description("C++ library for working with the Bethesda archive file format")
set_license("MIT")
add_urls("https://github.com/Ryan-rsm-McKenzie/bsa/archive/refs/tags/$(version).tar.gz",
"https://github.com/Ryan-rsm-McKenzie/bsa.git")
add_versions("4.1.0", "c2942eb1adc35114a256720a917cfae833aa98482da3b38f9d652762d1c281b2")
add_configs("xmem", {description = "build support for the xmem codec proxy", default = false, type = "boolean", readonly = true})
add_deps("rsm-mmio", "rsm-binary-io", "lz4", "zlib")
if is_plat("windows", "linux") then
add_deps("directxtex")
if is_plat("windows") then
add_syslinks("ole32")
end
end
on_load(function (package)
if package:config("xmem") then
package:add("defines", "BSA_SUPPORT_XMEM=1")
package:add("deps", "reproc", "expected-lite", "xbyak")
package:add("deps", "rsm-mmio~32", "rsm-binary-io~32")
package:add("deps", "expected-lite~32", "xbyak~32", "taywee_args~32")
end
end)
on_install("windows", "linux", function (package)
os.cp(path.join(os.scriptdir(), "port", "xmake.lua"), "xmake.lua")
local configs = {}
configs.ver = package:version_str()
if package:config("xmem") then
configs.xmem = true
end
import("package.tools.xmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <bsa/tes4.hpp>
void test() {
const char payload[] = { "Hello world!\n" };
bsa::tes4::file f;
f.set_data({ reinterpret_cast<const std::byte*>(payload), sizeof(payload) - 1 });
}
]]}, {configs = {languages = "c++20"}}))
end)
Loading…
Cancel
Save