Skip to content

Commit

Permalink
[GEOS] Generate debug library names with d suffix (#3371)
Browse files Browse the repository at this point in the history
* [GEOS] Generate debug library names with `d` suffix

Currently geos.lib name is used for both, debug and optimised
GEOS libraries. This leads to situation when:
```
find_library(GEOS_LIBRARY_DEBUG NAMES geos)
find_library(GEOS_LIBRARY_RELEASE NAMES geos)
```

finds the same library for both
```
GEOS_LIBRARY_DEBUG=D:/vcpkg/installed/x64-windows/debug/lib/geos.lib
GEOS_LIBRARY_RELEASE=D:/vcpkg/installed/x64-windows/debug/lib/geos.lib
```

This is minimal patch that works around the problem.

Next, complete fix should be submitted to GEOS upstream,
preferably using exported targets.

* [libspatialite] Add missing geos suffixes in static builds
  • Loading branch information
mloskot authored and ras0219-msft committed May 1, 2018
1 parent c4caf29 commit 793019b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ports/gdal/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libpng16d.lib" PNG_LIBRA
# Setup geos libraries + include path
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" GEOS_INCLUDE_DIR)
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib" GEOS_LIBRARY_REL)
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/geos_c.lib" GEOS_LIBRARY_DBG)
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib" GEOS_LIBRARY_DBG)

# Setup expat libraries + include path
file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" EXPAT_INCLUDE_DIR)
Expand Down
2 changes: 1 addition & 1 deletion ports/geos/CONTROL
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Source: geos
Version: 3.6.2-2
Version: 3.6.2-3
Description: Geometry Engine Open Source
11 changes: 7 additions & 4 deletions ports/geos/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ file(DOWNLOAD http://svn.osgeo.org/geos/branches/3.6/cmake/modules/GenerateSourc

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DGEOS_ENABLE_TESTS=False
PREFER_NINJA # Disable this option if project cannot be built with Ninja
OPTIONS
-DCMAKE_DEBUG_POSTFIX=d
-DGEOS_ENABLE_TESTS=False
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/geos)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/geos/COPYING ${CURRENT_PACKAGES_DIR}/share/geos/copyright)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libgeos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libgeos.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/libgeos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libgeosd.lib)
else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos_c.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos_c.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geosd.lib)
file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/geos_c.lib ${CURRENT_PACKAGES_DIR}/debug/lib/geos_cd.lib)

endif()

Expand Down
4 changes: 2 additions & 2 deletions ports/libspatialite/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(CL_FLAGS_DBG "/MDd /Zi")
set(CL_FLAGS_REL "/MD /Ox")
set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib")
set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib")
set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib")
else()
set(CL_FLAGS_DBG "/MTd /Zi")
set(CL_FLAGS_REL "/MT /Ox")
set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libgeos_c.lib ${CURRENT_INSTALLED_DIR}/lib/libgeos.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libgeos_c.lib ${CURRENT_INSTALLED_DIR}/debug/lib/libgeos.lib")
set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libgeos_cd.lib ${CURRENT_INSTALLED_DIR}/debug/lib/libgeosd.lib")
set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/lib/lzma.lib ws2_32.lib")
set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/debug/lib/lzma.lib ws2_32.lib")
endif()
Expand Down
2 changes: 1 addition & 1 deletion ports/spatialite-tools/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if(VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(CL_FLAGS_DBG "/MDd /Zi")
set(CL_FLAGS_REL "/MD /Ox")
set(GEOS_LIBS_REL "${LDIR}/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${LDIR}/debug/lib/geos_c.lib")
set(GEOS_LIBS_DBG "${LDIR}/debug/lib/geos_cd.lib")
set(LIBXML2_LIBS_REL "${LDIR}/lib/libxml2.lib")
set(LIBXML2_LIBS_DBG "${LDIR}/debug/lib/libxml2.lib")
set(SPATIALITE_LIBS_REL "${LDIR}/lib/spatialite.lib")
Expand Down

0 comments on commit 793019b

Please sign in to comment.