[cmake-developers] Visual Studio 2015 Makefile Project (GDB)

Cedric Perthuis cedric.perthuis at gmail.com
Sun Feb 7 19:01:47 EST 2016


Hi,

Visual studio has a new interesting extension which adds the project type
"Makefile Project (GDB)".

I am interested in exploring adding this project type to cmake, and
probably to the Visual Studio 2015 generator.

It's used to build and debug a program using GDB over an SSH connection,
it's mainly targeted at developing Linux programs from the Visual Studio
IDE. It doesn't include the build, it only hooks the build command of VS to
a user defined windows command. Up to that command to use SSH to execute
code on the target.

It's a VS 2015 NMake project type with 3 config files for build command,
run command, and SSH parameters. Some of the interesting parts of the
vcxproj

<PropertyGroup Label="Globals">
    <ApplicationType>LinuxDebugger</ApplicationType>
    <SecureShellExecutable>ssh</SecureShellExecutable>
    <RemoteDebuggerExecutable>gdb</RemoteDebuggerExecutable>
    <LocalDebuggerExecutable>gdb</LocalDebuggerExecutable>
    <ProjectGuid>{8E0AD268-B47B-4ED3-B9E0-F93E5CB1077B}</ProjectGuid>
  </PropertyGroup>

 <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label="Configuration">
    <ConfigurationType>Makefile</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>

 <PropertyGroup>

<UseDefaultDebuggersPropertyPageSchemas>false</UseDefaultDebuggersPropertyPageSchemas>
    <UseDefaultPropertyPageSchemas>false</UseDefaultPropertyPageSchemas>
    <_ApplicableDebuggers>Desktop</_ApplicableDebuggers>
    <DebuggerFlavor>LinuxDebugger</DebuggerFlavor>
  </PropertyGroup>

And the 3 config files:
  <ItemGroup>
    <None Include="Assets\LinuxDebugger.xaml" />
    <None Include="Assets\LocalDebugger.xaml" />
    <None Include="Assets\linux_nmake.xaml" />
  </ItemGroup>

Neither the project nor the config files include any source file (I am sure
we can add cpp files but they won't be associated with any compiler). The
project has slots for build and debug command. As a user you have to write
a build command which transfers of sources via SSH and do the compilation
yourself.

Here's an example of build command that the user can use

build.bat $(RemoteHostName) $(RemoteUserName) $(PrivateKey)
$(SecureShellExecutable) $(RemoteWorkingDirectory) $(RemoteExecutable)

The build.bat would be something along those lines:
"%SecureShellExecutable%" %RemoteUserName%@%RemoteHostName% -i
"%PrivateKey%" "mkdir -p %RemoteWorkingDirectory%"
"%SecureShellCopy%" -i "%PrivateKey%" source.cpp  %RemoteUserName%@
%RemoteHostName%:%RemoteWorkingDirectory%/source.cpp
"%SecureShellExecutable%" %RemoteUserName%@%RemoteHostName% -i
"%PrivateKey%" "cd %RemoteWorkingDirectory%;g++ -g source.cpp -o
%RemoteExecutable%"

Adding a generator for this is probably straightforward, but to respect the
format of the other cmake (and make it easier for the developer), I think
it should go further and also generate a linux makefile.

- the vs2015 generator can be augmented to create this new project type
- the linux makefile can already be generated from the makefile generator.

My question is what would be a good way to combine those 2. I was thinking
of trying to invoke the makefile generator from the vs2015 generator?

Any thoughts or advice?

Thanks,
Cedric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160207/56138bc1/attachment.html>


More information about the cmake-developers mailing list