diff --git a/ports/s2geometry/CMakeLists.txt.patch b/ports/s2geometry/CMakeLists.txt.patch new file mode 100644 index 00000000000000..262b0bcd0b5055 --- /dev/null +++ b/ports/s2geometry/CMakeLists.txt.patch @@ -0,0 +1,118 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5ecd280..9859890 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -20,16 +20,8 @@ set(CMAKE_CXX_EXTENSIONS OFF) + + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/third_party/cmake") + +-option(WITH_GFLAGS "Use gflags to change command line flags." OFF) +-add_feature_info(GFLAGS WITH_GFLAGS +- "allows changing command line flags.") + +-# glog option can only be turned on if gflags is on. +-cmake_dependent_option(WITH_GLOG "Use glog for logging." ON +- "WITH_GFLAGS" OFF) +-add_feature_info(GLOG WITH_GLOG "provides logging configurability.") +- +-option(BUILD_SHARED_LIBS "Build shared libraries instead of static." ON) ++option(BUILD_SHARED_LIBS "Build shared libraries instead of static." OFF) + add_feature_info(SHARED_LIBS BUILD_SHARED_LIBS + "builds shared libraries instead of static.") + +@@ -37,26 +29,19 @@ option(BUILD_EXAMPLES "Build s2 documentation examples." ON) + + feature_summary(WHAT ALL) + +-if (WITH_GLOG) +- find_package(Glog REQUIRED) +- # FindGFlags.cmake and FindGlog.cmake do not seem to implement REQUIRED; +- # check manually. +- if (NOT ${GLOG_FOUND}) +- message(FATAL_ERROR "Glog requested but not found") +- endif() +- add_definitions(-DS2_USE_GLOG) +-else() +- # Don't output anything for LOG(INFO). +- add_definitions(-DABSL_MIN_LOG_LEVEL=1) ++find_package(glog CONFIG REQUIRED) ++# FindGFlags.cmake and FindGlog.cmake do not seem to implement REQUIRED; ++# check manually. ++if (NOT ${GLOG_FOUND}) ++ message(FATAL_ERROR "Glog requested but not found") + endif() ++add_definitions(-DS2_USE_GLOG) + +-if (WITH_GFLAGS) +- find_package(GFlags REQUIRED) +- if (NOT ${GFLAGS_FOUND}) +- message(FATAL_ERROR "GFlags requested but not found") +- endif() +- add_definitions(-DS2_USE_GFLAGS) ++find_package(gflags CONFIG REQUIRED) ++if (NOT ${GFLAGS_FOUND}) ++ message(FATAL_ERROR "GFlags requested but not found") + endif() ++add_definitions(-DS2_USE_GFLAGS) + + find_package(OpenSSL REQUIRED) + # pthreads isn't used directly, but this is still required for std::thread. +@@ -204,14 +189,18 @@ add_library(s2testing STATIC + src/s2/s2testing.cc) + target_link_libraries( + s2 +- ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES} ${OPENSSL_LIBRARIES} ++ gflags::gflags glog::glog OpenSSL::SSL OpenSSL::Crypto + ${CMAKE_THREAD_LIBS_INIT}) + + # Allow other CMake projects to use this one with: + # list(APPEND CMAKE_MODULE_PATH "/third_party/cmake") + # add_subdirectory( s2geometry) + # target_link_libraries( s2) +-target_include_directories(s2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) ++target_include_directories(s2 PUBLIC ++ $ ++ $ ++) ++ + + # We don't need to install all headers, only those + # transitively included by s2 headers we are exporting. +@@ -407,7 +396,18 @@ install(FILES src/s2/util/math/mathutil.h + install(FILES src/s2/util/units/length-units.h + src/s2/util/units/physical-units.h + DESTINATION include/s2/util/units) +-install(TARGETS s2 s2testing DESTINATION lib) ++ install(TARGETS s2 s2testing ++ RUNTIME DESTINATION bin ++ ARCHIVE DESTINATION lib ++ LIBRARY DESTINATION lib) ++install(TARGETS s2 ++ EXPORT unofficial-s2Targets ++ ) ++install(EXPORT unofficial-s2Targets ++ NAMESPACE unofficial-s2 ++ FILE unofficial-s2Targets.cmake ++ DESTINATION share/unofficial-s2/ ++) + + message("GTEST_ROOT: ${GTEST_ROOT}") + if (GTEST_ROOT) +@@ -534,3 +534,17 @@ endif() + if (${SWIG_FOUND} AND ${PYTHONLIBS_FOUND}) + add_subdirectory("src/python" python) + endif() ++ ++ ++include(CMakePackageConfigHelpers) ++# generate the config file that is includes the exports ++configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in ++ "${CMAKE_CURRENT_BINARY_DIR}/unofficial-s2Config.cmake" ++ INSTALL_DESTINATION "share/unofficial-s2/" ++ NO_SET_AND_CHECK_MACRO ++ NO_CHECK_REQUIRED_COMPONENTS_MACRO ++ ) ++ install(FILES ++ ${CMAKE_CURRENT_BINARY_DIR}/unofficial-s2Config.cmake ++ DESTINATION "share/unofficial-s2/" ++ ) diff --git a/ports/s2geometry/Config.cmake.in.patch b/ports/s2geometry/Config.cmake.in.patch new file mode 100644 index 00000000000000..30162e6b9f2e62 --- /dev/null +++ b/ports/s2geometry/Config.cmake.in.patch @@ -0,0 +1,9 @@ +diff --git a/Config.cmake.in b/Config.cmake.in +new file mode 100644 +index 0000000..42bcf00 +--- /dev/null ++++ b/Config.cmake.in +@@ -0,0 +1,3 @@ ++@PACKAGE_INIT@ ++ ++include ( "${CMAKE_CURRENT_LIST_DIR}/unofficial-s2Targets.cmake" ) diff --git a/ports/s2geometry/portfile.cmake b/ports/s2geometry/portfile.cmake new file mode 100644 index 00000000000000..f15e3bcb58fe76 --- /dev/null +++ b/ports/s2geometry/portfile.cmake @@ -0,0 +1,29 @@ +vcpkg_fail_port_install(ON_TARGET "Windows") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/s2geometry + REF v0.9.0 + SHA512 854ec84a54aff036b3092a6233be0f5fc0e4846ac5f882326bbb3f2b9ce88bd5c866a80ae352d8e7d5ae00b9c9a8ab1cff6a95412f990b7bc1fdc5ca3d632b9c + HEAD_REF main + PATCHES + CMakeLists.txt.patch + Config.cmake.in.patch +) + + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBUILD_EXAMPLES=OFF + -DBUILD_TESTING=OFF + MAYBE_UNUSED_VARIABLES BUILD_TESTING +) + +vcpkg_cmake_install() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") + + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/s2geometry/" RENAME copyright) +file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/s2geometry/") diff --git a/ports/s2geometry/usage b/ports/s2geometry/usage new file mode 100644 index 00000000000000..31438446053d27 --- /dev/null +++ b/ports/s2geometry/usage @@ -0,0 +1,4 @@ +The package s2geometry provides CMake targets: + + find_package(unofficial-s2 CONFIG REQUIRED) + target_link_libraries(main PRIVATE unofficial-s2::s2) diff --git a/ports/s2geometry/vcpkg.json b/ports/s2geometry/vcpkg.json new file mode 100644 index 00000000000000..2f2a949b2dca5e --- /dev/null +++ b/ports/s2geometry/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "s2geometry", + "version": "0.9.0", + "description": "S2 is a library for spherical geometry that aims to have the same robustness, flexibility, and performance as the very best planar geometry libraries.", + "homepage": "https://s2geometry.io", + "supports": "!windows", + "dependencies": [ + "gflags", + "glog", + "gtest", + "openssl", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index 8f110801d4c84c..4a36ac7abdca9f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6132,6 +6132,10 @@ "baseline": "2.0", "port-version": 5 }, + "s2geometry": { + "baseline": "0.9.0", + "port-version": 0 + }, "s2n": { "baseline": "1.3.0", "port-version": 0 diff --git a/versions/s-/s2geometry.json b/versions/s-/s2geometry.json new file mode 100644 index 00000000000000..c439b2619110eb --- /dev/null +++ b/versions/s-/s2geometry.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "3cfb53e7df6cf6c9602e63606daa377568c52cd8", + "version": "0.9.0", + "port-version": 0 + } + ] +}