Docs

Build Script (doriax.py)

doriax.py runs the CMake configure and build steps for a Doriax project in one command. Every Source Code export puts it in the export root, next to CMakeLists.txt. The engine repository has it at engine/doriax.py, where it builds engine/project by default.

Desktop and Web exports are already built

The Export Window's Desktop and Web modes compile the game for you. The script is for Source Code exports.

Requirements

  • Python 3.9 or newer
  • CMake 3.20 or newer, on PATH
  • The toolchain of the target platform, see the platform guides
  • Optional: Ninja, used for Linux, macOS, and Web builds when it is on PATH

Usage

From the export folder:

python3 doriax.py              # Release build for this computer
python3 doriax.py --debug      # Debug build
python3 doriax.py -g vulkan    # choose the graphics backend
python3 doriax.py -p web       # Emscripten build

On Windows, run it with python or py.

Platforms

--platform Builds on Generator Output
linux Linux Ninja if installed build/linux/<App>
windows Windows Newest Visual Studio build/windows/Release/<App>.exe
macos macOS Ninja if installed build/macos/<App>
macos-xcode macOS Xcode build/macos-xcode/Release/<App>.app
ios-xcode macOS Xcode build/ios-xcode/Release-iphonesimulator/<App>.app
web Any Ninja if installed build/web/<App>.html

The default is the computer's own platform. Desktop platforms build only on their own operating system. <App> is the project name the export wrote into CMakeLists.txt, and Debug builds use Debug instead of Release in the paths.

Android builds go through Gradle. Open the exported Android Studio workspace instead, see Building for Android.

Options

Option Default Effect
-p, --platform This computer Target platform
-d, --debug / --no-debug Release Build type
-b, --build / --no-build Build --no-build only configures, for example to open the Xcode or Visual Studio project
-g, --graphic-backend Platform default glcore, gles3, metal, d3d11, or vulkan, see Graphics backend
-G, --generator See Platforms CMake generator
-j, --jobs CPU cores Parallel build jobs
-D, --define Extra CMake definition, repeatable: -DEMSCRIPTEN_THREAD_SUPPORT=ON
-o, --output build/<platform> Build directory
-a, --appname From CMakeLists.txt Executable name (APP_NAME)
-s, --project project/ Project root (PROJECT_ROOT)
-e, --doriax Script folder Engine root with the engine CMakeLists.txt
--no-cpp-init / --no-lua-init Define NO_CPP_INIT / NO_LUA_INIT, see Scripting entry options
--em-shell-file Emscripten --shell-file template for web

The build directory keeps its generator and CMake cache between runs, including --graphic-backend, --appname, and -D values. To start over, delete the build directory.

Web builds

The script finds emcmake in the EMSDK, EMSCRIPTEN_ROOT, or EMSCRIPTEN folder, or on PATH. Running emsdk_env sets EMSDK. On Windows it builds with Ninja, from PATH or from the C++ CMake tools of Visual Studio.

An exported project also gets <App>.export.html, the page with the Web settings applied, and a copy of it named index.html (unless the project itself is named index), so serving the build folder opens the game. Publish it with <App>.js, <App>.wasm, favicon.png, and, when present, <App>.data, not the plain Emscripten page <App>.html. Serve the files over HTTP as in Building for HTML5.

Xcode builds

macos-xcode and ios-xcode generate build/<platform>/<App>.xcodeproj. CMake copies assets/ and lua/ into the app bundle after each build, and the script also adds them to the project's resources after each configure. macOS glcore and vulkan builds are plain executables, not bundles, so they skip this step.

ios-xcode builds for the iOS Simulator. For devices, see Building for iOS.