-
Notifications
You must be signed in to change notification settings - Fork 7k
[sproto]Add new port for sproto serialization library #46727
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
Conversation
ports/sproto/CMakeLists.txt
Outdated
# Find Lua dependency | ||
find_package(Lua REQUIRED) |
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.
Remove comments which do not carry additional information.
ports/sproto/CMakeLists.txt
Outdated
|
||
# Link with Lua based on platform (Windows requires explicit linking) | ||
if(WIN32) | ||
target_link_libraries(sproto PUBLIC ${LUA_LIBRARIES}) |
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.
Is this really public?
target_link_libraries(sproto PUBLIC ${LUA_LIBRARIES}) | |
target_link_libraries(sproto PRIVATE ${LUA_LIBRARIES}) |
ports/sproto/portfile.cmake
Outdated
# Install usage file | ||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") | ||
|
||
vcpkg_cmake_config_fixup(CONFIG_PATH share/sproto) |
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.
vcpkg_cmake_config_fixup(CONFIG_PATH share/sproto) | |
vcpkg_cmake_config_fixup(CONFIG_PATH "share/sproto" PACKAGE_NAME "unofficial-sproto") |
And linebreak at end of file. (Empty line in VS Code.)
ports/sproto/sproto-config.cmake.in
Outdated
# Provide the sproto target | ||
set_target_properties(unofficial-sproto::sproto PROPERTIES | ||
IMPORTED_GLOBAL TRUE | ||
) | ||
|
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.
I don't think this should be set by the config package.
# Provide the sproto target | |
set_target_properties(unofficial-sproto::sproto PROPERTIES | |
IMPORTED_GLOBAL TRUE | |
) | |
ports/sproto/CMakeLists.txt
Outdated
# Install CMake config files | ||
install(EXPORT sproto-targets | ||
FILE sproto-targets.cmake | ||
NAMESPACE unofficial-sproto:: |
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.
NAMESPACE unofficial-sproto:: | |
NAMESPACE unofficial::sproto:: |
I do sympathize with using the CMake package name, but the Maintainer Guide...
ports/sproto/sproto-config.cmake.in
Outdated
# Create alias for backward compatibility | ||
if(NOT TARGET sproto::sproto) | ||
add_library(sproto::sproto ALIAS unofficial-sproto::sproto) | ||
endif() | ||
|
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.
New port. There is nothing to be backward-compatible with in this registry.
# Create alias for backward compatibility | |
if(NOT TARGET sproto::sproto) | |
add_library(sproto::sproto ALIAS unofficial-sproto::sproto) | |
endif() | |
ports/sproto/sproto-config.cmake.in
Outdated
add_library(sproto::sproto ALIAS unofficial-sproto::sproto) | ||
endif() | ||
|
||
check_required_components(sproto) |
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.
Linebreak at end of file. (Empty line in VS Code.)
check_required_components(sproto) | |
check_required_components(sproto) |
ports/sproto/usage
Outdated
The package sproto provides CMake targets: | ||
|
||
find_package(sproto CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE unofficial-sproto::sproto) |
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.
Adopt the pattern from the usage heuristics.
Prefix corrections.
Linebreak at end of file. (Empty line in VS Code.)
The package sproto provides CMake targets: | |
find_package(sproto CONFIG REQUIRED) | |
target_link_libraries(main PRIVATE unofficial-sproto::sproto) | |
sproto provides CMake targets: | |
find_package(unofficial-sproto CONFIG REQUIRED) | |
target_link_libraries(main PRIVATE unofficial::sproto::sproto) |
ports/sproto/CMakeLists.txt
Outdated
install(FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/sproto-config.cmake" | ||
DESTINATION share/sproto | ||
) |
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.
Linebreak at end of file. (Empty line in VS Code.)
) | |
) |
- Change CMake namespace from unofficial-sproto:: to unofficial::sproto:: - Update package name and config path to use unofficial-sproto - Switch to PRIVATE linkage for lua dependency - Use unofficial-lua CONFIG instead of Lua REQUIRED - Remove backward compatibility alias from config - Update usage instructions to use unofficial-sproto - Add Windows symbol export support with SPROTO_STATIC macro - Fix config file naming to unofficial-sproto-config.cmake
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.
Thanks for the new port!
@dg0yt Thanks for the code review comments, I agree with those and @cuihairu appears to have fixed them.
Next time we have to touch this I'd probably remove the leading blank line in portfile.cmake but I don't want to force a rebuild over that, so I'm going to merge this as is. Thanks!
find_package
calls are REQUIRED, are satisfied byvcpkg.json
's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.vcpkg.json
matches what upstream says.vcpkg.json
matches what upstream says../vcpkg x-add-version --all
and committing the result.