Skip to content

Building From Source

OpenSauce edited this page Oct 29, 2024 · 7 revisions

Firstly, clone the Lime3DS repository using the following command:

git clone --recursive https://github.com/Lime3DS/Lime3DS

After this has finished, use the following instructions depending on your operating system:

Windows

⠀⠀MSVC

Ensure that the following are installed:

Then, follow these instructions:

  • Open the CMake GUI Application and point it to the Lime3DS directory
  • Use the preexisting build/ directory or tell CMake to make one
  • Click the configure button and choose Visual Studio 17 2022 with x64 for the optional platform
    • If you get errors like "XXX does not contain a CMakeLists.txt file", it means you did not use the --recursive flag when cloning the repo.
    • Please run git submodule update --init --recursive to get the submodules
  • Click Generate to create the project files
  • Open the solution file in Visual Studio 2022, which is located in the build folder
  • Depending on which frontend (SDL2 or Qt) you want to build or run, select "lime" or "lime-qt" in the Solution Explorer, right click and "Set as Starup Project"
  • Select the appropriate build type, Debug for debug purposes or Release for performance (if in doubt, choose the latter)
  • Press F5 or select Build → Rebuild Solution in the menu

⠀⠀MSYS2

First, ensure that MSYS2 is installed.

Then, follow these instructions:

  • Open the "MSYS2 Clang64" (clang64.exe) shell inside the Lime3DS directory
  • Download and install all dependencies using: pacman -S mingw-w64-clang-x86_64-{gcc,qt6,cmake} make git
  • Make a build directory: mkdir build && cd build
  • Make CMake files: cmake -DCMAKE_BUILD_TYPE=Release ..
    • If you wish to build Lime3DS without the Qt GUI, pass -DENABLE_QT=no to CMake.
  • Make the executable: cmake --build . -- -j$(nproc)
  • You can run the exe from command line with: ./bin/lime-qt.exe

MacOS

Ensure that the following are installed:

  • CMake (brew install cmake)
  • A recent version of Xcode and the Xcode command line tools

Then, follow these instructions:

  • Make the build directory: mkdir build && cd build
  • Make CMake files for your machine's architecture:
    • ARM: cmake .. -DCMAKE_OSX_ARCHITECTURES="arm64"
    • x86: cmake .. -DCMAKE_OSX_ARCHITECTURES="x86_64"
  • Make executable: make -j$(sysctl -n hw.logicalcpu)
  • Make a distributable executable with: make bundle

Linux

