Using VSCode as IDE for Synfig Development on Windows
Step 1: Setup Environment
Setup your environment as described here:
This includes:
- Installing and setting up MSYS2
- Cloning the repository
- Running the setup script
Step 2: Build Synfig
Follow the build instructions here:
The default build directory is:
cmake-build/
This directory contains all generated build files (Ninja files, binaries, cache, etc.).
It is safe to delete this folder anytime to reset the build.
Once you are able to successfully build Synfig, proceed to VSCode setup.
Step 3: Install Required Extensions
Install one of the following:
Option 1: C/C++
Option 2: Extension Pack (Recommended)
Step 4: Select CMake Kit
When opening the synfig.git repo for the first time, VSCode will prompt you to select a CMake Kit.
Choose a kit that uses the MinGW64 compiler from MSYS2.
It should point to:
C:\msys64\mingw64\bin\gcc.exe
Example:
GCC (MinGW64)
Avoid selecting kits that point to:
- MSYS environment
- UCRT toolchains
Step 5: Configure CMake Arguments
If you encounter issues during CMake configuration, add:
VSCode → Settings → CMake: Configure Args
-DMSYS=1
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON //optional for IntelliSense see Step 6
Step 6: IntelliSense Setup using compile_commands.json
To enable accurate IntelliSense, ensure the following flag is used:
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
After running CMake, the file will be generated at:
cmake-build/compile_commands.json
This allows VSCode to correctly understand:
- Include directories
- Compilation flags
- File dependencies
If IntelliSense does not update:
C/C++: Reset IntelliSense Database
Step 7: Configure c_cpp_properties.json
Once compile_commands.json is generated, configure:
{
"configurations": [
{
"name": "Win32",
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"compileCommands": "C:/msys64/home/username/synfig.git/cmake-build/compile_commands.json",
"compilerPath": "C:\\msys64\\mingw64\\bin\\gcc.exe",
"cStandard": "c11",
"cppStandard": "gnu++14",
"intelliSenseMode": "clang-x64"
}
],
"version": 4
}
Step 8: Configure Debugger (launch.json)
{
"name": "[MSYS2] Debug Synfig Studio",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/cmake-build/output/Debug/bin/synfigstudio.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
You can now:
- Run the debugger
- Add breakpoints
- Inspect variables
Step 9: Using VSCode CMake Commands
You can run build and debug commands directly from VSCode:
Open Command Palette (Ctrl + Shift + P) and use:
CMake: Configure
CMake: Build
CMake: Debug
If you encounter issues or have suggestions for improvement, feel free to share them so this guide can be refined further. And then after some validations from new users, we can add it to the official wiki.
And maybe these tasks.json and c_cpp_properties.json can be commited to the code so that new developers can have out the box setup, smoothing their onboarding experience.