From 4bf5eff88cb33048dfb295a97f16ce480fd61641 Mon Sep 17 00:00:00 2001 From: inspectredc Date: Mon, 25 Sep 2023 11:21:59 +0100 Subject: [PATCH 1/4] initial go at building doc --- docs/building.md | 109 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 docs/building.md diff --git a/docs/building.md b/docs/building.md new file mode 100644 index 00000000..0e7b3a2f --- /dev/null +++ b/docs/building.md @@ -0,0 +1,109 @@ +# Building Ghostship + +## Setting Up CubeOS + +1. Clone the CubeOS repository and follow the build instructions. +2. Run the executable passing the path to your ROM as an argument. +3. You should now have a smcube.otr in the root folder of the repository, which will be needed when running this application. + +## Windows + +Requires: + * 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 + * Git (can be installed manually or as part of Visual Studio) + * Cmake (can be installed via chocolatey or manually) + +### Clone the Ghostship repository + +_Note: Be sure to either clone with the ``--recursive`` flag or do ``git submodule update --init`` after cloning to pull in the libultraship submodule!_ + +### Building Ghostship + +_Note: Instructions assume using powershell_ +```powershell +# Navigate to the Ghostship repo within powershell. ie: cd "C:\yourpath\Ghostship" +cd Ghostship + +# 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=Debug +# or for VS2019 +& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64 -DCMAKE_BUILD_TYPE=Debug +# Compile project +& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 # --config Release (if you're packaging) + +# If you need to clean the project you can run +& 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target clean + +#### Visual Studio +To develop using Visual Studio you only need to use cmake to generate the solution file: +```powershell +# Generates Ghostship.sln at `build/x64` for Visual Studio 2022 +& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v142 -A x64 +# or for Visual Studio 2019 +& 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 16 2019" -T v142 -A x64 +``` + +### Running the executable + +1. Copy over the smcube.otr you have generated into the directory containing your executable, e.g. `.\build\x64\Debug` +2. From the GitHub, download the soh.otr and place that in the same directory as you smcube.otr +3. Currently, in order to run this on Windows, you must be using OpenGL instead of DirectX11. Change the `GetWindowBackend()` function in `libultraship\src\window\Window.cpp` to `return WindowBackend::SDL_OPENGL;` before building. +4. + +## Linux +Requires `gcc >= 10, x11, sdl2 >= 2.0.22, libpng, ninja, cmake, lld` + +**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._ + +### Building Ghostship + +```bash +# Clone the repo +git clone https://github.com/HarbourMasters/Ghostship.git +cd Ghostship +# Clone the submodule libultraship +git submodule update --init +# Generate Ninja project +cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE= Debug +# Compile the project +cmake --build build-cmake + +# If you need to clean the project you can run +cmake --build build-cmake --target clean +``` + +### Running the executable + +1. Copy over the smcube.otr you have generated into the root directory if the repository +2. From the GitHub, download the soh.otr and place that in the build directory, e.g. `./build-cmake` + +## macOS +Requires Xcode (or xcode-tools) && `ninja, cmake` (can be installed via homebrew, macports, etc) + +**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._ + +```bash +# Clone the repo +git clone https://github.com/HarbourMasters/Ghostship.git +cd Ghostship +# Clone the submodule libultraship +git submodule update --init +# Generate Ninja project +cmake -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE=Debug +# Compile the project +cmake --build build-cmake + +# If you need to clean the project you can run +cmake --build build-cmake --target clean +``` + +### Running the executable + +1. Copy over the smcube.otr you have generated into the root directory if the repository +2. From the GitHub, download the soh.otr and place that in the build directory, e.g. `./build-cmake` From 762df1106e9740a3e8d4b8bc8f83e5ee6dc239cd Mon Sep 17 00:00:00 2001 From: inspectredc Date: Mon, 25 Sep 2023 11:57:50 +0100 Subject: [PATCH 2/4] runrunrun --- docs/building.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/building.md b/docs/building.md index 0e7b3a2f..39a16efe 100644 --- a/docs/building.md +++ b/docs/building.md @@ -50,7 +50,7 @@ To develop using Visual Studio you only need to use cmake to generate the soluti 1. Copy over the smcube.otr you have generated into the directory containing your executable, e.g. `.\build\x64\Debug` 2. From the GitHub, download the soh.otr and place that in the same directory as you smcube.otr 3. Currently, in order to run this on Windows, you must be using OpenGL instead of DirectX11. Change the `GetWindowBackend()` function in `libultraship\src\window\Window.cpp` to `return WindowBackend::SDL_OPENGL;` before building. -4. +4. Now you can run the executable directly or from Visual Studio ## Linux Requires `gcc >= 10, x11, sdl2 >= 2.0.22, libpng, ninja, cmake, lld` @@ -80,6 +80,7 @@ cmake --build build-cmake --target clean 1. Copy over the smcube.otr you have generated into the root directory if the repository 2. From the GitHub, download the soh.otr and place that in the build directory, e.g. `./build-cmake` +3. Now you can run the executable directly or from Visual Studio Code ## macOS Requires Xcode (or xcode-tools) && `ninja, cmake` (can be installed via homebrew, macports, etc) @@ -107,3 +108,4 @@ cmake --build build-cmake --target clean 1. Copy over the smcube.otr you have generated into the root directory if the repository 2. From the GitHub, download the soh.otr and place that in the build directory, e.g. `./build-cmake` +3. Now you can run the executable directly or from Visual Studio Code From 391342f3769a2c724824ffdc1b94d2b2670962a4 Mon Sep 17 00:00:00 2001 From: inspectredc Date: Mon, 25 Sep 2023 11:59:32 +0100 Subject: [PATCH 3/4] buildbuildbuild --- docs/building.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/building.md b/docs/building.md index 39a16efe..759cfc1a 100644 --- a/docs/building.md +++ b/docs/building.md @@ -89,6 +89,8 @@ Requires Xcode (or xcode-tools) && `ninja, cmake` (can be installed via homebrew _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._ +### Building Ghostship + ```bash # Clone the repo git clone https://github.com/HarbourMasters/Ghostship.git From b7e09733b39399bf0720e10c154b7a4bcb4b0a5a Mon Sep 17 00:00:00 2001 From: inspectredc Date: Mon, 25 Sep 2023 16:42:17 +0100 Subject: [PATCH 4/4] window backend temp fix now built in --- docs/building.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/building.md b/docs/building.md index 759cfc1a..8a755c31 100644 --- a/docs/building.md +++ b/docs/building.md @@ -49,8 +49,7 @@ To develop using Visual Studio you only need to use cmake to generate the soluti 1. Copy over the smcube.otr you have generated into the directory containing your executable, e.g. `.\build\x64\Debug` 2. From the GitHub, download the soh.otr and place that in the same directory as you smcube.otr -3. Currently, in order to run this on Windows, you must be using OpenGL instead of DirectX11. Change the `GetWindowBackend()` function in `libultraship\src\window\Window.cpp` to `return WindowBackend::SDL_OPENGL;` before building. -4. Now you can run the executable directly or from Visual Studio +3. Now you can run the executable directly or from Visual Studio ## Linux Requires `gcc >= 10, x11, sdl2 >= 2.0.22, libpng, ninja, cmake, lld`