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 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 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
— Specify build configuration:Debug
,Release
CMAKE_INSTALL_PREFIX
(default"/usr/local"
) — Install prefix on Unix systemsNCINE_DOWNLOAD_DEPENDENCIES
(defaultON
) — Download all missing dependencies automaticallyNCINE_PREFERRED_BACKEND
(default"GLFW"
) — Specify preferred backend on desktop:GLFW
,SDL2
NCINE_VERSION_FROM_GIT
(defaultON
) — Try to set current game version from Git repositoryNCINE_EMBED_SHADERS
(defaultON
) — Embed shader files inside executableNCINE_PROFILING
(defaultOFF
) — Enable profilingNCINE_WITH_THREADS
(defaultON
except on Emscripten) — Use multiple threads for better performanceNCINE_WITH_OPENGLES
(defaultOFF
) — Use OpenGL|ES instead of OpenGLNCINE_WITH_ANGLE
(defaultOFF
except on UWP) — Enable Google ANGLE libraries supportNCINE_WITH_GLEW
(defaultON
) — Use GLEW libraryNCINE_WITH_BACKWARD
(defaultON
) — Enable integration with Backward for exception handlingNCINE_WITH_WEBP
(defaultOFF
) — Enable.webp
image file supportNCINE_WITH_AUDIO
(defaultON
) — Enable audio support, requires OpenALNCINE_WITH_VORBIS
(defaultON
) – Enable.ogg
audio file supportNCINE_WITH_OPENMPT
(defaultON
) – Enable module music (libopenmpt
) audio file supportNCINE_COMPILE_OPENMPT
(defaultON
) – Download and compilelibopenmpt
from source automaticallyNCINE_WITH_ANGELSCRIPT
(defaultOFF
) — Enable AngelScript scripting supportNCINE_WITH_IMGUI
(defaultOFF
) — Enable integration with Dear ImGuiIMGUI_VERSION_TAG
allows to specify version
NCINE_WITH_TRACY
(defaultOFF
) — Enable integration with Tracy frame profilerTRACY_VERSION_TAG
allows to specify version
NCINE_WITH_RENDERDOC
(defaultOFF
) — Enable integration with RenderDocNCINE_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
Platform-specific parameters for Android
NCINE_BUILD_ANDROID
(defaultOFF
) — Enable building for AndroidNCINE_ASSEMBLE_APK
(defaultON
) — Assemble Android APK file, requires with GradleNCINE_UNIVERSAL_APK
(defaultOFF
) — Create universal APK containing all specified CPU architecturesNCINE_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:
NDK_DIR
— Android NDK directory, usually detected automatically
Platform-specific parameters for Linux
NCINE_BUILD_FLATPAK
(defaultOFF
) — Build Flatpak version of the gameNCINE_ASSEMBLE_DEB
(defaultOFF
) — Assemble DEB package of the gameNCINE_ASSEMBLE_RPM
(defaultOFF
) — Assemble RPM package 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
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
) — Enableruntime_cast<T>()
optimizationDEATH_TRACE
(defaultON
) — Enable runtime event tracingDEATH_TRACE_ASYNC
(defaultON
ifNCINE_WITH_THREADS
) — Enable asynchronous processing of event tracing for better performanceNCINE_ARCH_EXTENSIONS
— Target CPU architecture extensions (instruction sets)- See documentation of
/arch
(MSVC) and-m
(GCC) for more details.
- See documentation of
NCINE_INPUT_DEBUGGING
(defaultOFF
) — Enable (gamepad) input debugging and loggingNCINE_LINKTIME_OPTIMIZATION
(defaultON
) — Compile with link time optimizationNCINE_ADDRESS_SANITIZER
(defaultOFF
) — Enable AddressSanitizer memory error detectorNCINE_UNDEFINED_SANITIZER
(defaultOFF
) — Enable UndefinedBehaviorSanitizer detectorNCINE_CODE_COVERAGE
(defaultOFF
) — Enable gcov instrumentation for testing code coverageNCINE_GCC_HARDENING
(defaultOFF
) — Enable memory corruption mitigation methods of GCCNCINE_AUTOVECTORIZATION_REPORT
(defaultOFF
) — Enable report generation from compiler auto-vectorizationNCINE_STRIP_BINARIES
(defaultOFF
) — Strip debug symbols from binaries for smaller size
Game-specific parameters
SHAREWARE_DEMO_ONLY
(defaultOFF
) — Shareware Demo only, usually used with EmscriptenDISABLE_RESCALE_SHADERS
(defaultOFF
) — Disable rescale shaders and use only nearest neighbor for resizingWITH_MULTIPLAYER
(defaultOFF
) — Enable experimental multiplayer support