From 77d3666adac324c796ec446fd21179bd8619b39a Mon Sep 17 00:00:00 2001 From: Leonardo Florez Valencia Date: Fri, 7 Oct 2016 09:22:38 -0500 Subject: [PATCH] Windows compilation: 3/3 --- appli/bash/Utility.h.in | 9 ++++----- cmake/DetectOS.cmake | 2 +- cmake/cpPluginsConfig.cmake.in | 1 - lib/cpExtensions/Visualization/ImageSliceMapper.cxx | 2 ++ lib/cpExtensions/Visualization/LUTImageActor.cxx | 2 +- lib/cpPlugins/Config.h.in | 9 +++++---- lib/cpPlugins/DataObjects/Image.cxx | 2 +- lib/cpPlugins/Interface/Plugins.cxx | 6 ++++++ 8 files changed, 20 insertions(+), 13 deletions(-) diff --git a/appli/bash/Utility.h.in b/appli/bash/Utility.h.in index a0bbb21..95c8be0 100644 --- a/appli/bash/Utility.h.in +++ b/appli/bash/Utility.h.in @@ -6,15 +6,14 @@ #include // ------------------------------------------------------------------------- -#ifdef @prj_NAME@_Windows +#define @prj_NAME_OS@ +#ifdef @prj_NAME_OS@ # define cpExtensions_STRTOK( A, B, N ) strtok_s( A, B, N ) # define cpExtensions_SPRINTF( B, S, O ) sprintf_s( B, S, "%s", O ); -# define -#else // @prj_NAME@_Windows +#else // @prj_NAME_OS@ # define cpExtensions_STRTOK( A, B, N ) std::strtok( A, B ) # define cpExtensions_SPRINTF( B, S, O ) std::sprintf( B, "%s", O ); -#endif // @prj_NAME@_Windows - +#endif // @prj_NAME_OS@ // ------------------------------------------------------------------------- namespace cpPlugins_bash diff --git a/cmake/DetectOS.cmake b/cmake/DetectOS.cmake index 42621f8..6f8abc6 100644 --- a/cmake/DetectOS.cmake +++ b/cmake/DetectOS.cmake @@ -17,7 +17,7 @@ ELSEIF("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") SET(prj_NAME_LIB_PREFIX "") SET(prj_NAME_LIB_EXT ".dll") SET(prj_NAME_ENV_SEPARATOR ";") - SET(prj_NAME_PATH_SEPARATOR "\\\\") + SET(prj_NAME_PATH_SEPARATOR "\\\\\\\\") ENDIF("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux") ## eof - $RCSfile$ diff --git a/cmake/cpPluginsConfig.cmake.in b/cmake/cpPluginsConfig.cmake.in index 5465875..4f79456 100644 --- a/cmake/cpPluginsConfig.cmake.in +++ b/cmake/cpPluginsConfig.cmake.in @@ -9,7 +9,6 @@ ENDIF("@Qt4_FOUND@" STREQUAL "TRUE") ## ==================== ## == Find libraries == ## ==================== - SET( _all_libs "@cpPlugins_tinyxml2_LIB@" diff --git a/lib/cpExtensions/Visualization/ImageSliceMapper.cxx b/lib/cpExtensions/Visualization/ImageSliceMapper.cxx index f510b51..5bf36fc 100644 --- a/lib/cpExtensions/Visualization/ImageSliceMapper.cxx +++ b/lib/cpExtensions/Visualization/ImageSliceMapper.cxx @@ -18,6 +18,7 @@ cpExtensions::Visualization::ImageSliceMapper:: ImageSliceMapper( ) : Superclass( ) { +#ifdef cpPlugins_OpenGL_BackEnd_OpenGL2 // Complete polydatas to avoid bizarre rendering errors (multi-thread) vtkActor* a[ 3 ]; a[ 0 ] = this->PolyDataActor; @@ -51,6 +52,7 @@ ImageSliceMapper( ) } // fi } // rof +#endif // cpPlugins_OpenGL_BackEnd_OpenGL2 } // ------------------------------------------------------------------------- diff --git a/lib/cpExtensions/Visualization/LUTImageActor.cxx b/lib/cpExtensions/Visualization/LUTImageActor.cxx index a022b30..d377215 100644 --- a/lib/cpExtensions/Visualization/LUTImageActor.cxx +++ b/lib/cpExtensions/Visualization/LUTImageActor.cxx @@ -86,7 +86,7 @@ GetLUTColor( void cpExtensions::Visualization::LUTImageActor:: SetLUTColor( unsigned int id, double r, double g, double b, double a ) { - if( id >= this->m_LUT->GetNumberOfTableValues( ) ) + if( id >= ( unsigned int )( this->m_LUT->GetNumberOfTableValues( ) ) ) this->m_LUT->SetNumberOfTableValues( id + 1 ); this->m_LUT->SetTableValue( id, r, g, b, a ); this->m_LUT->Modified( ); diff --git a/lib/cpPlugins/Config.h.in b/lib/cpPlugins/Config.h.in index dea43e5..1c0f106 100644 --- a/lib/cpPlugins/Config.h.in +++ b/lib/cpPlugins/Config.h.in @@ -16,14 +16,14 @@ #define @prj_NAME@_ENV_SEPARATOR "@prj_NAME_ENV_SEPARATOR@" #define @prj_NAME@_PATH_SEPARATOR "@prj_NAME_PATH_SEPARATOR@" -#ifdef @prj_NAME@_Windows +#ifdef @prj_NAME@_OS_Windows # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN # endif # define NOMINMAX # include # include -#endif +#endif // @prj_NAME@_OS_Windows /* * ========================================================================= @@ -53,6 +53,7 @@ #define @prj_NAME@_RELEASE_VERSION @prj_REL_VER@ #define @prj_NAME@_VERSION "@prj_VERSION@" #define @prj_NAME@_SHORT_VERSION "@prj_SHORT_VERSION@" +#define @prj_NAME@_OpenGL_BackEnd_@VTK_RENDERING_BACKEND@ /* * ========================================================================= @@ -67,12 +68,12 @@ # define @prj_NAME@_NOEXCEPT noexcept # define @prj_NAME@_HAS_CXX11_STATIC_ASSERT # define @prj_NAME@_HAS_CXX11_RVREF -#else +#else // __cplusplus >= 201103L # define @prj_NAME@_OVERRIDE # define @prj_NAME@_DELETE_FUNCTION # define @prj_NAME@_NULLPTR NULL # define @prj_NAME@_NOEXCEPT throw() -#endif +#endif // __cplusplus >= 201103L /* * ========================================================================= diff --git a/lib/cpPlugins/DataObjects/Image.cxx b/lib/cpPlugins/DataObjects/Image.cxx index da575bb..d7e26d4 100644 --- a/lib/cpPlugins/DataObjects/Image.cxx +++ b/lib/cpPlugins/DataObjects/Image.cxx @@ -21,7 +21,7 @@ SetITK( itk::LightObject* o ) void cpPlugins::DataObjects::Image:: SetVTK( vtkObjectBase* o ) { - vtkImageData* img = dynamic_cast< vtkImageData* >( img ); + vtkImageData* img = dynamic_cast< vtkImageData* >( o ); this->Superclass::SetVTK( img ); if( img == NULL ) { diff --git a/lib/cpPlugins/Interface/Plugins.cxx b/lib/cpPlugins/Interface/Plugins.cxx index b5f9269..42ab2cc 100644 --- a/lib/cpPlugins/Interface/Plugins.cxx +++ b/lib/cpPlugins/Interface/Plugins.cxx @@ -424,7 +424,13 @@ cpPlugins::Interface::Plugins:: Plugins( ) : Superclass( ) { +#ifdef cpPlugins_OS_Windows + char* p; + size_t size; + _dupenv_s( &p, &size, cpPlugins_PATHS ); +#else // cpPlugins_OS_Windows char* p = std::getenv( cpPlugins_PATHS ); +#endif // cpPlugins_OS_Windows std::stringstream str; if( p != NULL ) str << p << cpPlugins_ENV_SEPARATOR; -- 2.47.1