aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-10-31 15:18:26 +0100
committerspicyjpeg <88942473+spicyjpeg@users.noreply.github.com>2021-10-31 15:18:26 +0100
commit74388f8ff7df42bcdc8e113967a0d1c1902a9027 (patch)
tree2ccade54664b97f060f2a1fc93834ee469e1d648
parent8b09040cf56bf732eccfc8a4bb1193d9ef0b10ac (diff)
downloadpsn00bsdk-74388f8ff7df42bcdc8e113967a0d1c1902a9027.tar.gz
Added CMake presets, updated installation guide
-rw-r--r--CMakePresets.json29
-rw-r--r--INSTALL.md99
-rw-r--r--TOOLCHAIN.md5
-rw-r--r--changelog.txt8
4 files changed, 86 insertions, 55 deletions
diff --git a/CMakePresets.json b/CMakePresets.json
new file mode 100644
index 0000000..50cf671
--- /dev/null
+++ b/CMakePresets.json
@@ -0,0 +1,29 @@
+{
+ "version": 3,
+ "cmakeMinimumRequired": {
+ "major": 3,
+ "minor": 21,
+ "patch": 0
+ },
+ "configurePresets": [
+ {
+ "name": "default",
+ "displayName": "Default configuration",
+ "description": "Use this preset when building the SDK for local installation.",
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/build"
+ },
+ {
+ "name": "package",
+ "displayName": "Installer package",
+ "description": "Use this preset to build installer packages via CPack.",
+ "generator": "Ninja",
+ "binaryDir": "${sourceDir}/build",
+ "cacheVariables": {
+ "CMAKE_BUILD_TYPE": "Release",
+ "SKIP_EXAMPLES": "ON",
+ "BUNDLE_TOOLCHAIN": "ON"
+ }
+ }
+ ]
+}
diff --git a/INSTALL.md b/INSTALL.md
index 6fac934..8fa7889 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -4,35 +4,46 @@
## Building and installing
The instructions below are for Windows and Linux. Building on macOS hasn't been
-tested but should work.
+tested.
-1. Set up a host compiler. Most Linux distros provide a `build-essential`,
- `base-devel` or similar all-in-one package. You'll also need to install the
- [Ninja](https://ninja-build.org) build engine (it's usually in a package
- called `ninja-build`). On Windows install [MSys2](https://www.msys2.org),
- then run the following command in the MSys2 shell to install MinGW and Ninja:
+1. Install prerequisites and a host compiler toolchain. On Linux (most distros)
+ install the following packages from your distro's package manager:
+
+ - `git`
+ - `build-essential`, `base-devel` or similar
+ - `ninja-build`
+ - `cmake` (3.21+ is required, download it from
+ [here](https://cmake.org/download) if your package manager only provides
+ older versions)
+
+ On Windows install [MSys2](https://www.msys2.org), then open the "MSys2
+ MSYS" shell and run this command:
```bash
- pacman -Syu mingw-w64-x86_64-gcc mingw-w64-x86_64-ninja
+ pacman -Syu git mingw-w64-x86_64-ninja mingw-w64-x86_64-cmake mingw-w64-x86_64-g++
```
- Add `C:\msys64\mingw64\bin` (replace `C:\msys64` if you installed MSys2 to a
+ **NOTE**: if you are prompted to close the shell, you may have to reopen it
+ afterwards and rerun the command to finish installation.
+ **Do not use the MSys2 shell for the next steps**, use a regular command
+ prompt or PowerShell instead.
+
+ Add these directories (replace `C:\msys64` if you installed MSys2 to a
different location) to the `PATH` environment variable using System
- Properties.
+ Properties:
-2. Install Git and CMake. Note that MSys2 and some Linux distros ship relatively
- old versions (PSn00bSDK requires 3.21+), so grab the latest CMake release
- from [here](https://cmake.org) instead of through your package manager.
+ - `C:\msys64\mingw64\bin`
+ - `C:\msys64\usr\bin`
-3. Build and install a GCC toolchain for `mipsel-unknown-elf`, as detailed in
+2. Build and install a GCC toolchain for `mipsel-unknown-elf`, as detailed in
[TOOLCHAIN.md](TOOLCHAIN.md). On Windows, you may download a precompiled
version from [Lameguy64's website](http://lameguy64.net?page=psn00bsdk) and
extract it into one of the directories listed below instead.
-4. If you chose a non-standard install location for the toolchain, add the `bin`
- subfolder (inside the top-level toolchain directory) to the `PATH`
- environment variable. This step is unnecessary if you installed/extracted the
- toolchain into any of these directories:
+3. If you chose a non-standard install location for the toolchain, add the
+ `bin` subfolder (inside the top-level toolchain directory) to the `PATH`
+ environment variable. This step is unnecessary if you installed/extracted
+ the toolchain into any of these directories:
- `C:\Program Files\mipsel-unknown-elf`
- `C:\Program Files (x86)\mipsel-unknown-elf`
@@ -41,25 +52,26 @@ tested but should work.
- `/usr/mipsel-unknown-elf`
- `/opt/mipsel-unknown-elf`
-5. Clone/download the PSn00bSDK repo and run the following commands from its
- directory:
+4. Clone the PSn00bSDK repo, then run the following command from the PSn00bSDK
+ repository to download additional dependencies:
```bash
- cmake -S . -B ./build -G Ninja
+ git submodule update --init --recursive --remote
+ ```
+
+5. Compile the libraries, tools and examples using CMake:
+
+ ```bash
+ cmake --preset default .
cmake --build ./build
```
If you want to install the SDK to a custom location rather than the default
one (`C:\Program Files\PSn00bSDK` or `/usr/local` depending on your OS), add
- `--install-prefix <INSTALL_PATH>` to the first command. Remove `-G Ninja` to
- use `make` instead of Ninja (slower, not recommended).
-
- If you run into errors, try passing `-DSKIP_TINYXML2=ON` to the first command
- after installing `tinyxml2` manually. [See below](#advanced-build-options)
- for more details.
+ `--install-prefix <INSTALL_PATH>` to the first command.
-6. Install the SDK to the path you chose by running this command (add `sudo` if
- necessary):
+6. Install the SDK to the path you chose (add `sudo` or run it from a command
+ prompt with admin privileges if necessary):
```bash
cmake --install ./build
@@ -81,23 +93,7 @@ with debugging capabilities such as [no$psx](https://problemkaputt.de/psx.htm)
[pcsx-redux](https://github.com/grumpycoders/pcsx-redux).
**Avoid ePSXe and anything based on MAME** as they are inaccurate.
-## Advanced build options
-
-### Skipping external dependency downloads
-
-By default [mkpsxiso](https://github.com/Lameguy64/mkpsxiso) (required for
-building CD images) and [tinyxml2](https://github.com/leethomason/tinyxml2)
-(required to build mkpsxiso and other SDK tools) are automatically cloned from
-their respective repos and built as part of the PSn00bSDK build process,
-*even if they are already installed*.
-
-If you wish to disable this behavior (e.g. because it leads to errors, or to
-perform an offline build), invoke CMake with the `-DSKIP_MKPSXISO=ON` and/or
-`-DSKIP_TINYXML2=ON` options when configuring the SDK. Note that you must have
-`mkpsxiso` and/or `tinyxml2` already installed (either manually or via vcpkg or
-your distro's package manager) to be able to skip them.
-
-### Building installer packages
+## Building installer packages
CPack can be used to build NSIS-based installers, DEB/RPM packages and zipped
releases that include built SDK libraries, headers as well as the GCC toolchain.
@@ -111,18 +107,15 @@ far from being feature-complete.
2. Run the following commands from the PSn00bSDK directory:
```bash
- cmake -S . -B ./build -G Ninja -DBUNDLE_TOOLCHAIN=ON
+ cmake --preset package .
cmake --build ./build -t package
```
All built packages will be copied to the `build/packages` folder.
- **NOTE**: do not use `-DSKIP_MKPSXISO=ON`, otherwise the mkpsxiso binary will
- not be included in the packages.
-
## Creating a project
-1. Copy the contents of `INSTALL_PATH/share/psn00bsdk/template` (or the
+1. Copy the contents of `<INSTALL_PATH>/share/psn00bsdk/template` (or the
`template` folder within the repo) to your new project's root directory.
2. Configure and build the template by running:
@@ -138,11 +131,11 @@ far from being feature-complete.
Note that, even though the template relies on the `PSN00BSDK_LIBS` environment
variable to locate the SDK by default, you can also specify the path directly
on the CMake command line by adding
-`-DCMAKE_TOOLCHAIN_FILE=INSTALL_PATH/lib/libpsn00b/cmake/sdk.cmake` (replace
-`INSTALL_PATH`) to the first command.
+`-DCMAKE_TOOLCHAIN_FILE=<INSTALL_PATH>/lib/libpsn00b/cmake/sdk.cmake` to the
+CMake command line.
The toolchain script defines a few CMake macros to create PS1 executables, DLLs
and CD images. See the [reference](doc/cmake_reference.md) for details.
-----------------------------------------
-_Last updated on 2021-10-18 by spicyjpeg_
+_Last updated on 2021-10-31 by spicyjpeg_
diff --git a/TOOLCHAIN.md b/TOOLCHAIN.md
index 8ecee38..2a78ccb 100644
--- a/TOOLCHAIN.md
+++ b/TOOLCHAIN.md
@@ -25,7 +25,8 @@ the latest stable release of GCC and binutils. If for some reason you are having
problems you may try building one of the following versions, which have been
tested extensively:
-- GCC **7.4.0** with binutils **2.31**
+- ~~GCC 7.4.0 with binutils 2.31~~ (the linker fails to build PS1 DLLs)
+- GCC **11.1.0** with binutils **2.36**
- GCC **11.2.0** with binutils **2.37**
If you wish to pick an older GCC release but don't know which binutils version
@@ -220,4 +221,4 @@ implemented due to bloat concerns that it may introduce. Besides, the official
SDK lacks full C++ support as well.
-----------------------------------------
-_Last updated on 2021-10-18 by spicyjpeg_
+_Last updated on 2021-10-31 by spicyjpeg_
diff --git a/changelog.txt b/changelog.txt
index 3d7ee97..c9f8847 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -2,6 +2,14 @@ PSn00bSDK changelog
Items that are lower in the log are more recently implemented.
+10-26-2021 by spicyjpeg:
+
+* Added tinyxml2 and mkpsxiso as git submodules and removed the (admittedly
+ short-lived) SKIP_* options completely. CMake's ExternalProject is no longer
+ used to download dependencies at build time.
+
+* Added CMake presets file with presets for building installer packages.
+
10-17-2021 by spicyjpeg: