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

[imgui-sfml] Force imgui-sfml to be a static library #10840

Merged
merged 2 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ports/imgui-sfml/004-fix-find-sfml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4d7a3fa..614564f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -32,9 +32,6 @@ set(IMGUI_SFML_CONFIG_INSTALL_DIR "" CACHE PATH "Path where user's config header
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

if (IMGUI_SFML_FIND_SFML)
- if (NOT BUILD_SHARED_LIBS)
- set(SFML_STATIC_LIBRARIES ON)
- endif()
find_package(SFML COMPONENTS graphics system window)
Copy link
Contributor

Choose a reason for hiding this comment

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

The consuming package should not need to care about whether SFML is static or dynamic -- we should introduce a vcpkg-cmake-wrapper in the sfml package that resolves this issue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ras0219-msft
Here, SFML_STATIC_LIBRARIES is forced to be BUILD_SHARED_LIBS, which causes sfml to be associated with imgui-sfml build type. So I think it needs to be removed here.

Since vcpkg_check_linkage changes the value of VCPKG_LIBRARY_LINKAGE, if we set this value in vcpkg-cmake-wrapper, we cannot use VCPKG_LIBRARY_LINKAGE to determine what VCPKG_LIBRARY_LINKAGE should be set to.


if(NOT SFML_FOUND)
2 changes: 1 addition & 1 deletion ports/imgui-sfml/CONTROL
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: imgui-sfml
Version: 2.1
Version: 2.1-1
Homepage: https:/eliasdaler/imgui-sfml
Description: ImGui binding for use with SFML
Build-Depends: sfml, imgui
11 changes: 9 additions & 2 deletions ports/imgui-sfml/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
include(vcpkg_common_functions)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" SFML_STATIC)

vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
Expand All @@ -10,15 +12,20 @@ vcpkg_from_github(
0001-fix_find_package.patch
0002-fix_imgui_config.patch
0003-fix_osx.patch
004-fix-find-sfml.patch
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DSFML_STATIC_LIBRARIES=${SFML_STATIC}
JackBoosY marked this conversation as resolved.
Show resolved Hide resolved
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()

vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/ImGui-SFML)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/imgui-sfml/copyright COPYONLY)

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)