[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(CMAKE_DEBUG_POSTFIX d)
set(IMGUI_INCLUDES_PUBLIC add_library(${PROJECT_NAME} "")
imgui.h add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
imconfig.h target_include_directories(
${PROJECT_NAME}
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:Include>
) )
set(IMGUI_INCLUDES_PRIVATE target_sources(
imgui_internal.h ${PROJECT_NAME}
imstb_textedit.h 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 if(IMGUI_FREETYPE)
imgui.cpp find_package(Freetype REQUIRED)
imgui_demo.cpp
imgui_draw.cpp target_include_directories(
imgui_widgets.cpp ${PROJECT_NAME}
PRIVATE
${FREETYPE_INCLUDE_DIRS}
) )
add_library(${PROJECT_NAME} target_sources(
${IMGUI_INCLUDES_PUBLIC} ${PROJECT_NAME}
${IMGUI_INCLUDES_PRIVATE} PRIVATE
${IMGUI_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/misc/freetype/imgui_freetype.cpp
)
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
) )
endif() endif()
if(IMGUI_COPY_BINDINGS)
install( install(
FILES ${IMGUI_INCLUDES_PRIVATE} 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 DESTINATION include
) )
if(IMGUI_COPY_BINDINGS)
file(GLOB IMGUI_BINDINGS ${CMAKE_CURRENT_SOURCE_DIR}/examples/imgui_impl_* )
install( install(
FILES ${IMGUI_BINDINGS} FILES ${IMGUI_BINDINGS}
DESTINATION include/bindings DESTINATION include/bindings
) )
endif() 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 Source: imgui
Version: 1.76-1 Version: 1.76-2
Homepage: https://github.com/ocornut/imgui Homepage: https://github.com/ocornut/imgui
Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies. Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies.
Feature: bindings Feature: bindings
Description: make available bindings header and source files for supported implementations 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

@ -12,15 +12,15 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS 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( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA PREFER_NINJA
OPTIONS_RELEASE OPTIONS
${FEATURE_OPTIONS} ${FEATURE_OPTIONS}
OPTIONS_DEBUG OPTIONS_DEBUG
-DIMGUI_COPY_BINDINGS=OFF
-DIMGUI_SKIP_HEADERS=ON -DIMGUI_SKIP_HEADERS=ON
) )