Add build scripts and Windows icon/resources
Added: - build_dev.bat / build_dev.sh - Development build scripts - build_release.bat / build_release.sh - Release build scripts with embedding - icon.ico - Default Windows icon for executable - resources.rc - Windows resource file for icon and exe metadata - BUILD_SCRIPTS.md - Complete documentation for build scripts Features: - Automated development builds (no embedding, fast iteration) - Automated release builds (with Lua and asset embedding) - Interactive verification and cleanup - Custom icon and version info in Windows executables - Cross-platform scripts (Windows .bat and Unix .sh) - Safety checks and helpful messages The build scripts provide one-command building for both development and release workflows, with clear instructions and progress feedback.
This commit is contained in:
213
BUILD_SCRIPTS.md
Normal file
213
BUILD_SCRIPTS.md
Normal file
@@ -0,0 +1,213 @@
|
|||||||
|
# Build Scripts Documentation
|
||||||
|
|
||||||
|
ReiLua includes automated build scripts for easy development and release builds.
|
||||||
|
|
||||||
|
## Available Scripts
|
||||||
|
|
||||||
|
### Development Build Scripts
|
||||||
|
- **Windows**: `build_dev.bat`
|
||||||
|
- **Linux/Unix**: `build_dev.sh`
|
||||||
|
|
||||||
|
### Release Build Scripts
|
||||||
|
- **Windows**: `build_release.bat`
|
||||||
|
- **Linux/Unix**: `build_release.sh`
|
||||||
|
|
||||||
|
## Development Build
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
Fast iteration during game development with external Lua files and assets.
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
**Windows:**
|
||||||
|
```cmd
|
||||||
|
build_dev.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
**Linux/Unix:**
|
||||||
|
```bash
|
||||||
|
chmod +x build_dev.sh
|
||||||
|
./build_dev.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- ✅ No embedding - loads Lua and assets from file system
|
||||||
|
- ✅ Fast build times
|
||||||
|
- ✅ Edit code and assets without rebuilding
|
||||||
|
- ✅ Automatic cleanup of embedded files
|
||||||
|
- ✅ Warns if Lua files or assets are in build directory
|
||||||
|
- ✅ Optional clean build: `build_dev.bat clean` or `./build_dev.sh clean`
|
||||||
|
|
||||||
|
### Output
|
||||||
|
- Development executable: `build/ReiLua.exe`
|
||||||
|
- Run your game: `cd your_game && path/to/build/ReiLua.exe`
|
||||||
|
- Debug mode: `path/to/build/ReiLua.exe --log`
|
||||||
|
|
||||||
|
## Release Build
|
||||||
|
|
||||||
|
### Purpose
|
||||||
|
Create a single-file executable for distribution with all code and assets embedded.
|
||||||
|
|
||||||
|
### Preparation
|
||||||
|
|
||||||
|
Before running the release build, prepare your files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd build
|
||||||
|
|
||||||
|
# Copy all Lua files
|
||||||
|
copy ..\your_game\*.lua .
|
||||||
|
# Or: cp ../your_game/*.lua .
|
||||||
|
|
||||||
|
# Copy assets
|
||||||
|
mkdir assets
|
||||||
|
copy ..\your_game\assets\* assets\
|
||||||
|
# Or: cp -r ../your_game/assets/* assets/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
**Windows:**
|
||||||
|
```cmd
|
||||||
|
build_release.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
**Linux/Unix:**
|
||||||
|
```bash
|
||||||
|
chmod +x build_release.sh
|
||||||
|
./build_release.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Features
|
||||||
|
- ✅ Embeds all Lua files from `build/` directory
|
||||||
|
- ✅ Embeds all assets from `build/assets/` folder
|
||||||
|
- ✅ Creates single-file executable
|
||||||
|
- ✅ Release optimization enabled
|
||||||
|
- ✅ Verifies Lua files and assets before building
|
||||||
|
- ✅ Shows summary of embedded files after build
|
||||||
|
- ✅ Interactive confirmation before building
|
||||||
|
|
||||||
|
### Output
|
||||||
|
- Release executable: `build/ReiLua.exe`
|
||||||
|
- Ready for distribution - no external dependencies
|
||||||
|
- Can be renamed to your game name
|
||||||
|
|
||||||
|
### Build Configuration
|
||||||
|
|
||||||
|
The release build automatically configures:
|
||||||
|
- `EMBED_MAIN=ON` - Embeds all Lua files
|
||||||
|
- `EMBED_ASSETS=ON` - Embeds all assets (if assets folder exists)
|
||||||
|
- `CMAKE_BUILD_TYPE=Release` - Optimized build
|
||||||
|
|
||||||
|
## Customizing Your Executable
|
||||||
|
|
||||||
|
### Adding Custom Icon
|
||||||
|
|
||||||
|
1. Replace `icon.ico` with your own icon file
|
||||||
|
2. Keep the same filename or update `resources.rc`
|
||||||
|
3. Rebuild
|
||||||
|
|
||||||
|
### Changing Executable Properties
|
||||||
|
|
||||||
|
Edit `resources.rc` to customize:
|
||||||
|
|
||||||
|
```rc
|
||||||
|
VALUE "CompanyName", "Your Studio Name"
|
||||||
|
VALUE "FileDescription", "Your Game Description"
|
||||||
|
VALUE "ProductName", "Your Game Name"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) Your Name, 2025"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Renaming the Executable
|
||||||
|
|
||||||
|
Edit `CMakeLists.txt`:
|
||||||
|
```cmake
|
||||||
|
project( YourGameName ) # Line 6
|
||||||
|
```
|
||||||
|
|
||||||
|
After building, the executable will be named `YourGameName.exe`.
|
||||||
|
|
||||||
|
## Workflow Examples
|
||||||
|
|
||||||
|
### Development Workflow
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Initial setup
|
||||||
|
build_dev.bat
|
||||||
|
|
||||||
|
# Edit your Lua files in your game directory
|
||||||
|
# ... make changes ...
|
||||||
|
|
||||||
|
# Just run - no rebuild needed!
|
||||||
|
cd your_game
|
||||||
|
path\to\build\ReiLua.exe
|
||||||
|
|
||||||
|
# If you modify C code, rebuild
|
||||||
|
build_dev.bat
|
||||||
|
```
|
||||||
|
|
||||||
|
### Release Workflow
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Prepare files
|
||||||
|
cd build
|
||||||
|
copy ..\your_game\*.lua .
|
||||||
|
mkdir assets
|
||||||
|
copy ..\your_game\assets\* assets\
|
||||||
|
|
||||||
|
# 2. Build release
|
||||||
|
cd ..
|
||||||
|
build_release.bat
|
||||||
|
|
||||||
|
# 3. Test
|
||||||
|
cd build
|
||||||
|
ReiLua.exe --log
|
||||||
|
|
||||||
|
# 4. Distribute
|
||||||
|
# Copy build\ReiLua.exe to your distribution folder
|
||||||
|
```
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
### "CMake configuration failed"
|
||||||
|
- Ensure CMake is installed and in PATH
|
||||||
|
- Ensure MinGW is installed and in PATH
|
||||||
|
- Check `CMakeLists.txt` exists in parent directory
|
||||||
|
|
||||||
|
### "No Lua files found"
|
||||||
|
- Copy your Lua files to `build/` directory before release build
|
||||||
|
- Ensure `main.lua` exists (required entry point)
|
||||||
|
|
||||||
|
### "Build failed"
|
||||||
|
- Check compiler errors in output
|
||||||
|
- Ensure all dependencies are installed
|
||||||
|
- Try clean build: `build_dev.bat clean`
|
||||||
|
|
||||||
|
### Development build embedding warning
|
||||||
|
- The dev build script warns if it finds Lua files or assets in build/
|
||||||
|
- These should be removed for development builds
|
||||||
|
- The script offers to remove them automatically
|
||||||
|
|
||||||
|
## Script Features
|
||||||
|
|
||||||
|
### Safety Features
|
||||||
|
- Checks for correct directory before running
|
||||||
|
- Validates required files exist
|
||||||
|
- Warns about potential issues
|
||||||
|
- Interactive confirmations for release builds
|
||||||
|
- Automatic cleanup of old embedded files
|
||||||
|
|
||||||
|
### User Friendly
|
||||||
|
- Clear progress messages
|
||||||
|
- Colored output (where supported)
|
||||||
|
- Helpful error messages
|
||||||
|
- Pause at end to review results
|
||||||
|
- Quick reference commands shown after build
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- Development builds are **much faster** than release builds
|
||||||
|
- Release builds may take longer due to embedding and optimization
|
||||||
|
- Always test your release build before distribution
|
||||||
|
- The scripts work on both Windows (CMD/PowerShell) and Unix shells
|
||||||
|
- On Unix, make scripts executable: `chmod +x build_*.sh`
|
||||||
@@ -62,6 +62,11 @@ set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DEMBED_FONT" )
|
|||||||
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
|
include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
|
||||||
include_directories( include )
|
include_directories( include )
|
||||||
|
|
||||||
|
# Add Windows resource file for icon and exe details
|
||||||
|
if( WIN32 )
|
||||||
|
list( APPEND SOURCES ${CMAKE_SOURCE_DIR}/resources.rc )
|
||||||
|
endif()
|
||||||
|
|
||||||
# Embed Lua files if EMBED_MAIN is ON
|
# Embed Lua files if EMBED_MAIN is ON
|
||||||
if( EMBED_MAIN )
|
if( EMBED_MAIN )
|
||||||
file( GLOB LUA_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.lua" )
|
file( GLOB LUA_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.lua" )
|
||||||
|
|||||||
100
build_dev.bat
Normal file
100
build_dev.bat
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
@echo off
|
||||||
|
REM ReiLua Development Build Script
|
||||||
|
REM Run this from w64devkit shell or CMD with MinGW in PATH
|
||||||
|
|
||||||
|
echo ================================
|
||||||
|
echo ReiLua - Development Build
|
||||||
|
echo ================================
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM Navigate to build directory
|
||||||
|
cd build
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Cannot access build directory
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Clean old embedded files (important for dev builds!)
|
||||||
|
echo Cleaning old embedded files...
|
||||||
|
del /Q embedded_main.h embedded_assets.h 2>nul
|
||||||
|
|
||||||
|
REM Warn about Lua files in build directory
|
||||||
|
dir /b *.lua >nul 2>&1
|
||||||
|
if not errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo WARNING: Found Lua files in build directory!
|
||||||
|
echo Development builds should load from file system, not embed.
|
||||||
|
echo.
|
||||||
|
dir /b *.lua
|
||||||
|
echo.
|
||||||
|
set /p REMOVE="Remove these files from build directory? (Y/n): "
|
||||||
|
if /i not "%REMOVE%"=="n" (
|
||||||
|
del /Q *.lua
|
||||||
|
echo Lua files removed.
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Warn about assets folder in build directory
|
||||||
|
if exist "assets" (
|
||||||
|
echo.
|
||||||
|
echo WARNING: Found assets folder in build directory!
|
||||||
|
echo Development builds should load from file system, not embed.
|
||||||
|
echo.
|
||||||
|
set /p REMOVE="Remove assets folder from build directory? (Y/n): "
|
||||||
|
if /i not "%REMOVE%"=="n" (
|
||||||
|
rmdir /S /Q assets
|
||||||
|
echo Assets folder removed.
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Clean old configuration if requested
|
||||||
|
if "%1"=="clean" (
|
||||||
|
echo Cleaning build directory...
|
||||||
|
del /Q CMakeCache.txt *.o *.a 2>nul
|
||||||
|
rmdir /S /Q CMakeFiles 2>nul
|
||||||
|
echo Clean complete!
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Configure with MinGW
|
||||||
|
echo Configuring CMake for development...
|
||||||
|
cmake -G "MinGW Makefiles" ..
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo ERROR: CMake configuration failed!
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Building ReiLua...
|
||||||
|
mingw32-make
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo ERROR: Build failed!
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ================================
|
||||||
|
echo Build Complete!
|
||||||
|
echo ================================
|
||||||
|
echo.
|
||||||
|
echo Development build created successfully!
|
||||||
|
echo.
|
||||||
|
echo To run your game:
|
||||||
|
echo cd \path\to\your\game
|
||||||
|
echo \path\to\ReiLua\build\ReiLua.exe
|
||||||
|
echo.
|
||||||
|
echo To run with console logging:
|
||||||
|
echo \path\to\ReiLua\build\ReiLua.exe --log
|
||||||
|
echo.
|
||||||
|
echo Features:
|
||||||
|
echo - Lua files load from file system
|
||||||
|
echo - Assets load from file system
|
||||||
|
echo - Fast iteration - edit and reload
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
96
build_dev.sh
Normal file
96
build_dev.sh
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ReiLua Development Build Script
|
||||||
|
# Run this from w64devkit shell
|
||||||
|
|
||||||
|
echo "================================"
|
||||||
|
echo "ReiLua - Development Build"
|
||||||
|
echo "================================"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Navigate to build directory
|
||||||
|
cd build || exit 1
|
||||||
|
|
||||||
|
# Clean old embedded files (important for dev builds!)
|
||||||
|
echo "Cleaning old embedded files..."
|
||||||
|
rm -f embedded_main.h embedded_assets.h
|
||||||
|
|
||||||
|
# Warn about Lua files in build directory
|
||||||
|
LUA_COUNT=$(ls *.lua 2>/dev/null | wc -l)
|
||||||
|
if [ "$LUA_COUNT" -gt 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "WARNING: Found Lua files in build directory!"
|
||||||
|
echo "Development builds should load from file system, not embed."
|
||||||
|
echo ""
|
||||||
|
ls -1 *.lua
|
||||||
|
echo ""
|
||||||
|
read -p "Remove these files from build directory? (Y/n): " -n 1 -r
|
||||||
|
echo ""
|
||||||
|
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
|
||||||
|
rm -f *.lua
|
||||||
|
echo "Lua files removed."
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Warn about assets folder in build directory
|
||||||
|
if [ -d "assets" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "WARNING: Found assets folder in build directory!"
|
||||||
|
echo "Development builds should load from file system, not embed."
|
||||||
|
echo ""
|
||||||
|
read -p "Remove assets folder from build directory? (Y/n): " -n 1 -r
|
||||||
|
echo ""
|
||||||
|
if [[ ! $REPLY =~ ^[Nn]$ ]]; then
|
||||||
|
rm -rf assets
|
||||||
|
echo "Assets folder removed."
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clean old configuration if requested
|
||||||
|
if [ "$1" == "clean" ]; then
|
||||||
|
echo "Cleaning build directory..."
|
||||||
|
rm -rf CMakeCache.txt CMakeFiles/ *.o *.a
|
||||||
|
echo "Clean complete!"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure with MinGW
|
||||||
|
echo "Configuring CMake for development..."
|
||||||
|
cmake -G "MinGW Makefiles" ..
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: CMake configuration failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "Building ReiLua..."
|
||||||
|
make
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: Build failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "================================"
|
||||||
|
echo "Build Complete!"
|
||||||
|
echo "================================"
|
||||||
|
echo ""
|
||||||
|
echo "Development build created successfully!"
|
||||||
|
echo ""
|
||||||
|
echo "To run your game:"
|
||||||
|
echo " cd /path/to/your/game"
|
||||||
|
echo " /path/to/ReiLua/build/ReiLua.exe"
|
||||||
|
echo ""
|
||||||
|
echo "To run with console logging:"
|
||||||
|
echo " /path/to/ReiLua/build/ReiLua.exe --log"
|
||||||
|
echo ""
|
||||||
|
echo "Features:"
|
||||||
|
echo " - Lua files load from file system"
|
||||||
|
echo " - Assets load from file system"
|
||||||
|
echo " - Fast iteration - edit and reload"
|
||||||
|
echo ""
|
||||||
144
build_release.bat
Normal file
144
build_release.bat
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
@echo off
|
||||||
|
REM ReiLua Release Build Script
|
||||||
|
REM Run this from w64devkit shell or CMD with MinGW in PATH
|
||||||
|
|
||||||
|
echo ================================
|
||||||
|
echo ReiLua - Release Build
|
||||||
|
echo ================================
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM Check if we're in the right directory
|
||||||
|
if not exist "CMakeLists.txt" (
|
||||||
|
echo ERROR: Please run this script from the ReiLua root directory
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Navigate to build directory
|
||||||
|
cd build
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo ERROR: Cannot access build directory
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Clean old embedded files
|
||||||
|
echo Cleaning old embedded files...
|
||||||
|
del /Q embedded_main.h embedded_assets.h 2>nul
|
||||||
|
|
||||||
|
REM Check for Lua files
|
||||||
|
echo.
|
||||||
|
echo Checking for Lua files...
|
||||||
|
dir /b *.lua >nul 2>&1
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo WARNING: No Lua files found in build directory!
|
||||||
|
echo.
|
||||||
|
echo Please copy your Lua files:
|
||||||
|
echo cd build
|
||||||
|
echo copy ..\your_game\*.lua .
|
||||||
|
echo.
|
||||||
|
set /p CONTINUE="Do you want to continue anyway? (y/N): "
|
||||||
|
if /i not "%CONTINUE%"=="y" exit /b 1
|
||||||
|
) else (
|
||||||
|
echo Found Lua files:
|
||||||
|
dir /b *.lua
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Check for assets folder
|
||||||
|
echo.
|
||||||
|
echo Checking for assets...
|
||||||
|
if not exist "assets" (
|
||||||
|
echo.
|
||||||
|
echo WARNING: No assets folder found!
|
||||||
|
echo.
|
||||||
|
echo To embed assets, create the folder and copy files:
|
||||||
|
echo cd build
|
||||||
|
echo mkdir assets
|
||||||
|
echo copy ..\your_game\assets\* assets\
|
||||||
|
echo.
|
||||||
|
set /p CONTINUE="Do you want to continue without assets? (y/N): "
|
||||||
|
if /i not "%CONTINUE%"=="y" exit /b 1
|
||||||
|
set EMBED_ASSETS=OFF
|
||||||
|
) else (
|
||||||
|
echo Found assets folder
|
||||||
|
set EMBED_ASSETS=ON
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ================================
|
||||||
|
echo Build Configuration
|
||||||
|
echo ================================
|
||||||
|
echo Lua Embedding: ON
|
||||||
|
echo Asset Embedding: %EMBED_ASSETS%
|
||||||
|
echo Build Type: Release
|
||||||
|
echo ================================
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
|
||||||
|
REM Clean CMake cache
|
||||||
|
echo.
|
||||||
|
echo Cleaning CMake cache...
|
||||||
|
del /Q CMakeCache.txt 2>nul
|
||||||
|
rmdir /S /Q CMakeFiles 2>nul
|
||||||
|
|
||||||
|
REM Configure with embedding enabled
|
||||||
|
echo.
|
||||||
|
echo Configuring CMake for release...
|
||||||
|
cmake -G "MinGW Makefiles" .. -DEMBED_MAIN=ON -DEMBED_ASSETS=%EMBED_ASSETS% -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo ERROR: CMake configuration failed!
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Build
|
||||||
|
echo.
|
||||||
|
echo Building ReiLua Release...
|
||||||
|
mingw32-make
|
||||||
|
|
||||||
|
if errorlevel 1 (
|
||||||
|
echo.
|
||||||
|
echo ERROR: Build failed!
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Show summary
|
||||||
|
echo.
|
||||||
|
echo ================================
|
||||||
|
echo Embedded Files Summary
|
||||||
|
echo ================================
|
||||||
|
|
||||||
|
if exist "embedded_main.h" (
|
||||||
|
echo.
|
||||||
|
echo Embedded Lua files:
|
||||||
|
findstr /C:"Embedded file:" embedded_main.h
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "embedded_assets.h" (
|
||||||
|
echo.
|
||||||
|
echo Embedded assets:
|
||||||
|
findstr /C:"Embedded asset:" embedded_assets.h
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ================================
|
||||||
|
echo Build Complete!
|
||||||
|
echo ================================
|
||||||
|
echo.
|
||||||
|
echo Executable: ReiLua.exe
|
||||||
|
echo Location: %CD%\ReiLua.exe
|
||||||
|
echo.
|
||||||
|
echo Your game is ready for distribution!
|
||||||
|
echo.
|
||||||
|
echo To test the release build:
|
||||||
|
echo ReiLua.exe --log (with console)
|
||||||
|
echo ReiLua.exe (production mode)
|
||||||
|
echo.
|
||||||
|
echo To distribute:
|
||||||
|
echo - Copy ReiLua.exe to your distribution folder
|
||||||
|
echo - Rename it to your game name (optional)
|
||||||
|
echo - That's it! Single file distribution!
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
150
build_release.sh
Normal file
150
build_release.sh
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# ReiLua Release Build Script
|
||||||
|
# Run this from w64devkit shell
|
||||||
|
|
||||||
|
echo "================================"
|
||||||
|
echo "ReiLua - Release Build"
|
||||||
|
echo "================================"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
# Check if we're in the right directory
|
||||||
|
if [ ! -f "CMakeLists.txt" ]; then
|
||||||
|
echo "ERROR: Please run this script from the ReiLua root directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Navigate to build directory
|
||||||
|
cd build || exit 1
|
||||||
|
|
||||||
|
# Clean old embedded files
|
||||||
|
echo "Cleaning old embedded files..."
|
||||||
|
rm -f embedded_main.h embedded_assets.h
|
||||||
|
|
||||||
|
# Check for Lua files
|
||||||
|
echo ""
|
||||||
|
echo "Checking for Lua files..."
|
||||||
|
LUA_FILES=$(ls *.lua 2>/dev/null | wc -l)
|
||||||
|
|
||||||
|
if [ "$LUA_FILES" -eq 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "WARNING: No Lua files found in build directory!"
|
||||||
|
echo ""
|
||||||
|
echo "Please copy your Lua files:"
|
||||||
|
echo " cd build"
|
||||||
|
echo " cp ../your_game/*.lua ."
|
||||||
|
echo ""
|
||||||
|
read -p "Do you want to continue anyway? (y/N): " -n 1 -r
|
||||||
|
echo ""
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Found $LUA_FILES Lua file(s):"
|
||||||
|
ls -1 *.lua
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check for assets folder
|
||||||
|
echo ""
|
||||||
|
echo "Checking for assets..."
|
||||||
|
if [ ! -d "assets" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "WARNING: No assets folder found!"
|
||||||
|
echo ""
|
||||||
|
echo "To embed assets, create the folder and copy files:"
|
||||||
|
echo " cd build"
|
||||||
|
echo " mkdir assets"
|
||||||
|
echo " cp ../your_game/assets/* assets/"
|
||||||
|
echo ""
|
||||||
|
read -p "Do you want to continue without assets? (y/N): " -n 1 -r
|
||||||
|
echo ""
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
EMBED_ASSETS="OFF"
|
||||||
|
else
|
||||||
|
ASSET_FILES=$(find assets -type f 2>/dev/null | wc -l)
|
||||||
|
echo "Found $ASSET_FILES asset file(s) in assets folder"
|
||||||
|
EMBED_ASSETS="ON"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "================================"
|
||||||
|
echo "Build Configuration"
|
||||||
|
echo "================================"
|
||||||
|
echo "Lua Embedding: ON"
|
||||||
|
echo "Asset Embedding: $EMBED_ASSETS"
|
||||||
|
echo "Build Type: Release"
|
||||||
|
echo "================================"
|
||||||
|
echo ""
|
||||||
|
read -p "Press Enter to continue or Ctrl+C to cancel..."
|
||||||
|
|
||||||
|
# Clean CMake cache to ensure fresh configuration
|
||||||
|
echo ""
|
||||||
|
echo "Cleaning CMake cache..."
|
||||||
|
rm -rf CMakeCache.txt CMakeFiles/
|
||||||
|
|
||||||
|
# Configure with embedding enabled
|
||||||
|
echo ""
|
||||||
|
echo "Configuring CMake for release..."
|
||||||
|
cmake -G "MinGW Makefiles" .. -DEMBED_MAIN=ON -DEMBED_ASSETS=$EMBED_ASSETS -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: CMake configuration failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Build
|
||||||
|
echo ""
|
||||||
|
echo "Building ReiLua Release..."
|
||||||
|
make
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "ERROR: Build failed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show embedded file info
|
||||||
|
echo ""
|
||||||
|
echo "================================"
|
||||||
|
echo "Embedded Files Summary"
|
||||||
|
echo "================================"
|
||||||
|
|
||||||
|
if [ -f "embedded_main.h" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "Embedded Lua files:"
|
||||||
|
grep 'Embedded file:' embedded_main.h | sed 's/.*Embedded file: / - /'
|
||||||
|
else
|
||||||
|
echo "No Lua files embedded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "embedded_assets.h" ]; then
|
||||||
|
echo ""
|
||||||
|
echo "Embedded assets:"
|
||||||
|
grep 'Embedded asset:' embedded_assets.h | sed 's/.*Embedded asset: / - /' | sed 's/ (.*//'
|
||||||
|
else
|
||||||
|
echo "No assets embedded"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get executable size
|
||||||
|
echo ""
|
||||||
|
echo "================================"
|
||||||
|
echo "Build Complete!"
|
||||||
|
echo "================================"
|
||||||
|
EXESIZE=$(du -h ReiLua.exe | cut -f1)
|
||||||
|
echo ""
|
||||||
|
echo "Executable: ReiLua.exe ($EXESIZE)"
|
||||||
|
echo "Location: $(pwd)/ReiLua.exe"
|
||||||
|
echo ""
|
||||||
|
echo "Your game is ready for distribution!"
|
||||||
|
echo ""
|
||||||
|
echo "To test the release build:"
|
||||||
|
echo " ./ReiLua.exe --log (with console)"
|
||||||
|
echo " ./ReiLua.exe (production mode)"
|
||||||
|
echo ""
|
||||||
|
echo "To distribute:"
|
||||||
|
echo " - Copy ReiLua.exe to your distribution folder"
|
||||||
|
echo " - Rename it to your game name (optional)"
|
||||||
|
echo " - That's it! Single file distribution!"
|
||||||
|
echo ""
|
||||||
30
resources.rc
Normal file
30
resources.rc
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
IDI_ICON1 ICON "icon.ico"
|
||||||
|
|
||||||
|
1 VERSIONINFO
|
||||||
|
FILEVERSION 1,0,0,0
|
||||||
|
PRODUCTVERSION 1,0,0,0
|
||||||
|
FILEFLAGSMASK 0x3fL
|
||||||
|
FILEFLAGS 0x0L
|
||||||
|
FILEOS 0x40004L
|
||||||
|
FILETYPE 0x1L
|
||||||
|
FILESUBTYPE 0x0L
|
||||||
|
BEGIN
|
||||||
|
BLOCK "StringFileInfo"
|
||||||
|
BEGIN
|
||||||
|
BLOCK "040904b0"
|
||||||
|
BEGIN
|
||||||
|
VALUE "CompanyName", "Reilua and Indrajith K L"
|
||||||
|
VALUE "FileDescription", "Made using ReiLua"
|
||||||
|
VALUE "FileVersion", "1.0.0.0"
|
||||||
|
VALUE "InternalName", "ReiLua"
|
||||||
|
VALUE "LegalCopyright", "Copyright (C) ReiLua and Indrajith K L, 2025"
|
||||||
|
VALUE "OriginalFilename", "ReiLua.exe"
|
||||||
|
VALUE "ProductName", "My Awesome Game"
|
||||||
|
VALUE "ProductVersion", "1.0.0.0"
|
||||||
|
END
|
||||||
|
END
|
||||||
|
BLOCK "VarFileInfo"
|
||||||
|
BEGIN
|
||||||
|
VALUE "Translation", 0x409, 1200
|
||||||
|
END
|
||||||
|
END
|
||||||
Reference in New Issue
Block a user