corregit makefile de windows
This commit is contained in:
13
.claude/settings.local.json
Normal file
13
.claude/settings.local.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"permissions": {
|
||||||
|
"allow": [
|
||||||
|
"Bash(dir \"C:\\mingw\\gitea\\orni_attack\\release\\dll\")",
|
||||||
|
"Bash(make:*)",
|
||||||
|
"Bash(echo:*)",
|
||||||
|
"Bash(objdump:*)",
|
||||||
|
"Bash(unzip:*)"
|
||||||
|
],
|
||||||
|
"deny": [],
|
||||||
|
"ask": []
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
# CMakeLists.txt
|
# CMakeLists.txt
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(orni VERSION 0.7.1)
|
project(diskito VERSION 0.7.1)
|
||||||
|
|
||||||
# Info del proyecto
|
# Info del proyecto
|
||||||
set(PROJECT_LONG_NAME "Orni Attack")
|
set(PROJECT_LONG_NAME "diskito")
|
||||||
set(PROJECT_COPYRIGHT_ORIGINAL "© 1999 Visente i Sergi")
|
set(PROJECT_COPYRIGHT_ORIGINAL "© 1999 Visente i Sergi")
|
||||||
set(PROJECT_COPYRIGHT_PORT "© 2025 JailDesigner")
|
set(PROJECT_COPYRIGHT_PORT "© 2025 JailDesigner")
|
||||||
set(PROJECT_COPYRIGHT "${PROJECT_COPYRIGHT_ORIGINAL}, ${PROJECT_COPYRIGHT_PORT}")
|
set(PROJECT_COPYRIGHT "${PROJECT_COPYRIGHT_ORIGINAL}, ${PROJECT_COPYRIGHT_PORT}")
|
||||||
@@ -84,6 +84,12 @@ endif()
|
|||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE WINDOWS_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE WINDOWS_BUILD)
|
||||||
target_link_libraries(${PROJECT_NAME} PRIVATE mingw32)
|
target_link_libraries(${PROJECT_NAME} PRIVATE mingw32)
|
||||||
|
# Static linking for libgcc and libstdc++ (avoid DLL dependencies for distribution)
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE
|
||||||
|
-static-libgcc
|
||||||
|
-static-libstdc++
|
||||||
|
-static
|
||||||
|
)
|
||||||
# Añadir icono en Windows (se configurará desde el Makefile con windres)
|
# Añadir icono en Windows (se configurará desde el Makefile con windres)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
target_compile_definitions(${PROJECT_NAME} PRIVATE MACOS_BUILD)
|
||||||
|
|||||||
80
Makefile
80
Makefile
@@ -9,8 +9,8 @@ DIR_BIN := $(DIR_ROOT)
|
|||||||
# TARGET NAMES
|
# TARGET NAMES
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
TARGET_NAME := $(shell powershell -Command "$$line = Get-Content CMakeLists.txt | Where-Object {$$_ -match '^project'}; if ($$line -match 'project\s*\x28(\w+)') { $$matches[1] }")
|
TARGET_NAME := $(shell powershell -Command "(Select-String -Path 'CMakeLists.txt' -Pattern 'project\s*\x28(\w+)').Matches.Groups[1].Value")
|
||||||
LONG_NAME := $(shell powershell -Command "$$line = Get-Content CMakeLists.txt | Where-Object {$$_ -match 'PROJECT_LONG_NAME'}; if ($$line -match '\"(.+)\"') { $$matches[1] }")
|
LONG_NAME := $(shell powershell -Command "(Select-String -Path 'CMakeLists.txt' -Pattern 'PROJECT_LONG_NAME\s+\x22(.+?)\x22').Matches.Groups[1].Value")
|
||||||
else
|
else
|
||||||
TARGET_NAME := $(shell awk '/^project/ {gsub(/[)(]/, " "); print $$2}' CMakeLists.txt)
|
TARGET_NAME := $(shell awk '/^project/ {gsub(/[)(]/, " "); print $$2}' CMakeLists.txt)
|
||||||
LONG_NAME := $(shell grep 'PROJECT_LONG_NAME' CMakeLists.txt | sed 's/.*"\(.*\)".*/\1/')
|
LONG_NAME := $(shell grep 'PROJECT_LONG_NAME' CMakeLists.txt | sed 's/.*"\(.*\)".*/\1/')
|
||||||
@@ -21,7 +21,11 @@ RELEASE_FOLDER := $(TARGET_NAME)_release
|
|||||||
RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
RELEASE_FILE := $(RELEASE_FOLDER)/$(TARGET_NAME)
|
||||||
|
|
||||||
# Release file names
|
# Release file names
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
RAW_VERSION := $(shell powershell -Command "\"$(VERSION)\" -replace '^v', ''")
|
||||||
|
else
|
||||||
RAW_VERSION := $(shell echo $(VERSION) | sed 's/^v//')
|
RAW_VERSION := $(shell echo $(VERSION) | sed 's/^v//')
|
||||||
|
endif
|
||||||
WINDOWS_RELEASE := $(TARGET_NAME)-$(VERSION)-windows-x64.zip
|
WINDOWS_RELEASE := $(TARGET_NAME)-$(VERSION)-windows-x64.zip
|
||||||
MACOS_ARM_RELEASE := $(TARGET_NAME)-$(VERSION)-macos-arm64.dmg
|
MACOS_ARM_RELEASE := $(TARGET_NAME)-$(VERSION)-macos-arm64.dmg
|
||||||
MACOS_INTEL_RELEASE := $(TARGET_NAME)-$(VERSION)-macos-x64.dmg
|
MACOS_INTEL_RELEASE := $(TARGET_NAME)-$(VERSION)-macos-x64.dmg
|
||||||
@@ -33,7 +37,7 @@ APP_NAME := $(LONG_NAME)
|
|||||||
# VERSION
|
# VERSION
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
ifeq ($(OS),Windows_NT)
|
ifeq ($(OS),Windows_NT)
|
||||||
VERSION := v$(shell powershell -Command "$$line = Get-Content CMakeLists.txt | Where-Object {$$_ -match '^project'}; if ($$line -match 'VERSION\s+([0-9.]+)') { $$matches[1] }")
|
VERSION := v$(shell powershell -Command "(Select-String -Path 'CMakeLists.txt' -Pattern 'project.*VERSION\s+([0-9.]+)').Matches.Groups[1].Value")
|
||||||
else
|
else
|
||||||
VERSION := v$(shell grep "^project" CMakeLists.txt | tr -cd 0-9.)
|
VERSION := v$(shell grep "^project" CMakeLists.txt | tr -cd 0-9.)
|
||||||
endif
|
endif
|
||||||
@@ -47,14 +51,16 @@ endif
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# PLATFORM-SPECIFIC UTILITIES
|
# PLATFORM-SPECIFIC UTILITIES
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
ifeq ($(OS),Windows_NT)
|
# Use Unix commands always (MinGW Make uses bash even on Windows)
|
||||||
RMFILE := del /Q
|
|
||||||
RMDIR := rmdir /S /Q
|
|
||||||
MKDIR := mkdir
|
|
||||||
else
|
|
||||||
RMFILE := rm -f
|
RMFILE := rm -f
|
||||||
RMDIR := rm -rf
|
RMDIR := rm -rf
|
||||||
MKDIR := mkdir -p
|
MKDIR := mkdir -p
|
||||||
|
|
||||||
|
ifeq ($(OS),Windows_NT)
|
||||||
|
# Windows-specific: Force cmd.exe shell for PowerShell commands
|
||||||
|
SHELL := cmd.exe
|
||||||
|
else
|
||||||
|
# Unix-specific
|
||||||
UNAME_S := $(shell uname -s)
|
UNAME_S := $(shell uname -s)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -71,7 +77,7 @@ PACK_TOOL := tools/pack_resources/pack_resources
|
|||||||
.PHONY: pack_tool resources.pack
|
.PHONY: pack_tool resources.pack
|
||||||
|
|
||||||
pack_tool:
|
pack_tool:
|
||||||
@$(MAKE) -C tools/pack_resources
|
@make -C tools/pack_resources
|
||||||
|
|
||||||
resources.pack: pack_tool
|
resources.pack: pack_tool
|
||||||
@echo "Creating resources.pack..."
|
@echo "Creating resources.pack..."
|
||||||
@@ -214,37 +220,25 @@ linux_release: pack_tool resources.pack
|
|||||||
|
|
||||||
# Windows Release (requires MinGW on Windows or cross-compiler on Linux)
|
# Windows Release (requires MinGW on Windows or cross-compiler on Linux)
|
||||||
.PHONY: windows_release
|
.PHONY: windows_release
|
||||||
windows_release:
|
windows_release: pack_tool resources.pack
|
||||||
@echo "Creating Windows release - Version: $(VERSION)"
|
@echo off
|
||||||
@echo "Note: This target should be run on Windows with MinGW or use windows_cross on Linux"
|
@echo Creating Windows release - Version: $(VERSION)
|
||||||
|
@powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
|
||||||
# Clean previous
|
@powershell if (Test-Path "$(WINDOWS_RELEASE)") {Remove-Item "$(WINDOWS_RELEASE)"}
|
||||||
@$(RMDIR) "$(RELEASE_FOLDER)"
|
@powershell if (-not (Test-Path "$(RELEASE_FOLDER)")) {New-Item "$(RELEASE_FOLDER)" -ItemType Directory}
|
||||||
@$(RMFILE) "$(WINDOWS_RELEASE)"
|
@powershell Copy-Item -Path "resources.pack" -Destination "$(RELEASE_FOLDER)"
|
||||||
|
@powershell Copy-Item "release\dll\SDL3.dll" -Destination "$(RELEASE_FOLDER)"
|
||||||
# Create folder
|
@powershell Copy-Item "release\dll\libwinpthread-1.dll" -Destination "$(RELEASE_FOLDER)"
|
||||||
@$(MKDIR) "$(RELEASE_FOLDER)"
|
@powershell if (Test-Path "LICENSE") {Copy-Item "LICENSE" -Destination "$(RELEASE_FOLDER)"}
|
||||||
|
@powershell if (Test-Path "README.md") {Copy-Item "README.md" -Destination "$(RELEASE_FOLDER)"}
|
||||||
# Copy resources
|
@windres release/$(TARGET_NAME).rc -O coff -o release/$(TARGET_NAME).res 2>nul || echo Warning: windres failed
|
||||||
@cp -r resources "$(RELEASE_FOLDER)/"
|
@cmake -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
|
||||||
@cp release/dll/*.dll "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: DLLs not found"
|
|
||||||
@cp LICENSE "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: LICENSE not found"
|
|
||||||
@cp README.md "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: README.md not found"
|
|
||||||
|
|
||||||
# Compile resource file
|
|
||||||
@windres release/$(TARGET_NAME).rc -O coff -o release/$(TARGET_NAME).res 2>/dev/null || echo "Warning: windres failed"
|
|
||||||
|
|
||||||
# Compile with CMake
|
|
||||||
@cmake -B build -DCMAKE_BUILD_TYPE=Release
|
|
||||||
@cmake --build build
|
@cmake --build build
|
||||||
@cp $(TARGET_FILE).exe "$(RELEASE_FILE).exe" || cp $(TARGET_FILE) "$(RELEASE_FILE).exe"
|
@powershell if (Test-Path "$(TARGET_FILE).exe") {Copy-Item "$(TARGET_FILE).exe" -Destination "$(RELEASE_FILE).exe"} else {Copy-Item "$(TARGET_FILE)" -Destination "$(RELEASE_FILE).exe"}
|
||||||
|
@strip "$(RELEASE_FILE).exe" 2>nul || echo Warning: strip not available
|
||||||
# Package
|
@powershell Compress-Archive -Path "$(RELEASE_FOLDER)\*" -DestinationPath "$(WINDOWS_RELEASE)" -Force
|
||||||
@cd "$(RELEASE_FOLDER)" && zip -r ../$(WINDOWS_RELEASE) *
|
@echo Release created: $(WINDOWS_RELEASE)
|
||||||
@echo "✓ Windows release created: $(WINDOWS_RELEASE)"
|
@powershell if (Test-Path "$(RELEASE_FOLDER)") {Remove-Item "$(RELEASE_FOLDER)" -Recurse -Force}
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
@$(RMDIR) "$(RELEASE_FOLDER)"
|
|
||||||
|
|
||||||
# Raspberry Pi Release (cross-compilation from Linux/macOS)
|
# Raspberry Pi Release (cross-compilation from Linux/macOS)
|
||||||
.PHONY: rpi_release
|
.PHONY: rpi_release
|
||||||
@@ -263,7 +257,7 @@ rpi_release:
|
|||||||
@$(MKDIR) "$(RELEASE_FOLDER)"
|
@$(MKDIR) "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
# Copy resources
|
# Copy resources
|
||||||
@cp -r resources "$(RELEASE_FOLDER)/"
|
@cp resources.pack "$(RELEASE_FOLDER)/"
|
||||||
@cp LICENSE "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: LICENSE not found"
|
@cp LICENSE "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: LICENSE not found"
|
||||||
@cp README.md "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: README.md not found"
|
@cp README.md "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: README.md not found"
|
||||||
|
|
||||||
@@ -299,8 +293,8 @@ windows_cross:
|
|||||||
@$(MKDIR) "$(RELEASE_FOLDER)"
|
@$(MKDIR) "$(RELEASE_FOLDER)"
|
||||||
|
|
||||||
# Copy resources
|
# Copy resources
|
||||||
@cp -r resources "$(RELEASE_FOLDER)/"
|
@cp resources.pack "$(RELEASE_FOLDER)/"
|
||||||
@cp release/dll/*.dll "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: DLLs not found in release/dll/"
|
@cp release/dll/SDL3.dll release/dll/libwinpthread-1.dll "$(RELEASE_FOLDER)/"
|
||||||
@cp LICENSE "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: LICENSE not found"
|
@cp LICENSE "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: LICENSE not found"
|
||||||
@cp README.md "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: README.md not found"
|
@cp README.md "$(RELEASE_FOLDER)/" 2>/dev/null || echo "Warning: README.md not found"
|
||||||
|
|
||||||
@@ -336,7 +330,7 @@ else
|
|||||||
@$(RMDIR) build $(RELEASE_FOLDER)
|
@$(RMDIR) build $(RELEASE_FOLDER)
|
||||||
@$(RMFILE) *.dmg *.zip *.tar.gz 2>/dev/null || true
|
@$(RMFILE) *.dmg *.zip *.tar.gz 2>/dev/null || true
|
||||||
@$(RMFILE) resources.pack 2>/dev/null || true
|
@$(RMFILE) resources.pack 2>/dev/null || true
|
||||||
@$(MAKE) -C tools/pack_resources clean 2>/dev/null || true
|
@make -C tools/pack_resources clean 2>/dev/null || true
|
||||||
endif
|
endif
|
||||||
@echo "Clean complete"
|
@echo "Clean complete"
|
||||||
|
|
||||||
|
|||||||
BIN
release/orni.res
Normal file
BIN
release/orni.res
Normal file
Binary file not shown.
Reference in New Issue
Block a user