- Cross-Platform: Windows, macOS, Linux, ARM Linux (Raspberry Pi), Emscripten (WASM) and Modern Android.
- Minimal & Popular Dependencies: Only spdlog, glad, imgui, glfw, sdl2.
For Android, we need GameActivity and EGL.
- Using XMake as Project Generator & Builder: Combining the functionalities of various build tools, incorporating the speed of Ninja, and introducing customizable library repositories, results in a versatile and efficient build system.
- Minimal system implemented: A simple cross-platform window is implemented using either GLFW or SDL2 paired with OpenGL. This provides a fundamental GL/GLES context for basic graphics operations.
For more showcases, please visit Media/Showcases
Ensure to globally replace instances of SomeEngine
with the name of your game engine and replace SOME_ENGINE
with the designated macro prefix for your game engine.
- XMake
- Visual Studio 2019 (or above) with C++ Desktop Development Environment
- Git 2.1 (or above)
- XMake
- XCode 13 (or above)
- Git 2.1 (or above)
To install XMake on macOS, you can use HomeBrew:
brew install xmake
To install XMake, simply use curl:
curl -fsSL https://xmake.io/shget.text | bash
Install other packages:
sudo apt-get install build-essential cmake git clang libx11-dev libxrandr-dev libxrender-dev libglvnd-dev libxinerama-dev libxcursor-dev libxi-dev
TODO
- Install Xmake as above.
- Install Emscripten by following official documentation.
Clone this repo and go to the root directory first:
git clone git@github.com:zzxzzk115/GameEngineStarter.git --recursive
cd GameEngineStarter
In CMD or Powershell, at the Source
directory, execute xmake -v -y
.
Or simply double click xmake_windows.bat
.
cd Source
xmake -v -y
cd Source
xmake f -p wasm
xmake -v -y
Currently, I've made a demo that shows how to use xmake to build an Android Native project by using GameActivity and xmake-gradle.
Now you can build an Android demo by executing the:
cd GameTemplate/Android/android
./gradlew app:assembleDebug
# ./gradlew app:assembleRelease
You may have to set the JAVA_HOME
system environment.
The generated APK file will be at GameTemplate/Android/android/app/build/outputs/apk/{mode}
The virtual keyboard is not working, which I'll fix later on.
Switch to SDL2:
xmake f --window=sdl2
xmake
Switch to GLFW:
xmake f --window=glfw
xmake
xmake f -c
Run all programs:
xmake run
Run a specific programe:
xmake run Playground
For example, debug Playground
:
cd Source
xmake f -m debug # Switch to debug mode
# Switch to release mode:
# xmake f -m release
xmake -v -y
xmake run Playground
If you want to know more about XMake, please visit their official document website.
Q: Why not using CMake, Premake, Scons and other project generators or build systems?
A: CMake can be challenging to use. Premake and Scons offer easier alternatives, but they both lack a dedicated package manager. XMake, on the other hand, comes with its official repository serving as a cross-platform package manager. Additionally, it allows you to fork it and implement your own package manager. Leveraging XMake makes managing dependencies a more straightforward process.
Q: Can I integrate other build system project, for example, use CMake and Makefile projects? Premake? Scons?
A: Yes, you certainly can. XMake inherently supports various build tools. If you can't locate a project in the official repository, you have the flexibility to utilize package managers such as vcpkg, conda, homebrew, pacman, apt, and more. Additionally, you have the option to fork the official repository and independently add a package to suit your needs.
This project is licensed under the MIT license.