Skip to content

Commit

Permalink
Add build instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
edo9300 committed Sep 8, 2024
1 parent 85d173c commit e2d9258
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 11 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,40 @@ A bleeding-edge fork of [YGOPro core](https://github.com/Fluorohydride/ygopro) w

This is the core logic and lua script processor of YGOPro. It maintains a state engine with an exposed API for Lua scripts. This library can be built independently of YGOPro clients and power server technologies.

## Compiling
See the [main EDOPro wiki](https://github.com/edo9300/ygopro/wiki/) for details.
## Building
A C++17 compliant compiler is needed (Visual Studio 2017, GCC 7, Clang 5.0.0 or any newer version)
The project uses the lua library, compiled from source alongside the main project
and the premake5 build system.

### Visual Studio
Double click the file `configure.bat`
in the scripts folder, select your installed Visual Studio version and it will download the needed resources
and generate the Visual Studio solution, which can then be found in `build/ocgcore.sln`.

Pick the appropriate configuration and architecture and build the solution.
The `ocgcore` solution to build a static library, the `ocgcoreshared` solution to build a dynamic library.

### POSIX (including mingw)
You'll need to have premake5 installed.
To manually download premake on your system, run
```
./scripts/install-premake5.sh linux|windows|macosx #pass the right system according to yours
```
To download and set up lua, run
```
./scripts/install-lua.sh
```
Then to configure run
```
premake5 gmake2
```
To build run
```
make -Cbuild TARGET config=CONFIG
```
`TARGET` can either be `ocgcore` to build a static library or `ocgcoreshared` to build a dynamic library.

`CONFIG` can either be `debug` or `release`, on mingw the values can be instead `debug_win32`, `debug_x64`, `release_win32`, `release_x64`

## License

Expand Down
4 changes: 2 additions & 2 deletions scripts/install-lua.bat
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ CD %~dp0..

MKDIR tmp

IF EXIST %LUA_ZIP% DEL /f /q %LUA_ZIP%
IF EXIST %LUA_ZIP% EXIT /B 1
IF EXIST "lua\src" RMDIR /s /q "lua\src"
IF EXIST "lua\src" EXIT /B 1
IF EXIST %LUA_ZIP% GOTO EXTRACT

CALL "%~DP0cmd\download.bat" ^
https://github.com/lua/lua/archive/refs/tags/v%LUA_VERSION%.zip %LUA_ZIP%
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%

:EXTRACT
CALL "%~DP0cmd/unzip.bat" %LUA_ZIP% lua
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
REN "lua/lua-%LUA_VERSION%" src
Expand Down
8 changes: 5 additions & 3 deletions scripts/install-lua.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ LUA_ARCHIVE=tmp/lua-$LUA_VERSION.tar.gz
cd "$(dirname "$0")/.."

mkdir -p tmp

rm -rf $LUA_ARCHIVE
curl --retry 2 --connect-timeout 30 --location https://github.com/lua/lua/archive/refs/tags/v$LUA_VERSION.tar.gz -o $LUA_ARCHIVE
rm -rf lua/src

if [ ! -f $LUA_ARCHIVE ]; then
curl --retry 2 --connect-timeout 30 --location https://github.com/lua/lua/archive/refs/tags/v$LUA_VERSION.tar.gz -o $LUA_ARCHIVE
fi

mkdir -p lua/src
tar xf $LUA_ARCHIVE --strip-components=1 -C lua/src
cd lua
Expand Down
3 changes: 3 additions & 0 deletions scripts/install-premake5.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ MKDIR tmp
IF EXIST %PREMAKE_EXTRACT_DIR% RMDIR /s /q %PREMAKE_EXTRACT_DIR%
IF EXIST %PREMAKE_EXTRACT_DIR% EXIT /B 1

IF EXIST %PREMAKE_ZIP% GOTO EXTRACT

CALL "%~DP0cmd\download.bat" ^
https://github.com/premake/premake-core/releases/download/v%PREMAKE_VERSION%/premake-%PREMAKE_VERSION%-windows.zip %PREMAKE_ZIP%
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%

:EXTRACT
CALL "%~DP0cmd\unzip.bat" %PREMAKE_ZIP% %PREMAKE_EXTRACT_DIR%
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%

Expand Down
9 changes: 5 additions & 4 deletions scripts/install-premake5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PREMAKE_VERSION=5.0.0-beta2
cd "$(dirname "$0")/.."

mkdir -p tmp
rm -rf tmp/premake

if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
PREMAKE_ARCHIVE=premake-$PREMAKE_VERSION-windows.zip
Expand All @@ -21,11 +22,11 @@ fi

PREMAKE_ARCHIVE_LOCATION=tmp/"$PREMAKE_ARCHIVE"

rm -rf $PREMAKE_ARCHIVE_LOCATION
curl --retry 5 --connect-timeout 30 --location --remote-header-name \
https://github.com/premake/premake-core/releases/download/v$PREMAKE_VERSION/$PREMAKE_ARCHIVE -o "$PREMAKE_ARCHIVE_LOCATION"
if [ ! -f $PREMAKE_ARCHIVE_LOCATION ]; then
curl --retry 5 --connect-timeout 30 --location --remote-header-name \
https://github.com/premake/premake-core/releases/download/v$PREMAKE_VERSION/$PREMAKE_ARCHIVE -o "$PREMAKE_ARCHIVE_LOCATION"
fi

rm -rf tmp/premake
mkdir tmp/premake
if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
unzip -uo "$PREMAKE_ARCHIVE_LOCATION" -d tmp/premake
Expand Down

0 comments on commit e2d9258

Please sign in to comment.