Merge lp:~zorba-coders/zorba/geo-win-build into lp:zorba/geo-module

Proposed by Gabriel Petrovay
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/geo-win-build
Merge into: lp:zorba/geo-module
Diff against target: 93 lines (+24/-19)
3 files modified
cmake_modules/FindGeos.cmake (+9/-5)
cmake_modules/Windows/FindGeos.cmake (+9/-9)
src/org/expath/ns/geo.xq.src/geo_functions.cpp (+6/-5)
To merge this branch: bzr merge lp:~zorba-coders/zorba/geo-win-build
Reviewer Review Type Date Requested Status
Juan Zacarias Approve
Daniel Turcanu Pending
Review via email: mp+78602@code.launchpad.net

Commit message

Fixing Windows build with Geo module (geo-module requires geos.dll when geos is built from source)

Description of the change

Geos was not building in Windows.

When built from source Geos generates a DLL. This is required when running with the geo module.

(and some code beautifications here and there)

To post a comment you must log in.
Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

Review from Daniel needed to see if it builds on his Windows.
Review from Juan to see if installers are still OK with this.

Thanks!

Revision history for this message
Daniel Turcanu (danielturcanu) wrote :

I have geos built from source, and there is no geos_c.dll. I always have to remove that FIND_PACKAGE_DLL_WIN32.
Do you need that dll? What geos do you have?

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

http://trac.osgeo.org/geos/

Download geos source (version starting with 3.3) since only these support CMake.

Building on Windows with CMake:
cd geos-3.3.0
mkdir build
cd build
cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=dist -D CMAKE_BUILD_TYPE=Release ..

Copy the "dist" directory to your ZORBA_THIRD_PARTY_REQUIREMENTS as "geos-3.3.0"

Build Zorba.

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

> http://trac.osgeo.org/geos/
>
> Download geos source (version starting with 3.3) since only these support
> CMake.
>
> Building on Windows with CMake:
> cd geos-3.3.0
> mkdir build
> cd build
> cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=dist -D
> CMAKE_BUILD_TYPE=Release ..

yes, and don't forget to build it: nmake install

:)

>
> Copy the "dist" directory to your ZORBA_THIRD_PARTY_REQUIREMENTS as
> "geos-3.3.0"
>
> Build Zorba.

Revision history for this message
Daniel Turcanu (danielturcanu) wrote :

I updated geos to latest trunk, and indeed now it used CMake and builds the geos lib as dll. It is called geos.dll.
But it also has geos_static project, so I used that for linking.
I had to fix the build with the new code.
You can leave FIND_PACKAGE_DLLS_WIN32 with geos.dll, it only raises a warning if it doesn't find it.
One new issue I had is that now geos library has two include dirs: one in the source dir and one in the build directory. I had to add manualy the one from the build dir because it cannot be discovered.

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

> I updated geos to latest trunk, and indeed now it used CMake and builds the
> geos lib as dll. It is called geos.dll.
> But it also has geos_static project, so I used that for linking.

You mean that you "are using" it for linking? For that I guess we have to ask on the list what is the choice between static linking and a DLL.

> I had to fix the build with the new code.

Does this mean you committed some code? What, where?

> You can leave FIND_PACKAGE_DLLS_WIN32 with geos.dll, it only raises a warning
> if it doesn't find it.
> One new issue I had is that now geos library has two include dirs: one in the
> source dir and one in the build directory. I had to add manualy the one from
> the build dir because it cannot be discovered.

To build with geos you only need the "install" dir. That is after you call "nmake install". No build, no source. Once built, you can delete them like I did (unless you keep them for debugging reasons)

Revision history for this message
Daniel Turcanu (danielturcanu) wrote :

I set GEOS_LIBRARY to point to libgeos.lib instead of geos.lib. At least I prefer static libs.

I didn't commit anything, I have to go through the same proposal process.

Ok, good tip about install.

Revision history for this message
Juan Zacarias (juan457) wrote :

The installer still works

review: Approve
lp:~zorba-coders/zorba/geo-win-build updated
38. By Daniel Turcanu

Fixed build with latest GEOS trunk

39. By Daniel Turcanu

Updated to lp:~zorba-coders/zorba/geo-win-build

40. By Daniel Turcanu

Fixing cross-dll memory allocation.

41. By Daniel Turcanu

Reverted fix for cross-dll allocation.
GEOS is not good as DLL, better use the static library.

Revision history for this message
Daniel Turcanu (danielturcanu) wrote :

FindGEOS.cmake from Windows should be made to search for libgeos.lib . I looked into it but I don't know how to do that.

Revision history for this message
Daniel Turcanu (danielturcanu) wrote :

Now I found it, I added into the general FindGeos.cmake.

lp:~zorba-coders/zorba/geo-win-build updated
42. By Daniel Turcanu

