openmohaa/docs/compiling.md

52 lines
2.7 KiB
Markdown
Raw Normal View History

2023-12-28 20:54:05 +01:00
# Compiling
OpenMoHAA supports any architecture, thanks to the CMake build system and cross-platform code/libraries. While the most common little-Endian architectures (arm, aarch64, x86, x86_64) have been tested and confirmed to work, big-Endian architectures should be supported as well; however, they remain untested.
The following tools are required for all platforms:
- CMake >= 3.12
2023-12-28 20:54:05 +01:00
- Flex (>= 2.6.4) and Bison (>= 3.5.1)
2024-08-21 18:35:06 +02:00
- A C++11 compiler
- OpenAL SDK (can be found [here](https://github.com/kcat/openal-soft))
2023-12-28 20:54:05 +01:00
2024-11-29 23:00:57 +01:00
The installation directory can be set to the MOHAA directory with `-DCMAKE_INSTALL_PREFIX=/path/to/mohaa`.
Compiling debug binaries will result in a `-dbg` suffix appended to the name of the binaries to avoid mixing debug/release code.
2023-12-28 20:54:05 +01:00
## Compiling for Linux
These are the tools required on Linux :
- Clang >= 7.0.1 or GCC >= 9.4.0
2023-12-28 20:54:05 +01:00
- libsdl2-dev
2024-08-21 18:35:06 +02:00
- libopenal-dev
2023-12-28 20:54:05 +01:00
**clang-7** and **gcc-9** has been tested to work on Ubuntu 20.04. Although it's best to use the latest versions.
2023-12-28 20:54:05 +01:00
1 line install command with clang:
```sh
2024-08-21 18:35:06 +02:00
sudo apt-get install -y cmake ninja-build clang lld flex bison libsdl2-dev libopenal-dev
2023-12-28 20:54:05 +01:00
```
Example with **CMake** and **ninja-build** installed:
```sh
mkdir .cmake && cd .cmake
cmake -G Ninja ../
```
Other compilers can be specified by appending `-DCMAKE_C_COMPILER=/path/to/compiler -DCMAKE_CXX_COMPILER=path/to/compiler` to the CMake command-line.
## Compiling for Windows
Visual Studio (2019 or 2022) is generally preferred.
2025-02-04 18:52:46 +01:00
Flex and Bison can be downloaded from here: https://github.com/lexxmark/winflexbison/releases/latest
OpenAL can be downloaded from here: https://github.com/kcat/openal-soft/releases/latest rename `soft_oal.dll` to `OpenAL64.dll` on 64-bit and `OpenAL32.dll` on 32-bit
2023-12-28 20:54:05 +01:00
2024-08-21 18:35:06 +02:00
Append `-DFLEX_EXECUTABLE=...\win_flex.exe -DBISON_EXECUTABLE=...\win_bison.exe -DOPENAL_INCLUDE_DIR="path/to/oal/include" -DOPENAL_LIBRARY="path/to/oal"` to the CMake command-line to use the package from the link above.
2024-11-29 23:00:57 +01:00
## Tweaking the build
- `-DBUILD_NO_CLIENT=1` Don't build client binaries. This will only build the dedicated server binaries.
- `-DCMAKE_LIB_SUFFIX=suffix` Default suffix to use for the default `lib` directory. For example `-DCMAKE_LIB_SUFFIX=64`
- `-DNO_MODERN_DMA=1` Use the basic DMA sound system from quake3. This lacks many features such as soundtracks and movie audio from the modern OpenAL-based DMA sound system. This option is not recommended, unless openal is not available.
- `-DTARGET_LOCAL_SYSTEM=1` for compiling and installing on the local system. This will remove the architecture suffix at the end of each binary. This option can be useful for packaging builds.
- `-DUSE_SYSTEM_LIBS=1` for third-party libraries, this will make use of system libraries instead of libraries that are embedded within the project.