Skip to content

Developing a mod with a local version of the SDK

Orfeas Zafeiris edited this page Apr 12, 2023 · 4 revisions

If you're trying to develop an out-of-tree mod (ie. a mod that's not part of the main SDK repository) with a local copy of the SDK instead of the prebuilt release, you're at the right place!

!! WARNING !!

Mods built with local copies of the SDK should NOT be distributed, as they will most likely NOT be compatible with the official published releases of the SDK and will result in crashes or other incompatibilities.

!! WARNING !!

1. Get a local copy of the SDK.

First of all, get a local copy of the SDK and set everything up as you would for regular SDK development, by following this guide.

2. Set the ZHMMODSDK_DIR variable.

After you've set up the SDK, you must set the ZHMMODSDK_DIR CMake variable in your mod project to point to the folder your local SDK repository copy is at. This will make it so instead of downloading the prebuilt release from the internet, it will instead build your local copy of the SDK and use that. It will also automatically re-build it every time you modify it.

The simplest way to set this variable is by opening your CMakeUserPresets.json (if you don't have one see this guide on how to create one), and adding it inside your cacheVariables like so:

{
    "version": 2,
    "configurePresets": [
        {
            "name": "x64-Debug-Install",
            "inherits": [
                "x64-Debug"
            ],
            "cacheVariables": {
                "GAME_INSTALL_PATH": "C:\\Games\\HITMAN3",
                "ZHMMODSDK_DIR": "C:\\Code\\ZHMModSDK"
            }
        },
        {
            "name": "x64-Release-Install",
            "inherits": [
                "x64-Release"
            ],
            "cacheVariables": {
                "GAME_INSTALL_PATH": "C:\\Games\\HITMAN3",
                "ZHMMODSDK_DIR": "C:\\Code\\ZHMModSDK"
            }
        }
    ]
}