From 350f70031ba1e3beffc376678150d3ee6655dbb8 Mon Sep 17 00:00:00 2001 From: Todd Date: Fri, 8 Mar 2019 15:39:22 -0600 Subject: [PATCH] [geotrans] add new port (#5498) --- ports/geotrans/CMakeLists.txt | 142 ++++++++++++++++++++++++ ports/geotrans/CONTROL | 3 + ports/geotrans/geotrans-config.in.cmake | 7 ++ ports/geotrans/portfile.cmake | 41 +++++++ ports/geotrans/usage | 11 ++ 5 files changed, 204 insertions(+) create mode 100644 ports/geotrans/CMakeLists.txt create mode 100644 ports/geotrans/CONTROL create mode 100644 ports/geotrans/geotrans-config.in.cmake create mode 100644 ports/geotrans/portfile.cmake create mode 100644 ports/geotrans/usage diff --git a/ports/geotrans/CMakeLists.txt b/ports/geotrans/CMakeLists.txt new file mode 100644 index 0000000000..ba2af58686 --- /dev/null +++ b/ports/geotrans/CMakeLists.txt @@ -0,0 +1,142 @@ +cmake_minimum_required(VERSION 3.10) +project(geotrans CXX) + +file(GLOB_RECURSE DTCC_CPP CCS/src/dtcc/*.cpp) +include_directories( +CCS/src/dtcc +CCS/src/dtcc/Enumerations +CCS/src/dtcc/Exception +CCS/src/dtcc/CoordinateSystemParameters +CCS/src/dtcc/CoordinateSystems +CCS/src/dtcc/CoordinateSystems/albers +CCS/src/dtcc/CoordinateSystems/bonne +CCS/src/dtcc/CoordinateSystems/datum +CCS/src/dtcc/CoordinateSystems/ellipse +CCS/src/dtcc/CoordinateSystems/geocent +CCS/src/dtcc/CoordinateSystems/grinten +CCS/src/dtcc/CoordinateSystems/mercator +CCS/src/dtcc/CoordinateSystems/misc +CCS/src/dtcc/CoordinateSystems/nzmg +CCS/src/dtcc/CoordinateSystems/polarst +CCS/src/dtcc/CoordinateSystems/stereogr +CCS/src/dtcc/CoordinateSystems/trcyleqa +CCS/src/dtcc/CoordinateSystems/utm +CCS/src/dtcc/CoordinateSystems/azeq +CCS/src/dtcc/CoordinateSystems/cassini +CCS/src/dtcc/CoordinateSystems/eckert4 +CCS/src/dtcc/CoordinateSystems/eqdcyl +CCS/src/dtcc/CoordinateSystems/georef +CCS/src/dtcc/CoordinateSystems/lambert +CCS/src/dtcc/CoordinateSystems/mgrs +CCS/src/dtcc/CoordinateSystems/mollweid +CCS/src/dtcc/CoordinateSystems/omerc +CCS/src/dtcc/CoordinateSystems/polycon +CCS/src/dtcc/CoordinateSystems/threads +CCS/src/dtcc/CoordinateSystems/ups +CCS/src/dtcc/CoordinateSystems/webmerc +CCS/src/dtcc/CoordinateSystems/bng +CCS/src/dtcc/CoordinateSystems/cyleqa +CCS/src/dtcc/CoordinateSystems/eckert6 +CCS/src/dtcc/CoordinateSystems/gars +CCS/src/dtcc/CoordinateSystems/gnomonic +CCS/src/dtcc/CoordinateSystems/loccart +CCS/src/dtcc/CoordinateSystems/miller +CCS/src/dtcc/CoordinateSystems/neys +CCS/src/dtcc/CoordinateSystems/orthogr +CCS/src/dtcc/CoordinateSystems/sinusoid +CCS/src/dtcc/CoordinateSystems/tranmerc +CCS/src/dtcc/CoordinateSystems/usng +CCS/src/dtcc/CoordinateTuples +) +set(DTCC_INCLUDES +include/dtcc/ +include/dtcc/Enumerations +include/dtcc/Exception +include/dtcc/CoordinateSystemParameters +include/dtcc/CoordinateSystems +include/dtcc/CoordinateSystems/albers +include/dtcc/CoordinateSystems/bonne +include/dtcc/CoordinateSystems/datum +include/dtcc/CoordinateSystems/ellipse +include/dtcc/CoordinateSystems/geocent +include/dtcc/CoordinateSystems/grinten +include/dtcc/CoordinateSystems/mercator +include/dtcc/CoordinateSystems/misc +include/dtcc/CoordinateSystems/nzmg +include/dtcc/CoordinateSystems/polarst +include/dtcc/CoordinateSystems/stereogr +include/dtcc/CoordinateSystems/trcyleqa +include/dtcc/CoordinateSystems/utm +include/dtcc/CoordinateSystems/azeq +include/dtcc/CoordinateSystems/cassini +include/dtcc/CoordinateSystems/eckert4 +include/dtcc/CoordinateSystems/eqdcyl +include/dtcc/CoordinateSystems/georef +include/dtcc/CoordinateSystems/lambert +include/dtcc/CoordinateSystems/mgrs +include/dtcc/CoordinateSystems/mollweid +include/dtcc/CoordinateSystems/omerc +include/dtcc/CoordinateSystems/polycon +include/dtcc/CoordinateSystems/threads +include/dtcc/CoordinateSystems/ups +include/dtcc/CoordinateSystems/webmerc +include/dtcc/CoordinateSystems/bng +include/dtcc/CoordinateSystems/cyleqa +include/dtcc/CoordinateSystems/eckert6 +include/dtcc/CoordinateSystems/gars +include/dtcc/CoordinateSystems/gnomonic +include/dtcc/CoordinateSystems/loccart +include/dtcc/CoordinateSystems/miller +include/dtcc/CoordinateSystems/neys +include/dtcc/CoordinateSystems/orthogr +include/dtcc/CoordinateSystems/sinusoid +include/dtcc/CoordinateSystems/tranmerc +include/dtcc/CoordinateSystems/usng +include/dtcc/CoordinateTuples +) + + +add_library(MSPdtcc ${DTCC_CPP}) +add_library(MSPCoordinateConversionService CCS/src/CoordinateConversion/CoordinateConversionService.cpp ${DTCC_CPP}) + +target_include_directories(MSPdtcc INTERFACE "$") +target_include_directories(MSPCoordinateConversionService INTERFACE $) + +if(WIN32) + if (BUILD_SHARED_LIBS) + add_definitions( + -DMSP_CCS_EXPORTS + -D_USRDLL + ) + endif() + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +else() + find_package(Threads REQUIRED) + target_link_libraries(MSPdtcc PRIVATE Threads::Threads ${CMAKE_DL_LIBS}) +endif() + + +install( + TARGETS MSPdtcc + EXPORT geotrans + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install( + TARGETS MSPCoordinateConversionService + EXPORT geotrans + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(DIRECTORY "${CMAKE_SOURCE_DIR}/CCS/src/" + DESTINATION "include" + CONFIGURATIONS Release + FILES_MATCHING + PATTERN "*.h" +) + +install(EXPORT geotrans NAMESPACE geotrans:: DESTINATION share/geotrans CONFIGURATIONS Release) diff --git a/ports/geotrans/CONTROL b/ports/geotrans/CONTROL new file mode 100644 index 0000000000..1d3373aaee --- /dev/null +++ b/ports/geotrans/CONTROL @@ -0,0 +1,3 @@ +Source: geotrans +Version: 3.7 +Description: Geotrans is a library that allows you convert geographic coordinates among a wide variety of coordinate systems, map projections, and datums. diff --git a/ports/geotrans/geotrans-config.in.cmake b/ports/geotrans/geotrans-config.in.cmake new file mode 100644 index 0000000000..f25224c0b2 --- /dev/null +++ b/ports/geotrans/geotrans-config.in.cmake @@ -0,0 +1,7 @@ + +if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32) + include(CMakeFindDependencyMacro) + find_dependency(Threads) +endif() + +include(${CMAKE_CURRENT_LIST_DIR}/geotrans.cmake) diff --git a/ports/geotrans/portfile.cmake b/ports/geotrans/portfile.cmake new file mode 100644 index 0000000000..4b63ba58a8 --- /dev/null +++ b/ports/geotrans/portfile.cmake @@ -0,0 +1,41 @@ +include(vcpkg_common_functions) + +set(VCPKG_LIBRARY_LINKAGE "dynamic") + +# We specify the Linux URL, but the only difference between the Windows/Linux packages are the included libraries +# which we re-build anyway. There is no source only package provided or it would be preferred (and smaller). +vcpkg_download_distfile(ARCHIVE + URLS "http://earth-info.nga.mil/GandG/geotrans/geotrans3.7/linux_dev.tgz" + FILENAME "geotrans-3.7.tgz" + SHA512 20bdc870026e95154f1d7f9560cbfa2c0b2dc39042aa544f093b502a0609121cb47df5729248e0d79ccf8f9908bf01bbcea8e777ae4f45e25472b7ce2bcb9742 +) + +vcpkg_extract_source_archive_ex( + OUT_SOURCE_PATH SOURCE_PATH + ARCHIVE ${ARCHIVE} +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/geotrans-config.in.cmake + ${CURRENT_PACKAGES_DIR}/share/geotrans/geotrans-config.cmake + @ONLY +) + +configure_file(${CMAKE_CURRENT_LIST_DIR}/usage ${CURRENT_PACKAGES_DIR}/share/${PORT} @ONLY) + + +# Handle copyright +file(INSTALL ${SOURCE_PATH}/GEOTRANS3/docs/MSP_Geotrans_Terms_Of_Use.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/geotrans RENAME copyright) + +# Install the geo model data +file(COPY ${SOURCE_PATH}/data DESTINATION ${CURRENT_PACKAGES_DIR}/share/geotrans) diff --git a/ports/geotrans/usage b/ports/geotrans/usage new file mode 100644 index 0000000000..83430e426c --- /dev/null +++ b/ports/geotrans/usage @@ -0,0 +1,11 @@ +The package geotrans provides CMake targets: + + find_package(geotrans CONFIG REQUIRED) + target_link_libraries(main PRIVATE geotrans::MSPdtcc geotrans::MSPCoordinateConversionService) + + +The geotrans library depends on being able to read it's model data so you'll need to +set an environment variable to let geotrans know where the models are installed: + +export MSPCCS_DATA=@CURRENT_INSTALLED_DIR@/share/@PORT@/data +