Added libgeos in the list for FIND_LIBRARIES

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :

At rev. 42 still not working.

Revision history for this message
Gabriel Petrovay (gabipetrovay) wrote :
Download full text (11.7 KiB)

Less segmentation faults but the same number of failures.

The following tests FAILED:
        2891 - zorba_geo_module/geo/area10.xq (Failed)
        2892 - zorba_geo_module/geo/area2.xq (Failed)
        2893 - zorba_geo_module/geo/area3.xq (Failed)
        2894 - zorba_geo_module/geo/area4.xq (Failed)
        2895 - zorba_geo_module/geo/area5.xq (Failed)
        2896 - zorba_geo_module/geo/area6.xq (Failed)
        2899 - zorba_geo_module/geo/area9.xq (Failed)
        2900 - zorba_geo_module/geo/as_binary1.xq (Failed)
        2901 - zorba_geo_module/geo/as_text1.xq (Failed)
        2902 - zorba_geo_module/geo/as_text2.xq (Failed)
        2903 - zorba_geo_module/geo/as_text3.xq (SEGFAULT)
        2904 - zorba_geo_module/geo/as_text4.xq (SEGFAULT)
        2905 - zorba_geo_module/geo/as_text5.xq (SEGFAULT)
        2906 - zorba_geo_module/geo/as_text6.xq (Failed)
        2907 - zorba_geo_module/geo/as_text7.xq (Failed)
        2908 - zorba_geo_module/geo/as_text8.xq (Failed)
        2909 - zorba_geo_module/geo/as_text9.xq (Failed)
        2910 - zorba_geo_module/geo/boundary1.xq (Failed)
        2911 - zorba_geo_module/geo/boundary10.xq (Failed)
        2912 - zorba_geo_module/geo/boundary11.xq (Failed)
        2913 - zorba_geo_module/geo/boundary12.xq (Failed)
        2914 - zorba_geo_module/geo/boundary13.xq (Failed)
        2915 - zorba_geo_module/geo/boundary14.xq (Failed)
        2916 - zorba_geo_module/geo/boundary2.xq (Failed)
        2917 - zorba_geo_module/geo/boundary3.xq (Failed)
        2921 - zorba_geo_module/geo/boundary7.xq (Failed)
        2922 - zorba_geo_module/geo/boundary8.xq (Failed)
        2923 - zorba_geo_module/geo/boundary9.xq (Failed)
        2924 - zorba_geo_module/geo/bounding-polygons1.xq (Failed)
        2925 - zorba_geo_module/geo/bounding-polygons2.xq (Failed)
        2926 - zorba_geo_module/geo/bounding-polygons3.xq (Failed)
        2927 - zorba_geo_module/geo/buffer1.xq (Failed)
        2928 - zorba_geo_module/geo/buffer10.xq (Failed)
        2929 - zorba_geo_module/geo/buffer2.xq (Failed)
        2930 - zorba_geo_module/geo/buffer3.xq (Failed)
        2933 - zorba_geo_module/geo/buffer6.xq (Failed)
        2935 - zorba_geo_module/geo/buffer8.xq (Failed)
        2936 - zorba_geo_module/geo/buffer9.xq (Failed)
        2937 - zorba_geo_module/geo/centroid1.xq (Failed)
        2938 - zorba_geo_module/geo/centroid10.xq (Failed)
        2939 - zorba_geo_module/geo/centroid2.xq (Failed)
        2940 - zorba_geo_module/geo/centroid3.xq (Failed)
        2941 - zorba_geo_module/geo/centroid4.xq (Failed)
        2942 - zorba_geo_module/geo/centroid5.xq (Failed)
        2945 - zorba_geo_module/geo/centroid8.xq (Failed)
        2947 - zorba_geo_module/geo/contains1.xq (Failed)
        2948 - zorba_geo_module/geo/contains10.xq (Failed)
        2949 - zorba_geo_module/geo/contains2.xq (Failed)
        2950 - zorba_geo_module/geo/contains3.xq (Failed)
        2951 - zorba_geo_module/geo/contains4.xq (Failed)
        2955 - zorba_geo_module/geo/contains8.xq (Failed)
        2956 - zorba_geo_module/geo/contains9.xq (Failed)
        2957 - zorba_geo_module/geo/convex-hull1.xq (Failed)
        2958 - zorba_geo_module/geo/convex-h...

lp:~zorba-coders/zorba/geo-win-build updated
43. By Daniel Turcanu

Removed search for geos.dll

44. By Daniel Turcanu

Trying another way to search static GEOS library.

Unmerged revisions

44. By Daniel Turcanu

Trying another way to search static GEOS library.

43. By Daniel Turcanu

Removed search for geos.dll

42. By Daniel Turcanu

Added libgeos in the list for FIND_LIBRARIES

41. By Daniel Turcanu

