Commit a5948d9f authored by David Gobbi's avatar David Gobbi

Move VTK_BUILD_SHARED_LIBS check to generated code.

Any use of vtkConfigure.h from within the wrapper tool code can
lead to incorrect configuration when cross compiling.  This change
moves the VTK_BUILD_SHARED_LIBS check from the wrapper tool code
into the generated code.

Change-Id: Ie80075bf107aa7635767488ed9f87b0aa3590c72
parent 67a70a82
......@@ -23,9 +23,6 @@
#include "vtkParseMain.h"
#include "vtkParseExtras.h"
/* required for VTK_BUILD_SHARED_LIBS */
#include "vtkConfigure.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -395,11 +392,7 @@ static void vtkWrapPython_ImportExportEnumTypes(
"#define DECLARED_Py%s_Type\n"
"#endif\n",
enumname,
#if defined(VTK_BUILD_SHARED_LIBS)
(is_external ? "VTK_ABI_IMPORT" : "VTK_ABI_EXPORT"),
#else
"VTK_ABI_EXPORT",
#endif
(is_external ? "VTK_PYTHON_IMPORT" : "VTK_PYTHON_EXPORT"),
enumname, enumname);
}
......@@ -501,6 +494,7 @@ int main(int argc, char *argv[])
fprintf(fp,
"#include \"vtkPythonArgs.h\"\n"
"#include \"vtkPythonOverload.h\"\n"
"#include \"vtkConfigure.h\"\n"
"#include <vtksys/ios/sstream>\n");
/* vtkPythonCommand is needed to wrap vtkObject.h */
......@@ -518,10 +512,20 @@ int main(int argc, char *argv[])
"#include \"%s.h\"\n\n",
name);
/* define import/export macros for use in wrapper code */
fprintf(fp,
"#if defined(VTK_BUILD_SHARED_LIBS)\n"
"# define VTK_PYTHON_EXPORT VTK_ABI_EXPORT\n"
"# define VTK_PYTHON_IMPORT VTK_ABI_IMPORT\n"
"#else\n"
"# define VTK_PYTHON_EXPORT VTK_ABI_EXPORT\n"
"# define VTK_PYTHON_IMPORT VTK_ABI_EXPORT\n"
"#endif\n\n");
/* do the export of the main entry point */
fprintf(fp,
"extern \"C\" { %s void PyVTKAddFile_%s(PyObject *, const char *); }\n",
"VTK_ABI_EXPORT", name);
"VTK_PYTHON_EXPORT", name);
/* do the imports of any enum types that are used by methods */
vtkWrapPython_ImportExportEnumTypes(fp, file_info, hinfo);
......
......@@ -314,7 +314,7 @@ static void vtkWrapPython_ExportVTKClass(
fprintf(fp,
"extern \"C\" { %s PyObject *PyVTKClass_%sNew(const char *); }\n"
"\n",
"VTK_ABI_EXPORT", classname);
"VTK_PYTHON_EXPORT", classname);
/* declare the New methods for all the superclasses */
supername = vtkWrapPython_GetSuperClass(data, hinfo);
......
......@@ -94,7 +94,7 @@ void vtkWrapPython_GenerateEnumType(
"#define DECLARED_Py%s_Type\n"
"#endif\n"
"\n",
enumname, "VTK_ABI_EXPORT", enumname, enumname);
enumname, "VTK_PYTHON_EXPORT", enumname, enumname);
/* generate all functions and protocols needed for the type */
......
......@@ -24,9 +24,6 @@
#include "vtkWrap.h"
#include "vtkParseExtras.h"
/* required for VTK_BUILD_SHARED_LIBS */
#include "vtkConfigure.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -670,7 +667,7 @@ void vtkWrapPython_GenerateSpecialType(
"#define DECLARED_Py%s_Type\n"
"#endif\n"
"\n",
classname, "VTK_ABI_EXPORT", classname, classname);
classname, "VTK_PYTHON_EXPORT", classname, classname);
/* and the superclass */
has_superclass = vtkWrapPython_HasWrappedSuperClass(
......@@ -685,11 +682,7 @@ void vtkWrapPython_GenerateSpecialType(
"#define DECLARED_Py%s_Type\n"
"#endif\n"
"\n",
#if defined(VTK_BUILD_SHARED_LIBS)
supername, (is_external ? "VTK_ABI_IMPORT" : "VTK_ABI_EXPORT"),
#else
supername, "VTK_ABI_EXPORT",
#endif
supername, (is_external ? "VTK_PYTHON_IMPORT" : "VTK_PYTHON_EXPORT"),
supername, supername);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment