As discussed at the mitk users meeting, here is our solution how we run different builds from within VS.

I have attached a patch how we accomplished it in mitk. We use it for our own application and I just recreated it to work with the workbench.

If you want it to work only for the workbench but more projects it has to be extended. But I think you know better how to integrate it into your cmake.

Best regards
Florian

--
Florian Jung
Department Visual Healthcare Technologies

Fraunhofer-Institute for Computer Graphics Research IGD
Fraunhoferstr. 5, 64283 Darmstadt, Germany

phone:  +49.6151.155.520
fax:    +49.6151.155.480
email:  florian.j...@igd.fraunhofer.de
web:    http://www.igd.fraunhofer.de

From 0ea7e8678049e05590cb545903c92ddea50532a3 Mon Sep 17 00:00:00 2001
From: FJung <florian.j...@igd.fraunhofer.de>
Date: Tue, 3 May 2016 11:35:50 +0200
Subject: [PATCH] Add: Mitk workbench can now be run
 release/debug/releaseWDebug from within visual studio without having to
 restart VS with the opposite .bat Can be adapted to any other Mitk project
 usual.

---
 CMake/MITK.vcxproj.user.in | 15 +++++++++++++++
 CMakeLists.txt             | 22 +++++++++++++++++-----
 2 files changed, 32 insertions(+), 5 deletions(-)
 create mode 100644 CMake/MITK.vcxproj.user.in

diff --git a/CMake/MITK.vcxproj.user.in b/CMake/MITK.vcxproj.user.in
new file mode 100644
index 0000000..60e696e
--- /dev/null
+++ b/CMake/MITK.vcxproj.user.in
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" 
xmlns="http://schemas.microsoft.com/developer/msbuild/2003";>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    
<LocalDebuggerEnvironment>PATH=@MITK_RUNTIME_PATH_REL@;@CUSTOM_RUNTIME_PATH@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\@VS_BUILD_TYPE_REL@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\plugins\@VS_BUILD_TYPE_REL@;%PATH%</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup 
Condition="'$(Configuration)|$(Platform)'=='RelWithDebInfo|x64'">
+    
<LocalDebuggerEnvironment>PATH=@MITK_RUNTIME_PATH_RELDEB@;@CUSTOM_RUNTIME_PATH@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\@VS_BUILD_TYPE_RELDEB@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\plugins\@VS_BUILD_TYPE_RELDEB@;%PATH%</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    
<LocalDebuggerEnvironment>PATH=@MITK_RUNTIME_PATH_DEB@;@CUSTOM_RUNTIME_PATH@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\@VS_BUILD_TYPE_DEB@;@CMAKE_RUNTIME_OUTPUT_DIRECTORY@\plugins\@VS_BUILD_TYPE_DEB@;%PATH%</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+</Project>
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 214226c..b16a64a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1361,11 +1361,23 @@ if(WIN32)
     list(APPEND MITK_LIBRARY_DIRS ${HDF5_DIR}/install/bin)
     message(STATUS "MITK-Runtime " ${MITK_RUNTIME_PATH})
   endif(MITK_USE_HDF5)
-  foreach(VS_BUILD_TYPE debug release)
-    
mitkFunctionCreateWindowsBatchScript("${MITK_SOURCE_DIR}/CMake/StartVS.bat.in"
-      ${PROJECT_BINARY_DIR}/StartVS_${VS_BUILD_TYPE}.bat
-      ${VS_BUILD_TYPE})
-  endforeach()
+  # foreach(VS_BUILD_TYPE debug release)
+    # 
mitkFunctionCreateWindowsBatchScript("${MITK_SOURCE_DIR}/CMake/StartVS.bat.in"
+      # ${PROJECT_BINARY_DIR}/StartVS_${VS_BUILD_TYPE}.bat
+      # ${VS_BUILD_TYPE})
+  # endforeach()
+  
+set(VS_SOLUTION_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.sln")
+CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/CMake/StartVS.bat.in" 
${PROJECT_BINARY_DIR}/StartVS.bat @ONLY) 
+SET(VS_BUILD_TYPE_DEB debug)
+SET(VS_BUILD_TYPE_REL release)
+SET(VS_BUILD_TYPE_RELDEB relwithdebinfo)  
+mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_DEB ${VS_BUILD_TYPE_DEB})
+mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_REL ${VS_BUILD_TYPE_REL})
+mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_RELDEB 
${VS_BUILD_TYPE_RELDEB})
+CONFIGURE_FILE("${PROJECT_SOURCE_DIR}/CMake/MITK.vcxproj.user.in" 
${PROJECT_BINARY_DIR}/Applications/Workbench/MitkWorkbench.vcxproj.user @ONLY)
+  
+  
 endif(WIN32)
 
 
-- 
2.7.1.windows.2

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
mitk-users mailing list
mitk-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to