Skip to content

Commit 065ef7a

Browse files
committed
Added support to Mac OS X (at least the 10.6 version)
1 parent 2dcb4fc commit 065ef7a

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

CMakeLists.txt

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,27 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
2020
add_library(ca_smoothing SHARED ca_smoothing.cxx)
2121
add_executable(ca_smoothing_app ca_smoothing_app.cxx)
2222

23-
SET (Libraries vtkPythonCore)
24-
23+
IF (WIN32)
24+
SET (Libraries vtkPythonCore)
25+
ELSEIF()
26+
SET (Libraries )
27+
ENDIF(WIN32)
28+
29+
SET_SOURCE_FILES_PROPERTIES(ca_smoothing.i PROPERTIES CPLUSPLUS ON)
30+
#SET_SOURCE_FILES_PROPERTIES(ca_smoothing.i PROPERTIES SWIG_FLAGS "-includeall")
31+
SWIG_ADD_MODULE(ca_smoothing python ca_smoothing.i ca_smoothing.cxx)
32+
2533
if(VTK_LIBRARIES)
2634
target_link_libraries(ca_smoothing ${VTK_LIBRARIES} ${Libraries})
2735
target_link_libraries(ca_smoothing_app ca_smoothing ${VTK_LIBRARIES} ${Libraries})
36+
SWIG_LINK_LIBRARIES(ca_smoothing ${PYTHON_LIBRARIES} ${VTK_LIBRARIES} ${Libraries})
2837
else()
29-
target_link_libraries(ca_smoothing vtkHybrid )
38+
target_link_libraries(ca_smoothing vtkHybrid )
39+
target_link_libraries(ca_smoothing_app ca_smoothing vtkHybrid ${Libraries})
40+
SWIG_LINK_LIBRARIES(ca_smoothing vtkHybrid vtkCommon vtkHybridPythonD vtkFiltering ${PYTHON_LIBRARIES} ${Libraries})
41+
3042
endif()
3143

32-
SET_SOURCE_FILES_PROPERTIES(ca_smoothing.i PROPERTIES CPLUSPLUS ON)
33-
#SET_SOURCE_FILES_PROPERTIES(ca_smoothing.i PROPERTIES SWIG_FLAGS "-includeall")
34-
35-
SWIG_ADD_MODULE(ca_smoothing python ca_smoothing.i ca_smoothing.cxx)
36-
SWIG_LINK_LIBRARIES(ca_smoothing ${PYTHON_LIBRARIES} ${VTK_LIBRARIES} ${Libraries})
37-
3844
IF (CMAKE_COMPILER_IS_GNUCXX)
3945
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
4046

ca_smoothing.i

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@
2424
%{
2525
#include "vtkPythonUtil.h"
2626
#include "vtkPolyData.h"
27+
#if (VTK_MAJOR_VERSION > 5 ||((VTK_MAJOR_VERSION == 5)&&(VTK_MINOR_VERSION > 6)))
28+
#define vtkPythonGetObjectFromPointer vtkPythonUtil::GetObjectFromPointer
29+
#define vtkPythonGetPointerFromObject vtkPythonUtil::GetPointerFromObject
30+
#endif
2731
%}
2832

2933
%typemap(out) vtkPolyData* {
3034
PyImport_ImportModule("vtk");
31-
$result = vtkPythonUtil::GetObjectFromPointer ( (vtkPolyData*)$1 );
35+
$result = vtkPythonGetObjectFromPointer( (vtkPolyData*)$1 );
3236
}
3337

3438
%typemap(in) vtkPolyData* {
35-
/*$1 = NULL;*/
36-
$1 = (vtkPolyData*) vtkPythonUtil::GetPointerFromObject ( $input, "vtkPolyData" );
39+
$1 = NULL;
40+
$1 = (vtkPolyData*) vtkPythonGetPointerFromObject ( $input, "vtkPolyData" );
3741
if ( $1 == NULL ) { SWIG_fail; }
3842
}
3943

0 commit comments

Comments
 (0)