[Insight-users] Feature Request: Adding "Debug" filename decorations to installed libraries

John Drescher drescherjm at gmail.com
Wed Sep 9 12:49:37 EDT 2009


On Wed, Sep 9, 2009 at 12:42 PM, Michael Jackson
<mike.jackson at bluequartz.net> wrote:
>
> On Sep 9, 2009, at 12:33 PM, John Drescher wrote:
>
>> On Wed, Sep 9, 2009 at 12:12 PM, Michael Jackson
>> <mike.jackson at bluequartz.net> wrote:
>>>
>>> Reading the recent thread "Speeding up the evaluation of the
>>> itk::Gaussian?"
>>> the original poster is going through some of the same trials and
>>> tribulations that I went through on Windows in the last month or so. The
>>> root of the problem with Visual Studio builds is that you can not combine
>>> a
>>> debug build of ITK with Release build of your own application/library.
>>> Doing
>>> this will cause all sorts of endless heartaches.
>>>
>>>  So what you can do is build ITK twice, once in Debug mode and once in
>>> Release mode. Install each to their own installation prefixes and now you
>>> have both. But the next problem is that with your own project you will
>>> need
>>> to have 2 separate CMake Build directories. One that has ITK_DIR pointing
>>> to
>>> the Debug ITK installation and the other build directory where the
>>> ITK_DIR
>>> points to the release build. This creates 2 VS Solution files and is kind
>>> of
>>> cumbersome to manage. Instead of just using the Drop down combo box in
>>> Visual Studio, I have to actually load up a completely separate solution
>>> file. This probably isn't the most efficient use of my time.
>>
>> You do not need separate binary builds for Release and Debug. I have
>> been building RelWithDebInfo and Debug builds in the same project for
>> over a year without a single problem. I do most of my GUI debugging in
>> Debug mode and most of my image processing in Release mode since Debug
>> mode is too slow. I use the Visual Stidio GUI batch build option to
>> build both Debug and RelWithDebInfo builds for ITK, VTK, GDCM and Qt.
>> For my own code I have CMake generate a install.bat file that builds
>> the two configurations using the command line interface to devenv.
>>
>> Here is an example install.bat.in file:
>>
>> devenv @PROJECT_BINARY_DIR@\@PROJECT_NAME at .sln /build Debug /project
>> INSTALL
>> devenv @PROJECT_BINARY_DIR@\@PROJECT_NAME at .sln /build
>> @RELEASE_BUILD_NAME@ /project INSTALL
>>
>> Then I have a main install.bat that calls the install.bat file for all
>> 6 of my dependent projects.
>>
>> x:\32Bit\VC.80>type install_la.bat
>> call Lung\CT_Imaging\Batch\install.bat
>> call Lung\BZ_Airway\Batch\install.bat
>> call Lung\SCP_LS\Batch\install.bat
>> call Lung\JPU_Lobe\Batch\install.bat
>> call Qt\QtbasicUtils\Batch\install.bat
>> call Qt\LungAnalysis\Batch\install.bat
>> x:\32Bit\VC.80>
>>
>> I execute this in two different Visual Studio Command prompts. One for
>> 64 bit one for 32 bit.
>>
>> John
>
> Hmm. Thanks for the info. How do you handle deploying your code to another
> machine that does not have any type of visual studio or prebuilt ITK/VTK
> libraries installed?
>

I only deploy the Release versions. Also, I build ITK and VTK as
static libraries although I do build Qt as .dlls. I have CPack
generate a NSIS installer that installs the main executable, Release
version, Qt dlls and the vc_redist.

IF(PACKAGE_FOR_INSTALL)

SET(CPACK_PACKAGE_VERSION_MAJOR ${LungAnalysis_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${LungAnalysis_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${LungAnalysis_VERSION_PATCH})

IF(CMAKE_CL_64)
     SET(CMAKE_MSVC_ARCH amd64)
   ELSE(CMAKE_CL_64)
     SET(CMAKE_MSVC_ARCH x86)
ENDIF(CMAKE_CL_64)

IF(MSVC80)

    FIND_PROGRAM(MSVC_REDIST NAMES
vcredist_${CMAKE_MSVC_ARCH}/vcredist_${CMAKE_MSVC_ARCH}.exe
      PATHS
      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../SDK/v2.0/BootStrapper/Packages/"
      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\8.0;InstallDir]/../../SDK/v2.0/BootStrapper/Packages/"
      )
    GET_FILENAME_COMPONENT(vcredist_name "${MSVC_REDIST}" NAME)
    INSTALL(PROGRAMS ${MSVC_REDIST} COMPONENT Runtime DESTINATION bin)
    SET(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "ExecWait
'\\\"$INSTDIR\\\\bin\\\\${vcredist_name}\\\"'")
ENDIF(MSVC80)

IF(WIN32)
	SET(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
	SET(CPACK_PACKAGE_EXECUTABLES "LungAnalysis" "Lung Analysis")

	INSTALL(FILES
			"${QT_LIBRARY_DIR}/QtCore${QT_VERSION_MAJOR}.dll"
			"${QT_LIBRARY_DIR}/QtXml${QT_VERSION_MAJOR}.dll"
			"${QT_LIBRARY_DIR}/QtTest${QT_VERSION_MAJOR}.dll"
			"${QT_LIBRARY_DIR}/QtGui${QT_VERSION_MAJOR}.dll"
			"${QT_LIBRARY_DIR}/QtNetwork${QT_VERSION_MAJOR}.dll"
			"${QT_LIBRARY_DIR}/QtScript${QT_VERSION_MAJOR}.dll"
			DESTINATION bin
			COMPONENT Applications
	)
ENDIF(WIN32)

set(CPACK_COMPONENTS_ALL Applications Runtime)

INCLUDE(CPack)
ENDIF(PACKAGE_FOR_INSTALL)


More information about the Insight-users mailing list