boost rebuild
[packages/vtk.git] / proj6_compat.patch
CommitLineData
26d6f052
JR
1--- a/CMake/FindLibPROJ.cmake
2+++ b/CMake/FindLibPROJ.cmake
3@@ -30,7 +30,7 @@ if ( NOT LibPROJ_INCLUDE_DIR OR NOT LibP
4 )
5
6 find_path( LibPROJ_INCLUDE_DIR
7- NAMES proj_api.h
8+ NAMES proj_api.h proj.h
9 HINTS
10 ${_LibPROJ_DIR}
11 ${_LibPROJ_DIR}/include
12--- a/Geovis/Core/vtkGeoProjection.cxx
13+++ b/Geovis/Core/vtkGeoProjection.cxx
14@@ -72,6 +72,9 @@ public:
15 }
16
17 std::map< std::string, std::string > OptionalParameters;
18+#if PROJ_VERSION_MAJOR >= 5
19+ PJ_PROJ_INFO ProjInfo;
20+#endif
21 };
22
23 //-----------------------------------------------------------------------------
24@@ -80,7 +83,7 @@ int vtkGeoProjection::GetNumberOfProject
25 if ( vtkGeoProjectionNumProj < 0 )
26 {
27 vtkGeoProjectionNumProj = 0;
28- for ( const PJ_LIST* pj = pj_get_list_ref(); pj && pj->id; ++ pj )
29+ for ( const PJ_LIST* pj = proj_list_operations(); pj && pj->id; ++ pj )
30 ++ vtkGeoProjectionNumProj;
31 }
32 return vtkGeoProjectionNumProj;
33@@ -91,7 +94,7 @@ const char* vtkGeoProjection::GetProject
34 if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
35 return nullptr;
36
37- return pj_get_list_ref()[projection].id;
38+ return proj_list_operations()[projection].id;
39 }
40 //-----------------------------------------------------------------------------
41 const char* vtkGeoProjection::GetProjectionDescription( int projection )
42@@ -99,7 +102,7 @@ const char* vtkGeoProjection::GetProject
43 if ( projection < 0 || projection >= vtkGeoProjection::GetNumberOfProjections() )
44 return nullptr;
45
46- return pj_get_list_ref()[projection].descr[0];
47+ return proj_list_operations()[projection].descr[0];
48 }
49 //-----------------------------------------------------------------------------
50 vtkGeoProjection::vtkGeoProjection()
51@@ -144,7 +147,7 @@ void vtkGeoProjection::PrintSelf( ostrea
52 int vtkGeoProjection::GetIndex()
53 {
54 int i = 0;
55- for ( const PJ_LIST* proj = pj_get_list_ref(); proj && proj->id; ++ proj, ++ i )
56+ for ( const PJ_LIST* proj = proj_list_operations(); proj && proj->id; ++ proj, ++ i )
57 {
58 if ( ! strcmp( proj->id, this->Name ) )
59 {
60@@ -161,7 +164,11 @@ const char* vtkGeoProjection::GetDescrip
61 {
62 return nullptr;
63 }
64+#if PROJ_VERSION_MAJOR >= 5
65+ return this->Internals->ProjInfo.description;
66+#else
67 return this->Projection->descr;
68+#endif
69 }
70 //-----------------------------------------------------------------------------
71 projPJ vtkGeoProjection::GetProjection()
72@@ -232,6 +239,9 @@ int vtkGeoProjection::UpdateProjection()
73 this->ProjectionMTime = this->GetMTime();
74 if ( this->Projection )
75 {
76+#if PROJ_VERSION_MAJOR >= 5
77+ this->Internals->ProjInfo = proj_pj_info(this->Projection);
78+#endif
79 return 0;
80 }
81 return 1;
82--- a/Geovis/Core/vtkGeoTransform.cxx
83+++ b/Geovis/Core/vtkGeoTransform.cxx
84@@ -167,9 +167,17 @@ void vtkGeoTransform::InternalTransformP
85 double* coord = x;
86 for ( vtkIdType i = 0; i < numPts; ++ i )
87 {
88+#if PROJ_VERSION_MAJOR >= 5
89+ xy.x = coord[0]; xy.y = coord[1];
90+#else
91 xy.u = coord[0]; xy.v = coord[1];
92+#endif
93 lp = pj_inv( xy, src );
94+#if PROJ_VERSION_MAJOR >= 5
95+ coord[0] = lp.lam; coord[1] = lp.phi;
96+#else
97 coord[0] = lp.u; coord[1] = lp.v;
98+#endif
99 coord += stride;
100 }
101 }
102@@ -191,9 +199,17 @@ void vtkGeoTransform::InternalTransformP
103 double* coord = x;
104 for ( vtkIdType i = 0; i < numPts; ++ i )
105 {
106+#if PROJ_VERSION_MAJOR >= 5
107+ lp.lam = coord[0]; lp.phi = coord[1];
108+#else
109 lp.u = coord[0]; lp.v = coord[1];
110+#endif
111 xy = pj_fwd( lp, dst );
112+#if PROJ_VERSION_MAJOR >= 5
113+ coord[0] = xy.x; coord[1] = xy.y;
114+#else
115 coord[0] = xy.u; coord[1] = xy.v;
116+#endif
117 coord += stride;
118 }
119 }
120--- a/ThirdParty/libproj/vtk_libproj.h.in
121+++ b/ThirdParty/libproj/vtk_libproj.h.in
122@@ -15,10 +15,20 @@
123 #ifndef vtk_libproj_h
124 #define vtk_libproj_h
125
126+#define VTK_LibPROJ_MAJOR_VERSION @LibPROJ_MAJOR_VERSION@
127+
128 /* Use the libproj library configured for VTK. */
129 #cmakedefine VTK_USE_SYSTEM_LIBPROJ
130 #ifdef VTK_USE_SYSTEM_LIBPROJ
131-# include <projects.h>
132+# if VTK_LibPROJ_MAJOR_VERSION >= 5
133+# include <proj.h>
134+# endif
135+# if VTK_LibPROJ_MAJOR_VERSION < 6
136+# include <projects.h>
137+# endif
138+# if VTK_LibPROJ_MAJOR_VERSION >= 6
139+# define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H 1
140+# endif
141 # include <proj_api.h>
142 # include <geodesic.h>
143 #else
144--- VTK-8.2.0/CMake/FindLibPROJ.cmake 2019-09-11 22:13:29.493741215 -0600
145+++ vtk/CMake/FindLibPROJ.cmake 2019-09-11 19:56:57.465802610 -0600
146@@ -1,55 +1,67 @@
147-# Find LibPROJ library and header file
148-# Sets
149-# LibPROJ_FOUND to 0 or 1 depending on the result
150-# LibPROJ_INCLUDE_DIR to directories required for using libproj4
151-# LibPROJ_LIBRARIES to libproj4 and any dependent libraries
152-# If LibPROJ_REQUIRED is defined, then a fatal error message will be generated if libproj4 is not found
153-
154-if ( NOT LibPROJ_INCLUDE_DIR OR NOT LibPROJ_LIBRARIES OR NOT LibPROJ_FOUND )
155+find_path(LibPROJ_INCLUDE_DIR
156+ NAMES proj_api.h proj.h
157+ DOC "libproj include directories")
158+mark_as_advanced(LibPROJ_INCLUDE_DIR)
159
160- if ( $ENV{LibPROJ_DIR} )
161- file( TO_CMAKE_PATH "$ENV{LibPROJ_DIR}" _LibPROJ_DIR )
162+find_library(LibPROJ_LIBRARY_RELEASE
163+ NAMES proj
164+ DOC "libproj release library")
165+mark_as_advanced(LibPROJ_LIBRARY_RELEASE)
166+
167+find_library(LibPROJ_LIBRARY_DEBUG
168+ NAMES projd
169+ DOC "libproj debug library")
170+mark_as_advanced(LibPROJ_LIBRARY_DEBUG)
171+
172+include(SelectLibraryConfigurations)
173+select_library_configurations(LibPROJ)
174+
175+if (LibPROJ_INCLUDE_DIR)
176+ if (EXISTS "${LibPROJ_INCLUDE_DIR}/proj.h")
177+ file(STRINGS "${LibPROJ_INCLUDE_DIR}/proj.h" _libproj_version_lines REGEX "#define[ \t]+PROJ_VERSION_(MAJOR|MINOR|PATCH)")
178+ string(REGEX REPLACE ".*PROJ_VERSION_MAJOR *\([0-9]*\).*" "\\1" _libproj_version_major "${_libproj_version_lines}")
179+ string(REGEX REPLACE ".*PROJ_VERSION_MINOR *\([0-9]*\).*" "\\1" _libproj_version_minor "${_libproj_version_lines}")
180+ string(REGEX REPLACE ".*PROJ_VERSION_PATCH *\([0-9]*\).*" "\\1" _libproj_version_patch "${_libproj_version_lines}")
181+ else ()
182+ file(STRINGS "${LibPROJ_INCLUDE_DIR}/proj_api.h" _libproj_version_lines REGEX "#define[ \t]+PJ_VERSION")
183+ string(REGEX REPLACE ".*PJ_VERSION *\([0-9]*\).*" "\\1" _libproj_version "${_libproj_version_lines}")
184+ math(EXPR _libproj_version_major "${_libproj_version} / 100")
185+ math(EXPR _libproj_version_minor "(${_libproj_version} % 100) / 10")
186+ math(EXPR _libproj_version_patch "${_libproj_version} % 10")
187 endif ()
188-
189- set(LibPROJ_LIBRARY_SEARCH_PATHS
190- ${_LibPROJ_DIR}
191- ${_LibPROJ_DIR}/lib64
192- ${_LibPROJ_DIR}/lib
193- )
194-
195- find_library( LibPROJ_LIBRARY_RELEASE
196- NAMES proj
197- HINTS
198- ${LibPROJ_LIBRARY_SEARCH_PATHS}
199- )
200-
201- find_library( LibPROJ_LIBRARY_DEBUG
202- NAMES projd
203- PATHS
204- ${LibPROJ_LIBRARY_SEARCH_PATHS}
205- )
206-
207- find_path( LibPROJ_INCLUDE_DIR
208- NAMES proj_api.h proj.h
209- HINTS
210- ${_LibPROJ_DIR}
211- ${_LibPROJ_DIR}/include
212- )
213-
214- include(SelectLibraryConfigurations)
215- select_library_configurations(LibPROJ)
216-
217- include(FindPackageHandleStandardArgs)
218- find_package_handle_standard_args(LibPROJ
219- REQUIRED_VARS LibPROJ_LIBRARY LibPROJ_INCLUDE_DIR)
220-
221- if(LibPROJ_FOUND)
222- set(LibPROJ_INCLUDE_DIRS ${LibPROJ_INCLUDE_DIR})
223-
224- if(NOT LibPROJ_LIBRARIES)
225- set(LibPROJ_LIBRARIES ${LibPROJ_LIBRARY})
226- endif()
227- endif()
228+ set(LibPROJ_VERSION "${_libproj_version_major}.${_libproj_version_minor}.${_libproj_version_patch}")
229+ set(LibPROJ_MAJOR_VERSION "${_libproj_version_major}")
230+ unset(_libproj_version_major)
231+ unset(_libproj_version_minor)
232+ unset(_libproj_version_patch)
233+ unset(_libproj_version)
234+ unset(_libproj_version_lines)
235 endif ()
236
237-mark_as_advanced(LibPROJ_INCLUDE_DIR)
238+include(FindPackageHandleStandardArgs)
239+find_package_handle_standard_args(LibPROJ
240+ REQUIRED_VARS LibPROJ_LIBRARY LibPROJ_INCLUDE_DIR
241+ VERSION_VAR LibPROJ_VERSION)
242+
243+if (LibPROJ_FOUND)
244+ set(LibPROJ_INCLUDE_DIRS "${LibPROJ_INCLUDE_DIR}")
245+ set(LibPROJ_LIBRARIES "${LibPROJ_LIBRARY}")
246+
247+ if (NOT TARGET LibPROJ::LibPROJ)
248+ add_library(LibPROJ::LibPROJ UNKNOWN IMPORTED)
249+ set_target_properties(LibPROJ::LibPROJ PROPERTIES
250+ INTERFACE_INCLUDE_DIRECTORIES "${LibPROJ_INCLUDE_DIR}")
251+ if (LibPROJ_LIBRARY_RELEASE)
252+ set_property(TARGET LibPROJ::LibPROJ APPEND PROPERTY
253+ IMPORTED_CONFIGURATIONS RELEASE)
254+ set_target_properties(LibPROJ::LibPROJ PROPERTIES
255+ IMPORTED_LOCATION_RELEASE "${LibPROJ_LIBRARY_RELEASE}")
256+ endif ()
257+ if (LibPROJ_LIBRARY_DEBUG)
258+ set_property(TARGET LibPROJ::LibPROJ APPEND PROPERTY
259+ IMPORTED_CONFIGURATIONS DEBUG)
260+ set_target_properties(LibPROJ::LibPROJ PROPERTIES
261+ IMPORTED_LOCATION_DEBUG "${LibPROJ_LIBRARY_DEBUG}")
262+ endif ()
263+ endif ()
264+endif ()
This page took 0.191302 seconds and 4 git commands to generate.