Skip to content
Closed
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
27 changes: 26 additions & 1 deletion ports/imgui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,38 @@ set(IMGUI_SOURCES
imgui_widgets.cpp
)

if (IMGUI_INCLUDE_IMPL_VULKAN)
find_package(vulkan REQUIRED)

list (APPEND IMGUI_INCLUDES_PUBLIC examples/imgui_impl_vulkan.h)
list (APPEND IMGUI_SOURCES examples/imgui_impl_vulkan.cpp)
endif()

if (IMGUI_INCLUDE_IMPL_SDL2)
find_package(SDL2 CONFIG REQUIRED)

list (APPEND IMGUI_INCLUDES_PUBLIC examples/imgui_impl_sdl.h)
list (APPEND IMGUI_SOURCES examples/imgui_impl_sdl.cpp)
endif()


add_library(${PROJECT_NAME}
${IMGUI_INCLUDES_PUBLIC}
${IMGUI_INCLUDES_PRIVATE}
${IMGUI_SOURCES}
)

target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
if (IMGUI_INCLUDE_IMPL_VULKAN)
target_link_libraries(${PROJECT_NAME} PUBLIC Vulkan::Vulkan)
endif()

if (IMGUI_INCLUDE_IMPL_SDL2)
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2::SDL2main SDL2::SDL2-static)
endif()

target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>)

install(TARGETS ${PROJECT_NAME}
EXPORT IMGUIExport
Expand Down
12 changes: 10 additions & 2 deletions ports/imgui/CONTROL
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
Source: imgui
Version: 1.73-1
Version: 1.74
Homepage: https://github.com/ocornut/imgui
Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies.

Feature: vulkan
Description: imgui developer renderer bindings implementation for vulkan
Build-Depends: vulkan

Feature: sdl2
Description: imgui developer platform bindings implementation for sdl2
Build-Depends: sdl2

Feature: example
Description: build with examples
Description: build with all examples
Build-Depends: glfw3, freeglut, opengl, sdl1
20 changes: 16 additions & 4 deletions ports/imgui/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ocornut/imgui
REF v1.73
SHA512 1d67b7cc3f06ea77a2484e62034104386f42106fefe9b6eb62ee8a31fe949c9cda0cc095fbead9269e9da2a5d6199604d34c095eefd630655725265ac0fc4d92
REF v1.74
SHA512 e49e5cbe55899c0d0abc9b66c4e6e3e9941542af542d0ed3304bd3bde34c769baa2367355b77b91acb7fca56f9bcfd233dfc99881cfc8f5f6a2e2e6839990832
HEAD_REF master
)

file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
vulkan IMGUI_INCLUDE_IMPL_VULKAN
sdl2 IMGUI_INCLUDE_IMPL_SDL2
example IMGUI_COMPILE_ALL_EXAMPLES
)

if ("example" IN_LIST FEATURES AND ("sdl2" IN_LIST FEATURES OR "vulkan" IN_LIST FEATURES))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

after vcpkg_check_features there must be better way of checking for this

message (FATAL_ERROR "example feature uses includes whole examples folder, do not use it with other features")
endif()

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DIMGUI_SKIP_HEADERS=ON
)
Expand All @@ -29,11 +41,11 @@ if ("example" IN_LIST FEATURES)
USE_VCPKG_INTEGRATION
PROJECT_PATH ${SOURCE_PATH}/examples/imgui_examples.sln
)

# Install headers
file(GLOB IMGUI_EXAMPLE_INCLUDES ${SOURCE_PATH}/examples/*.h)
file(INSTALL ${IMGUI_EXAMPLE_INCLUDES} DESTINATION ${CURRENT_PACKAGES_DIR}/include)

# Install tools
file(GLOB_RECURSE IMGUI_EXAMPLE_BINARIES ${SOURCE_PATH}/examples/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
file(INSTALL ${IMGUI_EXAMPLE_BINARIES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
Expand Down