Skip to content
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

[sfml][imgui-sfml] Push SFML_STATIC_LIBRARIES setting into sfml #11800

Merged
merged 6 commits into from
Aug 22, 2020

Conversation

ras0219
Copy link
Contributor

@ras0219 ras0219 commented Jun 5, 2020

PR #10840 addresses the core problem of #9660, however it misplaces the truth of whether sfml was built statically. This PR causes SFMLConfig.cmake to always override the definition of SFML_STATIC_LIBRARIES according to the original build configuration.

As an additional drive-by fix, I've added a dependency on opengl to fix #10840 (comment).

CC: @Neumann-A @JackBoosY @cenit

Comment on lines +35 to +39
FILE(READ ${CURRENT_PACKAGES_DIR}/share/sfml/SFMLConfig.cmake SFML_CONFIG)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
FILE(READ ${CURRENT_PACKAGES_DIR}/share/sfml/SFMLConfig.cmake SFML_CONFIG)
FILE(WRITE ${CURRENT_PACKAGES_DIR}/share/sfml/SFMLConfig.cmake "set(SFML_STATIC_LIBRARIES true)\ninclude(CMakeFindDependencyMacro)\nfind_dependency(Freetype)\n${SFML_CONFIG}")
else()
FILE(WRITE ${CURRENT_PACKAGES_DIR}/share/sfml/SFMLConfig.cmake "set(SFML_STATIC_LIBRARIES false)\n${SFML_CONFIG}")
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 get why you need this change. I also don't get why imgui-sfml required SFML_STATIC_LIBRARIES
since SFML seems to already set SFML_STATIC_LIBRARIES if required.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is potentially an issue in the reverse case -- if sfml is dynamic and imgui-sfml is static. This change ensures that SFML_STATIC_LIBRARIES is always set exactly according to how sfml was built, regardless of whether the outer project sets the variable or not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Better make that a FATAL_ERROR instead of silently accepting it because it means a consumer needs to be patched instead and might be assuming something wrongly.

Copy link
Contributor Author

@ras0219 ras0219 Aug 10, 2020

Choose a reason for hiding this comment

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

I think that it's better to be optimistic here:

  1. Patching every single consumer is not realistic
  2. The vast majority of cases will work without patching
  3. The cases that don't work will have build failures, not silent misbehavior

Finally, it's essentially impossible for consumers to do the right thing; setting SFML_STATIC_LIBRARIES requires knowledge of whether SFML was built statically or not. Therefore, it's actually somewhat impossible to patch consumers correctly.

@JackBoosY
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@JackBoosY JackBoosY added category:port-bug The issue is with a library, which is something the port should already support info:internal This PR or Issue was filed by the vcpkg team. labels Jun 10, 2020
@BillyONeal BillyONeal merged commit de0501f into microsoft:master Aug 22, 2020
remz1337 pushed a commit to remz1337/vcpkg that referenced this pull request Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support info:internal This PR or Issue was filed by the vcpkg team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants