Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
30 changes: 30 additions & 0 deletions ports/hello-imgui/cmake-config.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 26ae5f7..10a58fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -407,7 +407,8 @@ if(HELLOIMGUI_INSTALL)
VERSION ${hello_imgui_VERSION}
COMPATIBILITY AnyNewerVersion)

- install(FILES "hello_imgui_cmake/hello-imguiConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/hello-imguiConfigVersion.cmake"
+ configure_file("${PROJECT_SOURCE_DIR}/hello_imgui_cmake/hello-imguiConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/hello-imguiConfig.cmake" @ONLY)
+ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/hello-imguiConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/hello-imguiConfigVersion.cmake"
DESTINATION lib/cmake/hello_imgui)
endif()

diff --git a/hello_imgui_cmake/hello-imguiConfig.cmake b/hello_imgui_cmake/hello-imguiConfig.cmake
index 2b93540..6cfa3f8 100644
--- a/hello_imgui_cmake/hello-imguiConfig.cmake
+++ b/hello_imgui_cmake/hello-imguiConfig.cmake
@@ -1,6 +1,9 @@
include(CMakeFindDependencyMacro)
-find_dependency(imgui CONFIG REQUIRED)
-find_dependency(glad CONFIG REQUIRED)
+find_dependency(imgui CONFIG)
+find_dependency(nlohmann_json CONFIG)
+if("@HELLOIMGUI_HAS_OPENGL3@")
+ find_dependency(glad CONFIG)
+endif()

include(${CMAKE_CURRENT_LIST_DIR}/hello_imgui_cmake/hello_imgui_add_app.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/hello-imgui-targets.cmake)
24 changes: 24 additions & 0 deletions ports/hello-imgui/imgui-test-engine.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/src/hello_imgui_test_engine_integration/hello_imgui_test_engine_cmake.cmake b/src/hello_imgui_test_engine_integration/hello_imgui_test_engine_cmake.cmake
index fda2d91..44c76a3 100644
--- a/src/hello_imgui_test_engine_integration/hello_imgui_test_engine_cmake.cmake
+++ b/src/hello_imgui_test_engine_integration/hello_imgui_test_engine_cmake.cmake
@@ -147,9 +147,6 @@ endfunction()

# Public API for this module
function(add_imgui_test_engine)
- _fetch_imgui_test_engine_if_needed()
- _add_imgui_test_engine_lib()
- _configure_imgui_with_test_engine()
_add_hello_imgui_test_engine_integration()
# _add_imgui_test_engine_app_minimal_example()
endfunction()
diff --git a/src/hello_imgui_test_engine_integration/test_engine_integration.cpp b/src/hello_imgui_test_engine_integration/test_engine_integration.cpp
index 9f5bb59..2be0fa1 100644
--- a/src/hello_imgui_test_engine_integration/test_engine_integration.cpp
+++ b/src/hello_imgui_test_engine_integration/test_engine_integration.cpp
@@ -1,4 +1,4 @@
-#include "imgui_test_engine/imgui_te_engine.h"
+#include <imgui_te_engine.h>
#include "hello_imgui/runner_params.h"
#include "hello_imgui/internal/functional_utils.h"
#include "hello_imgui/internal/backend_impls/opengl_setup_helper/opengl_screenshot.h"
121 changes: 53 additions & 68 deletions ports/hello-imgui/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,94 +6,77 @@ vcpkg_from_github(
REF "v${VERSION}"
SHA512 b44741e27278974f6a545a3143abd18027d98503cc912085e08528c467197fb208d2d4876e483f74e518f3dfc14d12c3579e379b9939dc364a1fff4ee98bb8f5
HEAD_REF master
PATCHES
cmake-config.diff
imgui-test-engine.diff
)
file(REMOVE_RECURSE
"${SOURCE_PATH}/external/imgui"
"${SOURCE_PATH}/external/nlohmann_json"
"${SOURCE_PATH}/external/OpenGL_Loaders"
"${SOURCE_PATH}/external/stb_hello_imgui/stb_image.h"
"${SOURCE_PATH}/external/stb_hello_imgui/stb_image_write.h"
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
vcpkg_check_features(OUT_FEATURE_OPTIONS options
FEATURES
"opengl3-binding" HELLOIMGUI_HAS_OPENGL3
"metal-binding" HELLOIMGUI_HAS_METAL
"experimental-vulkan-binding" HELLOIMGUI_HAS_VULKAN
"experimental-dx11-binding" HELLOIMGUI_HAS_DIRECTX11
"experimental-dx12-binding" HELLOIMGUI_HAS_DIRECTX12
"glfw-binding" HELLOIMGUI_USE_GLFW3
"freetype-plutosvg" HELLOIMGUI_USE_FREETYPE # When hello_imgui is built with freetype, it will also build with plutosvg
# "target platforms"
opengl3-binding HELLOIMGUI_HAS_OPENGL3
metal-binding HELLOIMGUI_HAS_METAL
experimental-vulkan-binding HELLOIMGUI_HAS_VULKAN
experimental-dx11-binding HELLOIMGUI_HAS_DIRECTX11
experimental-dx12-binding HELLOIMGUI_HAS_DIRECTX12
# "platform backends"
glfw-binding HELLOIMGUI_USE_GLFW3
# sdl2-binding HELLOIMGUI_USE_SDL2 # removed with imgui[sdl2-binding]
# other
test-engine HELLOIMGUI_WITH_TEST_ENGINE
)

if (NOT HELLOIMGUI_HAS_OPENGL3
AND NOT HELLOIMGUI_HAS_METAL
AND NOT HELLOIMGUI_HAS_VULKAN
AND NOT HELLOIMGUI_HAS_DIRECTX11
AND NOT HELLOIMGUI_HAS_DIRECTX12)
set(no_rendering_backend ON)
endif()

if (NOT HELLOIMGUI_USE_GLFW3 AND NOT HELLOIMGUI_USE_SDL2)
set(no_platform_backend ON)
endif()


set(platform_options "")
if(VCPKG_TARGET_IS_WINDOWS)
# Standard win32 options (these are the defaults for HelloImGui)
# we could add a vcpkg feature for this, but it would have to be platform specific
list(APPEND platform_options
-DHELLOIMGUI_WIN32_NO_CONSOLE=ON
-DHELLOIMGUI_WIN32_AUTO_WINMAIN=ON
)
endif()

if(VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_IOS)
# Standard macOS options (these are the defaults for HelloImGui)
# we could add a vcpkg feature for this, but it would have to be platform specific
list(APPEND platform_options
-DHELLOIMGUI_MACOS_NO_BUNDLE=OFF
)
endif()


vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DHELLOIMGUI_BUILD_DEMOS=OFF
-DHELLOIMGUI_BUILD_DOCS=OFF
-DHELLOIMGUI_BUILD_TESTS=OFF

# vcpkg does not support ImGui Test Engine, so we cannot enable it
-DHELLOIMGUI_WITH_TEST_ENGINE=OFF

-DHELLOIMGUI_USE_IMGUI_CMAKE_PACKAGE=ON
${options}
-DHELLO_IMGUI_IMGUI_SHARED=OFF
-DHELLOIMGUI_BUILD_DEMOS=OFF
-DHELLOIMGUI_BUILD_IMGUI=OFF

${platform_options}

# Rendering backends
-DHELLOIMGUI_HAS_OPENGL3=${HELLOIMGUI_HAS_OPENGL3}
-DHELLOIMGUI_HAS_METAL=${HELLOIMGUI_HAS_METAL}
-DHELLOIMGUI_HAS_VULKAN=${HELLOIMGUI_HAS_VULKAN}
-DHELLOIMGUI_HAS_DIRECTX11=${HELLOIMGUI_HAS_DIRECTX11}
-DHELLOIMGUI_HAS_DIRECTX12=${HELLOIMGUI_HAS_DIRECTX12}

# Platform backends
-DHELLOIMGUI_USE_GLFW3=${HELLOIMGUI_USE_GLFW3}
-DHELLOIMGUI_USE_SDL2=${HELLOIMGUI_USE_SDL2}
-DHELLOIMGUI_FETCH_FORBIDDEN=ON
-DHELLOIMGUI_FREETYPE_STATIC=OFF
-DHELLOIMGUI_MACOS_NO_BUNDLE=OFF
-DHELLOIMGUI_USE_IMGUI_CMAKE_PACKAGE=ON
-DHELLOIMGUI_WIN32_NO_CONSOLE=ON
-DHELLOIMGUI_WIN32_AUTO_WINMAIN=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_glad=ON
-DCMAKE_REQUIRE_FIND_PACKAGE_nlohmann_json=ON
MAYBE_UNUSED_VARIABLES
CMAKE_REQUIRE_FIND_PACKAGE_glad
HELLOIMGUI_WIN32_NO_CONSOLE
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/hello_imgui PACKAGE_NAME "hello-imgui") # should be active once himgui produces a config
vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/hello_imgui" PACKAGE_NAME "hello-imgui")

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/share/hello-imgui/hello_imgui_cmake/ios-cmake"
)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

