2022-04-24 11:00:14 -04:00
# Building Ship of Harkinian
2022-05-11 13:18:24 -04:00
## Windows
2022-08-08 20:04:55 -04:00
Requires:
* At least 8GB of RAM (machines with 4GB have seen complier failures)
* Visual Studio 2022 Community Edition with the C++ feature set
* One of the Windows SDKs that comes with Visual Studio, for example the current Windows 10 version 10.0.19041.0
* The `MSVC v142 - VS 2019 C++ build tools` component of Visual Studio
* Python 3 (can be installed manually or as part of Visual Studio)
* Git (can be installed manually or as part of Visual Studio)
* Cmake (can be installed via chocolatey or manually)
During installation, check the "Desktop development with C++" feature set:
![image ](https://user-images.githubusercontent.com/30329717/183511274-d11aceea-7900-46ec-acb6-3f2cc110021a.png )
Doing so should also check one of the Windows SDKs by default. Then, in the installation details in the right-hand column, make sure you also check the v142 toolset.
You can also find the v142 toolset by searching through the individual components tab:
![image ](https://user-images.githubusercontent.com/30329717/183521169-ead6a73b-a1bf-4e99-aab8-441746d8f08e.png )
While you're there, you can also install Python 3 and Git if needed.
1. Clone the Ship of Harkinian repository
2023-01-20 22:06:14 -05:00
_Note: Be sure to either clone with the ``--recursive`` flag or do ``git submodule init`` after cloning to pull in the libultraship submodule!_
2022-08-08 20:04:55 -04:00
2. Place one or more [compatible ](#compatible-roms ) roms in the `OTRExporter` directory with namings of your choice
2022-08-05 01:59:19 -04:00
_Note: Instructions assume using powershell_
```powershell
# Navigate to the Shipwright repo within powershell. ie: cd "C:\yourpath\Shipwright"
cd Shipwright
# Setup cmake project
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
2022-09-20 23:23:47 -04:00
# or for VS2019
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64
2022-08-05 01:59:19 -04:00
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # --config Release (if you're packaging)
# Compile project
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 # --config Release (if you're packaging)
# Now you can run the executable in .\build\x64
# If you need to clean the project you can run
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target clean
2023-04-14 09:54:56 -04:00
# If you need to regenerate the asset headers to check them into source
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssetHeaders
2023-10-09 11:28:22 -04:00
# If you need a newer soh.otr only
& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target GenerateSohOtr
2022-08-05 01:59:19 -04:00
```
### Developing SoH
With the cmake build system you have two options for working on the project:
#### Visual Studio
To develop using Visual Studio you only need to use cmake to generate the solution file:
```powershell
2022-08-08 21:01:46 -04:00
# Generates Ship.sln at `build/x64` for Visual Studio 2022
2022-08-05 11:49:38 -04:00
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64
2022-08-08 21:01:46 -04:00
# or for Visual Studio 2019
& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64
2022-08-05 01:59:19 -04:00
```
#### Visual Studio Code or another editor
To develop using Visual Studio Code or another editor you only need to open the repository in it.
To build you'll need to follow the instructions from the building section.
_Note: If you're using Visual Studio Code, the [cpack plugin ](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools ) makes it very easy to just press run and debug._
2022-08-21 22:14:05 -04:00
_Experimental: You can also use another build system entirely rather than MSVC like [Ninja ](https://ninja-build.org/ ) for possibly better performance._
2022-08-05 01:59:19 -04:00
### Generating the distributable
After compiling the project you can generate the distributable by running:
```powershell
# Go to build folder
cd "build/x64"
# Generate
& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP
```
2022-04-24 11:00:14 -04:00
2022-05-11 13:18:24 -04:00
## Linux
2024-02-15 21:13:49 -05:00
### Install dependencies
#### Debian/Ubuntu
```sh
# using gcc
2024-03-02 20:51:32 -05:00
apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool libboost-dev libopengl-dev
2024-02-15 21:13:49 -05:00
# or using clang
2024-03-02 20:51:32 -05:00
apt-get install clang git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool libboost-dev libopengl-dev
2024-02-15 21:13:49 -05:00
```
#### Arch
```sh
# using gcc
2024-03-02 20:51:32 -05:00
pacman -S gcc git cmake ninja lsb-release sdl2 libpng libzip sdl2_net boost
2022-08-05 01:59:19 -04:00
2024-02-15 21:13:49 -05:00
# or using clang
2024-03-02 20:51:32 -05:00
pacman -S clang git cmake ninja lsb-release sdl2 libpng libzip sdl2_net boost
2024-02-15 21:13:49 -05:00
```
#### Fedora
```sh
# using gcc
2024-03-02 20:51:32 -05:00
dnf install gcc gcc-c++ git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools boost-devel
2022-08-05 01:59:19 -04:00
2024-02-15 21:13:49 -05:00
# or using clang
2024-03-02 20:51:32 -05:00
dnf install clang git cmake ninja-build lsb_release SDL2-devel libpng-devel libzip-devel libzip-tools boost-devel
2024-02-15 21:13:49 -05:00
```
#### openSUSE
```sh
# using gcc
2024-03-02 20:51:32 -05:00
zypper in gcc gcc-c++ git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools
2024-02-15 21:13:49 -05:00
# or using clang
2024-03-02 20:51:32 -05:00
zypper in clang libstdc++-devel git cmake ninja SDL2-devel libpng16-devel libzip-devel libzip-tools
2024-02-15 21:13:49 -05:00
```
### Build
_Note: If you're using Visual Studio Code, the [CMake Tools plugin ](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools ) makes it very easy to just press run and debug._
2022-05-11 13:18:24 -04:00
```bash
2024-04-03 22:17:32 -04:00
# Clone the repo and enter the directory
2022-06-06 19:23:29 -04:00
git clone https://github.com/HarbourMasters/Shipwright.git
2022-07-08 17:39:21 -04:00
cd Shipwright
2024-04-03 22:17:32 -04:00
2024-02-15 21:13:49 -05:00
# Clone the submodules
2022-11-28 19:04:24 -05:00
git submodule update --init
2024-04-03 22:17:32 -04:00
2022-08-05 01:59:19 -04:00
# Generate Ninja project
2023-02-28 21:10:19 -05:00
cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging) -DPython3_EXECUTABLE=$(which python3) (if you are using non-standard Python installations such as PyEnv)
2024-04-03 22:17:32 -04:00
# Generate soh.otr
cmake --build build-cmake --target GenerateSohOtr
2022-08-05 01:59:19 -04:00
# Compile the project
cmake --build build-cmake # --config Release (if you're packaging)
# Now you can run the executable in ./build-cmake/soh/soh.elf
# To develop the project open the repository in VSCode (or your preferred editor)
2022-05-11 13:18:24 -04:00
```
2022-08-05 01:59:19 -04:00
2024-04-03 22:17:32 -04:00
### Generate a distributable
2022-08-05 01:59:19 -04:00
After compiling the project you can generate a distributable by running of the following:
2022-05-11 13:18:24 -04:00
```bash
2022-08-05 01:59:19 -04:00
# Go to build folder
cd build-cmake
# Generate
cpack -G DEB
cpack -G ZIP
cpack -G External (creates appimage)
2022-05-11 13:18:24 -04:00
```
2024-04-03 22:17:32 -04:00
### Additional CMake Targets
#### Clean
```bash
# If you need to clean the project you can run
cmake --build build-cmake --target clean
```
#### Regenerate Asset Headers
```bash
# If you need to regenerate the asset headers to check them into source
cp < path to your ROM > OTRExporter
cmake --build build-cmake --target ExtractAssetHeaders
```
2022-06-22 14:59:21 -04:00
## macOS
2022-08-08 20:04:55 -04:00
Requires Xcode (or xcode-tools) && `sdl2, libpng, glew, ninja, cmake` (can be installed via homebrew, macports, etc)
2022-08-05 01:59:19 -04:00
**Important: For maximum performance make sure you have ninja build tools installed!**
_Note: If you're using Visual Studio Code, the [cpack plugin ](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools ) makes it very easy to just press run and debug._
2022-06-22 14:59:21 -04:00
```bash
# Clone the repo
git clone https://github.com/HarbourMasters/Shipwright.git
cd ShipWright
2022-11-28 19:04:24 -05:00
# Clone the submodule libultraship
git submodule update --init
2022-06-22 14:59:21 -04:00
# Copy the baserom to the OTRExporter folder
cp < path to your ROM > OTRExporter
2022-08-05 01:59:19 -04:00
# Generate Ninja project
cmake -H. -Bbuild-cmake -GNinja # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Compile the project
cmake --build build-cmake # --config Release (if you're packaging)
2022-08-14 23:21:16 -04:00
# Copy oot.otr into the Application Support directory
cp build-cmake/soh/oot.otr ~/Library/Application\ Support/com.shipofharkinian.soh/
# Now you can run the executable file:
./build-cmake/soh/soh-macos
2022-08-05 01:59:19 -04:00
# To develop the project open the repository in VSCode (or your preferred editor)
# If you need to clean the project you can run
cmake --build build-cmake --target clean
2023-04-14 09:54:56 -04:00
# If you need to regenerate the asset headers to check them into source
cmake --build build-cmake --target ExtractAssetHeaders
2023-10-09 11:28:22 -04:00
# If you need a newer soh.otr only
cmake --build build-cmake --target GenerateSohOtr
2022-08-05 01:59:19 -04:00
```
### Generating a distributable
After compiling the project you can generate a distributable by running of the following:
```bash
# Go to build folder
cd build-cmake
# Generate
cpack
```
## Switch
1. Requires that your build machine is setup with the tools necessary for your platform above
2. Requires that you have the switch build tools installed
3. Clone the Ship of Harkinian repository
4. Place one or more [compatible ](#compatible-roms ) roms in the `OTRExporter` directory with namings of your choice
```bash
cd Shipwright
# Setup cmake project for your host machine
cmake -H. -Bbuild-cmake -GNinja
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Setup cmake project for building for Switch
cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake
# Build project and generate nro
cmake --build build-switch --target soh_nro
2022-06-22 14:59:21 -04:00
2022-08-05 01:59:19 -04:00
# Now you can run the executable in ./build-switch/soh/soh.nro
# To develop the project open the repository in VSCode (or your preferred editor)
2022-06-22 14:59:21 -04:00
```
2022-08-14 22:57:24 -04:00
## Wii U
1. Requires that your build machine is setup with the tools necessary for your platform above
2. Requires that you have the Wii U build tools installed
3. Clone the Ship of Harkinian repository
4. Place one or more [compatible ](#compatible-roms ) roms in the `OTRExporter` directory with namings of your choice
```bash
cd Shipwright
# Setup cmake project for your host machine
cmake -H. -Bbuild-cmake -GNinja
# Extract assets & generate OTR (run this anytime you need to regenerate OTR)
cmake --build build-cmake --target ExtractAssets
# Setup cmake project for building for Wii U
cmake -H. -Bbuild-wiiu -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/WiiU.cmake # -DCMAKE_BUILD_TYPE:STRING=Release (if you're packaging)
# Build project and generate rpx
2022-09-08 22:55:55 -04:00
cmake --build build-wiiu --target soh # --target soh_wuhb (for building .wuhb)
2022-08-14 22:57:24 -04:00
2022-09-08 22:55:55 -04:00
# Now you can run the executable in ./build-wiiu/soh/soh.rpx or the Wii U Homebrew Bundle in ./build-wiiu/soh/soh.wuhb
2022-08-14 22:57:24 -04:00
# To develop the project open the repository in VSCode (or your preferred editor)
```
2022-05-11 13:18:24 -04:00
# Compatible Roms
2023-09-19 10:05:37 -04:00
See [`supportedHashes.json` ](supportedHashes.json )
2022-12-19 07:58:22 -05:00
## Getting CI to work on your fork
The CI works via [Github Actions ](https://github.com/features/actions ) where we mostly make use of machines hosted by Github; except for the very first step of the CI process called "Extract assets". This steps extracts assets from the game file and generates an "assets" folder in `soh/` .
To get this step working on your fork, you'll need to add a machine to your own repository as a self-hosted runner via "Settings > Actions > Runners" in your repository settings. Make sure to add the 'asset-builder' tag to your newly added runner to assign it to run this step. To setup your runner as a service read the docs [here ](https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service?platform=linux ).
### Runner on Windows
2023-06-09 17:22:25 -04:00
You'll have to enable the ability to run unsigned scripts through PowerShell. To do this, open Powershell as administrator and run `set-executionpolicy remotesigned` . Most dependencies get installed as part of the CI process. You will also need to separately install 7z and add it to the PATH so `7z` can be run as a command. [Chocolatey ](https://chocolatey.org/ ) or other package managers can be used to install it easily.
2022-12-19 07:58:22 -05:00
### Runner on UNIX systems
If you're on macOS or Linux take a look at `macports-deps.txt` or `apt-deps.txt` to see the dependencies expected to be on your machine.