Skip to content

[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

Merged
merged 4 commits into from
Aug 4, 2025

Conversation

cuihairu
Copy link
Contributor

@cuihairu cuihairu commented Aug 3, 2025

  • Changes comply with the maintainer guide.
  • The name of the port matches an existing name for this component on https://repology.org/ if possible, and/or is strongly associated with that component on search engines.
  • Optional dependencies are resolved in exactly one way. For example, if the component is built with CMake, all find_package calls are REQUIRED, are satisfied by vcpkg.json's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.
  • The versioning scheme in vcpkg.json matches what upstream says.
  • The license declaration in vcpkg.json matches what upstream says.
  • The installed as the "copyright" file matches what upstream says.
  • The source code of the component installed comes from an authoritative source.
  • The generated "usage text" is accurate. See adding-usage for context.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is in the new port's versions file.
  • Only one version is added to each modified port's versions file.

@cuihairu cuihairu marked this pull request as ready for review August 3, 2025 07:23
Comment on lines 6 to 7
# Find Lua dependency
find_package(Lua REQUIRED)
Copy link
Contributor

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.


# Link with Lua based on platform (Windows requires explicit linking)
if(WIN32)
target_link_libraries(sproto PUBLIC ${LUA_LIBRARIES})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really public?

Suggested change
target_link_libraries(sproto PUBLIC ${LUA_LIBRARIES})
target_link_libraries(sproto PRIVATE ${LUA_LIBRARIES})

# Install usage file
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

vcpkg_cmake_config_fixup(CONFIG_PATH share/sproto)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.)

Comment on lines 5 to 9
# Provide the sproto target
set_target_properties(unofficial-sproto::sproto PROPERTIES
IMPORTED_GLOBAL TRUE
)

Copy link
Contributor

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.

Suggested change
# Provide the sproto target
set_target_properties(unofficial-sproto::sproto PROPERTIES
IMPORTED_GLOBAL TRUE
)

# Install CMake config files
install(EXPORT sproto-targets
FILE sproto-targets.cmake
NAMESPACE unofficial-sproto::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NAMESPACE unofficial-sproto::
NAMESPACE unofficial::sproto::

I do sympathize with using the CMake package name, but the Maintainer Guide...

Comment on lines 10 to 14
# Create alias for backward compatibility
if(NOT TARGET sproto::sproto)
add_library(sproto::sproto ALIAS unofficial-sproto::sproto)
endif()

Copy link
Contributor

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.

Suggested change
# Create alias for backward compatibility
if(NOT TARGET sproto::sproto)
add_library(sproto::sproto ALIAS unofficial-sproto::sproto)
endif()

add_library(sproto::sproto ALIAS unofficial-sproto::sproto)
endif()

check_required_components(sproto)
Copy link
Contributor

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.)

Suggested change
check_required_components(sproto)
check_required_components(sproto)

Comment on lines 1 to 4
The package sproto provides CMake targets:

find_package(sproto CONFIG REQUIRED)
target_link_libraries(main PRIVATE unofficial-sproto::sproto)
Copy link
Contributor

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.)

Suggested change
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)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/sproto-config.cmake"
DESTINATION share/sproto
)
Copy link
Contributor

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.)

Suggested change
)
)

cuihairu added 3 commits August 4, 2025 12:38
- 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
@cuihairu cuihairu requested a review from dg0yt August 4, 2025 14:50
@BillyONeal
Copy link
Member

FYI other reviewers this is a reopened #46688

@cuihairu Please try to avoid reopening PRs when you can just update the contents, it makes following the discussion history difficult.

Copy link
Member

@BillyONeal BillyONeal left a 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!

@BillyONeal BillyONeal merged commit e975f0e into microsoft:master Aug 4, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants