From 0ec2144d3569d045ee5dfe886e3db723f400225a Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 9 Sep 2021 12:53:42 +0200 Subject: [PATCH] #3227 vtk8itk4wx3-mingw64 MACOS --- cmake/CREAMacro_FindAndUseLibraries.cmake | 42 ++++++++++++------- cmake/CREAMacro_FindAndUseVTK.cmake | 24 ++++++----- cmake/CREAMacro_FindAndUseWt.cmake | 12 +++++- cmake/CREAMacro_FindAndUseWxWidgets.cmake | 50 +++++++++++------------ src/CMakeLists.txt | 2 + src/creaRTTI.cxx | 3 +- src/creaVtk_MACROS.h | 13 ++++++ src/creawxVTKRenderWindowInteractor.mm | 28 ++++--------- 8 files changed, 99 insertions(+), 75 deletions(-) diff --git a/cmake/CREAMacro_FindAndUseLibraries.cmake b/cmake/CREAMacro_FindAndUseLibraries.cmake index eb8b24a..e5e57ba 100644 --- a/cmake/CREAMacro_FindAndUseLibraries.cmake +++ b/cmake/CREAMacro_FindAndUseLibraries.cmake @@ -96,6 +96,7 @@ ENDIF(USE_KWWIDGETS) # #----------------------------------------------------------------------------- + IF(USE_ITK) IF(NOT ITK_FOUND) # Search ITK @@ -110,14 +111,12 @@ IF(USE_ITK) INCLUDE(${ITK_USE_FILE}) CREA_DEFINE( USE_ITK ) CREA_DEFINE( _USE_ITK_ ) - If (${ITK_VERSION_MAJOR} MATCHES "4") - MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}") - SET(ITK_LIBRARIES - ${ITK_LIBRARIES}) - MESSAGE ( STATUS "${ITK_LIBRARIES}") + If (${ITK_VERSION_MAJOR} MATCHES "4" OR ${ITK_VERSION_MAJOR} MATCHES "5" ) + MESSAGE ( STATUS "* Version = ${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}") + SET(ITK_LIBRARIES ${ITK_LIBRARIES}) + MESSAGE ( STATUS "${ITK_LIBRARIES}") ELSEIF() - SET(ITK_LIBRARIES - ITKCommon ITKIO ITKBasicFilters ITKAlgorithms) + SET(ITK_LIBRARIES ITKCommon ITKIO ITKBasicFilters ITKAlgorithms) ENDIF() MARK_AS_ADVANCED(ITK_DIR) ELSE(ITK_FOUND) @@ -328,10 +327,15 @@ IF(USE_BOOST) add_definitions( -DBOOST_ALL_NO_LIB ) add_definitions( -DBOOST_ALL_DYN_LINK ) IF (MINGW) - FIND_PACKAGE(Boost COMPONENTS filesystem-mgw71 system-mgw71 signals-mgw71 date_time-mgw71 thread-mgw71 regex-mgw71 program_options-mgw71 REQUIRED) + IF(APPLE) + FIND_PACKAGE(Boost COMPONENTS filesystem-mgw71 system-mgw71 signals-mgw71 date_time-mgw71 thread-mgw71 regex-mgw71 program_options-mgw71 REQUIRED) + ELSE(APPLE) + set( Boost_INCLUDE_DIR $ENV{BOOST_ROOT}/include/boost-1_69) + FIND_PACKAGE(Boost COMPONENTS filesystem-mgw73-mt-x64-1_69 system-mgw73-mt-x64-1_69 date_time-mgw73-mt-x64-1_69 thread-mgw73-mt-x64-1_69 regex-mgw73-mt-x64-1_69 program_options-mgw73-mt-x64-1_69 REQUIRED) + ENDIF(APPLE) ELSE (MINGW) # FIND_PACKAGE(Boost COMPONENTS filesystem system signals date_time thread regex program_options REQUIRED) - FIND_PACKAGE(Boost COMPONENTS filesystem system date_time thread regex program_options REQUIRED) + FIND_PACKAGE(Boost COMPONENTS filesystem system date_time thread regex program_options REQUIRED) ENDIF(MINGW) IF(Boost_FOUND) ADD_DEFINITIONS(-DBOOST_FILESYSTEM_VERSION=3) @@ -416,11 +420,21 @@ IF(USE_XERCES) ENDIF(NOT XERCES_LIB_DIR) - IF(USE_DEBUG_LIB) - set(XERCES_LIBRARIES xerces-c_3D) - ELSE(USE_DEBUG_LIB) - set(XERCES_LIBRARIES xerces-c_3) - ENDIF(USE_DEBUG_LIB) + IF(APPLE) + IF(USE_DEBUG_LIB) + set(XERCES_LIBRARIES xerces-c_3D) + ELSE(USE_DEBUG_LIB) + set(XERCES_LIBRARIES xerces-c_3) + ENDIF(USE_DEBUG_LIB) + ELSEIF(APPLE) + IF(USE_DEBUG_LIB) + #EED 2019-07-03 set(XERCES_LIBRARIES xerces-c_3D) + set(XERCES_LIBRARIES xerces-c) + ELSE(USE_DEBUG_LIB) + #EED 2019-07-03 set(XERCES_LIBRARIES xerces-c_3) + set(XERCES_LIBRARIES xerces-c) + ENDIF(USE_DEBUG_LIB) + ENDIF(APPLE) MARK_AS_ADVANCED(XERCES_LIB_DIR) ENDIF(WIN32) diff --git a/cmake/CREAMacro_FindAndUseVTK.cmake b/cmake/CREAMacro_FindAndUseVTK.cmake index 2b889d9..7d1518c 100644 --- a/cmake/CREAMacro_FindAndUseVTK.cmake +++ b/cmake/CREAMacro_FindAndUseVTK.cmake @@ -38,8 +38,6 @@ MACRO(CREA_FIND_AND_USE_VTK) MESSAGE ( STATUS "Looking for VTK... found") MESSAGE ( STATUS "* Dir = ${VTK_DIR}") MESSAGE ( STATUS "* Version = ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}") - - SET(VTK_BUILD_SETTINGS_FILE OFF) INCLUDE(${VTK_USE_FILE}) LINK_DIRECTORIES(${VTK_DIR}) #DFCH -- 16/7/2012 @@ -53,6 +51,8 @@ MACRO(CREA_FIND_AND_USE_VTK) #MESSAGE("${GTK2_INCLUDE_DIRS}") INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS}) LINK_LIBRARIES(${GTK2_LIBRARIES}) +message("EED CREAMacro_FindAndUseVTK.cmake GTK2_INCLUDE_DIRS "${GTK2_INCLUDE_DIRS} ) +message("EED CREAMacro_FindAndUseVTK.cmake GTK2_VERSION "${GTK2_VERSION} ) # Can I require all my user to have the gl lib on linux, even if they do not really need it... SET(WXGLCANVASLIBS "gl") ENDIF(VTK_USE_GL2PS) @@ -63,14 +63,14 @@ MACRO(CREA_FIND_AND_USE_VTK) ##EED 2017-01-01 Migration VTK7 IF("${VTK_MAJOR_VERSION}" LESS 6) SET(VTK_LIBRARIES - vtkCommon # Mandatory - vtkFiltering # vtkImageData - vtkRendering # vtkProp3D - vtkWidgets # vtkImagePlaneWidget - vtkIO # vtkMetaImageReader/Writer - vtkImaging # filters such as vtkImageAnisotropicDiffusion3D - vtkGraphics # vtkContourFilter, sources - vtkVolumeRendering # Mappers + vtkCommon # Mandatory + vtkFiltering # vtkImageData + vtkRendering # vtkProp3D + vtkWidgets # vtkImagePlaneWidget + vtkIO # vtkMetaImageReader/Writer + vtkImaging # filters such as vtkImageAnisotropicDiffusion3D + vtkGraphics # vtkContourFilter, sources + vtkVolumeRendering # Mappers vtkGenericFiltering vtkHybrid # vtkInfovis @@ -213,7 +213,9 @@ ENDIF("${VTK_MAJOR_VERSION}" LESS 6) # vtkViewsQt # vtkNetCDF_cxx ) - ENDIF(WIN32) + ENDIF(WIN32) + + # ENDIF("${VTK_MAJOR_VERSION}" GREATER 5) diff --git a/cmake/CREAMacro_FindAndUseWt.cmake b/cmake/CREAMacro_FindAndUseWt.cmake index 41ffd7b..ce3fddd 100644 --- a/cmake/CREAMacro_FindAndUseWt.cmake +++ b/cmake/CREAMacro_FindAndUseWt.cmake @@ -2,10 +2,18 @@ MACRO(CREA_FINDANDUSEWT) SET (WT_CONNECTOR "wthttp" CACHE STRING "Connector used (wthttp or wtfcgi)") - SET(WT_LIBRARIES wt wtfcgi wtext) + +#EED2019-08-20 +# SET(WT_LIBRARIES wt wtfcgi wtext) + SET(WT_LIBRARIES wt wtfcgi ) + # SET(WT_LIBRARIES wt wthttp wtext) INCLUDE_DIRECTORIES($ENV{WT_DIR}/../../include) - LINK_DIRECTORIES($ENV{WT_DIR}/../../lib/wt-3.3.4) + +#EED2019-08-20 +# LINK_DIRECTORIES($ENV{WT_DIR}/../../lib/wt-3.3.4) + LINK_DIRECTORIES($ENV{WT_DIR}/../../lib/wt-4.0.4-rc1) + CREA_DEFINE( USE_WT) CREA_DEFINE( _USE_WT_ ) diff --git a/cmake/CREAMacro_FindAndUseWxWidgets.cmake b/cmake/CREAMacro_FindAndUseWxWidgets.cmake index 3d45b78..8acd436 100644 --- a/cmake/CREAMacro_FindAndUseWxWidgets.cmake +++ b/cmake/CREAMacro_FindAndUseWxWidgets.cmake @@ -1,7 +1,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé© +# pour la Santé) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil @@ -60,35 +60,33 @@ MACRO(CREA_FIND_WXWIDGETS) ##2018-08-28 if(APPLE) message("EED CREAMacro_FindAndUseWxWidgets APPLE. forsing wxWidgets_CONFIG_EXECUTABLE. wxWidgets_wxrc_EXECUTABLE ") - #set(wxWidgets_CONFIGURATION mswu) - #set(wxWidgets_USE_LIBS) - SET(wxWidgets_CONFIG_EXECUTABLE /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wx-config CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE) + SET(wxWidgets_CONFIG_EXECUTABLE /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wx-config CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE) SET(wxWidgets_wxrc_EXECUTABLE /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/bin/wxrc-3.0 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE) - elseif(UNIX) + elseif(APPLE) message("EED CREAMacro_FindAndUseWxWidgets UNIX") #MESSAGE ( "===============Manual wx-config 2 EED =======================") #SET(wxWidgets_CONFIG_EXECUTABLE /usr/bin/wx-config-2.0 CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE) #SET(wxWidgets_wxrc_EXECUTABLE /usr/bin/wxrc-2.8 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE) - SET(wxWidgets_CONFIG_EXECUTABLE /usr/bin/wx-config-3.0 CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE) - SET(wxWidgets_wxrc_EXECUTABLE /usr/bin/wxrc-3.0 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE) + SET(wxWidgets_CONFIG_EXECUTABLE /usr/bin/wx-config-3.0 CACHE STRING wxWidgets_CONFIG_EXECUTABLE FORCE) + SET(wxWidgets_wxrc_EXECUTABLE /usr/bin/wxrc-3.0 CACHE STRING wxWidgets_wxrc_EXECUTABLE FORCE) # CMake 2.6: # technically those packages are not required # since one can still use the Motif/X11 version and not the gtk one: - FIND_PACKAGE(PkgConfig REQUIRED) - ## pkg_check_modules (GTK2 gtk+-2.0) - ## pkg_check_modules (GTK322 gtk+-3.0) - pkg_check_modules (GTK3 REQUIRED gtk+-3.0) - endif(APPLE) + FIND_PACKAGE(PkgConfig REQUIRED) + ## pkg_check_modules (GTK2 gtk+-2.0) + ## pkg_check_modules (GTK322 gtk+-3.0) + pkg_check_modules (GTK3 REQUIRED gtk+-3.0) +endif(APPLE) - # Can I require all my user to have the gl lib on linux, even if they do not really need it... - SET(WXGLCANVASLIBS "gl") - SET(WXAUILIBS "aui") - # LG : These options should be set by the user at top level of crea - FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS base core adv html - ${WXAUILIBS} - ${WXGLCANVASLIBS} - ) + # Can I require all my user to have the gl lib on linux, even if they do not really need it... + SET(WXGLCANVASLIBS "gl") + SET(WXAUILIBS "aui") + # LG : These options should be set by the user at top level of crea + FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS base core adv html + ${WXAUILIBS} + ${WXGLCANVASLIBS} + ) IF(wxWidgets_FOUND) MESSAGE ( STATUS "=======================================") MESSAGE ( STATUS "Looking for wxWidgets... found ${wxWidgets_CONFIG_EXECUTABLE}") @@ -141,22 +139,20 @@ MACRO(CREA_USE_WXWIDGETS) ## INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS}) ## LINK_DIRECTORIES(${GTK2_LIBRARY_DIRS}) ## LINK_LIBRARIES(${GTK2_LIBRARIES}) - ## SET(WXWIDGETS_LIBRARIES - ## GTK2 - ## ${GTK2_LIBRARIES} - ## #${GTK_LIBRARIES} - ## ${wxWidgets_LIBRARIES} - ## ) - # GTK3 INCLUDE_DIRECTORIES(${GTK3_INCLUDE_DIRS}) LINK_DIRECTORIES(${GTK3_LIBRARY_DIRS}) + LINK_LIBRARIES(${GTK3_LIBRARIES} ) +message("EED GTK3_VERSION "${GTK3_VERSION}) # WX # INCLUDE( ${GTK_USE_FILE} ) INCLUDE( ${wxWidgets_USE_FILE} ) MARK_AS_ADVANCED(wxWidgets_CONFIG_EXECUTABLE) SET(WXWIDGETS_LIBRARIES + ## GTK2 + ## ${GTK2_LIBRARIES} ${GTK3_LIBRARIES} + #${GTK_LIBRARIES} ${wxWidgets_LIBRARIES} ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9a1568..9c99fbb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -104,3 +104,5 @@ INSTALL( DESTINATION ${CREA_LIB_PATH}) #---------------------------------------------------------------------------- MESSAGE(STATUS "===============================================") +MESSAGE(STATUS "===============================================") + diff --git a/src/creaRTTI.cxx b/src/creaRTTI.cxx index 0f682ed..a89d2bd 100644 --- a/src/creaRTTI.cxx +++ b/src/creaRTTI.cxx @@ -2,7 +2,7 @@ # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image -# pour la Santé© +# pour la Santé) # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton # Previous Authors : Laurent Guigues, Jean-Pierre Roux # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil @@ -74,7 +74,6 @@ namespace crea (__GNUC__ == 3 && (__GNUC_MINOR__ > 1 || \ (__GNUC_MINOR__ == 1 && \ __GNUC_PATCHLEVEL__ > 0))) - const abi::__class_type_info* targetTI = (const abi::__class_type_info *)( &(target_type)); creaDebugMessage("info",7," * source = "<GetScalarSize(); \ + POINTERIMAGE = (char*)(VTKIMAGE->GetScalarPointer()); \ + SCALARTYPE = VTKIMAGE->GetScalarType(); + + #define DEF_POINTER_IMAGE_VTK_CREA(VALUE,SCALARSIZE,POINTERIMAGE,SCALARTYPE,VTKIMAGE) \ double VALUE = 0; \ int SCALARSIZE = VTKIMAGE->GetScalarSize(); \ diff --git a/src/creawxVTKRenderWindowInteractor.mm b/src/creawxVTKRenderWindowInteractor.mm index 3047c93..6bc66c2 100644 --- a/src/creawxVTKRenderWindowInteractor.mm +++ b/src/creawxVTKRenderWindowInteractor.mm @@ -43,15 +43,12 @@ =========================================================================*/ -//#import + #include #include "creawxVTKRenderWindowInteractor.h" -#include - - //This is needed for vtk 3.1 : #ifndef VTK_MAJOR_VERSION # include "vtkVersion.h" @@ -66,7 +63,8 @@ // AKT: wxOSX 2.9.x defines __WXOSX_COCOA__ rather than __WXCOCOA__ #ifdef __WXOSX_COCOA__ -#define __WXCOCOA__ + #import + #define __WXCOCOA__ #endif #if defined(__WXMAC__) && wxCHECK_VERSION(2,9,0) @@ -105,7 +103,6 @@ wxWindow* wxGetTopLevelParent(wxWindow *win) // To access objc calls on cocoa #ifdef __WXCOCOA__ #ifdef VTK_USE_COCOA -#import // This trick is no longer need in VTK CVS, should get rid of that: #define id Id #else @@ -114,7 +111,6 @@ wxWindow* wxGetTopLevelParent(wxWindow *win) #endif //__WXCOCOA__ #if wxMAJOR_VERSION <= 2 - #ifdef __WXGTK__ #include // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0 #include "gdk/gdkprivate.h" @@ -515,9 +511,12 @@ long wxVTKRenderWindowInteractor::GetHandleHack() //--------------------------------------------------------------------------- void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) { - //must always be here -//EED2021-08-26 wxPaintDC pDC(this); +//EED2021-08-26 +#ifdef __WXCOCOA__ +#else + wxPaintDC pDC(this); +#endif //do it here rather than in the cstor: this is safer. if(!Handle) @@ -526,9 +525,6 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) #ifdef __WXCOCOA__ vtkCocoaRenderWindow *rwin = vtkCocoaRenderWindow::SafeDownCast(RenderWindow); -//2021-08-30 -// rwin->SetWantsBestResolution(true); - NSView *nvsview = (NSView* )Handle; NSWindow *nswindow = nvsview.window; rwin->SetRootWindow( nswindow ); @@ -555,8 +551,7 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) #endif } // get vtk to render to the wxWindows - -Render(); + Render(); #ifdef __WXMAC__ // This solves a problem with repainting after a window resize // See also: http://sourceforge.net/mailarchive/forum.php?thread_id=31690967&forum_id=41789 @@ -570,7 +565,6 @@ Render(); } #endif #else - vtkCarbonRenderWindow* rwin = vtkCarbonRenderWindow::SafeDownCast(RenderWindow); if( rwin ) { @@ -582,7 +576,6 @@ Render(); #endif #endif } - //--------------------------------------------------------------------------- void wxVTKRenderWindowInteractor::OnEraseBackground(wxEraseEvent &event) { @@ -606,9 +599,7 @@ void wxVTKRenderWindowInteractor::OnSize(wxSizeEvent& WXUNUSED(event)) #endif //this will check for Handle //Render(); - } - //--------------------------------------------------------------------------- void wxVTKRenderWindowInteractor::OnMotion(wxMouseEvent &event) { @@ -617,7 +608,6 @@ void wxVTKRenderWindowInteractor::OnMotion(wxMouseEvent &event) return; } #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0) - SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL); -- 2.49.0