-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[s2geometry] Add new port #22107
[s2geometry] Add new port #22107
Changes from 41 commits
8add833
d7902b9
b8c364a
f27bc3c
1ac8147
fc96e70
757a375
b54d601
8b8eb17
ef56f7d
64672b7
34f4281
fab1111
a19bedd
1a0a2fe
bfb9db9
1bec8e8
9227e3e
38f7c8e
608d912
83c0859
f8992fb
b84c9fc
2e46c24
91d0eea
6bc621a
df7ead3
9202ec0
87a780b
a222dc6
a941c14
d416206
4f1784a
ba42f4c
a32e324
503614c
0ec3a89
4112681
e52f697
79becf3
21bd28f
4dfa99b
4abd41a
a86b65e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 5ecd280..1a8367f 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -211,7 +211,11 @@ target_link_libraries( | ||
# list(APPEND CMAKE_MODULE_PATH "<path_to_s2geometry_dir>/third_party/cmake") | ||
# add_subdirectory(<path_to_s2geometry_dir> s2geometry) | ||
# target_link_libraries(<target_name> s2) | ||
-target_include_directories(s2 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src) | ||
+target_include_directories(s2 PUBLIC | ||
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src> | ||
+$<INSTALL_INTERFACE:include> | ||
+) | ||
+ | ||
|
||
# We don't need to install all headers, only those | ||
# transitively included by s2 headers we are exporting. | ||
@@ -407,7 +411,17 @@ 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 s2Targets | ||
+ ) | ||
+install(EXPORT s2Targets | ||
+ FILE s2Targets.cmake | ||
+ DESTINATION share/s2/ | ||
+) | ||
|
||
message("GTEST_ROOT: ${GTEST_ROOT}") | ||
if (GTEST_ROOT) | ||
@@ -534,3 +548,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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This suggests that there is a missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I will fix them, Billy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Billy, I follow cmake tutorial https://cmake.org/cmake/help/latest/guide/tutorial/Adding%20Export%20Configuration.html , I think I am correct. Don't need vcpkg_fixup_pkgconfig here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, this is a CMake config script, not |
||
+ "${CMAKE_CURRENT_BINARY_DIR}/s2Config.cmake" | ||
+ INSTALL_DESTINATION "share/s2/" | ||
+ NO_SET_AND_CHECK_MACRO | ||
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO | ||
+ ) | ||
+ install(FILES | ||
+ ${CMAKE_CURRENT_BINARY_DIR}/s2Config.cmake | ||
+ DESTINATION "share/s2/" | ||
+ ) | ||
diff --git a/Config.cmake.in b/Config.cmake.in | ||
new file mode 100644 | ||
index 0000000..ac09b2d | ||
--- /dev/null | ||
+++ b/Config.cmake.in | ||
@@ -0,0 +1,3 @@ | ||
+@PACKAGE_INIT@ | ||
+ | ||
+include ( "${CMAKE_CURRENT_LIST_DIR}/s2Targets.cmake" ) |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,28 @@ | ||||||||||
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 | ||||||||||
config.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") | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
|
||||||||||
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"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": [ | ||
{ | ||
"name": "vcpkg-cmake", | ||
"host": true | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"versions": [ | ||
{ | ||
"git-tree": "1061917340485b0fecaabf0b460101b34873a679", | ||
"version": "0.9.0", | ||
"port-version": 0 | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When upstream does not have targets, we tend to add
unofficial-
as a prefix so that if upstream ever decides to add targets, they won't conflict with the ones injected byvcpkg
.