Skip to content

Commit

Permalink
[geographiclib] Update to 1.50.1 (#12379)
Browse files Browse the repository at this point in the history
* Upgrade geographiclib to version 1.50.1

* Tinker with sourceforge download

* Strip verbiage at top of geographiclib/portfile.cmake

* geographiclib: fix for windows build

* geographiclib: minimize size of patch file

* add missing manifest

* A stab at fixing uwp build error.  But I'm working in the dark!

* Back out of previous commit.  It didn't help.

* Call cmake_minimum_required first

* geographiclib: remove tools from build -- incompatible with uwp

* geographiclib: remove stray reference to TOOLS

* geographiclib: try installing executables into tools

* geographiclib: Do not build tools for uwp

* geographiclib: fix up build of tools

* geographiclib: Minor clean up

* geographiclib: handle uwp vs tools more elegantly

* geographiclib: reformation vcpkg,json

* geographiclib: don't build tools by default

* geographiclib: Don't register the tools as targets; this causes problems if they are moved

Co-authored-by: Charles Karney <[email protected]>
  • Loading branch information
cffk and cffk authored Jul 14, 2020
1 parent 8e3c304 commit e554608
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 131 deletions.
4 changes: 0 additions & 4 deletions ports/geographiclib/CONTROL

This file was deleted.

130 changes: 130 additions & 0 deletions ports/geographiclib/cxx-library-only.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30875ddb..34aa6515 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -464,12 +464,12 @@ endif ()
# documentation files into the source tree. Skip Apple here because
# man/makeusage.sh uses "head --lines -4" to drop the last 4 lines of a
# file and there's no simple equivalent for MacOSX
-if (NOT WIN32 AND NOT APPLE)
+if (NOT WIN32 AND NOT APPLE AND FALSE)
find_program (HAVE_POD2MAN pod2man)
find_program (HAVE_POD2HTML pod2html)
find_program (HAVE_COL col)
endif ()
-if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL)
+if (HAVE_POD2MAN AND HAVE_POD2HTML AND HAVE_COL AND FALSE)
set (MAINTAINER ON)
else ()
set (MAINTAINER OFF)
@@ -496,25 +496,34 @@ if (WIN32)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
endif ()

+if (SKIP_TOOLS)
+ set (TOOLS)
+ set (SCRIPTS)
+else ()
# The list of tools (to be installed into, e.g., /usr/local/bin)
set (TOOLS CartConvert ConicProj GeodesicProj GeoConvert GeodSolve
GeoidEval Gravity MagneticField Planimeter RhumbSolve TransverseMercatorProj)
# The list of scripts (to be installed into, e.g., /usr/local/sbin)
set (SCRIPTS geographiclib-get-geoids geographiclib-get-gravity
geographiclib-get-magnetic)
+endif ()

set_property (GLOBAL PROPERTY USE_FOLDERS ON)