if (NOT HELLOIMGUI_HAS_OPENGL3
AND NOT HELLOIMGUI_HAS_METAL
AND NOT HELLOIMGUI_HAS_VULKAN
AND NOT HELLOIMGUI_HAS_DIRECTX11
AND NOT HELLOIMGUI_HAS_DIRECTX12)
set(no_rendering_backend TRUE)
endif()
if (NOT HELLOIMGUI_USE_GLFW3
AND NOT HELLOIMGUI_USE_SDL2)
set(no_platform_backend TRUE)
endif()
if (no_rendering_backend OR no_platform_backend)
message(STATUS "
file(APPEND "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" "
########################################################################
!!!! WARNING !!!!!
!!!! Installed hello-imgui without a viable backend !!!!!
Expand All @@ -109,10 +92,10 @@ if (no_rendering_backend OR no_platform_backend)
experimental-dx11-binding # Windows only, still experimental
experimental-dx12-binding # Windows only, advanced users only, still experimental

- At least one (or more) platform backend (SDL2, Glfw3):
Make your choice according to your needs and your target platforms, between:
- At least one (or more) platform backend (Glfw3*):
Make your choice according to your needs and your target platforms, between:
glfw-binding
sdl-binding
*) This port currently doesn't offer an SDL platform backend.

For example, you could use:
vcpkg install \"hello-imgui[opengl3-binding,glfw-binding]\"
Expand All @@ -123,3 +106,5 @@ if (no_rendering_backend OR no_platform_backend)
########################################################################
")
endif()

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
23 changes: 7 additions & 16 deletions ports/hello-imgui/usage
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
hello_imgui provides CMake targets and hello_imgui_add_app:
hello-imgui provides CMake integration:

Usage with `hello_imgui_add_app` (recommended)
set(CMAKE_CXX_STANDARD 17)
find_package(hello-imgui CONFIG REQUIRED)
hello_imgui_add_app(test test.cpp) # see example below

Usage with `target_link_libraries`
set(CMAKE_CXX_STANDARD 17)
find_package(hello-imgui CONFIG REQUIRED)
# Note the subtle difference between the package name and the target name: hello-imgui vs hello_imgui!
target_link_libraries(main PRIVATE hello-imgui::hello_imgui)
# this mode will ignore all of hello_imgui cmake tooling, and will not deploy the assets

Example test.cpp:
#include "hello_imgui/hello_imgui.h"
int main() { HelloImGui::Run([](){ ImGui::Text("Hello, world!"); ImGui::ShowDemoWindow(); }); }
set(CMAKE_CXX_STANDARD 17)
find_package(hello-imgui CONFIG REQUIRED)
# Usage with `hello_imgui_add_app` (recommended)
hello_imgui_add_app(main my_main.cpp)
# Usage with `target_link_libraries` (no tooling, no asset deployment)
target_link_libraries(main PRIVATE hello-imgui::hello_imgui)
31 changes: 17 additions & 14 deletions ports/hello-imgui/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"name": "hello-imgui",
"version": "1.6.0",
"port-version": 1,
"description": "Hello ImGui: unleash your creativity in app development and prototyping",
"port-version": 2,
"description": [
"Hello ImGui: unleash your creativity in app development and prototyping",
"Note that at least on renderer backend and at least one platform backend must be chosen."
],
"homepage": "https://pthom.github.io/hello_imgui/",
"license": "MIT",
"dependencies": [
Expand All @@ -12,6 +15,7 @@
"docking-experimental"
]
},
"nlohmann-json",
"stb",
{
"name": "vcpkg-cmake",
Expand Down Expand Up @@ -56,18 +60,6 @@
}
]
},
"freetype-plutosvg": {
"description": "Improve font rendering and use colored fonts with freetype and plutosvg",
"dependencies": [
{
"name": "imgui",
"features": [
"freetype",
"freetype-svg"
]
}
]
},
"glfw-binding": {
"description": "Use GLFW platform backend (default)",
"dependencies": [
Expand Down Expand Up @@ -106,6 +98,17 @@
]
}
]
},
"test-engine": {
"description": "Build test engine",
"dependencies": [
{
"name": "imgui",
"features": [
"test-engine"
]
}
]
}
}
}
6 changes: 6 additions & 0 deletions scripts/test_ports/vcpkg-ci-hello-imgui/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)

vcpkg_cmake_configure(
SOURCE_PATH "${CURRENT_PORT_DIR}/project"
)
vcpkg_cmake_build()
11 changes: 11 additions & 0 deletions scripts/test_ports/vcpkg-ci-hello-imgui/project/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.30)
project(hello-imgui-test CXX)

set(CMAKE_CXX_STANDARD 17)

find_package(hello-imgui CONFIG REQUIRED)

add_executable(main main.cpp)
target_link_libraries(main PRIVATE
hello-imgui::hello_imgui
)
10 changes: 10 additions & 0 deletions scripts/test_ports/vcpkg-ci-hello-imgui/project/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include <hello_imgui/hello_imgui.h>

int main()
{
HelloImGui::Run([]() {
ImGui::Text("Hello vcpkg");
ImGui::ShowDemoWindow();
});
return 0;
}
Loading