Skip to content

Instantly share code, notes, and snippets.

@neontorrent
Last active October 19, 2022 13:34
Show Gist options
  • Save neontorrent/7cddfbb999f186047620231d71ff70f7 to your computer and use it in GitHub Desktop.
Save neontorrent/7cddfbb999f186047620231d71ff70f7 to your computer and use it in GitHub Desktop.
MSYS2+cmake+MSVS+GTK3+VSCode
MSYS2:
pacman -S base-devel mingw64/mingw-w64-x86_64-cmake mingw-w64-x86_64-gtk3 mingw-w64-x86_64-gtkmm3 mingw-w64-x86_64-pkg-config
#Optional: pacman -S mingw-w64-x86_64-glade
#In .bashrc
export PATH=/mingw64/bin:$PATH
export PKG_CONFIG_PATH=/mingw64/lib/pkgconfig
Compiler:
Option 1: Use MSYS2 GCC
pacman -S mingw-w64-x86_64-gcc
Option 2: Use MSVS (Compiler Only) from:
https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017
VSCode:
1. Install C/C++ Extension
2. Add to settings.json:
"terminal.integrated.shell.windows": "DRIVE:\\PATH_TO\\msys64\\usr\\bin\\bash.exe",
"terminal.integrated.env.windows": {
"MSYSTEM": "MSYS2",
"MSYS2_PATH_TYPE": "inherit"
},
"C_Cpp.default.includePath": [
"D:\\Applications\\msys64\\mingw64\\include\\gtkmm-3.0",
"D:\\Applications\\msys64\\mingw64\\lib\\gtkmm-3.0\\include",
"D:\\Applications\\msys64\\mingw64\\include\\glibmm-2.4",
"D:\\Applications\\msys64\\mingw64\\include\\atkmm-1.6 ",
"D:\\Applications\\msys64\\mingw64\\include\\gdkmm-3.0 ",
"D:\\Applications\\msys64\\mingw64\\lib\\gdkmm-3.0\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\giomm-2.4 ",
"D:\\Applications\\msys64\\mingw64\\lib\\giomm-2.4\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\pangomm-1.4 ",
"D:\\Applications\\msys64\\mingw64\\lib\\pangomm-1.4\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\glibmm-2.4 ",
"D:\\Applications\\msys64\\mingw64\\lib\\glibmm-2.4\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\gtk-3.0 ",
"D:\\Applications\\msys64\\mingw64\\include\\cairo ",
"D:\\Applications\\msys64\\mingw64\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\pango-1.0 ",
"D:\\Applications\\msys64\\mingw64\\include\\fribidi ",
"D:\\Applications\\msys64\\mingw64\\include\\atk-1.0 ",
"D:\\Applications\\msys64\\mingw64\\include\\cairo ",
"D:\\Applications\\msys64\\mingw64\\include\\cairomm-1.0 ",
"D:\\Applications\\msys64\\mingw64\\lib\\cairomm-1.0\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\cairo ",
"D:\\Applications\\msys64\\mingw64\\include\\pixman-1 ",
"D:\\Applications\\msys64\\mingw64\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\freetype2 ",
"D:\\Applications\\msys64\\mingw64\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\harfbuzz ",
"D:\\Applications\\msys64\\mingw64\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\libpng16 ",
"D:\\Applications\\msys64\\mingw64\\include\\sigc++-2.0 ",
"D:\\Applications\\msys64\\mingw64\\lib\\sigc++-2.0\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\gdk-pixbuf-2.0 ",
"D:\\Applications\\msys64\\mingw64\\include\\libpng16 ",
"D:\\Applications\\msys64\\mingw64\\include ",
"D:\\Applications\\msys64\\mingw64\\include\\glib-2.0 ",
"D:\\Applications\\msys64\\mingw64\\lib\\glib-2.0\\include ",
"D:\\Applications\\msys64\\mingw64\\include",
],
3. Set up project. Go to project root, and run:
mkdir build
cd build
cmake ..
#For GCC, use `cmake -G"MSYS Makefiles" ..`
#If cmake complains no package found, try add `-DCMAKE_PREFIX_PATH=/mingw64/lib` to cmake command
4. Add the debug and build task json files to .vscode folder
5. Run build tasks, and/or Debug
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceFolder}/build/Debug/anyflow.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"preLaunchTask": "build-debug"
}
]
}
{
"version": "2.0.0",
"tasks": [{
"label": "build-debug",
"command": "/mingw64/bin/cmake --build build --config debug",
"type": "shell",
"group": "build",
"presentation": {
"reveal": "silent"
},
"problemMatcher": "$msCompile"
}]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment