From f22927e124d1cae25ac35f27b7593c499c77a496 Mon Sep 17 00:00:00 2001 From: Sara Date: Sat, 7 Jun 2025 19:29:21 +0200 Subject: [PATCH] feat: windows builds in premake --- premake5.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/premake5.lua b/premake5.lua index 0f6c4f7..3440c70 100644 --- a/premake5.lua +++ b/premake5.lua @@ -1,5 +1,6 @@ workspace "roguelike" configurations { "debug", "release" } + platforms { "linux", "windows" } location "." project "roguelike" @@ -9,12 +10,10 @@ project "roguelike" location "build/" buildinputs "../resources/**.*" buildoutputs "%{cfg.targetdir}/resources/**.*" - postbuildcommands "{COPYDIR} ../resources %{cfg.targetdir}" files { "src/**.cpp", "vendor/**.cpp" } - includedirs { "src/", "vendor/" } - links { "SDL2", "SDL2_image", "m", "SDL2_ttf" } targetdir "bin/" exceptionhandling "Off" + includedirs { "src/", "libs/SDL2/include/", "libs/SDL2_image/include/", "libs/SDL2/include/SDL2/" } filter "configurations:debug" defines { "DEBUG" } optimize "Off" @@ -23,3 +22,13 @@ project "roguelike" defines { "NDEBUG" } optimize "On" symbols "Off" + filter "platforms:linux" + postbuildcommands { "{COPYDIR} ../resources %{cfg.targetdir}" } + includedirs { "src/", "vendor/" } + links { "SDL2", "SDL2_image", "m" } + filter "platforms:windows" + libdirs { "libs/SDL2/lib/", "libs/SDL2/bin/", "libs/SDL2_image/lib/", "libs/SDL2_image/bin/" } + links { "stdc++:static", "gcc:static", "winpthread:static", "mingw32:static", "SDL2main", "SDL2_image", "SDL2" } + buildoptions { "-mwindows", "-static-libgcc", "-static-libstdc++" } + prebuildcommands { "{COPY} ../libs/SDL2_image/bin/SDL2_image.dll %{cfg.targetdir}", "{COPY} ../libs/SDL2/bin/SDL2.dll %{cfg.targetdir}", "{COPY} ../libs/SDL2/lib/libSDL2main.a %{cfg.targetdir}" } + postbuildcommands { "{COPYDIR} ../resources %{cfg.targetdir}" }