# The list of subdirectories to process
add_subdirectory (src)
add_subdirectory (include/GeographicLib)
+if (NOT SKIP_TOOLS)
add_subdirectory (tools)
+endif ()
+if (FALSE)
add_subdirectory (man)
add_subdirectory (doc)
add_subdirectory (js)
add_subdirectory (matlab)
add_subdirectory (python/geographiclib)
add_subdirectory (examples)
+endif ()
if (MSVC AND BUILD_NETGEOGRAPHICLIB)
if (GEOGRAPHICLIB_PRECISION EQUAL 2)
set (NETGEOGRAPHICLIB_LIBRARIES NETGeographicLib)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 90e773ba..c9a303b0 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -33,10 +33,10 @@ configure_file (project-config.cmake.in
configure_file (project-config-version.cmake.in
"${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-config-version.cmake" @ONLY)
export (TARGETS
- ${PROJECT_ALL_LIBRARIES} ${TOOLS}
+ ${PROJECT_ALL_LIBRARIES}
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-targets.cmake")
export (TARGETS
- ${PROJECT_ALL_LIBRARIES} ${TOOLS}
+ ${PROJECT_ALL_LIBRARIES}
NAMESPACE ${PROJECT_NAME}::
FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME_LOWER}-namespace-targets.cmake")

@@ -44,15 +44,9 @@ export (TARGETS
# ${INSTALL_CMAKE_DIR} and @PROJECT_ROOT_DIR@ is the relative
# path to the root from there. (Note that the whole install tree can
# be relocated.)
-if (COMMON_INSTALL_PATH)
- # Install under lib${LIB_SUFFIX} so that 32-bit and 64-bit packages
- # can be installed on a single machine.
- set (INSTALL_CMAKE_DIR "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}")
- set (PROJECT_ROOT_DIR "../../..")
-else ()
- set (INSTALL_CMAKE_DIR "cmake")
- set (PROJECT_ROOT_DIR "..")
-endif ()
+ set (INSTALL_CMAKE_DIR "share/${PROJECT_NAME_LOWER}")
+ set (PROJECT_ROOT_DIR "../..")
+
# @PROJECT_INCLUDE_DIRS@ is not used in the install tree; reset
# it to prevent the source and build paths appearing in the installed
# config files
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index b8c028c7..26e4ba14 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -1,7 +1,7 @@
# Build the tools...

# Where to find the *.usage files for the --help option.
-include_directories (${PROJECT_BINARY_DIR}/man)
+include_directories (${PROJECT_SOURCE_DIR}/man)
# Only needed if target_compile_definitions is not supported
add_definitions (${PROJECT_DEFINITIONS})

@@ -16,7 +16,7 @@ foreach (TOOL ${TOOLS})
add_dependencies (tools ${TOOL})

set_source_files_properties (${TOOL}.cpp PROPERTIES
- OBJECT_DEPENDS ${PROJECT_BINARY_DIR}/man/${TOOL}.usage)
+ OBJECT_DEPENDS ${PROJECT_SOURCE_DIR}/man/${TOOL}.usage)

target_link_libraries (${TOOL} ${PROJECT_LIBRARIES} ${HIGHPREC_LIBRARIES})

@@ -35,7 +35,7 @@ if (APPLE)
endif ()

# Specify where the tools are installed, adding them to the export targets
-install (TARGETS ${TOOLS} EXPORT targets DESTINATION bin)
+install (TARGETS ${TOOLS} DESTINATION tools)

if (MSVC AND PACKAGE_DEBUG_LIBS)
# Possibly don't EXPORT the debug versions of the tools and then this
@@ -55,7 +55,7 @@ set_property (TARGET tools ${TOOLS} PROPERTY FOLDER tools)
# systems. This needs to substitute ${GEOGRAPHICLIB_DATA} as the
# default data directory. These are installed under sbin, because it is
# expected to be run with write access to /usr/local.
-if (NOT WIN32)
+if (NOT WIN32 AND FALSE)
foreach (SCRIPT ${SCRIPTS})
configure_file (${SCRIPT}.sh scripts/${SCRIPT} @ONLY)
add_custom_command (OUTPUT ${SCRIPT}
16 changes: 0 additions & 16 deletions ports/geographiclib/fix-usage.patch

This file was deleted.

99 changes: 56 additions & 43 deletions ports/geographiclib/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,46 +1,59 @@
vcpkg_from_sourceforge(
vcpkg_from_sourceforge (
OUT_SOURCE_PATH SOURCE_PATH
REPO geographiclib/distrib
REF archive
FILENAME "GeographicLib-1.47-patch1.zip"
SHA512 d8fdfd7ae093057ec1a4ab922457fe71a3fb9975df5b673c276d62a0e9c4f212dc63652830b9d89e3890bc96aafd335992943cf6a1bce8260acf932d1eb7abfd
PATCHES
remove-tools-and-fix-version.patch
fix-usage.patch
REPO geographiclib
REF distrib
FILENAME "GeographicLib-1.50.1.tar.gz"
SHA512 1db874f30957a0edb8a1df3eee6db73cc993629e3005fe912e317a4ba908e7d7580ce483bb0054c4b46370b8edaec989609fb7e4eb6ba00c80182db43db436f1
PATCHES cxx-library-only.patch
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DGEOGRAPHICLIB_LIB_TYPE=SHARED
PREFER_NINJA # Disable this option if project cannot be built with Ninja
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
else()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS -DGEOGRAPHICLIB_LIB_TYPE=STATIC
PREFER_NINJA # Disable this option if project cannot be built with Ninja
# OPTIONS -DUSE_THIS_IN_ALL_BUILDS=1 -DUSE_THIS_TOO=2
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
endif()

vcpkg_install_cmake()

if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
else()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/GeographicLib)
endif()
vcpkg_copy_pdbs()

file(COPY ${CURRENT_PACKAGES_DIR}/lib/pkgconfig DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_check_features (
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
INVERTED_FEATURES
"tools" SKIP_TOOLS
)

if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set (LIB_TYPE "SHARED")
else ()
set (LIB_TYPE "STATIC")
endif ()

if (tools IN_LIST FEATURES)
vcpkg_fail_port_install (
MESSAGE "Cannot build GeographicLib tools for UWP"
ON_TARGET uwp
)
endif ()

vcpkg_configure_cmake (
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
"-DGEOGRAPHICLIB_LIB_TYPE=${LIB_TYPE}"
${FEATURE_OPTIONS}
PREFER_NINJA # Disable this option if project cannot be built with Ninja
)

vcpkg_install_cmake ()
vcpkg_fixup_cmake_targets (CONFIG_PATH share/geographiclib)
vcpkg_copy_pdbs ()

file (GLOB TOOL_LIST LIST_DIRECTORIES false
${CURRENT_PACKAGES_DIR}/tools/*)
if (TOOL_LIST)
file (INSTALL ${TOOL_LIST}
DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
vcpkg_copy_tool_dependencies (${CURRENT_PACKAGES_DIR}/tools/${PORT})
file (REMOVE ${TOOL_LIST})
endif ()

file (REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file (REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file (REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/tools)
file (INSTALL ${SOURCE_PATH}/LICENSE.txt
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
RENAME copyright)

# Install usage
configure_file (${CMAKE_CURRENT_LIST_DIR}/usage
${CURRENT_PACKAGES_DIR}/share/${PORT}/usage @ONLY)
60 changes: 0 additions & 60 deletions ports/geographiclib/remove-tools-and-fix-version.patch

This file was deleted.

12 changes: 4 additions & 8 deletions ports/geographiclib/usage
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
The package geographiclib:x64-linux provides CMake targets:

find_package(GeographicLib CONFIG REQUIRED)
#dynamic
target_link_libraries(main PRIVATE GeographicLib GeographicLib::GeographicLib)
#static
target_link_libraries(main PRIVATE GeographicLib_STATIC GeographicLib::GeographicLib_STATIC)

The package @PORT@:@TARGET_TRIPLET@ provides CMake targets:

find_package (GeographicLib CONFIG REQUIRED)
target_link_libraries (main PRIVATE ${GeographicLib_LIBRARIES})
12 changes: 12 additions & 0 deletions ports/geographiclib/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "geographiclib",
"version-string": "1.50.1",
"homepage": "https://geographiclib.sourceforge.io",
"description": "GeographicLib, a C++ library for performing geographic conversions",
"features": [
{
"name": "tools",
"description": "The GeographicLib tools"
}
]
}

0 comments on commit e554608

Please sign in to comment.