The primary build tool for LLGL is CMake and while LLGL is compatible with older versions down to version 3.7,
it is recommended to use a more up to date version, i.e. 3.18 and later. You can either use the CMake GUI, run the cmake command manually,
or run the Build script for the respective platform (run them with -h/--help for more details).
LLGL is compatible with the MSVC toolchain of Visual Studio 2015 and later. To build D3D11 and D3D12 backends, the Windows SDK 10 (10.0.10240.0 or later) is also required.
LLGL for macOS is compatible with Xcode 9 and later.
To build LLGL on older Macs back to Mac OS X 10.6 Snow Leopard with Xcode 3,
there is a legacy mode (run $ ./BuildMacOS.command --legacy) using MacPorts of Clang.
This mode only supports the OpenGL backend with compatibility profile for GL 2.0-2.1.
It is recommended to use a higher version of Xcode for LLGL on iOS. At least version 12 on macOS 10.15 Catalina is required to test the Metal backend on the iOS simulator.
The build script for Android compiles LLGL for one or more ABIs, since Android is available on many different devices. It can generate the folder structure of all example projects for Android Studio. The recommended process to build LLGL examples for Android can be split into two steps:
- Run
./BuildAndroid.sh --apps(additional arguments are optional), which compiles LLGL for the default ABIs (arm64-v8a, armeabi-v7a, x86, x86_64). - Open the respective example directory (<LLGL-ROOT>/build_android/apps/<EXAMPLE>) in Android Studio to build and run the app in either a simulator or on your Android device. On Windows, MSYS2 can be used to run BuildAndroid.sh.
The BuildLinux.sh script recognizes several major Linux distributions.
Use $ ./BuildLinux.sh -h in a command prompt for more details.
See also scripts/ListMissingPackages.sh for details about supported OS distributions.
The following libraries are the minimum requirement to build LLGL on Linux:
- X11:
libx11-dev(Debian),libx11(Arch),libx11-devel(RedHat) - Xrandr:
libxrandr-dev(Debian),libxrandr(Arch),libXrandr-devel(RedHat)
To build LLGL with the GNU ABI for Windows using MinGW, there is a build script for MSYS2. The compiler toolchain, cmake, and the OpenGL development libraries for mingw64-w64 can be installed as follows:
$ pacman -S mingw-w64-x86_64-gcc
$ pacman -S mingw-w64-x86_64-cmake
$ pacman -S mingw-w64-x86_64-glew
$ pacman -S mingw-w64-x86_64-freeglut
The build script BuildMsys2.sh can be used to automate the build process.
Use $ ./BuildMsys2.sh -h in a command prompt for more details.
LLGL can be built for the web using Emscripten 3.1.4x or later, WebAssembly, and WebGL 2.
When building on Windows, it is recommended to use the Windows Subsystem for Linux (WSL) to run the BuildWasm.sh bash script.
The generated example projects can be tested by running a local web server from the output folder, for instance with Node.js or Python http.server module:
$ python -m http.server
Then launch your web browser of choice and open the URL http://localhost:8000/.
If you want to build LLGL as a static library and link your project against it, you'll have to link against the core library (LLGL.lib/ libLLGL.a) and all backends that are compiled into that core library. So any backend that has been enabled via the respective CMake option needs to be linked against, for example the Vulkan backend (LLGL_Vulkan.lib/ libLLGL_Vulkan.a) if LLGL_BUILD_RENDERER_VULKAN is enabled. At the time of writing, CMake does not provide a straightforward method to build all submodules into a single static library. Another caveat is that the core library and its backends have a cyclic dependency when built as static library. This makes it necessary for some compilers such as GCC to link against the core library twice, once before all backends and a second time afterwards. In CMake, this may look like this:
set(MyProjectLibraryDependencies
libLLGL.a # First reference to LLGL is required for the backends to use LLGL's core functionality
libLLGL_Vulkan.a # Reference to Vulkan backend if LLGL_BUILD_RENDERER_VULKAN is enabled
libLLGL_OpenGL.a # Reference to OpenGL backend if LLGL_BUILD_RENDERER_OPENGL is enabled
libLLGL.a # Second reference to LLGL is required for it to instantiate the backends
)
