caseymcc / CreateLaunchers

CMake module for creating batch/shell scripts and Visual Studio user file for launching your application.
Other
6 stars 3 forks source link

Remote debugging target #4

Open haferburg opened 4 years ago

haferburg commented 4 years ago

Hey there. I just found your project, finally CreateLaunchers is compatible with newer CMake versions. Thank you!

If you're interested, I added a REMOTE flag to create_target_launcher() to configure targets intended for remote debugging. I won't make it a PR, it's just a couple of lines changed:

diff --git a/CreateLaunchers.cmake b/CreateLaunchers.cmake
index ae9fcd46..a839fc2b 100644
--- a/CreateLaunchers.cmake
+++ b/CreateLaunchers.cmake
@@ -12,6 +12,7 @@
 #
 #  create_target_launcher(<targetname>
 #    [COMMAND <target command>]
+#    [REMOTE]
 #    [ARGS <args...>]
 #    [FORWARD_ARGS]
 #    [RUNTIME_LIBRARY_DIRS <dir...>]
@@ -121,7 +122,7 @@ macro(_launcher_process_args)
         WORKING_DIRECTORY
         ENVIRONMENT
         TARGET_PLATFORM)
-    set(_bool_args FORWARD_ARGS)
+    set(_bool_args FORWARD_ARGS REMOTE)
     foreach(_arg ${_val_args} ${_bool_args})
         set(${_arg})
     endforeach()
@@ -226,8 +227,13 @@ macro(_launcher_produce_vcproj_user)
     if(MSVC)
         set(CMAKEFILES_PATH "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles")
         set(TARGET_CMAKE_FILES "${CMAKEFILES_PATH}/${_targetname}")
+        if (REMOTE)
+          set(_perconfig_suffix "_remote")
+        else()
+          set(_perconfig_suffix "")
+        endif()
         file(READ
-            "${_launchermoddir}/perconfig.${VCPROJ_TYPE}.user.in"
+            "${_launchermoddir}/perconfig${_perconfig_suffix}.${VCPROJ_TYPE}.user.in"
             _perconfig)

         #generator expressions do not play well with ">"
diff --git a/launcher-templates/perconfig_remote.vcxproj.user.in b/launcher-templates/perconfig_remote.vcxproj.user.in
new file mode 100644
index 00000000..94a2bd27
--- /dev/null
+++ b/launcher-templates/perconfig_remote.vcxproj.user.in
@@ -0,0 +1,8 @@
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='@USERFILE_CONFIGNAME@|@USERFILE_PLATFORM@'">
+    <DebuggerFlavor>WindowsRemoteDebugger</DebuggerFlavor>
+    <RemoteDebuggerCommand>$(RemoteDebuggingDirectory)\$(TargetFileName)</RemoteDebuggerCommand>
+    <RemoteDebuggerServerName>$(RemoteDebuggingTarget)</RemoteDebuggerServerName>
+    <RemoteDebuggerWorkingDirectory>$(RemoteDebuggingDirectory)</RemoteDebuggerWorkingDirectory>
+    <RemoteDebuggerCommandArguments>@USERFILE_COMMAND_ARGUMENTS@</RemoteDebuggerCommandArguments>
+    <RemoteDebuggerConnection>RemoteWithoutAuthentication</RemoteDebuggerConnection>
+  </PropertyGroup>
-- 
caseymcc commented 4 years ago

Will look into this as I might be using the remote option sometime soon. Likely need to add a few more options to set remote server name/authentication/etc...

rpavlik commented 4 years ago

pretty cool! You're welcome to submit this "upstream" - I finally merged @caseymcc 's changes. https://github.com/rpavlik/cmake-modules