Skip to content

Instantly share code, notes, and snippets.

@phit
Last active September 8, 2021 18:59
Show Gist options
  • Save phit/22744fcaf09b3814fe2765dbf5822681 to your computer and use it in GitHub Desktop.
Save phit/22744fcaf09b3814fe2765dbf5822681 to your computer and use it in GitHub Desktop.
MultiMC Windows Development

MultiMC Windows Development

Note this worked for me your mileage may vary, if you need any assistance join the MultiMC Discord server. https://discord.gg/multimc

Requirements

For everything else I used aqtinstall since the QT Installer is terrible.

I put all the tools in my F:\ drive, please ajust all paths below accordingly to your choice.

python -m aqt install -O f:\Qt 5.15.2 windows desktop win32_mingw81
python -m aqt tool -O f:\Qt windows tools_mingw 8.1.0-1-202004170606 qt.tools.win32_mingw810
python -m aqt tool -O f:\Qt windows tools_openssl_x86 1.1.1-10 qt.tools.openssl.win_x86

you can find the versions here http://master.qt.io/online/qtsdkrepository/windows_x86/desktop/

Add F:\Qt\Tools\mingw810_32\bin and F:/Qt/Tools/OpenSSL/Win_x86/bin to your Windows Path

VSCode

Open the MultiMC folder you cloned and create a new file called .vscode/extensions.json

{
    "recommendations": [
        "ms-vscode.cmake-tools",
        "twxs.cmake",
        "ms-vscode.cpptools-themes",
        "ms-vscode.cpptools",
        "jeff-hykin.better-cpp-syntax"
    ]
}

When prompted install the extensions, and possibly restart VSCode.

Open the Command Palette (Ctrl+Shift+P or F1) and run "CMake: Scan for Kits", it should find Qt's MinGW, if not restart VSCode and double check your PATH setup. You can list found kits via "CMake: Select a Kit"

Then setup a .vscode/settings.json with all the paths

{
  "cmake.configureOnOpen": true,
  "terminal.integrated.env.windows": {
    "PATH": "F:/Qt/5.15.2/mingw81_32/bin;F:/Qt/Tools/OpenSSL/Win_x86/bin;${env:PATH}"
  },
  "cmake.configureSettings": {
    "CMAKE_PREFIX_PATH": "F:/Qt/5.15.2/mingw81_32",
    "CMAKE_INSTALL_PREFIX": "build-target"
  }
}

Now you can run "CMake: Configure", if you run into any errors at this point doublecheck all the paths.

To build make sure to select the right task (install) in the bottom bar, and click the button next to it.

image

After it's done go to After Building

Commandline

Make the build directory and run the build, note the last three flags and adjust them according to your setup

"C:\Program Files (x86)\CMake\bin\cmake.EXE" 
-DCMAKE_PREFIX_PATH:STRING=F:/Qt/5.15.2/mingw81_32 
-DCMAKE_INSTALL_PREFIX:STRING=../build-target 
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE 
-DCMAKE_C_COMPILER:FILEPATH=F:\Qt\Tools\mingw810_32\bin\i686-w64-mingw32-gcc.exe 
-DCMAKE_CXX_COMPILER:FILEPATH=F:\Qt\Tools\mingw810_32\bin\i686-w64-mingw32-g++.exe 
-G "MinGW Makefiles" 
-DCMAKE_BUILD_TYPE:STRING=Debug 
-Hd:/git/MultiMC5 
-Bd:/git/MultiMC5/build

Now you can start the compilation, replace the 4 at the end with the number of CPU cores available to you.

"C:\Program Files (x86)\CMake\bin\cmake.EXE" --build d:/git/MultiMC5/build --config Debug --target install -j 4 --

After it's done go to After Building

After Building

After the build is completed you should have a MultiMC.exe to test in the build-target folder.

You also need those files that are not part of the build to launch it.

xcopy "F:\Qt\Tools\mingw810_32\opt\bin\ssleay32.dll" .\build-target\
xcopy "F:\Qt\Tools\mingw810_32\opt\bin\libeay32.dll" .\build-target\
xcopy "F:\Qt\5.15.2\mingw81_32\plugins\platforms\qwindows.dll" .\build-target\platforms\
xcopy "F:\Qt\Tools\OpenSSL\Win_x86\bin\libssl-1_1.dll" .\build-target\
xcopy "F:\Qt\Tools\OpenSSL\Win_x86\bin\libcrypto-1_1.dll" .\build-target\

keywords: windows build development multimc cmake

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment