aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTri Tran <lepnit205@gmail.com>2019-09-03 16:45:31 -0500
committerdan-shaw <51385773+dan-shaw@users.noreply.github.com>2019-09-03 14:45:31 -0700
commit79b5a9ae5865b81cea275789613c4fa5151e46c6 (patch)
tree9f4a3471ade838c9f6bc65906db9583ab3669a6d
parent8fb4a3153c475c25119bb908da67f456560eccae (diff)
downloadvcpkg-79b5a9ae5865b81cea275789613c4fa5151e46c6.tar.gz
vcpkg-79b5a9ae5865b81cea275789613c4fa5151e46c6.zip
[imgui-sfml] Add new port (#7429)
* [imgui-sfml] Add new package ImGui-SFML * Static build only to match with `imgui`. * [imgui-sfml] Fix case-sensitive imgui package name * [imgui-sfml] Require C++11 * [imgui-sfml] Include IMGUI_API define * [imgui-sfml] Remove delegating ctor - C++11 is not required
-rw-r--r--ports/imgui-sfml/CONTROL5
-rw-r--r--ports/imgui-sfml/portfile.cmake30
-rw-r--r--ports/imgui-sfml/remove-delegating-ctor.patch13
-rw-r--r--ports/imgui-sfml/static-build-with-vcpkg-imgui.patch71
4 files changed, 119 insertions, 0 deletions
diff --git a/ports/imgui-sfml/CONTROL b/ports/imgui-sfml/CONTROL
new file mode 100644
index 000000000..f72f50db8
--- /dev/null
+++ b/ports/imgui-sfml/CONTROL
@@ -0,0 +1,5 @@
+Source: imgui-sfml
+Version: 2.0.2
+Homepage: https://github.com/eliasdaler/imgui-sfml
+Description: Library which allows you to use ImGui with SFML
+Build-Depends: sfml, imgui
diff --git a/ports/imgui-sfml/portfile.cmake b/ports/imgui-sfml/portfile.cmake
new file mode 100644
index 000000000..4cc33edb9
--- /dev/null
+++ b/ports/imgui-sfml/portfile.cmake
@@ -0,0 +1,30 @@
+include(vcpkg_common_functions)
+
+# Compile as static lib since vcpkg's imgui is compiled as static lib
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO eliasdaler/imgui-sfml
+ REF v2.0.2
+ SHA512 44099e162c0e712ec9147452189649801a6463396830e117c7a0a4483d0526e94554498bfa41e9cd418d26286b5d1a28dd1c2d305c30d1eb266922767e53ab48
+ HEAD_REF master
+ PATCHES
+ static-build-with-vcpkg-imgui.patch
+ remove-delegating-ctor.patch
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/ImGui-SFML)
+vcpkg_copy_pdbs()
+
+# Debug include directory not needed
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+# License
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/imgui-sfml RENAME copyright)
diff --git a/ports/imgui-sfml/remove-delegating-ctor.patch b/ports/imgui-sfml/remove-delegating-ctor.patch
new file mode 100644
index 000000000..a0442fc13
--- /dev/null
+++ b/ports/imgui-sfml/remove-delegating-ctor.patch
@@ -0,0 +1,13 @@
+diff --git a/imconfig-SFML.h b/imconfig-SFML.h
+index 0f43ce6..1fce2c1 100644
+--- a/imconfig-SFML.h
++++ b/imconfig-SFML.h
+@@ -19,7 +19,7 @@
+
+ #define IM_VEC4_CLASS_EXTRA \
+ ImVec4(const sf::Color & c) \
+- : ImVec4(c.r / 255.f, c.g / 255.f, c.b / 255.f, c.a / 255.f) { \
++ : x(c.r / 255.f), y(c.g / 255.f), z(c.b / 255.f), w(c.a / 255.f) { \
+ } \
+ operator sf::Color() const { \
+ return sf::Color( \
diff --git a/ports/imgui-sfml/static-build-with-vcpkg-imgui.patch b/ports/imgui-sfml/static-build-with-vcpkg-imgui.patch
new file mode 100644
index 000000000..0432a5c26
--- /dev/null
+++ b/ports/imgui-sfml/static-build-with-vcpkg-imgui.patch
@@ -0,0 +1,71 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 015a030..33d6894 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -29,7 +29,7 @@ set(IMGUI_SFML_CONFIG_NAME "imconfig-SFML.h" CACHE STRING "Name of a custom user
+ set(IMGUI_SFML_CONFIG_INSTALL_DIR "" CACHE PATH "Path where user's config header will be installed")
+
+ # For FindImGui.cmake
+-list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
++# list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
+
+ if (IMGUI_SFML_FIND_SFML)
+ find_package(SFML 2.5 COMPONENTS graphics system window)
+@@ -42,24 +42,24 @@ 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_ROOT to imgui's top-level path (containing 'imgui.h' and other files).\n")
+-endif()
++# if(NOT IMGUI_DIR)
++ # set(IMGUI_DIR "" CACHE PATH "imgui top-level directory")
++ # message(FATAL_ERROR "ImGui directory not found. Set IMGUI_ROOT 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.68 REQUIRED)
++find_package(imgui REQUIRED)
+
+ # these headers will be installed alongside ImGui-SFML
+-set(IMGUI_PUBLIC_HEADERS
+- ${IMGUI_INCLUDE_DIR}/imconfig.h
+- ${IMGUI_INCLUDE_DIR}/imgui.h
+- ${IMGUI_INCLUDE_DIR}/imgui_internal.h # not actually public, but users might need it
+- ${IMGUI_INCLUDE_DIR}/imstb_rectpack.h
+- ${IMGUI_INCLUDE_DIR}/imstb_textedit.h
+- ${IMGUI_INCLUDE_DIR}/imstb_truetype.h
+- ${IMGUI_INCLUDE_DIR}/misc/cpp/imgui_stdlib.h
+-)
++# set(IMGUI_PUBLIC_HEADERS
++ # ${IMGUI_INCLUDE_DIR}/imconfig.h
++ # ${IMGUI_INCLUDE_DIR}/imgui.h
++ # ${IMGUI_INCLUDE_DIR}/imgui_internal.h # not actually public, but users might need it
++ # ${IMGUI_INCLUDE_DIR}/imstb_rectpack.h
++ # ${IMGUI_INCLUDE_DIR}/imstb_textedit.h
++ # ${IMGUI_INCLUDE_DIR}/imstb_truetype.h
++ # ${IMGUI_INCLUDE_DIR}/misc/cpp/imgui_stdlib.h
++# )
+
+ # CMake 3.11 and later prefer to choose GLVND, but we choose legacy OpenGL just because it's safer
+ # (unless the OpenGL_GL_PREFERENCE was explicitly set)
+@@ -80,6 +80,7 @@ add_library(ImGui-SFML::ImGui-SFML ALIAS ImGui-SFML)
+
+ target_link_libraries(ImGui-SFML
+ PUBLIC
++ imgui::imgui
+ sfml-graphics
+ sfml-system
+ sfml-window
+diff --git a/imconfig-SFML.h b/imconfig-SFML.h
+index f66ba20..0f43ce6 100644
+--- a/imconfig-SFML.h
++++ b/imconfig-SFML.h
+@@ -28,5 +28,3 @@
+ static_cast<sf::Uint8>(z * 255.f), \
+ static_cast<sf::Uint8>(w * 255.f)); \
+ }
+-
+-#define ImTextureID unsigned int
+\ No newline at end of file