diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-06-19 03:09:28 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2022-06-19 03:09:28 +0200 |
| commit | 7c1795401be49831b6601ad31632ffe55c29c8f7 (patch) | |
| tree | a75d04fb10f46471790e96413394202bea9fa01a | |
| parent | 3cb276b19fa21699aa7241956f5b11d1d5b24fe3 (diff) | |
| download | rts-7c1795401be49831b6601ad31632ffe55c29c8f7.tar.gz | |
Deprecate <TARGET>_BUILD in favor of CMAKE_TOOLCHAIN_FILE
| -rw-r--r-- | CMakeLists.txt | 25 | ||||
| -rw-r--r-- | README.md | 30 |
2 files changed, 32 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e96f88..1c09380 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,5 @@ cmake_minimum_required(VERSION 3.13) -option(PS1_BUILD "Build for the original Sony Playstation" OFF) -option(HOST_BUILD "Build for host platform using SDL-1.2" OFF) -option(WIN9X_BUILD "Build for Win9x using SDL-1.2" OFF) - -if(NOT PS1_BUILD AND NOT HOST_BUILD AND NOT WIN9X_BUILD) - message(STATUS "Assuming native build. " -"Please use one of the available options in CMakeLists.txt to " -"cross-compile for a specific target.") - set(HOST_BUILD ON) -endif() - -if(PS1_BUILD) - include("cmake/ps1-toolchain.cmake") -elseif(WIN9X_BUILD) - include("cmake/win9x-toolchain.cmake") -endif() - set(TOOLS_PREFIX ${CMAKE_BINARY_DIR}/tools) include(ExternalProject) ExternalProject_Add(tools @@ -26,6 +9,14 @@ ExternalProject_Add(tools project(rts) +if(CMAKE_TOOLCHAIN_FILE MATCHES "ps1") + set(PS1_BUILD 1) +elseif(CMAKE_TOOLCHAIN_FILE MATCHES "win9x") + set(WIN9X_BUILD 1) +else() + set(HOST_BUILD 1) +endif() + add_executable(${PROJECT_NAME} "src/main.c") set(cdroot ${CMAKE_BINARY_DIR}/cdimg) # Avoid C11 since it is not supported by the i386-mingw32 toolchain. @@ -34,6 +34,8 @@ hardware. ## Building from source +### Native build + A native version of **RTS** can be built using the typical CMake build process: @@ -41,21 +43,25 @@ process: mkdir build cd build cmake .. +make -j$(nproc --all) ``` -The following options can be otherwise defined: +### Cross-compilation + +[`CMAKE_TOOLCHAIN_FILE`](https://cmake.org/cmake/help/latest/variable/CMAKE_TOOLCHAIN_FILE.html) +can be used to set up the cross-toolchain. Files labeled as +`cmake/*-toolchain.cmake` can be used as values. -- `PS1_BUILD`: builds for Sony Playstation 1 -- `HOST_BUILD`: builds for the host operating system using SDL-1.2 -- `WIN9X_BUILD`: builds for Microsoft Win9x operating systems using -SDL-1.2. A `i386-mingw32` cross-toolchain must be available. +#### Sony PlayStation 1 For example, the Sony PlayStation 1 version can be built using: ```sh mkdir build cd build -cmake .. -DPS1_BUILD=1 -DVIDEO_MODE=VMODE_PAL +cmake .. \ + -DCMAKE_TOOLCHAIN_FILE=../cmake/ps1-toolchain.cmake \ + -DVIDEO_MODE=VMODE_PAL # VMODE_NTSC can be otherwise used make -j$(nproc --all) ``` @@ -63,6 +69,18 @@ This will generate a `.bin`/`.cue` file pair in `build` that can be played on an emulator or burnt into a CD-r in order to play the game on real hardware. +#### Microsoft Win9x + +```sh +mkdir build +cd build +cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/win9x-toolchain.cmake +make -j$(nproc --all) +``` + +A stripped version of the executable, as well as game assets, will be +located in `build/cdimg`. + ## License Unless stated otherwise, **RTS** follows the license described by the |
