Building the project
Guide how to build Jazz² Resurrection.
The project requires following tools and libraries to build it successfully:
- CMake 3.15 or newer
- C++ compiler with C++17 support — any newer version of GCC, Clang and MSVC should work, MinGW and Clang-CL toolchains should be also supported
- OpenGL 3.0, OpenGL|ES 3.0 or WebGL 2.0 library (alternatively ANGLE or Mesa translation library)
- GLEW (required only on Windows)
- GLFW or SDL2 (not required on Android and UWP, because these platforms use a custom backend)
- zlib
In addition, these libraries are required for an optimal experience:
- OpenAL — audio support
- libopenmpt — module music playback
- libogg / libvorbis —
.ogg
file support (not needed for original levels) - libwebp —
.webp
file support (not needed for original levels) - AngelScript — AngelScript scripting support
- liblua — Lua scripting support (currently not supported)
It tries to download or compile all libraries automatically, but in case of build errors a manual download is necessary. Also, system-wide libraries have priority over the bundled ones, so in case of any incompatibility just install the system libraries.
How to get started
Clone the repository using any Git client, IDE, or command line:
git clone https://github.com/deathkiller/jazz2-native.git
To configure CMake, following commands can be used:
mkdir build cmake -B build -D CMAKE_BUILD_TYPE=Debug
Alternatively, change CMAKE_BUILD_TYPE
to Release
to enable all performance optimizations and disable debugging. You can also specify build configuration parameters, which are described below. To start actual build of the project, use following commands:
make -j $(nproc) -C build
Everything should be built in the "build"
directory. Additionally, you can create a symbolic link to "Content"
directory or copy it to "build"
directory manually:
ln -s "$(pwd)/Content" "$(pwd)/build/Content"
Building on Android
Android build requires Android SDK and NDK installed, see Get started with the NDK. Assembling APK files also requires Gradle. Path to Gradle can be supplied by GRADLE_HOME
environment variable if not detected automatically. The build can be configured using a similar command as above:
mkdir build cmake -B build -D CMAKE_BUILD_TYPE=Debug \ -D NCINE_BUILD_ANDROID=ON \ -D NCINE_UNIVERSAL_APK=ON \ -D NCINE_NDK_ARCHITECTURES="arm64-v8a;armeabi-v7a"
See Platform-specific parameters for Android for more details. Then following commands can be used to build the project and assemble the APK file:
make -j $(nproc) -C build cd build gradle assembleDebug
Alternatively, replace assembleDebug
with assembleRelease
to create release APK file.
Building on Windows
On Windows, Visual Studio can be used. Using already included .sln
is not recommended, because it requires manual configuration. Instead the project can be opened as CMake directory directly in Visual Studio, or it can be configured using a similar command as above:
mkdir build cmake -B build -D CMAKE_BUILD_TYPE=Debug -A x64 ^ -D CMAKE_SYSTEM_PROCESSOR=x64 ^ -D NCINE_COPY_DEPENDENCIES=ON
See Platform-specific parameters for Windows for more details. To build it for 32-bit operating system, use Win32
instead of x64
. To change version of VS toolset, use -D CMAKE_GENERATOR_TOOLSET=…
parameter. By default CMake creates a new Visual Studio .sln
solution and project files in "build"
directory that can be opened easily afterwards. Building with Clang-CL compiler is also possible specifying -T ClangCL
parameter.
Building for Xbox (Universal Windows Platform)
The same commands can be used as for Windows, but two additional parameters must be specified to change the target:
cmake -B build -D CMAKE_BUILD_TYPE=Debug -A x64 ^ -D CMAKE_SYSTEM_PROCESSOR=x64 ^ -D CMAKE_SYSTEM_NAME=WindowsStore ^ -D CMAKE_SYSTEM_VERSION="10.0"
Additionaly, a code-signing certificate is required to create an installable .msixbundle
package. See Platform-specific parameters for Universal Windows Platform for more details.
Build configuration parameters
By default it tries to find the first available backend for the currently installed libraries. GLFW is usually preferred over SDL2, because it's more lightweight. On the other hand, SDL2 usually has better gamepad support and better support in general. The following parameters can be used to customize the build:
CMAKE_BUILD_TYPE
— Build configuration- Possible values:
Debug
,Release
- Possible values:
CMAKE_INSTALL_PREFIX
(default"/usr/local"
) — Install prefix on Unix systemsNCINE_DATA_DIR
(default"./Content"
) — Path to"Content"
game data directory- Some build targets include
"Content"
directory directly inside the executable package
- Some build targets include
NCINE_DOWNLOAD_DEPENDENCIES
(defaultON
) — Download all missing dependencies automaticallyNCINE_EMBED_SHADERS
(defaultON
) — Embed shader files inside executableNCINE_PREFERRED_BACKEND
(default"GLFW"
) — Preferred backend on desktop- Possible values:
GLFW
,SDL2
- Ignored on Android and UWP platforms
- Possible values:
NCINE_VERSION_FROM_GIT
(defaultON
) — Set current game version from Git repository automaticallyNCINE_WITH_THREADS
(defaultON
except on Emscripten) — Allow to use multiple threads for better performanceNCINE_WITH_OPENGLES
(defaultOFF
) — Use OpenGL|ES library instead of OpenGLNCINE_WITH_ANGLE
(defaultOFF
except on UWP) — Enable Google ANGLE library supportNCINE_WITH_GLEW
(defaultON
) — Use GLEW libraryNCINE_WITH_BACKWARD
(defaultON
) — Enable better exception handlingNCINE_WITH_WEBP
(defaultOFF
) — Enable.webp
image file support, requires libwebp libraryNCINE_WITH_AUDIO
(defaultON
) — Enable audio support, requires OpenAL libraryNCINE_WITH_VORBIS
(defaultON
) – Enable.ogg
audio file support, requires libvorbis libraryNCINE_WITH_OPENMPT
(defaultON
) – Enable module music audio file support, requires libopenmpt libraryNCINE_COMPILE_OPENMPT
(defaultOFF
) – Download and compile libopenmpt from source automatically
NCINE_WITH_ANGELSCRIPT
(defaultOFF
) — Enable AngelScript scripting supportANGELSCRIPT_VERSION_TAG
allows to specify the version to be downloaded ifNCINE_DOWNLOAD_DEPENDENCIES
is enabled
NCINE_WITH_LUA
deprecated — Enable Lua scripting supportNCINE_WITH_IMGUI
(defaultOFF
) — Enable integration with Dear ImGui libraryIMGUI_VERSION_TAG
allows to specify the version to be downloaded
Platform-specific parameters for Android
NCINE_BUILD_ANDROID
(defaultOFF
) — Enable building for Android platformNCINE_ASSEMBLE_APK
(defaultON
) — Assemble Android APK file, requires with GradleNCINE_NDK_ARCHITECTURES
(default"arm64-v8a"
) — Semicolon-separated list of target CPU architectures- Possible values:
arm64-v8a
(for 64-bit ARM),armeabi-v7a
(for 32-bit ARM),x86
,x86_64
- Possible values:
NCINE_UNIVERSAL_APK
(defaultOFF
) — Create universal APK containing all specified CPU architecturesNDK_DIR
— Android NDK directory, usually detected automatically
Platform-specific parameters for Linux
NCINE_ASSEMBLE_DEB
(defaultOFF
) — Assemble DEB package of the gameNCINE_ASSEMBLE_RPM
(defaultOFF
) — Assemble RPM package of the gameNCINE_BUILD_FLATPAK
(defaultOFF
) — Build Flatpak version of the gameNCINE_LINUX_PACKAGE
— Override Linux package name, otherwise"Jazz² Resurrection"
will be usedNCINE_OVERRIDE_CONTENT_PATH
— Override"Content"
directory path- If not specified, following path will be used:
CMAKE_INSTALL_PREFIX "/share/" NCINE_LINUX_PACKAGE "/Content/"
- If not specified, following path will be used:
NCINE_PACKAGED_CONTENT_PATH
(defaultOFF
) — Use alternative path search strategy- If enabled,
"Content"
will be always relative to current directory - Has higher priority than
NCINE_OVERRIDE_CONTENT_PATH
- If enabled,
Platform-specific parameters for Windows
DEATH_WITH_VC_LTL
(defaultON
) — Build with VC-LTL for lighter binaries, requires VC-LTLNCINE_COPY_DEPENDENCIES
(defaultOFF
) — Copy all required libraries to build target directory automatically
Platform-specific parameters for Universal Windows Platform
NCINE_UWP_CERTIFICATE_THUMBPRINT
— Code-signing certificate thumbprint- Use either
NCINE_UWP_CERTIFICATE_THUMBPRINT
orNCINE_UWP_CERTIFICATE_PATH
- Use either
NCINE_UWP_CERTIFICATE_PATH
(default"UwpCertificate.pfx"
) — Code-signing certificate pathNCINE_UWP_CERTIFICATE_PASSWORD
(optional) — Code-signing certificate password forNCINE_UWP_CERTIFICATE_PATH
Advanced parameters
DEATH_CPU_USE_RUNTIME_DISPATCH
(defaultON
ifDEATH_CPU_USE_IFUNC
) — Build with runtime dispatch for CPU-dependent functionality, see Death::Cpu DEATH_CPU_USE_IFUNC
(defaultON
if supported) — Allow using GNU IFUNC for runtime CPU dispatchDEATH_RUNTIME_CAST
(defaultON
) — Enable Death::runtime_cast() optimization DEATH_TRACE
(defaultON
) — Enable runtime event tracing, see Asserts.hDEATH_TRACE_ASYNC
(defaultON
ifNCINE_WITH_THREADS
) — Enable asynchronous processing of event tracing for better performanceNCINE_ADDRESS_SANITIZER
(defaultOFF
) — EnableAddressSanitizer
memory error detectorNCINE_ARCH_EXTENSIONS
— Target CPU architecture extensions (instruction sets)NCINE_CODE_COVERAGE
(defaultOFF
) — Enablegcov
instrumentation for testing code coverageNCINE_GCC_HARDENING
(defaultOFF
) — Enable memory corruption mitigation methods of GCCNCINE_LINKTIME_OPTIMIZATION
(defaultON
) — Compile with link-time optimizationNCINE_UNDEFINED_SANITIZER
(defaultOFF
) — EnableUndefinedBehaviorSanitizer
detector
Debugging parameters
NCINE_AUTOVECTORIZATION_REPORT
(defaultOFF
) — Enable report generation from compiler auto-vectorizationNCINE_INPUT_DEBUGGING
(defaultOFF
) — Enable extensive (gamepad) input debugging and loggingNCINE_PROFILING
(defaultOFF
) — Enable profilingNCINE_STRIP_BINARIES
(defaultOFF
) — Strip debug symbols from binaries for smaller sizeNCINE_WITH_FIXED_BATCH_SIZE
(defaultOFF
) — Enable fixed batch size for renderingNCINE_WITH_RENDERDOC
deprecated — Enable integration with RenderDocNCINE_WITH_TRACY
(defaultOFF
) — Enable integration with Tracy frame profilerTRACY_VERSION_TAG
allows to specify the version to be downloaded
Game-specific parameters
DISABLE_RESCALE_SHADERS
(defaultOFF
) — Disable rescale shaders and use only nearest neighborSHAREWARE_DEMO_ONLY
(defaultOFF
) — Shareware Demo only, usually used on Emscripten platformWITH_MULTIPLAYER
(defaultOFF
) — Enable experimental multiplayer support