Reverted fix for cross-dll allocation.
GEOS is not good as DLL, better use the static library.

40. By Daniel Turcanu

Fixing cross-dll memory allocation.

39. By Daniel Turcanu

Updated to lp:~zorba-coders/zorba/geo-win-build

38. By Daniel Turcanu

Fixed build with latest GEOS trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake_modules/FindGeos.cmake'
2--- cmake_modules/FindGeos.cmake 2011-02-23 12:55:52 +0000
3+++ cmake_modules/FindGeos.cmake 2011-10-08 17:41:25 +0000
4@@ -15,19 +15,23 @@
5 # Try to find the GEOS lib
6 #
7 # GEOS_FOUND - true if GEOS was found
8-# GEOS_INCLUDE_DIR - Directory to include to get GEOS headers
9+# GEOS_INCLUDE_DIR - Directory to include to get GEOS headers
10 # GEOS_LIBRARIES - Libraries to link against for the GEOS
11 #
12
13-INCLUDE(CMakeCompareVersionStrings)
14+INCLUDE (CMakeCompareVersionStrings)
15
16 IF (GEOS_INCLUDE_DIR)
17- SET(GEOS_FIND_QUIETLY TRUE)
18+ SET (GEOS_FIND_QUIETLY TRUE)
19 ENDIF (GEOS_INCLUDE_DIR)
20
21 # Look for the header file.
22-FIND_PATH(GEOS_INCLUDE_DIR geos.h PATHS "/usr/local/include/geos/")
23-MARK_AS_ADVANCED(GEOS_INCLUDE_DIR)
24+FIND_PATH (
25+ GEOS_INCLUDE_DIR
26+ NAMES geos/geos.h
27+ PATHS "/usr/local/include"
28+)
29+MARK_AS_ADVANCED (GEOS_INCLUDE_DIR)
30
31 # Look for the library.
32 # FIND_LIBRARY(GEOS_LIBRARY NAMES geos PATHS ${GEOS_LIBRARIES})
33
34=== modified file 'cmake_modules/Windows/FindGeos.cmake'
35--- cmake_modules/Windows/FindGeos.cmake 2011-08-19 00:03:44 +0000
36+++ cmake_modules/Windows/FindGeos.cmake 2011-10-08 17:41:25 +0000
37@@ -25,13 +25,13 @@
38 # -D GEOS_INCLUDE="path_to_3rd_party_dir\*geos*\src"
39 # -D GEOS_LIBRARY="path_to_3rd_party_dir\*geos*\bin\[Release]\geos.lib"
40 #
41-# See the FindLibTidy.cmake module shipped with Zorba for more information.
42-
43-FIND_PACKAGE_WIN32(NAME GEOS FOUND_VAR GEOS_FOUND SEARCH_NAMES GEOS)
44-
45-IF(GEOS_FOUND)
46-
47- #find the needed DLL's
48- FIND_PACKAGE_DLLS_WIN32 (${FOUND_LOCATION} geos_c.dll)
49+# See the FindGeos.cmake module shipped with Zorba for more information.
50+
51+FIND_PACKAGE_WIN32 (NAME "Geos" FOUND_VAR "GEOS_FOUND" SEARCH_NAMES "geos")
52+
53+IF (GEOS_FOUND)
54+
55+ # find the needed DLLs
56+ FIND_PACKAGE_DLL_WIN32 (${FOUND_LOCATION} "geos")
57
58-ENDIF (GEOS_FOUND)
59\ No newline at end of file
60+ENDIF (GEOS_FOUND)
61
62=== modified file 'src/org/expath/ns/geo.xq.src/geo_functions.cpp'
63--- src/org/expath/ns/geo.xq.src/geo_functions.cpp 2011-07-07 14:54:21 +0000
64+++ src/org/expath/ns/geo.xq.src/geo_functions.cpp 2011-10-08 17:41:25 +0000
65@@ -13,12 +13,16 @@
66 * See the License for the specific language governing permissions and
67 * limitations under the License.
68 */
69+
70+#include "geo_functions.h"
71+
72 #include <string.h>
73 #include <stdio.h>
74 #include <cmath>
75 #include <stdlib.h>
76-
77-#include "geo_functions.h"
78+#include <vector>
79+#include <sstream>
80+#include <iomanip>
81
82 #include <geos/geom/PrecisionModel.h>
83 #include <geos/geom/GeometryFactory.h>
84@@ -45,9 +49,6 @@
85 #include <geos/opLinemerge.h>
86 #include <geos/opPolygonize.h>
87 #include <geos/version.h>
88-#include <vector>
89-#include <sstream>
90-#include <iomanip>
91
92 #include <zorba/empty_sequence.h>
93 #include <zorba/singleton_item_sequence.h>

Subscribers

People subscribed via source and target branches