Skip to content

Commit

Permalink
[imgui-sfml] Update imgui-sfml to v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eXpl0it3r committed Jan 4, 2025
1 parent 9742056 commit 5064eba
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 215 deletions.
70 changes: 36 additions & 34 deletions ports/imgui-sfml/0001-fix_find_package.patch
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 075d793..9bc635a 100644
index 7945482..1c91277 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,13 +41,14 @@ if (IMGUI_SFML_FIND_SFML)
if (NOT BUILD_SHARED_LIBS)
set(SFML_STATIC_LIBRARIES ON)
endif()
- find_package(SFML 2.5 COMPONENTS graphics system window)
+ find_package(SFML COMPONENTS graphics system window)

if(NOT SFML_FOUND)
message(FATAL_ERROR "SFML 2 directory not found. Set SFML_DIR to directory where SFML was built (or one which contains SFMLConfig.cmake)")
endif()
endif()

+if(0)
# ImGui does not provide native support for CMakeLists, workaround for now to have
# users specify IMGUI_DIR. Waiting for this PR to get merged...
# https://github.com/ocornut/imgui/pull/1713
@@ -69,6 +70,8 @@ set(IMGUI_PUBLIC_HEADERS
${IMGUI_INCLUDE_DIR}/imstb_truetype.h
${IMGUI_INCLUDE_DIR}/misc/cpp/imgui_stdlib.h
)
+endif()
+find_package(imgui CONFIG REQUIRED)

if (IMGUI_SFML_IMGUI_DEMO)
list(APPEND IMGUI_SOURCES ${IMGUI_DEMO_SOURCES})
@@ -93,6 +96,7 @@ add_library(ImGui-SFML::ImGui-SFML ALIAS ImGui-SFML)

target_link_libraries(ImGui-SFML
PUBLIC
+ imgui::imgui
sfml-graphics
sfml-system
sfml-window
@@ -29,16 +29,7 @@ if(IMGUI_SFML_FIND_SFML)
find_package(SFML 3 REQUIRED COMPONENTS Graphics)
endif()

-# ImGui does not provide native support for CMakeLists, workaround for now to have
-# users specify IMGUI_DIR. Waiting for this PR to get merged...
-# https://github.com/ocornut/imgui/pull/1713
-if(NOT IMGUI_DIR)
- set(IMGUI_DIR "" CACHE PATH "imgui top-level directory")
- message(FATAL_ERROR "ImGui directory not found. Set IMGUI_DIR to imgui's top-level path (containing 'imgui.h' and other files).\n")
-endif()
-
-# This uses FindImGui.cmake provided in ImGui-SFML repo for now
-find_package(ImGui 1.91.1 REQUIRED)
+find_package(ImGui CONFIG REQUIRED)

# These headers will be installed alongside ImGui-SFML
set(IMGUI_PUBLIC_HEADERS
@@ -70,7 +61,7 @@ target_include_directories(ImGui-SFML PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
-target_link_libraries(ImGui-SFML PUBLIC SFML::Graphics OpenGL::GL)
+target_link_libraries(ImGui-SFML PUBLIC imgui::imgui SFML::Graphics OpenGL::GL)
if(WIN32 AND MINGW)
target_link_libraries(ImGui-SFML PUBLIC imm32)
endif()
@@ -113,7 +104,6 @@ target_compile_definitions(ImGui-SFML PUBLIC IMGUI_USER_CONFIG="${IMGUI_SFML_CON
set(IMGUI_SFML_PUBLIC_HEADERS
${PROJECT_SOURCE_DIR}/imgui-SFML.h
${PROJECT_SOURCE_DIR}/imgui-SFML_export.h
- ${IMGUI_PUBLIC_HEADERS}
)
if(IMGUI_SFML_USE_DEFAULT_CONFIG OR (NOT DEFINED "${IMGUI_SFML_CONFIG_INSTALL_DIR}"))
list(APPEND IMGUI_SFML_PUBLIC_HEADERS "${IMGUI_SFML_CONFIG_DIR}/${IMGUI_SFML_CONFIG_NAME}")
58 changes: 0 additions & 58 deletions ports/imgui-sfml/0002-clean-deprecated-api.patch

This file was deleted.

111 changes: 0 additions & 111 deletions ports/imgui-sfml/0003-use-explicit-id.patch

This file was deleted.

12 changes: 4 additions & 8 deletions ports/imgui-sfml/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO eliasdaler/imgui-sfml
REPO sfml/imgui-sfml
REF "v${VERSION}"
SHA512 c8f2ed21ad5dfac417474f0caed1c59105b7dd8bf2dcb1db3b1f46a4fb07cec3c199d6fda0ff05ec5040a18000a0168f1a8caa978dee356c2b6874b5b2e10ec4
SHA512 be02207533b532f10038bb83eb49311e57774dbddd1bac2ebb1789cbdef2abbfa24cee59b8b5889302feba72af1e98a4a1c7ac063e7d815ce1f2ef9bd40cf552
HEAD_REF master
PATCHES
0001-fix_find_package.patch
0002-clean-deprecated-api.patch # see https://github.com/SFML/imgui-sfml/pull/305
0003-use-explicit-id.patch # see https://github.com/SFML/imgui-sfml/pull/266
)

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DCMAKE_CXX_STANDARD=11
-DCMAKE_CXX_STANDARD=17
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
Expand All @@ -25,7 +21,7 @@ file(READ "${CURRENT_PACKAGES_DIR}/share/imgui-sfml/ImGui-SFMLConfig.cmake" cmak
string(PREPEND cmake_config [[
include(CMakeFindDependencyMacro)
find_dependency(imgui CONFIG)
find_dependency(SFML COMPONENTS graphics system window)
find_dependency(SFML COMPONENTS Graphics Window System)
]])
file(WRITE "${CURRENT_PACKAGES_DIR}/share/imgui-sfml/ImGui-SFMLConfig.cmake" "${cmake_config}")

Expand Down
3 changes: 1 addition & 2 deletions ports/imgui-sfml/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "imgui-sfml",
"version": "2.6",
"port-version": 1,
"version": "3.0",
"description": "ImGui binding for use with SFML",
"homepage": "https://github.com/eliasdaler/imgui-sfml",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3705,8 +3705,8 @@
"port-version": 2
},
"imgui-sfml": {
"baseline": "2.6",
"port-version": 1
"baseline": "3.0",
"port-version": 0
},
"imguizmo": {
"baseline": "2024-05-29",
Expand Down
5 changes: 5 additions & 0 deletions versions/i-/imgui-sfml.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d97a22934a499fb47307f798123f64137b700e80",
"version": "3.0",
"port-version": 0
},
{
"git-tree": "68bb56897b198937d6aade36289e5f74167bb99d",
"version": "2.6",
Expand Down

0 comments on commit 5064eba

Please sign in to comment.