Corregit resource_helper i millora DMG amb create-dmg

This commit is contained in:
2025-10-25 00:20:35 +02:00
parent 9d974438b3
commit 052bb063df
3 changed files with 37 additions and 48 deletions

View File

@@ -224,6 +224,10 @@ macos_release:
@$(MAKE) pack_tool
@$(MAKE) resources.pack
@echo "Creando release para macOS - Version: $(VERSION)"
# Verificar e instalar create-dmg si es necesario
@which create-dmg > /dev/null || (echo "Instalando create-dmg..." && brew install create-dmg)
# Elimina datos de compilaciones anteriores
$(RMDIR) "$(RELEASE_FOLDER)"
$(RMDIR) Frameworks
@@ -247,9 +251,6 @@ macos_release:
cp LICENSE "$(RELEASE_FOLDER)"
cp README.md "$(RELEASE_FOLDER)"
# Crea enlaces
ln -s /Applications "$(RELEASE_FOLDER)"/Applications
# Compila la versión para procesadores Intel
ifdef ENABLE_MACOS_X86_64
$(CXX) $(APP_SOURCES) $(INCLUDES) -DMACOS_BUNDLE -DRELEASE_BUILD $(CXXFLAGS) $(LDFLAGS) -o "$(RELEASE_FOLDER)/$(APP_NAME).app/Contents/MacOS/$(TARGET_NAME)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.15
@@ -257,27 +258,21 @@ ifdef ENABLE_MACOS_X86_64
# Firma la aplicación
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
# Empaqueta el .dmg de la versión Intel
@echo "Creando DMG con iconos de 96x96..."
hdiutil create tmp.dmg -ov -volname "$(APP_NAME)" -fs HFS+ -srcfolder "$(RELEASE_FOLDER)"
hdiutil attach tmp.dmg -mountpoint /Volumes/"$(APP_NAME)"
osascript -e 'tell application "Finder"' \
-e 'tell disk "$(APP_NAME)"' \
-e 'open' \
-e 'set current view of container window to icon view' \
-e 'set toolbar visible of container window to false' \
-e 'set statusbar visible of container window to false' \
-e 'set bounds of container window to {100, 100, 600, 400}' \
-e 'set icon size of icon view options of container window to 96' \
-e 'set arrangement of icon view options of container window to not arranged' \
-e 'update without registering applications' \
-e 'close' \
-e 'end tell' \
-e 'end tell'
sleep 2
hdiutil detach /Volumes/"$(APP_NAME)"
hdiutil convert tmp.dmg -format UDZO -o "$(MACOS_INTEL_RELEASE)"
$(RMFILE) tmp.dmg
# Empaqueta el .dmg de la versión Intel con create-dmg
@echo "Creando DMG Intel con iconos de 96x96..."
create-dmg \
--volname "$(APP_NAME)" \
--window-pos 200 120 \
--window-size 720 300 \
--icon-size 96 \
--text-size 12 \
--icon "$(APP_NAME).app" 278 102 \
--icon "LICENSE" 441 102 \
--icon "README.md" 604 102 \
--app-drop-link 115 102 \
--hide-extension "$(APP_NAME).app" \
"$(MACOS_INTEL_RELEASE)" \
"$(RELEASE_FOLDER)" || true
@echo "Release Intel creado: $(MACOS_INTEL_RELEASE)"
endif
@@ -287,27 +282,21 @@ endif
# Firma la aplicación
codesign --deep --force --sign - --timestamp=none "$(RELEASE_FOLDER)/$(APP_NAME).app"
# Empaqueta el .dmg de la versión Apple Silicon
@echo "Creando DMG con iconos de 96x96..."
hdiutil create tmp.dmg -ov -volname "$(APP_NAME)" -fs HFS+ -srcfolder "$(RELEASE_FOLDER)"
hdiutil attach tmp.dmg -mountpoint /Volumes/"$(APP_NAME)"
osascript -e 'tell application "Finder"' \
-e 'tell disk "$(APP_NAME)"' \
-e 'open' \
-e 'set current view of container window to icon view' \
-e 'set toolbar visible of container window to false' \
-e 'set statusbar visible of container window to false' \
-e 'set bounds of container window to {100, 100, 600, 400}' \
-e 'set icon size of icon view options of container window to 96' \
-e 'set arrangement of icon view options of container window to not arranged' \
-e 'update without registering applications' \
-e 'close' \
-e 'end tell' \
-e 'end tell'
sleep 2
hdiutil detach /Volumes/"$(APP_NAME)"
hdiutil convert tmp.dmg -format UDZO -o "$(MACOS_APPLE_SILICON_RELEASE)"
$(RMFILE) tmp.dmg
# Empaqueta el .dmg de la versión Apple Silicon con create-dmg
@echo "Creando DMG Apple Silicon con iconos de 96x96..."
create-dmg \
--volname "$(APP_NAME)" \
--window-pos 200 120 \
--window-size 720 300 \
--icon-size 96 \
--text-size 12 \
--icon "$(APP_NAME).app" 278 102 \
--icon "LICENSE" 441 102 \
--icon "README.md" 604 102 \
--app-drop-link 115 102 \
--hide-extension "$(APP_NAME).app" \
"$(MACOS_APPLE_SILICON_RELEASE)" \
"$(RELEASE_FOLDER)" || true
@echo "Release Apple Silicon creado: $(MACOS_APPLE_SILICON_RELEASE)"
# Elimina las carpetas temporales

View File

@@ -10,9 +10,9 @@
namespace ResourceHelper {
static bool resource_system_initialized = false;
auto initializeResourceSystem(const std::string& pack_file) -> bool {
auto initializeResourceSystem(const std::string& pack_file, bool enable_fallback) -> bool {
auto& loader = ResourceLoader::getInstance();
resource_system_initialized = loader.initialize(pack_file, true);
resource_system_initialized = loader.initialize(pack_file, enable_fallback);
if (resource_system_initialized) {
std::cout << "Resource system initialized with pack: " << pack_file << '\n';

View File

@@ -9,7 +9,7 @@
// Helper functions para integrar ResourceLoader con el sistema existente
namespace ResourceHelper {
// Inicializa ResourceLoader (llamar al inicio del programa)
auto initializeResourceSystem(const std::string& pack_file = "resources.pack") -> bool;
auto initializeResourceSystem(const std::string& pack_file = "resources.pack", bool enable_fallback = true) -> bool;
// Cierra ResourceLoader
void shutdownResourceSystem();