Skip to content
Nils Schimmelmann edited this page Jun 24, 2024 · 43 revisions

Building MMapper

Get the code

Enter a directory that you want to build in and check out the code

git clone https://github.com/MUME/MMapper.git
cd MMapper

Linux

You need to have a C++ compiler, CMake, and Qt development packages installed for your distribution:

Distro Command
Debian/Ubuntu sudo apt-get install -y build-essential qt5-qmake libqt5opengl5-dev zlib1g-dev libglm-dev libssl-dev cmake libminiupnpc-dev
Fedora sudo dnf install gcc-c++ qt5-qtbase-devel zlib-devel openssl-devel miniupnpc-devel

Make sure you are in the directory of the source tree and run:

mkdir build
cd build
cmake -S ..
make -j$(getconf _NPROCESSORS_ONLN)
ctest
cpack

Mac OS X

Utilize brew to install the dependencies:

brew install cmake ninja miniupnpc openssl@1.1 qt@5 clang-format@11
brew link qt@5 --force

Make sure you have installed the X-code install the Command Line Tools package:

xcode-select --install

Add qt@5's /bin dir to your path (instructions for zsh from brew info qt@5). This step was necessary for me (@mdrcode):

If you need to have qt@5 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"' >> ~/.zshrc

Change the directory to the source tree, and run:

mkdir build
cd build
cmake -G Ninja -S ..
cmake --build .
ctest
cpack

Windows

MingW64

Download and install the following:

  1. Qt Open Source for Windows with MinGW, Git, and the OpenSSL toolkit
  2. CMake
  3. NSIS
  4. 7-zip

Reference the following script to figure out how to build everything: https://github.com/MUME/MMapper/blob/master/.appveyor.yml#L178

MSVC

  1. Install Visual Studio Community 2019 with the Desktop development with C++ workload option
  2. Install Qt Visual Studio Tools
  3. Install Qt Open Source for Windows for MSVC 2019 along with the OpenSSL toolkit
  4. Clone the repository and edit your CMakeSettings.json accordingly:
{
  "configurations": [
    {
      "name": "x64-Debug",
      "generator": "Ninja",
      "configurationType": "Debug",
      "inheritEnvironments": [ "msvc_x64_x64" ],
      "buildRoot": "${projectDir}\\out\\build\\${name}",
      "installRoot": "${projectDir}\\out\\install\\${name}",
      "cmakeCommandArgs": "",
      "buildCommandArgs": "",
      "ctestCommandArgs": "",
      "variables": [
        {
          "name": "Qt5_DIR",
          "value": "C:/Qt/5.15.2/msvc2019_64/"
        },
        {
          "name": "QTDIR",
          "value": "C:/Qt/5.15.2/msvc2019_64/"
        },
        {
          "name": "OPENSSL_ROOT_DIR",
          "value": "C:/Qt/Tools/OpenSSL/Win_x64"
        }
      ],
      "cmakeToolchain": ""
    }
  ]
}

Code Style

You can run a code style check with the following Docker command:

docker run \
        --platform linux/amd64 \
		--volume "$(pwd)":"$(pwd)" \
		--workdir "$(pwd)" \
		ghcr.io/jidicula/clang-format:"14" \
		--dry-run \
		--Werror \
		--style=file \
		$(find src/ -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.hpp)
Clone this wiki locally