Ensure that the following are installed:

  • SDL2
    • Deb: sudo apt install libsdl2-dev
    • Arch: pacman -S --needed sdl2
    • Fedora: sudo dnf install SDL2-devel
    • OpenSUSE: zypper in libSDL2-devel
  • OpenSSL (Optional)
    • Deb: sudo apt install libssl-dev
    • Arch: pacman -S --needed openssl-1.0
    • Fedora: sudo dnf install openssl-devel
    • OpenSUSE: zypper in openssl-devel
  • Qt 6.2+
    • Deb: sudo apt install qt6-base-dev qt6-base-private-dev qt6-multimedia-dev
    • For Translation Support: apt install qt6-l10n-tools qt6-tools-dev qt6-tools-dev-tools
    • For WrapOpenGL Errors: apt install libgl-dev
    • Arch: pacman -S --needed qt6-base qt6-multimedia qt6-multimedia-ffmpeg
    • You also need a multimedia backend: qt6-multimedia-ffmpeg or qt6-multimedia-gstreamer
    • Fedora: sudo dnf install qt6-qtbase-devel qt6-qtbase-private-devel qt6-qtmultimedia-devel
    • OpenSUSE: zypper in qt6-base qt6-multimedia
  • PortAudio
    • Deb: sudo apt install libasound-dev
    • Fedora: sudo dnf install portaudio-devel
    • OpenSUSE Leap 15: zypper in portaudio-devel
    • OpenSUSE Tumbleweed: zypper in portaudio-devel
  • XORG
    • Deb: sudo apt install xorg-dev libx11-dev libxext-dev
    • Fedora: sudo dnf install xorg-x11-server-devel libX11-devel libXext-devel
    • OpenSUSE Leap 15: zypper in xorg-x11-util-devel libX11-devel libXext-devel
    • OpenSUSE Tumbleweed: zypper in xorg-x11-util-devel libX11-devel libXext-devel
  • JACK Audio Connection Kit
    • Deb: sudo apt install jackd
    • Fedora: sudo dnf install jack-audio-connection-kit-devel
    • OpenSUSE Leap 15: zypper in libjack-devel
    • OpenSUSE Tumbleweed: zypper in libjack-devel
  • PipeWire
    • Deb: sudo apt install libpipewire-0.3-dev
    • Fedora: sudo dnf install pipewire-devel
    • OpenSUSE Leap 15: zypper in pipewire-devel
    • OpenSUSE Tumbleweed: zypper in pipewire-devel
  • sndio (Optional)
    • Deb: sudo apt install libsndio-dev
    • Fedora: sudo dnf -y copr enable andykimpe/shadow && sudo dnf -y install sndio
    • OpenSUSE Leap 15: zypper in sndio-devel
    • OpenSUSE Tumbleweed: zypper in sndio-devel
  • Gnome ESound (Optional)
    • Deb: echo "esound require build use source code https://download.gnome.org/sources/esound/"
    • Fedora: sudo dnf install esound-devel
    • OpenSUSE Leap 15: zypper in libesd0-devel
    • OpenSUSE Tumbleweed: zypper in libesd0-devel
  • Compiler (You only need one of these)
    • GCC 11.0+
      • Deb: apt install build-essential
      • Arch: pacman -S --needed base-devel
      • Fedora: dnf install gcc-c++
      • OpenSUSE: zypper in gcc-c++
    • Clang 18.0+
      • Deb: apt install clang clang-format libc++-dev
      • Arch: pacman -S --needed clang, libc++ is in the AUR. Use pacaur or yaourt to install it.
      • Fedora: dnf install clang libcxx-devel
      • OpenSUSE: zypper in clang
  • CMake 3.22+
    • Deb: apt install cmake
    • Arch: pacman -S --needed cmake
    • Fedora: dnf install cmake
    • OpenSUSE: zypper in cmake extra-cmake-modules

Then, enter one of the following depending on your compiler:

GCC

mkdir build
cd build
cmake ../
cmake --build . -- -j"$(nproc)"
sudo make install (optional)

Clang

mkdir build
cd build
cmake .. -DCMAKE_CXX_COMPILER=clang++ \
    -DCMAKE_C_COMPILER=clang \
    -DCMAKE_CXX_FLAGS="-O2 -g -stdlib=libc++"
cmake --build . -- -j"$(nproc)"
sudo make install (optional)

If you get a weird compile error related to std::span conversions, make sure you are using clang and libc++ 15 or up. This is an issue with libc++ 14.

Installing newer Qt Version

If your distribution’s version of Qt is too old, there are a few places you may be able to find newer versions.

This Ubuntu PPA contains backports of Qt 6 to various older versions: https://launchpad.net/~savoury1/+archive/ubuntu/qt-6-2 This unofficial CLI installer allows downloading and installing the latest first-party builds of Qt to your system (whether it works against your distribution may vary): https://github.com/miurahr/aqtinstall

Android

Firstly, ensure that Android Studio is installed with NDK and CMake support enabled in the SDK tools.

Then, follow these instructions:

  • Start Android Studio and on the startup dialog select 'Open'.
  • Navigate to the Lime3DS/src/android directory and click on 'Ok'
  • Build the project with 'Build' > 'Make Project' or run it on an Android device with 'Run' > 'Run 'app''

OpenBSD (Unofficial)

OpenBSD, and by extension these instructions, are not officially supported. YMMV.

Firstly, install the required packages:

pkg_add cmake sdl2 qtbase

Then, follow these instructions:

  • Make the build directory: mkdir build && cd build
  • Export the Qt directory: export Qt5_DIR=/usr/local/lib/qt5/cmake/Qt5
  • Make CMake files: cmake -DCMAKE_CXX_FLAGS='-I/usr/local/include -O2' -DCMAKE_EXE_LINKER_FLAGS='-z wxneeded' ..
  • Make the executable: make