Vita3K uses CMake for its project configuration and generation. In theory, it should be compatible with any project generator supported by CMake, C++17 compatible compiler and an IDE with CMake support.
The project provides CMake presets to allow configuring and building Vita3K without having to deal with adding the needed arguments through a command-line interface or using the user interface of your IDE. As long as your IDE or code editor supports CMake, the software should immediately detect the presets and let you choose which configuration settings you want to use to generate the program. Reference on how to use CMake presets with various IDEs and code editors can be found here:
- Visual Studio
- Visual Studio Code
- CLion: CMake presets in CLion are imported as CLion's CMake profiles.
All presets are named after <target_os>-<project_generator>-<compiler>
, are automatically hidden and shown depending on your host OS and generate a binary folder of path <source_directory>/build/<preset_name>
. For command-line users, run cmake --list-presets
on the top directory of the repository to see which presets are available to you. For presets without <project_generator>
and/or <compiler>
, the project generator and/or the compiler haven't been explicitly specified in the preset to let CMake fallback to the platform defaults.
If you still want to use presets but none of them works for your setup, you can make new ones by creating a CMakeUserPresets.json
file and you can check the specification here. Git will ignore this file.
Note: Vita3K doesn't support compilation for 32-bit/x86/i386 platforms. macOS is also considered unsupported due to incompatibilities with the OpenGL implementation.
For convenience, the following building instructions are given as examples:
-
Install Visual Studio 2022 and choose to install
Desktop development with C++
. You will get compiler andcmake
required for building.Example for Visual Studio 2019:
-
Install
git
toclone
the project. Download and installgit
from here. -
Clone this repo.
git clone --recursive https://github.com/Vita3K/Vita3K cd Vita3K
-
Run Visual Studio 2022. On the project selection window open the local clone of the repository as a folder. Thanks to the integration between Visual Studio and CMake, Visual Studio will automatically detect the repository as a CMake project.
-
Wait for all components for Visual Studio to be loaded. At the top of the window, there should be three new menus that allow you to select the target (specific to Visual Studio), a CMake configure preset and a CMake build preset (if available). Recommended preset for Visual Studio 2022 is Windows with Visual Studio 2022.
From there, the project will be ready to build right from the Visual Studio UI.
If you aren't satisfied with the way the Visual Studio integrates CMake projects and you would like to just use regular Visual Studio solution files (.sln
), you can close Visual Studio and then open the solution file found in build/<preset_name>/
.
-
Install:
- Git
- CMake
- Either the Build Tools for Visual Studio 2022 or Visual Studio 2022 with the
Desktop development with C++
workload.
-
On the Start Menu, open the
x64 Native Tools Command Prompt for Visual Studio 2022
. -
Clone the repository:
git clone --recursive https://github.com/Vita3K/Vita3K cd Vita3K
-
Generate the project:
cmake --preset windows-vs2022
The line above will generate a Visual Studio 2022 project inside a folder called
build/windows-vs2022
. -
Build the project:
cmake --build build/windows-vs2022
-
Install Xcode at App Store.
-
Install
brew
. -
Install dependencies with
brew
.brew install git cmake molten-vk openssl
-
Clone this repo.
git clone --recursive https://github.com/Vita3K/Vita3K cd Vita3K
-
Generate Xcode project.
cmake --preset macos-xcode
This example will generate a Xcode project inside a folder called
build/macos-xcode
. -
Open Xcode project
vita3k.xcodeproj
generated inbuild/macos-xcode
directory. -
When prompted to create schemes, create one for the
vita3k
target only. The project builds many targets, so it will make your life easier if you create schemes as needed. -
Build the project using the Xcode UI. If needed, the build process can be invoked as well the same way as with the other platforms using a terminal:
cmake --build build/macos-xcode
Note: The CMake preset linux-ninja-clang
makes use of the LLD linker, which will need to be installed in your system along with Clang.
-
Install dependencies.
sudo apt install git cmake ninja-build libsdl2-dev pkg-config libgtk-3-dev clang lld xdg-desktop-portal openssl libssl-dev
-
Clone this repo.
git clone --recursive https://github.com/Vita3K/Vita3K cd Vita3K
-
Generate the project.
cmake --preset linux-ninja-clang
This example will generate a Ninja Multi-Config (
ninja-build
) project instead of a Make (make
, the default project generator for Linux) one inside the folderbuild/linux-ninja-clang
. -
Build the project:
cmake --build build/linux-ninja-clang
-
After cloning or checking out a branch, you should always update submodules.
git submodule update --init --recursive
-
If Boost failed to build, you can use the system Boost package (Linux and macOS only).
brew install boost # for macOS sudo apt install libboost-filesystem-dev libboost-program-options-dev libboost-system-dev # for Ubuntu/Debian
If needed, CMake options
VITA3K_FORCE_CUSTOM_BOOST
andVITA3K_FORCE_SYSTEM_BOOST
can be set to change the way the CMake project looks for Boost.