-
Notifications
You must be signed in to change notification settings - Fork 43
Windows configuration with MSYS2 and VS Code
This guide will walk you through the necessary steps to compile the game on Windows. There's also an optional part to configure the VS Code editor in order to have autocompletion. I will assume you have a 64-bits version of Windows.
-
Download MSYS2 here. Install it wherever you want (for example, I installed it in
C:\Users\Olivier\tools\msys64). -
Run MSYS2 and install the following packages:
mingw-w64-x86_64-gcc,mingw-w64-x86_64-makeandmingw-w64-x86_64-sfml(note that the SFML version should be 2.5.1). You can do that with the following commands:pacman -S mingw-w64-x86_64-gcc pacman -S mingw-w64-x86_64-make pacman -S mingw-w64-x86_64-sfml -
Add the
mingw64\bindirectory to yourPATH(for example, I addedC:\Users\Olivier\tools\msys64\mingw64\bin).
- Download CMake here. Take the version "Windows win64-x64 Installer".
- During the installation, check the option to add the CMake command to your
PATH. - To check that CMake is correctly installed, open a command prompt and type
cmake --version.
-
Download OpMon source, and run CMake within the project directory:
cmake . -G "MinGW Makefiles"Or, if you want a debug build:
cmake . -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug -
Run the following command to compile:
cmake --build . -
Copy the
GameDatadirectory right next to the generated executable (so inOpMon/bin/release). -
You can now launch the game.
This step is optionnal, but it will allow you to have autocompletion in VS Code.
- Install the C/C++ extension for VS Code here.
- In the OpMon project, create a
.vscodedirectory (if it doesn't already exist) and create a file namedc_cpp.properties.jsonin this directory (so it should look likeOpMon\.vscode\c_cpp_properties.json). - Here is an example
c_cpp_properties.json. You should tweak this file according to your installation.
{
"configurations": [
{
"browse": {
"path": [
"${workspaceRoot}",
"C:\\Users\\Olivier\\tools\\msys64\\mingw64\\include",
"C:\\Users\\Olivier\\tools\\msys64\\mingw64\\x86_64-w64-mingw32\\include"
]
},
"compilerPath": "C:\\Users\\Olivier\\tools\\msys64\\mingw64\\bin\\g++.exe",
"cppStandard": "c++17",
"cStandard": "c11",
"includePath": [
"${workspaceRoot}",
"C:\\Users\\Olivier\\tools\\msys64\\mingw64\\include",
"C:\\Users\\Olivier\\tools\\msys64\\mingw64\\x86_64-w64-mingw32\\include"
],
"intelliSenseMode": "gcc-x64",
"name": "OpMon",
"compileCommands": "${workspaceFolder}/compile_commands.json"
}
],
"version": 4
}IntelliSense mays give you the following warning:
IntelliSense: PCH warning: cannot find a suitable header stop location. An intellisense PCH file was not generated.In that case, you can try to add the parameter"C_Cpp.intelliSenseCacheSize": 0in VS Code settings.
OpMons (creatures)