* add blah

* add logs

* fix windows

* add d3d11

* add dxguid

* disable shared for windows
pull/1722/head
ruki 2 years ago committed by GitHub
parent 901d18e0b7
commit 4f9e511387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 59
      packages/b/blah/xmake.lua
  2. 10
      packages/l/libsdl/xmake.lua

@ -0,0 +1,59 @@
package("blah")
set_homepage("https://github.com/NoelFB/blah")
set_description("A small 2d c++ game framework")
set_license("MIT")
add_urls("https://github.com/NoelFB/blah.git")
add_versions("2023.01.03", "a0cccca457cfb91213fae6e4e994d1c181c358fe")
add_deps("cmake")
add_deps("libsdl >=2.26")
if is_plat("macosx") then
add_frameworks("ForceFeedback", "CoreVideo", "CoreGraphics", "CoreFoundation", "Foundation", "AppKit", "IOKit")
elseif is_plat("windows") then
add_syslinks("d3d11", "d3dcompiler", "dxguid")
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end
on_install("windows", "macosx", "linux", function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
io.replace("CMakeLists.txt", "if (NOT DEFINED BLAH_SDL2_LIBS)", "IF(FALSE)", {plain = true})
import("package.tools.cmake").build(package, configs, {buildir = "build", packagedeps = "libsdl"})
os.cp("include", package:installdir())
os.trycp("build/*.a", package:installdir("lib"))
os.trycp("build/*.so", package:installdir("lib"))
os.trycp("build/*.dylib", package:installdir("lib"))
os.trycp("build/*/*.lib", package:installdir("lib"))
os.trycp("build/*/*.dll", package:installdir("bin"))
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
using namespace Blah;
Batch batch;
int test() {
Config config;
config.name = "blah app";
config.on_render = []() {
auto target = App::backbuffer();
target->clear(Color::black);
auto center = Vec2f(target->width(), target->height()) / 2;
auto rotation = Time::seconds * Calc::TAU;
auto transform = Mat3x2f::create_transform(center, Vec2f::zero, Vec2f::one, rotation);
batch.push_matrix(transform);
batch.rect(Rectf(-32, -32, 64, 64), Color::red);
batch.pop_matrix();
batch.render(target);
batch.clear();
};
return App::run(&config);
}
]]}, {configs = {languages = "c++17"}, includes = {"blah.h"}}))
end)

@ -1,7 +1,7 @@
package("libsdl")
set_homepage("https://www.libsdl.org/")
set_description("Simple DirectMedia Layer")
if is_plat("mingw") and is_subhost("msys") then
add_extsources("pacman::SDL2")
elseif is_plat("linux") then
@ -72,14 +72,14 @@ package("libsdl")
component:add("syslinks", "user32", "gdi32", "winmm", "imm32", "ole32", "oleaut32", "version", "uuid", "advapi32", "setupapi", "shell32")
elseif package:is_plat("linux", "bsd") then
component:add("syslinks", "pthread", "dl")
if package:is_plat("bsd") then
if package:is_plat("bsd") then
component:add("syslinks", "usbhid")
end
elseif package:is_plat("android") then
component:add("syslinks", "dl", "log", "android", "GLESv1_CM", "GLESv2", "OpenSLES")
elseif package:is_plat("iphoneos", "macosx") then
component:add("frameworks", "AudioToolbox", "AVFoundation", "CoreAudio", "CoreVideo", "Foundation", "Metal", "QuartzCore")
component:add("syslinks", "iconv")
component:add("frameworks", "AudioToolbox", "AVFoundation", "CoreAudio", "CoreVideo", "Foundation", "Metal", "QuartzCore", "CoreFoundation")
component:add("syslinks", "iconv")
if package:is_plat("macosx") then
component:add("frameworks", "Cocoa", "Carbon", "ForceFeedback", "IOKit")
else
@ -174,7 +174,7 @@ package("libsdl")
opt = opt or {}
opt.packagedeps = "libusb"
elseif package:is_plat("wasm") then
-- emscripten enables USE_SDL by default which will conflict with the sdl headers
-- emscripten enables USE_SDL by default which will conflict with the sdl headers
opt = opt or {}
opt.cflags = {"-sUSE_SDL=0"}
end

Loading…
Cancel
Save