Skip to content

Compiling

Amr Satrio edited this page Nov 16, 2024 · 13 revisions

ExplorerPatcher builds are automated using GitHub Actions. When a new commit is pushed, a new pre-release containing the binaries is created as well, so people always have access to the latest version, compiled independently. Also, artifacts are uploaded, containing the unpacked resources, symbol files, and anything else generated during the compilation process.

You can also use the existing infrastructure to build a custom commit. For that, go to the build GitHub Actions page, click run workflow. On newer builds, specify only a commit number. On older builds, you can specify "x64" for Configuration, and "x64" for build directory.

Also, if you want to build this yourself on your local machine, then follow the instructions below. Also, you can consult the build.yml file to see how the automated process does it. If you encounter some issues when following the steps below, or should you want to find out more information and the latest tips from other users/me regarding how to pull this off, also consult the relevant thread in Discussions located here.

The following prerequisites are necessary in order to compile this project:

  • Microsoft C/C++ Optimizing Compiler - this can be obtained by installing either of these packages:

    • Visual Studio - this is a fully featured IDE; you'll need to check "C/C++ application development role" when installing. If you do not require the full suite, use the package below.
    • Build Tools for Visual Studio - this just installs the compiler, which you'll be able to use from the command line, or from other applications like CMake

    Download either of those here. The guide assumes you have installed either Visual Studio 2022 or Build Tools for Visual Studio 2022.

  • A recent version of the Windows SDK - for development, version 10.0.22621 is used (this may also be offered as an option when installing Visual Studio). The automated infrastructure usually uses the latest SDK available, currently 10.0.22621.

  • CMake - for easier usage, make sure to have it added to PATH during installation

  • Git - you can use Git for Windows, make sure to have it added to PATH during installation

  • nuget standalone or use Visual Studio

Steps:

  1. Clone git repo along with all submodules

    git clone --recursive https://github.com/valinet/ExplorerPatcher
    git submodule update --init --recursive
    

    If "git" is not found as a command, type its full path, or have its folder added to PATH, or open Git command window in the respective folder if using Git for Windows.

  2. Restore nuget packages by running this in the folder where the solution file is:

    nuget restore ExplorerPatcher.sln
    
  3. Compile dependencies by running BuildDependenciesRelease.bat or BuildDependenciesDebug.bat located in the root folder of the repository.

  4. Compile ExplorerPatcher

    • Double click the ExplorerPatcher.sln file to open the solution in Visual Studio. Choose Release and your processor architecture in the toolbar. Press [Ctrl]+[Shift]+[B] or choose "Build" - "Build solution" to compile.

    • Open "x64 Native Tools Command Prompt for VS 2022" or "ARM64 Native Tools Command Prompt for VS 2022" (search that in Start), go to folder containing solution file and type:

      • For x64 (Intel, AMD):

        msbuild ExplorerPatcher.sln /property:Configuration=Release /property:Platform=IA-32
        msbuild ExplorerPatcher.sln /property:Configuration=Release /property:Platform=amd64
        
      • For ARM64 (Snapdragon):

        msbuild ExplorerPatcher.sln /property:Configuration=Release /property:Platform=IA-32
        msbuild ExplorerPatcher.sln /property:Configuration=Release /property:Platform=arm64
        

    Debug builds mostly work as well, although they may have some quirks or issues. We mostly test the software as release builds.

    The resulting libraries will be in the "build\Release" or "build\Debug" folder in the directory containing the solution file.

  5. To generate an ep_setup.exe file suitable for uploading to an ExplorerPatcher update server (which means inserting the MD5 hash of ExplorerPatcher.amd64.dll in the setup program), after the build is completed, run this in the build folder:

    ep_setup_patch.exe
    

That's it. Later, if you want to recompile, make sure to update the repository and the submodules first:

git pull
git submodule update --init --recursive
Clone this wiki locally