From 8c4233e90e2f5122e352de85e5f2d6f55c6fa525 Mon Sep 17 00:00:00 2001 From: JailDoctor Date: Mon, 23 Oct 2023 16:49:13 +0200 Subject: [PATCH] =?UTF-8?q?-=20Ara=20la=20versi=C3=B3=20la=20dona=20el=20M?= =?UTF-8?q?akefile=20-=20El=20Makefile=20ja=20inclou=20la=20generaci=C3=B3?= =?UTF-8?q?=20de=20windows=5Frelease?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 49 ++++++++++++++++++++++++++++++++++----- source/gamestate_menu.cpp | 5 ++-- source/versio.h | 3 --- 3 files changed, 46 insertions(+), 11 deletions(-) delete mode 100644 source/versio.h diff --git a/Makefile b/Makefile index 42e08f9..24966d4 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,65 @@ executable = arounders source = source/*.cpp +appName = arounders +releaseFolder = release +version = v1.2.1 + +# Release names +windowsRelease = $(executable)-$(version)-win32-x64.zip +macosIntelRelease = $(executable)-$(version)-macos-intel.dmg +macosAppleSiliconRelease = $(executable)-$(version)-macos-apple-silicon.dmg +linuxRelease = $(executable)-$(version)-linux.tar.gz windows: @echo off windres icon.rc -O coff icon.res - g++ $(source) icon.res -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -mwindows -o "$(executable).exe" + g++ $(source) icon.res -D VERSION=\"$(version)\" -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -mwindows -o "$(executable).exe" strip -s -R .comment -R .gnu.version --strip-unneeded "$(executable).exe" windows_debug: @echo off - g++ $(source) -D DEBUG -g -Wall -fvar-tracking -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -o "$(executable)_debug.exe" + g++ $(source) -D DEBUG -D VERSION=\"$(version)\" -g -Wall -fvar-tracking -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -o "$(executable)_debug.exe" + +windows_release: + @echo off + +# Fem el paquetet + respak2 -p + +# Create release folder + powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force} + powershell if (-not (Test-Path "$(releaseFolder)")) {New-Item "$(releaseFolder)" -ItemType Directory} + +# Copy root files + powershell Copy-Item "data.jf2" -Destination "$(releaseFolder)" + powershell Copy-Item "versions.txt" -Destination "$(releaseFolder)" + powershell Copy-Item "README.md" -Destination "$(releaseFolder)" + powershell Copy-Item "bin\*.dll" -Destination "$(releaseFolder)" + +# Build + windres icon.rc -O coff icon.res + g++ $(source) icon.res -D VERSION=\"$(version)\" -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer -mwindows -o "$(releaseFolder)/$(executable).exe" + strip -s -R .comment -R .gnu.version --strip-unneeded "$(releaseFolder)/$(executable).exe" + +# Create ZIP + powershell if (Test-Path $(windowsRelease)) {Remove-Item $(windowsRelease)} + powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(windowsRelease) + +# Remove folder + powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force} macos: clang++ $(source) -Wall -Os -std=c++11 -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)" macos_debug: - clang++ $(source) -D DEBUG -g -Wall -Os -std=c++11 -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)_debug" + clang++ $(source) -D DEBUG -D VERSION=\"$(version)\" -g -Wall -Os -std=c++11 -ffunction-sections -fdata-sections -lSDL2 -lSDL2_mixer -o "$(executable)_debug" macos_bundle: - clang++ $(source) -D MACOS_BUNDLE -Wall -Os -std=c++11 -framework SDL2 -framework SDL2_mixer -F /Library/Frameworks -ffunction-sections -fdata-sections -o mini_bundle -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12 + clang++ $(source) -D MACOS_BUNDLE -D VERSION=\"$(version)\" -Wall -Os -std=c++11 -framework SDL2 -framework SDL2_mixer -F /Library/Frameworks -ffunction-sections -fdata-sections -o mini_bundle -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12 linux: - g++ $(source) -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lSDL2 -lSDL2_mixer -o "$(executable)" + g++ $(source) -D VERSION=\"$(version)\" -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lSDL2 -lSDL2_mixer -o "$(executable)" strip -s -R .comment -R .gnu.version --strip-unneeded "$(executable)" linux_debug: - g++ $(source) -D DEBUG -g -Wall -fvar-tracking -lSDL2 -lSDL2_mixer -o "$(executable)_debug" + g++ $(source) -D DEBUG -D VERSION=\"$(version)\" -g -Wall -fvar-tracking -lSDL2 -lSDL2_mixer -o "$(executable)_debug" diff --git a/source/gamestate_menu.cpp b/source/gamestate_menu.cpp index d6ac5f5..d982574 100644 --- a/source/gamestate_menu.cpp +++ b/source/gamestate_menu.cpp @@ -1,7 +1,6 @@ #include "gamestates.h" #include "jgame.h" #include "aux_font.h" -#include "versio.h" namespace gamestate { @@ -55,7 +54,9 @@ namespace gamestate draw::draw(fondo); - font::print(277,192, versio); +#ifdef VERSION + font::print(277,192, VERSION); +#endif draw::setSource(cursor); draw::draw(x, y); diff --git a/source/versio.h b/source/versio.h deleted file mode 100644 index b438766..0000000 --- a/source/versio.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -const char *versio = "v1.2.0";