arreglos en makefile
This commit is contained in:
@@ -225,7 +225,17 @@ if(WIN32)
|
|||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-deprecated)
|
target_compile_options(${PROJECT_NAME} PRIVATE -Wno-deprecated)
|
||||||
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
if(NOT CMAKE_OSX_ARCHITECTURES)
|
||||||
|
set(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||||
|
endif()
|
||||||
|
if(MACOS_BUNDLE)
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUNDLE)
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE
|
||||||
|
-framework SDL3
|
||||||
|
-F ${CMAKE_SOURCE_DIR}/release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64
|
||||||
|
-rpath @executable_path/../Frameworks/
|
||||||
|
)
|
||||||
|
endif()
|
||||||
elseif(UNIX AND NOT APPLE)
|
elseif(UNIX AND NOT APPLE)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE LINUX_BUILD)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
284
Makefile
284
Makefile
@@ -18,24 +18,13 @@ RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
|||||||
RESOURCE_FILE := release/windows/jdd.res
|
RESOURCE_FILE := release/windows/jdd.res
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# PACKING TOOL
|
# TOOLS
|
||||||
# ==============================================================================
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources.exe
|
|
||||||
PACK_CXX := $(CXX)
|
|
||||||
else
|
|
||||||
PACK_TOOL := $(DIR_TOOLS)pack_resources/pack_resources
|
|
||||||
PACK_CXX := $(CXX)
|
|
||||||
endif
|
|
||||||
PACK_SOURCES := $(DIR_TOOLS)pack_resources/pack_resources.cpp source/core/resources/resource_pack.cpp
|
|
||||||
PACK_INCLUDES := -Isource
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# SHADERS
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
DIR_PACK_TOOL := $(DIR_TOOLS)pack_resources
|
||||||
SHADER_SCRIPT := $(DIR_ROOT)tools/shaders/compile_spirv.sh
|
SHADER_SCRIPT := $(DIR_ROOT)tools/shaders/compile_spirv.sh
|
||||||
SHADER_VERT_H := $(DIR_ROOT)source/core/rendering/sdl3gpu/postfx_vert_spv.h
|
SHADER_CMAKE := $(DIR_ROOT)tools/shaders/compile_spirv.cmake
|
||||||
SHADER_FRAG_H := $(DIR_ROOT)source/core/rendering/sdl3gpu/postfx_frag_spv.h
|
SHADERS_DIR := $(DIR_ROOT)data/shaders
|
||||||
|
HEADERS_DIR := $(DIR_ROOT)source/core/rendering/sdl3gpu
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
GLSLC := $(shell where glslc 2>NUL)
|
GLSLC := $(shell where glslc 2>NUL)
|
||||||
else
|
else
|
||||||
@@ -79,190 +68,87 @@ MACOS_APPLE_SILICON_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-macos-apple
|
|||||||
LINUX_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux.tar.gz
|
LINUX_RELEASE := $(DIST_DIR)/$(TARGET_NAME)-$(VERSION)-linux.tar.gz
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SOURCE FILES
|
# PLATAFORMA
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
APP_SOURCES := \
|
|
||||||
source/main.cpp \
|
|
||||||
source/core/audio/audio.cpp \
|
|
||||||
source/core/input/global_inputs.cpp \
|
|
||||||
source/core/input/input_types.cpp \
|
|
||||||
source/core/input/input.cpp \
|
|
||||||
source/core/input/mouse.cpp \
|
|
||||||
source/core/locale/locale.cpp \
|
|
||||||
source/core/rendering/gif.cpp \
|
|
||||||
source/core/rendering/palette_manager.cpp \
|
|
||||||
source/core/rendering/pixel_reveal.cpp \
|
|
||||||
source/core/rendering/render_info.cpp \
|
|
||||||
source/core/rendering/screen.cpp \
|
|
||||||
source/core/rendering/sdl3gpu/sdl3gpu_shader.cpp \
|
|
||||||
source/core/rendering/sprite/animated_sprite.cpp \
|
|
||||||
source/core/rendering/sprite/dissolve_sprite.cpp \
|
|
||||||
source/core/rendering/sprite/moving_sprite.cpp \
|
|
||||||
source/core/rendering/sprite/sprite.cpp \
|
|
||||||
source/core/rendering/surface.cpp \
|
|
||||||
source/core/rendering/text.cpp \
|
|
||||||
source/core/resources/resource_cache.cpp \
|
|
||||||
source/core/resources/resource_helper.cpp \
|
|
||||||
source/core/resources/resource_list.cpp \
|
|
||||||
source/core/resources/resource_loader.cpp \
|
|
||||||
source/core/resources/resource_pack.cpp \
|
|
||||||
source/core/system/debug.cpp \
|
|
||||||
source/core/system/director.cpp \
|
|
||||||
source/core/system/global_events.cpp \
|
|
||||||
source/game/entities/enemy.cpp \
|
|
||||||
source/game/entities/item.cpp \
|
|
||||||
source/game/entities/player.cpp \
|
|
||||||
source/game/gameplay/cheevos.cpp \
|
|
||||||
source/game/gameplay/collision_map.cpp \
|
|
||||||
source/game/gameplay/enemy_manager.cpp \
|
|
||||||
source/game/gameplay/item_manager.cpp \
|
|
||||||
source/game/gameplay/item_tracker.cpp \
|
|
||||||
source/game/gameplay/room_loader.cpp \
|
|
||||||
source/game/gameplay/room_tracker.cpp \
|
|
||||||
source/game/gameplay/room.cpp \
|
|
||||||
source/game/gameplay/scoreboard.cpp \
|
|
||||||
source/game/gameplay/stats.cpp \
|
|
||||||
source/game/gameplay/tilemap_renderer.cpp \
|
|
||||||
source/game/options.cpp \
|
|
||||||
source/game/scenes/credits.cpp \
|
|
||||||
source/game/scenes/ending.cpp \
|
|
||||||
source/game/scenes/ending2.cpp \
|
|
||||||
source/game/scenes/game_over.cpp \
|
|
||||||
source/game/scenes/game.cpp \
|
|
||||||
source/game/scenes/loading_screen.cpp \
|
|
||||||
source/game/scenes/logo.cpp \
|
|
||||||
source/game/scenes/title.cpp \
|
|
||||||
source/game/ui/console.cpp \
|
|
||||||
source/game/ui/notifier.cpp \
|
|
||||||
source/utils/delta_timer.cpp \
|
|
||||||
source/utils/utils.cpp
|
|
||||||
|
|
||||||
# All sources combined
|
|
||||||
ALL_SOURCES := $(APP_SOURCES)
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# INCLUDES
|
|
||||||
# ==============================================================================
|
|
||||||
INCLUDES := -Isource
|
|
||||||
|
|
||||||
# ==============================================================================
|
|
||||||
# COMPILER FLAGS (OS-specific)
|
|
||||||
# ==============================================================================
|
|
||||||
CPP_STANDARD := c++20
|
|
||||||
|
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
FixPath = $(subst /,\\,$1)
|
FixPath = $(subst /,\\,$1)
|
||||||
CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections \
|
|
||||||
-Wl,--gc-sections -static-libstdc++ -static-libgcc \
|
|
||||||
-Wl,-subsystem,windows -DWINDOWS_BUILD
|
|
||||||
CXXFLAGS_DEBUG := -std=$(CPP_STANDARD) -Wall -g -D_DEBUG -DWINDOWS_BUILD
|
|
||||||
LDFLAGS := -lmingw32 -lws2_32 -lSDL3
|
|
||||||
RM := del /Q
|
RM := del /Q
|
||||||
MKDIR := mkdir
|
MKDIR := mkdir
|
||||||
else
|
else
|
||||||
FixPath = $1
|
FixPath = $1
|
||||||
CXXFLAGS := -std=$(CPP_STANDARD) -Wall -Os -ffunction-sections -fdata-sections
|
|
||||||
CXXFLAGS_DEBUG := -std=$(CPP_STANDARD) -Wall -g -D_DEBUG
|
|
||||||
LDFLAGS := -lSDL3
|
|
||||||
RMFILE := rm -f
|
RMFILE := rm -f
|
||||||
RMDIR := rm -rdf
|
RMDIR := rm -rdf
|
||||||
MKDIR := mkdir -p
|
MKDIR := mkdir -p
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
ifeq ($(UNAME_S),Linux)
|
|
||||||
CXXFLAGS += -DLINUX_BUILD
|
|
||||||
endif
|
|
||||||
ifeq ($(UNAME_S),Darwin)
|
|
||||||
CXXFLAGS += -DMACOS_BUILD
|
|
||||||
CXXFLAGS_DEBUG += -DMACOS_BUILD
|
|
||||||
# Configurar arquitectura (por defecto arm64)
|
|
||||||
CXXFLAGS += -arch arm64
|
|
||||||
CXXFLAGS_DEBUG += -arch arm64
|
|
||||||
# Usar Apple Clang explícitamente para evitar LLVM de Homebrew
|
|
||||||
MACOS_CXX := /usr/bin/clang++
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# REGLAS PARA COMPILACIÓN DE SHADERS
|
# COMPILACIÓN CON CMAKE
|
||||||
|
# ==============================================================================
|
||||||
|
all:
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
|
debug:
|
||||||
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
@cmake --build build
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# RELEASE AUTOMÁTICO (detecta SO)
|
||||||
|
# ==============================================================================
|
||||||
|
release:
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
@"$(MAKE)" windows_release
|
||||||
|
else
|
||||||
|
ifeq ($(UNAME_S),Darwin)
|
||||||
|
@$(MAKE) macos_release
|
||||||
|
else
|
||||||
|
@$(MAKE) linux_release
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ==============================================================================
|
||||||
|
# REGLAS PARA COMPILACIÓN DE SHADERS (multiplataforma via cmake)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
compile_shaders:
|
compile_shaders:
|
||||||
ifdef GLSLC
|
ifdef GLSLC
|
||||||
ifeq ($(OS),Windows_NT)
|
@cmake -D GLSLC=$(GLSLC) -D SHADERS_DIR=$(SHADERS_DIR) -D HEADERS_DIR=$(HEADERS_DIR) -P $(SHADER_CMAKE)
|
||||||
@powershell -Command "if ((Test-Path '$(SHADER_VERT_H)') -and (Test-Path '$(SHADER_FRAG_H)')) { Write-Host 'Shaders SPIR-V precompilados OK' } else { Write-Host 'Compilando shaders SPIR-V...'; bash '$(SHADER_SCRIPT)'; Write-Host 'Shaders compilados' }"
|
|
||||||
else
|
else
|
||||||
@echo "Compilando shaders SPIR-V..."
|
@echo "glslc no encontrado - asegurate de que los headers SPIR-V precompilados existen"
|
||||||
@$(SHADER_SCRIPT)
|
|
||||||
@echo "✓ Shaders compilados"
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
@powershell -Command "if ((Test-Path '$(SHADER_VERT_H)') -and (Test-Path '$(SHADER_FRAG_H)')) { Write-Host 'glslc no encontrado - usando headers SPIR-V precompilados' } else { Write-Host 'ERROR: glslc no encontrado y headers SPIR-V no existen.'; Write-Host ' Instala glslc o ejecuta: tools/shaders/compile_spirv.sh'; exit 1 }"
|
|
||||||
else
|
|
||||||
@if [ -f "$(SHADER_VERT_H)" ] && [ -f "$(SHADER_FRAG_H)" ]; then \
|
|
||||||
echo "⚠ glslc no encontrado - usando headers SPIR-V precompilados"; \
|
|
||||||
else \
|
|
||||||
echo "ERROR: glslc no encontrado y headers SPIR-V no existen."; \
|
|
||||||
echo " Instala glslc: sudo apt install glslang-tools"; \
|
|
||||||
echo " O ejecuta manualmente: tools/shaders/compile_spirv.sh"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# REGLAS PARA HERRAMIENTA DE EMPAQUETADO Y RESOURCES.PACK
|
# REGLAS PARA HERRAMIENTA DE EMPAQUETADO Y RESOURCES.PACK
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
$(PACK_TOOL): FORCE
|
pack_tool:
|
||||||
@echo "Compilando herramienta de empaquetado..."
|
@$(MAKE) -C $(DIR_PACK_TOOL)
|
||||||
$(PACK_CXX) -std=$(CPP_STANDARD) -Wall -Os $(PACK_INCLUDES) $(PACK_SOURCES) -o $(PACK_TOOL)
|
|
||||||
@echo "✓ Herramienta de empaquetado lista: $(PACK_TOOL)"
|
|
||||||
|
|
||||||
pack_tool: $(PACK_TOOL)
|
resources.pack: pack_tool
|
||||||
|
@$(MAKE) -C $(DIR_PACK_TOOL) pack
|
||||||
resources.pack: $(PACK_TOOL)
|
|
||||||
@echo "Generando resources.pack desde directorio data/..."
|
|
||||||
$(PACK_TOOL) data resources.pack
|
|
||||||
@echo "✓ resources.pack generado exitosamente"
|
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# COMPILACIÓN PARA WINDOWS
|
# COMPILACIÓN PARA WINDOWS (RELEASE)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
windows:
|
|
||||||
@echo off
|
|
||||||
@echo Generando version.h...
|
|
||||||
@powershell -Command "$$GIT_HASH = (git rev-parse --short=7 HEAD 2>$$null); if (-not $$GIT_HASH) { $$GIT_HASH = 'unknown' }; (Get-Content source/version.h.in) -replace '@GIT_HASH@', $$GIT_HASH | Set-Content source/version.h"
|
|
||||||
@echo Compilando para Windows con nombre: "$(WIN_TARGET_FILE).exe"
|
|
||||||
windres release/windows/jdd.rc -O coff -o $(RESOURCE_FILE)
|
|
||||||
g++ $(ALL_SOURCES) $(RESOURCE_FILE) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_TARGET_FILE).exe"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(WIN_TARGET_FILE).exe" --strip-unneeded
|
|
||||||
|
|
||||||
windows_release:
|
windows_release:
|
||||||
@"$(MAKE)" compile_shaders
|
|
||||||
@"$(MAKE)" resources.pack
|
|
||||||
@echo off
|
@echo off
|
||||||
@echo Creando release para Windows - Version: $(VERSION)
|
@echo Creando release para Windows - Version: $(VERSION)
|
||||||
|
|
||||||
# Generate version.h from version.h.in
|
# Compila con cmake (genera shaders, resources.pack y ejecutable)
|
||||||
@echo "Generando version.h..."
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
@powershell -Command "$$GIT_HASH = (git rev-parse --short=7 HEAD 2>$$null); if (-not $$GIT_HASH) { $$GIT_HASH = 'unknown' }; (Get-Content source/version.h.in) -replace '@GIT_HASH@', $$GIT_HASH | Set-Content source/version.h"
|
@cmake --build build
|
||||||
|
|
||||||
# Crea carpeta de distribución y carpeta temporal 'RELEASE_FOLDER'
|
# Crea carpeta de distribución y carpeta temporal 'RELEASE_FOLDER'
|
||||||
@powershell -Command "if (-not (Test-Path '$(DIST_DIR)')) {New-Item '$(DIST_DIR)' -ItemType Directory}"
|
@powershell -Command "if (-not (Test-Path '$(DIST_DIR)')) {New-Item '$(DIST_DIR)' -ItemType Directory}"
|
||||||
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
||||||
@powershell -Command "if (-not (Test-Path '$(RELEASE_FOLDER)')) {New-Item '$(RELEASE_FOLDER)' -ItemType Directory}"
|
@powershell -Command "if (-not (Test-Path '$(RELEASE_FOLDER)')) {New-Item '$(RELEASE_FOLDER)' -ItemType Directory}"
|
||||||
|
|
||||||
# Copia el archivo 'resources.pack'
|
# Copia ficheros
|
||||||
@powershell -Command "Copy-Item -Path 'resources.pack' -Destination '$(RELEASE_FOLDER)'"
|
@powershell -Command "Copy-Item -Path 'resources.pack' -Destination '$(RELEASE_FOLDER)'"
|
||||||
|
|
||||||
# Copia los ficheros que están en la raíz del proyecto
|
|
||||||
@powershell -Command "Copy-Item 'LICENSE' -Destination '$(RELEASE_FOLDER)'"
|
@powershell -Command "Copy-Item 'LICENSE' -Destination '$(RELEASE_FOLDER)'"
|
||||||
@powershell -Command "Copy-Item 'README.md' -Destination '$(RELEASE_FOLDER)'"
|
@powershell -Command "Copy-Item 'README.md' -Destination '$(RELEASE_FOLDER)'"
|
||||||
@powershell -Command "Copy-Item 'gamecontrollerdb.txt' -Destination '$(RELEASE_FOLDER)'"
|
@powershell -Command "Copy-Item 'gamecontrollerdb.txt' -Destination '$(RELEASE_FOLDER)'"
|
||||||
@powershell -Command "Copy-Item 'release\windows\dll\*.dll' -Destination '$(RELEASE_FOLDER)'"
|
@powershell -Command "Copy-Item 'release\windows\dll\*.dll' -Destination '$(RELEASE_FOLDER)'"
|
||||||
|
@powershell -Command "Copy-Item -Path '$(TARGET_FILE)' -Destination '\"$(WIN_RELEASE_FILE).exe\"'"
|
||||||
# Compila (con icono)
|
|
||||||
windres release/windows/jdd.rc -O coff -o $(RESOURCE_FILE)
|
|
||||||
g++ $(ALL_SOURCES) $(RESOURCE_FILE) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(WIN_RELEASE_FILE).exe"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(WIN_RELEASE_FILE).exe" --strip-unneeded
|
||||||
|
|
||||||
# Crea el fichero .zip
|
# Crea el fichero .zip
|
||||||
@@ -274,26 +160,17 @@ windows_release:
|
|||||||
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
@powershell -Command "if (Test-Path '$(RELEASE_FOLDER)') {Remove-Item '$(RELEASE_FOLDER)' -Recurse -Force}"
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# COMPILACIÓN PARA MACOS
|
# COMPILACIÓN PARA MACOS (RELEASE)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
macos:
|
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
@echo "Compilando para macOS: $(TARGET_NAME)"
|
|
||||||
$(MACOS_CXX) $(ALL_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
|
||||||
|
|
||||||
macos_release:
|
macos_release:
|
||||||
@$(MAKE) compile_shaders
|
|
||||||
@$(MAKE) resources.pack
|
|
||||||
@echo "Creando release para macOS - Version: $(VERSION)"
|
@echo "Creando release para macOS - Version: $(VERSION)"
|
||||||
|
|
||||||
# Verificar e instalar create-dmg si es necesario
|
# Verificar e instalar create-dmg si es necesario
|
||||||
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
|
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
|
||||||
|
|
||||||
# Generate version.h from version.h.in
|
# Compila la versión para procesadores Intel con cmake (genera shaders y resources.pack)
|
||||||
@echo "Generando version.h..."
|
@cmake -S . -B build-intel -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DMACOS_BUNDLE=ON
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
@cmake --build build-intel
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
|
|
||||||
# Elimina datos de compilaciones anteriores
|
# Elimina datos de compilaciones anteriores
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
@@ -322,8 +199,8 @@ macos_release:
|
|||||||
sed -i '' '/<key>CFBundleShortVersionString<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"; \
|
sed -i '' '/<key>CFBundleShortVersionString<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"; \
|
||||||
sed -i '' '/<key>CFBundleVersion<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"
|
sed -i '' '/<key>CFBundleVersion<\/key>/{n;s|<string>.*</string>|<string>'"$$RAW_VERSION"'</string>|;}' "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/Info.plist"
|
||||||
|
|
||||||
# Compila la versión para procesadores Intel
|
# Copia el ejecutable Intel al bundle
|
||||||
$(MACOS_CXX) $(ALL_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD -std=$(CPP_STANDARD) -Wall -Os -framework SDL3 -F release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64 -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15
|
cp "$(TARGET_FILE)" "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)"
|
||||||
|
|
||||||
# Firma la aplicación
|
# Firma la aplicación
|
||||||
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
||||||
@@ -345,8 +222,10 @@ macos_release:
|
|||||||
"$(RELEASE_FOLDER)" || true
|
"$(RELEASE_FOLDER)" || true
|
||||||
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
|
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
|
||||||
|
|
||||||
# Compila la versión para procesadores Apple Silicon
|
# Compila la versión para procesadores Apple Silicon con cmake
|
||||||
$(MACOS_CXX) $(ALL_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD -std=$(CPP_STANDARD) -Wall -Os -framework SDL3 -F release/macos/frameworks/SDL3.xcframework/macos-arm64_x86_64 -ffunction-sections -fdata-sections -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target arm64-apple-macos11
|
@cmake -S . -B build-arm -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DMACOS_BUNDLE=ON
|
||||||
|
@cmake --build build-arm
|
||||||
|
cp "$(TARGET_FILE)" "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)"
|
||||||
|
|
||||||
# Firma la aplicación
|
# Firma la aplicación
|
||||||
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
|
||||||
@@ -373,24 +252,14 @@ macos_release:
|
|||||||
$(RMFILE) "$(DIST_DIR)"/rw.*
|
$(RMFILE) "$(DIST_DIR)"/rw.*
|
||||||
|
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# COMPILACIÓN PARA LINUX
|
# COMPILACIÓN PARA LINUX (RELEASE)
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
linux:
|
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
@echo "Compilando para Linux: $(TARGET_NAME)"
|
|
||||||
g++ $(ALL_SOURCES) $(INCLUDES) $(CXXFLAGS) $(LDFLAGS) -o "$(TARGET_FILE)"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(TARGET_FILE)" --strip-unneeded
|
|
||||||
|
|
||||||
linux_release:
|
linux_release:
|
||||||
@$(MAKE) compile_shaders
|
|
||||||
@$(MAKE) resources.pack
|
|
||||||
@echo "Creando release para Linux - Version: $(VERSION)"
|
@echo "Creando release para Linux - Version: $(VERSION)"
|
||||||
|
|
||||||
# Generate version.h from version.h.in
|
# Compila con cmake (genera shaders, resources.pack y ejecutable)
|
||||||
@echo "Generando version.h..."
|
@cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
@GIT_HASH=$$(git rev-parse --short=7 HEAD 2>/dev/null || echo "unknown"); \
|
@cmake --build build
|
||||||
sed "s/@GIT_HASH@/$$GIT_HASH/g" source/version.h.in > source/version.h
|
|
||||||
|
|
||||||
# Elimina carpeta temporal previa y la recrea (crea dist/ si no existe)
|
# Elimina carpeta temporal previa y la recrea (crea dist/ si no existe)
|
||||||
$(RMDIR) "$(RELEASE_FOLDER)"
|
$(RMDIR) "$(RELEASE_FOLDER)"
|
||||||
@@ -401,9 +270,7 @@ linux_release:
|
|||||||
cp LICENSE "$(RELEASE_FOLDER)"
|
cp LICENSE "$(RELEASE_FOLDER)"
|
||||||
cp README.md "$(RELEASE_FOLDER)"
|
cp README.md "$(RELEASE_FOLDER)"
|
||||||
cp gamecontrollerdb.txt "$(RELEASE_FOLDER)"
|
cp gamecontrollerdb.txt "$(RELEASE_FOLDER)"
|
||||||
|
cp "$(TARGET_FILE)" "$(RELEASE_FILE)"
|
||||||
# Compila
|
|
||||||
g++ $(ALL_SOURCES) $(INCLUDES) -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FILE)"
|
|
||||||
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded
|
strip -s -R .comment -R .gnu.version "$(RELEASE_FILE)" --strip-unneeded
|
||||||
|
|
||||||
# Empaqueta ficheros
|
# Empaqueta ficheros
|
||||||
@@ -425,17 +292,24 @@ show_version:
|
|||||||
help:
|
help:
|
||||||
@echo "Makefile para JailDoctor's Dilemma"
|
@echo "Makefile para JailDoctor's Dilemma"
|
||||||
@echo "Comandos disponibles:"
|
@echo "Comandos disponibles:"
|
||||||
@echo " windows - Compilar para Windows"
|
@echo ""
|
||||||
@echo " windows_release - Crear release completo para Windows"
|
@echo " Compilacion:"
|
||||||
@echo " linux - Compilar para Linux"
|
@echo " make - Compilar con cmake (Release)"
|
||||||
@echo " linux_release - Crear release completo para Linux"
|
@echo " make debug - Compilar con cmake (Debug)"
|
||||||
@echo " macos - Compilar para macOS"
|
@echo ""
|
||||||
@echo " macos_release - Crear release completo para macOS"
|
@echo " Release:"
|
||||||
@echo " pack_tool - Compilar herramienta de empaquetado"
|
@echo " make release - Crear release (detecta SO automaticamente)"
|
||||||
@echo " resources.pack - Generar pack de recursos desde data/"
|
@echo " make windows_release - Crear release para Windows"
|
||||||
@echo " show_version - Mostrar version actual ($(VERSION))"
|
@echo " make linux_release - Crear release para Linux"
|
||||||
@echo " help - Mostrar esta ayuda"
|
@echo " make macos_release - Crear release para macOS"
|
||||||
|
@echo ""
|
||||||
|
@echo " Herramientas:"
|
||||||
|
@echo " make compile_shaders - Compilar shaders SPIR-V"
|
||||||
|
@echo " make pack_tool - Compilar herramienta de empaquetado"
|
||||||
|
@echo " make resources.pack - Generar pack de recursos desde data/"
|
||||||
|
@echo ""
|
||||||
|
@echo " Otros:"
|
||||||
|
@echo " make show_version - Mostrar version actual ($(VERSION))"
|
||||||
|
@echo " make help - Mostrar esta ayuda"
|
||||||
|
|
||||||
FORCE:
|
.PHONY: all debug release windows_release macos_release linux_release compile_shaders pack_tool resources.pack show_version help
|
||||||
|
|
||||||
.PHONY: windows windows_release macos macos_release linux linux_release compile_shaders pack_tool resources.pack show_version help
|
|
||||||
|
|||||||
Reference in New Issue
Block a user