← Back to team overview

kicad-developers team mailing list archive

Re: Using Visual Studio 2017 CE for KiCad development

 

Here's an updated Cmakesettings.json for Debug and Release.
And a launch.vs.json you put into the /.vs/ folder that VS creates. Then
you can debug with gdb in VS. (It adds launch entries with the correct
config)
Only thing, if you want to debug any kiface program like eeschema or
pcbnew, you must set a breakpoint in corresponding OnKifaceStart first (and
just step over on start). The kiface system confuses VS and without that
breakpoint, its unable to see the rest of the files are loaded to alow
setting breakpoints graphically.

On Sun, Aug 19, 2018 at 9:17 AM Mark Roszko <mark.roszko@xxxxxxxxx> wrote:

> Nice. I tried using the VS Cmake support a long time ago when it was
> initially released but still buggy. Great you got it fully working!
> Honestly as nice as CLion can be, VS completely blows it away.
>
> Personally I would consider using a build and install root of
>
>
>       "buildRoot": "${workspaceRoot}\\build\\${name}",
>       "installRoot": "${workspaceRoot}\\install\\${name}",
>
> so it doesn't get buried in your user root and you end up wondering,
> months later, where all your disk space went.
>
> This should be considered for commiting into the source tree. It doesn't
> alter the source and still builds under msys.
>
>
> On Sun, Aug 19, 2018 at 6:05 AM Andrew Lutsenko <anlutsenko@xxxxxxxxx>
> wrote:
>
>> Hi all,
>>
>> I've managed to get KiCad code base to build in VS 2017 and more
>> importantly be parsed
>> by intellisense. Thought I'd share the config for other windows devs.
>>
>> I've been using Atom so far with relative success but it's not great.
>> Decided to try if KiCad can
>> be worked on in real IDE with contextual autocomplete that works.
>>
>> MS has been investing in building support in Visual Studio for non ms
>> build systems. GCC,
>> clang, cmake, non x86 targets, all of this has been coming along in
>> recent releases.
>> Not everything works like in ms build projects, but it's still miles
>> ahead of generic text editors.
>>
>> Prerequisite: have msys2 windows environment with working KiCad build.
>>
>> Get VS 15.8.0 or later. I've tested this on 15.8.1 community edition
>> preview. (It's free).
>>
>> Install additional components:
>> Linux development with C++
>> Visual C++ tools for CMake and Linux
>>
>> Then open VS and go to File -> Open... -> CMake...
>> select CMakeLists.txt in KiCad src root.
>>
>> Next go to CMake -> Change CMake Settings -> CMakeLists.txt
>> In popup window choose Mingw64 Release (or Debug)
>> A file named CMakeSettings.json will be created and you have to tweak a
>> few things.
>> I've attached my CMakeSettings.json for reference but the important bits
>> are:
>>
>> configurations.environments.MINGW64_ROOT - this is path to your mingw64
>> folder
>> configurations.environments.FLAVOR - mingw flavor, I use
>> x86_64-w64-mingw32
>> configurations.environments.TOOLSET_VERSION should be autodetected, if
>> not check
>>     mingw64\lib\gcc\x86_64-w64-mingw32 folder for version. It's 7.3.0 for
>> me
>> configurations.environments.INCLUDE - add ${env.MINGW64_ROOT}\\include to
>> the list
>> configurations.generator - I set it to "MSYS Makefiles" and VS frowns on
>> it but it works.
>>     Maybe "Unix Makefiles" work too, I didn't check.
>> configurations.cmakeCommandArgs - this is the tricky one that I had to do
>> trial and error
>>    dance with a lot and also read cmake find rules that don't always
>> work. I found this
>>    combination to do the job:
>>    "-DCMAKE_PREFIX_PATH=${env.MINGW64_ROOT} -DMINGW:STRING=TRUE
>>     -DMSYS:STRING=TRUE -DCYGWIN:STRING=TRUE
>>     -DOPENGL_INCLUDE_DIR=${env.MINGW64_ROOT}\\include",
>> configurations.buildCommandArgs - remove the "-v" that VS puts there, it
>> just prints version
>>     for make. I put "-j6" instead to speed up the build.
>> configurations.intelliSenseMode - VS should auto fill this to
>> "linux-gcc-x64"
>>
>> Remaining configs can be left default, or you can tweak them to your
>> taste.
>>
>> After you save the CMakeSettings.json VS will automatically regenerate
>> CMake cache.
>> Go to CMake menu and you can build all targets or specific ones from
>> there.
>> In my case intellisense only picked up cache after I did full build, so
>> maybe it is required
>> to do at least once.
>>
>> But result is so worth it:
>>
>> [image: intellisense.png]
>>
>> Hope this helps!
>>
>> Regards,
>> Andrew
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
>>
>
>
> --
> Mark
>


-- 
Mark

PNG image

Attachment: CMakeSettings.json
Description: application/json

Attachment: launch.vs.json
Description: application/json


Follow ups

References