[imgui] Add Freetype feature (#11919)

This commit is contained in:
Rémy Tassoux 2020-06-23 22:56:15 +02:00 committed by GitHub
parent 5058547304
commit 8e9ee5d36c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 49 deletions

View File

@ -3,56 +3,78 @@ project(imgui CXX)
set(CMAKE_DEBUG_POSTFIX d)
set(IMGUI_INCLUDES_PUBLIC
imgui.h
imconfig.h
add_library(${PROJECT_NAME} "")
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
target_include_directories(
${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:Include>
)
set(IMGUI_INCLUDES_PRIVATE
imgui_internal.h
imstb_textedit.h
target_sources(
${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/imgui.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui_demo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui_draw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui_widgets.cpp
${CMAKE_CURRENT_SOURCE_DIR}/misc/cpp/imgui_stdlib.cpp
)
set(IMGUI_SOURCES
imgui.cpp
imgui_demo.cpp
imgui_draw.cpp
imgui_widgets.cpp
)
if(IMGUI_FREETYPE)
find_package(Freetype REQUIRED)
add_library(${PROJECT_NAME}
${IMGUI_INCLUDES_PUBLIC}
${IMGUI_INCLUDES_PRIVATE}
${IMGUI_SOURCES}
)
target_include_directories(
${PROJECT_NAME}
PRIVATE
${FREETYPE_INCLUDE_DIRS}
)
file(GLOB IMGUI_BINDINGS ${CMAKE_CURRENT_SOURCE_DIR}/examples/imgui_impl_* )
target_include_directories(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
install(TARGETS ${PROJECT_NAME}
EXPORT IMGUIExport
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(EXPORT IMGUIExport FILE ${PROJECT_NAME}Config.cmake NAMESPACE ${PROJECT_NAME}:: DESTINATION share/${PROJECT_NAME})
if(NOT IMGUI_SKIP_HEADERS)
install(
FILES ${IMGUI_INCLUDES_PUBLIC}
DESTINATION include
)
target_sources(
${PROJECT_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.cpp
)
endif()
if(IMGUI_COPY_BINDINGS)
install(
FILES ${IMGUI_INCLUDES_PRIVATE}
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}_target
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
if(NOT IMGUI_SKIP_HEADERS)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/imgui.h
${CMAKE_CURRENT_SOURCE_DIR}/imconfig.h
${CMAKE_CURRENT_SOURCE_DIR}/imgui_internal.h
${CMAKE_CURRENT_SOURCE_DIR}/imstb_textedit.h
${CMAKE_CURRENT_SOURCE_DIR}/misc/cpp/imgui_stdlib.h
DESTINATION include
)
install(
FILES ${IMGUI_BINDINGS}
DESTINATION include/bindings
)
endif()
if(IMGUI_COPY_BINDINGS)
file(GLOB IMGUI_BINDINGS ${CMAKE_CURRENT_SOURCE_DIR}/examples/imgui_impl_* )
install(
FILES ${IMGUI_BINDINGS}
DESTINATION include/bindings
)
endif()
if(IMGUI_FREETYPE)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.h
DESTINATION include
)
endif()
endif()
install(
EXPORT ${PROJECT_NAME}_target
NAMESPACE ${PROJECT_NAME}::
FILE ${PROJECT_NAME}-config.cmake
DESTINATION share/${PROJECT_NAME}
)

View File

@ -1,8 +1,12 @@
Source: imgui
Version: 1.76-1
Version: 1.76-2
Homepage: https://github.com/ocornut/imgui
Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies.
Feature: bindings
Description: make available bindings header and source files for supported implementations
Build-Depends: glfw3, freeglut, opengl, sdl1, allegro5
Build-Depends: glfw3, freeglut, opengl, sdl2, allegro5
Feature: freetype
Description: Build font atlases using FreeType instead of stb_truetype
Build-Depends: freetype

View File

@ -11,16 +11,16 @@ 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
bindings IMGUI_COPY_BINDINGS # should only be copied once, at most
freetype IMGUI_FREETYPE
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS_RELEASE
OPTIONS
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DIMGUI_COPY_BINDINGS=OFF
-DIMGUI_SKIP_HEADERS=ON
)
@ -29,4 +29,4 @@ vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets()
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)