Interested in contributing to Etterna? This guide is the place to start!
- Getting Started
- Quick Start
- Universal Dependencies
- Project Generation
- Compiling
- Distribution
- Static Analysis
- Documentation
To begin, take a look at what dependencies
you're going to need to start compiling. Etterna is cross-platform on Linux, macOS, and Windows. Typically, we work off of the develop
branch, therefore all pull requests should be made towards develop
.
Here are some commands for current developers and contributors to get started. More are listed at Sample CMake Commands.
cmake -G "Unix Makefiles" .. # Linux
cmake -G "Visual Studio 16 2019" .. # Windows
cmake -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl" -G "Xcode" .. # macOS
- CMake (Minimum version 3.14.0) - It is recommended to get this package from the CMake website as many package managers do not have the latest version. Check your package manager before trying.
- OpenSSL (Version 1.1.1)
- Debian:
apt install libssl-dev
- Fedora:
dnf install openssl-devel
- macOS:
brew install openssl
- Windows: A CMake compatible version of OpenSSL is available at Shining Light Productions website. You will need the 32bit and 64bit installers if you plan on building both versions. It's reccomended to uninstall old versions to make sure CMake can find the correct latest version. Direct links: 32bit, 64bit
- Debian:
While most dependencies for macOS and Windows are included in the repo, there are some linux libraries which cannot be included in the repo.
- Debian:
apt install libssl-dev libx11-dev libxrandr-dev libcurl4-openssl-dev libglu1-mesa-dev libpulse-dev libogg-dev libasound-dev libjack-dev
- Fedora:
dnf install libssl-devel libX11-devel libcurl-devel mesa-libGLU-devel libXrandr-devel libogg-devel pulseaudio-libs-devel alsa-lib-devel jack-audio-connection-kit-devel
- Visual Studio - Any modern version of Visual Studio should be compatible (The earliest version we theoretically support is
Visual Studio 9 2008
, though we have only tested onVisual Studio 15 2017
and after) - DirectX Runtimes (June 2010)
- DirectX SDK
- Microsoft Visual C++ Redistributables - Both 32bit and 64bit
- Windows 10 Development Kit
YASM
orNASM
. They can be installed with brew commandsbrew install yasm
orbrew install nasm
. They are not directly used for Etterna, though is required for ffmpeg to be built from source.
First, ensure you have forked Etterna, cloned to your system, and checked out develop
.
There are two stages apart of CMake projects.
- Configuration: CMake will run through all CMakeLists.txt and ensure all code processes.
- Generation: CMake will take information from generation, and create the project files based on what was selected through the generation option.
Both configuration and generation stages automatically happen one after the other when using the CLI.
Start by creating a folder to hold all the output object files, usually called build
, within the root of the project.
mkdir build && cd build
Etterna has game resources in the root of the project, so the output binary is either placed in the root of the project (Unix) or in the Program
folder in the project root (Windows).
To generate project files, you will only need to specify the GENERATOR
. The ARCHITECTURE
will assume 64bit if left undefined. If any trouble occurs with OpenSSL, the most likely answer will be to define where you have it installed through the SSL_DIRECTORY
variable.
GENERATOR
: The generator you are choosing to use. Supported generators are listed below.ARCHITECTURE
: The target architecture. Currently we supportWin32
andx64
. This parameter is only necessary if using a Visual Studio generator.x64
will automatically be selected if the variable is left empty.SSL_DIRECTORY
: The root directory of your OpenSSL install. It may be required on macOS depending on the OpenSSL version which comes with your system (thought we recommend getting the latest version from homebrew).
cmake -G "GENERATOR" -A "ARCHITECTURE" -DOPENSSL_ROOT_DIR="SSL_DIRECTORY" ..
We actively support the following CMake generators
- macOS:
Ninja
,Xcode
,Unix Makefiles
- Linux:
Ninja
,Unix Makefiles
- Windows:
Ninja
,Visual Studio 15 2017
,Visual Studio 16 2019
(Technically, with how the CMake script is setup, any generator as far back asVisual Studio 9 2008
should work), but it has only tested it with the above three.
For the OPENSSL_ROOT_DIR
parameter, set the directory for where ever the openssl root directory is located. Here are possible options
- macOS:
/usr/local/opt/openssl
or otherwise depending on your setup (if you're using HomeBrew, MacPorts or installed in from source) - Linux: This parameter is not necessary on linux. (CMake can find it on it's own)
- Windows: CMake writes files to find the version of OpenSSL linked above. If that version is installed, it should not be necessary to specify this variable (unless you have OpenSSL installed in a non-standard location, in which case, you should set OPENSSL_ROOT_DIR to that location)
cmake -G "Ninja" .. # Linux Ninja
cmake -G "Unix Makefiles" .. # Linux Makefiles
cmake -G "Visual Studio 16 2019" -A Win32 .. # 32bit Windows
cmake -G "Visual Studio 16 2019" -A x64 .. # 64bit Windows
cmake -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl" -G "Xcode" .. # macOS Xcode
cmake -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl" -G "Ninja" .. # macOS Ninja
cmake -DOPENSSL_ROOT_DIR="/usr/local/opt/openssl" -G "Unix Makefiles" .. # macOS Ninja
When generating a project for Xcode, you may see errors stating No CMAKE_{C,CXX}_COMPILER could be found.
Ensure that you have the Xcode command line tools installed. The command line tools can be installed with xcodeselect --install
. You may also have to run xcode-select --reset
to ensure the correct command line tools are apart of the system path.
In order to compile properly, you will want to make your CMake-GUI look similar to the photo below. The first text field is the location where you cloned Etterna, the second text field is where you want to place the build object files. If necessary,OPENSSL_ROOT_DIR
can be added by clicking the add entry button. It should look similar to the following image.
NOTE: Setting OPENSSL_ROOT_DIR
is unnecessary for linux users as CMake will find the location of OpenSSL on it's own.
Windows Users: If CMake was unable to find OpenSSL on it's own, remember to change the value correspond to the correct 32bit or 64bit version of the OpenSSL library.
Click the buttons labeled Configure
. The first time this button is clicked (and a CMakeCache.txt
does not exit in the build directory), CMake will ask about what generator you would like to use. If a Visual Studio generator is chosen, the Optional platform for generator
will assume the 64bit option of x64
if left empty. If building the 32bit version is required, click the drop down and select Win32
. Once Finish
is clicked, the project will begin configuring.
Finally, click Generate
. An Etterna.sln
file should appear in the build folder. Open it , and you are ready to start coding.
The ninja command used is exactly the same across all operating systems. It should be noted that Ninja can only build 64bit binaries (unless you would like to compile Ninja yourself).
To install ninja, use one of the following commands
- Debian:
apt install ninja-build
- Fedora:
dnf install ninja-build
- macOS:
brew install ninja
To start compiling, run the cmake command with the Ninja generator, then run ninja
.
Run make
or ninja
corresponding to the CMake generator you used.
Open the Etterna.xcodeproj
file generated within the build directory, select the Etterna target, and you are ready to start coding.
xcodebuild -project Etterna.xcodeproj -configuration Release
Due to the extreme verbosity of xcodebuild
, we recommend xcpretty to clean up the output.
Open the Etterna.sln
file generated within the build directory, and you are ready to start coding.
If you prefer the command line, these commands should be what you are looking for. Make sure you run the proper visual studio command prompt.
msbuild Etterna.sln /p:Platform="Win32" /p:Configuration="Release" # Only for 32bit CMake generator
msbuild Etterna.sln /p:Platform="x64" /p:Configuration="Release" # Only for 64bit CMake generator
We use CMake's CPack module to build distribution files. Currently, we create distribution binaries for Windows and macOS.
Windows only prerequisite: Install the latest version of Nullsoft Scriptable Install System
To build a distribution file for the operating system you are using, run cpack
in the build directory after compiling.
cppcheck is a cross-platform static analysis tool which CMake supports by adding a target for it in your desired generator. The target named cppcheck
will only be created if CMake can find the cppcheck command on your system.
- macOS:
brew install cppcheck
- Debian:
apt install cppcheck
- Windows: An installer is available at the cppcheck website. Make sure that
cppcheck
runs when you enter the command in your CLI. If it doesn't, check your system/user path to ensure that the bin folder of where you installed cppcheck is listed there.
When cppcheck is run, it will generate a file in the build directory called cppcheck.txt
which will have the output of the command. The output is saved to a file as the command produces significant output, and can take some time to run.
To run cppcheck
, run the target. Running the target will be different depending on the generator you have chosen.
Etterna uses doxygen to build it's C++ documentation. Documentation is generated in a doxygen
directory, inside the build directory. CMake is setup to make a target called doxygen
if the executable found in the path.
- macOS:
brew install doxygen
- Debian:
apt install doxygen
- Windows: An installer is available at the doxygen website. As with cppcheck, make sure the executable binary directory is added to your path.
Doxygen within CMake is able to use graphviz to generate better looking relationship/hierarchy graphs. You can see how to download it for your operating system at the graphgiz download page.
Etterna uses LDoc to generate Lua documentation. We reccomend installing LuaRocks, and then installing LDoc through LuaRocks. Similar to Doxygen, it will only create the ldoc
target if it can find the ldoc
command in your system path.