EasyRPG / liblcf

Library to handle RPG Maker 2000/2003 and EasyRPG projects
https://easyrpg.org
MIT License
113 stars 52 forks source link

Add CMakePresets.json file to make building liblcf easier #447

Closed Ghabry closed 1 year ago

Ghabry commented 1 year ago

Almost like the Player one but the script is a bit simplified (no libretro or liblcf) and Android was added. (Android makes no sense for Player as it requires Gradle)

Not tested yet ;)


$ cmake --list-presets 
Available configure presets:

  "debug"                              - Use system environment (Debug)
  "relwithdebinfo"                     - Use system environment (RelWithDebInfo)
  "release"                            - Use system environment (Release)
  "linux-debug"                        - Linux (Debug)
  "linux-relwithdebinfo"               - Linux (RelWithDebInfo)
  "linux-release"                      - Linux (Release)
  "windows-x86-debug"                  - Windows (x86) (Debug)
  "windows-x86-relwithdebinfo"         - Windows (x86) (RelWithDebInfo)
  "windows-x86-release"                - Windows (x86) (Release)
  "windows-x86-vs2022-debug"           - Windows (x86) using Visual Studio 2022 (Debug)
  "windows-x86-vs2022-relwithdebinfo"  - Windows (x86) using Visual Studio 2022 (RelWithDebInfo)
  "windows-x86-vs2022-release"         - Windows (x86) using Visual Studio 2022 (Release)
  "windows-x64-debug"                  - Windows (x64) (Debug)
  "windows-x64-relwithdebinfo"         - Windows (x64) (RelWithDebInfo)
  "windows-x64-release"                - Windows (x64) (Release)
  "windows-x64-vs2022-debug"           - Windows (x64) using Visual Studio 2022 (Debug)
  "windows-x64-vs2022-relwithdebinfo"  - Windows (x64) using Visual Studio 2022 (RelWithDebInfo)
  "windows-x64-vs2022-release"         - Windows (x64) using Visual Studio 2022 (Release)
  "macos-debug"                        - macOS (Debug)
  "macos-relwithdebinfo"               - macOS (RelWithDebInfo)
  "macos-release"                      - macOS (Release)
  "emscripten-debug"                   - Emscripten (Web) (Debug)
  "emscripten-relwithdebinfo"          - Emscripten (Web) (RelWithDebInfo)
  "emscripten-release"                 - Emscripten (Web) (Release)
  "3ds-debug"                          - Nintendo 3DS (Debug)
  "3ds-relwithdebinfo"                 - Nintendo 3DS (RelWithDebInfo)
  "3ds-release"                        - Nintendo 3DS (Release)
  "switch-debug"                       - Nintendo Switch (Debug)
  "switch-relwithdebinfo"              - Nintendo Switch (RelWithDebInfo)
  "switch-release"                     - Nintendo Switch (Release)
  "wii-debug"                          - Nintendo Wii (Debug)
  "wii-relwithdebinfo"                 - Nintendo Wii (RelWithDebInfo)
  "wii-release"                        - Nintendo Wii (Release)
  "psvita-debug"                       - PlayStation Vita (Debug)
  "psvita-relwithdebinfo"              - PlayStation Vita (RelWithDebInfo)
  "psvita-release"                     - PlayStation Vita (Release)
  "android-armeabi-v7a-debug"          - Android (armeabi-v7a) (Debug)
  "android-armeabi-v7a-relwithdebinfo" - Android (armeabi-v7a) (RelWithDebInfo)
  "android-armeabi-v7a-release"        - Android (armeabi-v7a) (Release)
  "android-arm64-v8a-debug"            - Android (arm64-v8a) (Debug)
  "android-arm64-v8a-relwithdebinfo"   - Android (arm64-v8a) (RelWithDebInfo)
  "android-arm64-v8a-release"          - Android (arm64-v8a) (Release)
  "android-x86-debug"                  - Android (x86) (Debug)
  "android-x86-relwithdebinfo"         - Android (x86) (RelWithDebInfo)
  "android-x86-release"                - Android (x86) (Release)
  "android-x86_64-debug"               - Android (x86_64) (Debug)
  "android-x86_64-relwithdebinfo"      - Android (x86_64) (RelWithDebInfo)
  "android-x86_64-release"             - Android (x86_64) (Release)
Ghabry commented 1 year ago

This is ready now. Compiled everything on Linux and macOS.

I disabled (hidden=true) the Windows presets for now because the CMake provided by VS2019 is too old and I won't install VS2022 before the next Player release. Consider this as "should work" but I can't really test this on Windows right now.

As this is mostly for prototyping it always builds the static library by default (can be overwritten) and disables the tools on selected platforms.


Testscript for Linux

#!/bin/bash
set -e

export EASYRPG_BUILDSCRIPTS=$PWD/easyrpg-buildscripts
cd easyrpg-liblcf

# Native
echo "=== Native ==="
cmake . -GNinja --preset debug
cmake --build --preset debug

# Linux
echo "=== Linux ==="
cmake . -GNinja --preset linux-debug
cmake --build --preset linux-debug

# Vita
echo "=== Vita ==="
cmake . -GNinja --preset psvita-debug
cmake --build --preset psvita-debug

# 3DS
echo "=== 3ds ==="
cmake . -GNinja --preset 3ds-debug
cmake --build --preset 3ds-debug

# Wii
echo "=== Wii ==="
cmake . -GNinja --preset wii-debug
cmake --build --preset wii-debug

# Switch
echo "=== Switch ==="
cmake . -GNinja --preset switch-debug
cmake --build --preset switch-debug

# emscripten
echo "=== Emscripten ==="
cmake . -GNinja --preset emscripten-debug
cmake --build --preset emscripten-debug

# Android
echo "=== Android v7a ==="
cmake . -GNinja --preset android-armeabi-v7a-debug
cmake --build --preset android-armeabi-v7a-debug

echo "=== Android v8a ==="
cmake . -GNinja --preset android-arm64-v8a-debug
cmake --build --preset android-arm64-v8a-debug

echo "=== Android x86 ==="
cmake . -GNinja --preset android-x86-debug
cmake --build --preset android-x86-debug

echo "=== Android x64 ==="
cmake . -GNinja --preset android-x86_64-debug
cmake --build --preset android-x86_64-debug

Test for macOS

export EASYRPG_BUILDSCRIPTS=$HOME/jenkins/workspace/macos-toolchain
cmake . -GNinja --preset macos-debug
cmake --build --preset macos-debug
Ghabry commented 1 year ago

The generator script is not needed downstream because the generated files are in the repo. The generated files are not code (no idea if a DSL/Domain specific language is code or content :thinking:). I will change the license, thanks for that info.