I did some experiments, and I think it's a bit easier than I thought. I
don't think I need to generate the linux makefile from the Visual Studio
generator on windows. I would just add few new cmake options for the Visual
Studio GDB project type and among those the "build command" option.
And as a user, in the build command option, I can simply execute a script
on the target which calls cmake there to generate the makefile and then
call make.

On Sun, Feb 7, 2016 at 4:01 PM, Cedric Perthuis <[email protected]>
wrote:

> 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
>
>
>
>
>
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to