Skip to content

Commit

Permalink
[imgui-sfml] Force imgui-sfml to be a static library (#10840)
Browse files Browse the repository at this point in the history
* [imgui-sfml] Force imgui-sfml as a static library

* [imgui-sfml] Change the way to detect sfml
  • Loading branch information
JackBoosY authored May 15, 2020
1 parent 9b79636 commit 6319183
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
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)

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
21 changes: 19 additions & 2 deletions ports/imgui-sfml/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

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

if (VCPKG_TARGET_IS_WINDOWS)
file(GLOB SFML_DYNAMIC_LIBS "${CURRENT_INSTALLED_DIR}/bin/sfml-*")
else()
file(GLOB SFML_DYNAMIC_LIBS "${CURRENT_INSTALLED_DIR}/bin/libsfml-*")
endif()

if (SFML_DYNAMIC_LIBS)
set(SFML_STATIC OFF)
else()
set(SFML_STATIC ON)
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DSFML_STATIC_LIBRARIES=${SFML_STATIC}
)
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)

0 comments on commit 6319183

Please sign in to comment.