[imgui] Add feature bindings and remove feature example (#10253)

* [imgui] Separate feature tools from feature example

* [imgui] Separate feature tools from feature example

Co-authored-by: JackBoosY <yuzaiyang@microsoft.com>
This commit is contained in:
Jack·Boos·Yu 2020-05-01 13:57:38 +08:00 committed by GitHub
parent 28fc76e733
commit 7db2ffa0b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 88 additions and 28 deletions

View File

@ -9,4 +9,4 @@ Description: Build K4A doxygen documentation.
Feature: tool
Description: Build tools.
Build-Depends: gl3w, imgui[example]
Build-Depends: gl3w, glew, imgui[bindings]

View File

@ -0,0 +1,45 @@
diff --git a/tools/k4aviewer/CMakeLists.txt b/tools/k4aviewer/CMakeLists.txt
index 6ab38d9..e0c5bad 100644
--- a/tools/k4aviewer/CMakeLists.txt
+++ b/tools/k4aviewer/CMakeLists.txt
@@ -35,6 +35,8 @@ set(SOURCE_FILES
k4awindowset.cpp
perfcounter.cpp
${CMAKE_CURRENT_BINARY_DIR}/version.rc
+ ${IMGUI_EXTERNAL_PATH}/imgui_impl_glfw.cpp
+ ${IMGUI_EXTERNAL_PATH}/imgui_impl_opengl3.cpp
)
# Include ${CMAKE_CURRENT_BINARY_DIR}/version.rc in the target's sources
@@ -54,6 +56,8 @@ include_directories(
${CMAKE_CURRENT_LIST_DIR}
)
+find_package(GLEW REQUIRED)
+
set(EXTERNAL_LIBRARIES
k4a::k4a
k4a::k4arecord
@@ -65,6 +69,7 @@ set(EXTERNAL_LIBRARIES
glfw
${OPENGL_LIBRARIES}
unofficial::gl3w::gl3w
+ GLEW::GLEW
)
# On Windows, we need to call into setupapi to get USB container ID information
diff --git a/tools/k4aviewer/k4aimgui_all.h b/tools/k4aviewer/k4aimgui_all.h
index e40ccfb..756fb09 100644
--- a/tools/k4aviewer/k4aimgui_all.h
+++ b/tools/k4aviewer/k4aimgui_all.h
@@ -34,8 +34,8 @@
#include <GL/gl3w.h>
#include <GLFW/glfw3.h>
#include <imgui.h>
-#include <imgui_impl_glfw.h>
-#include <imgui_impl_opengl3.h>
+#include <bindings/imgui_impl_glfw.h>
+#include <bindings/imgui_impl_opengl3.h>
// For disabling buttons, which has not yet been promoted to the public API
//

View File

@ -7,6 +7,7 @@ vcpkg_from_github(
PATCHES
fix-builds.patch
disable-c4275.patch
fix-dependency-imgui.patch
)
vcpkg_find_acquire_program(PYTHON3)
@ -26,6 +27,7 @@ vcpkg_configure_cmake(
-DK4A_MTE_VERSION=ON
-DBUILD_EXAMPLES=OFF
-DWITH_TEST=OFF
-DIMGUI_EXTERNAL_PATH=${CURRENT_INSTALLED_DIR}/include/bindings
)
vcpkg_install_cmake()
@ -40,6 +42,18 @@ vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if ("tool" IN_LIST FEATURES)
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)
file(GLOB AZURE_TOOLS ${CURRENT_PACKAGES_DIR}/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
file(COPY ${AZURE_TOOLS} DESTINATION ${CURRENT_PACKAGES_DIR}/tools)
file(REMOVE ${AZURE_TOOLS})
endif()
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
file(GLOB AZURE_TOOLS ${CURRENT_PACKAGES_DIR}/debug/bin/*${VCPKG_TARGET_EXECUTABLE_SUFFIX})
file(REMOVE ${AZURE_TOOLS})
endif()
endif()
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin)
endif()

View File

@ -10,6 +10,7 @@ set(IMGUI_INCLUDES_PUBLIC
set(IMGUI_INCLUDES_PRIVATE
imgui_internal.h
imstb_textedit.h
)
set(IMGUI_SOURCES
@ -25,6 +26,8 @@ add_library(${PROJECT_NAME}
${IMGUI_SOURCES}
)
file(GLOB IMGUI_BINDINGS ${CMAKE_CURRENT_SOURCE_DIR}/examples/imgui_impl_* )
target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
install(TARGETS ${PROJECT_NAME}
@ -42,3 +45,14 @@ if(NOT IMGUI_SKIP_HEADERS)
DESTINATION include
)
endif()
if(IMGUI_COPY_BINDINGS)
install(
FILES ${IMGUI_INCLUDES_PRIVATE}
DESTINATION include
)
install(
FILES ${IMGUI_BINDINGS}
DESTINATION include/bindings
)
endif()

View File

@ -1,8 +1,8 @@
Source: imgui
Version: 1.74
Version: 1.74-1
Homepage: https://github.com/ocornut/imgui
Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies.
Feature: example
Description: build with examples
Build-Depends: glfw3, freeglut, opengl, sdl1
Feature: bindings
Description: make available bindings header and source files for supported implementations
Build-Depends: glfw3, freeglut, opengl, sdl1, allegro5

View File

@ -1,5 +1,3 @@
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
@ -12,34 +10,23 @@ vcpkg_from_github(
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
bindings IMGUI_COPY_BINDINGS # should only be copied once, at most
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_RELEASE
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DIMGUI_COPY_BINDINGS=OFF
-DIMGUI_SKIP_HEADERS=ON
)
vcpkg_install_cmake()
if ("example" IN_LIST FEATURES)
if (NOT VCPKG_TARGET_IS_WINDOWS)
message(FATAL_ERROR "Feature example only support windows.")
endif()
vcpkg_build_msbuild(
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)
endif()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
configure_file(${SOURCE_PATH}/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/imgui/copyright COPYONLY)
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

View File

@ -1,5 +1,5 @@
Source: libigl
Version: 2.1.0-1
Version: 2.1.0-2
Homepage: https://github.com/libigl/libigl
Description: libigl is a simple C++ geometry processing library. We have a wide functionality including construction of sparse discrete differential geometry operators and finite-elements matrices such as the cotangent Laplacian and diagonalized mass matrix, simple facet and edge-based topology data structures, mesh-viewing utilities for OpenGL and GLSL, and many core functions for matrix manipulation which make Eigen feel a lot more like MATLAB.
Build-Depends: eigen3
@ -18,7 +18,7 @@ Build-Depends: glfw3
Feature: imgui
Description: Build with imgui
Build-Depends: imgui[example]
Build-Depends: imgui[bindings]
Feature: png
Description: Build with libpng