optionally use freetype and plutosvg for color fonts
This commit is contained in:
2
external/CMakeLists.txt
vendored
2
external/CMakeLists.txt
vendored
@ -17,6 +17,8 @@ add_subdirectory(./solanaceae_toxcore)
|
||||
add_subdirectory(./solanaceae_tox)
|
||||
|
||||
add_subdirectory(./sdl)
|
||||
add_subdirectory(./freetype)
|
||||
add_subdirectory(./plutosvg)
|
||||
add_subdirectory(./imgui)
|
||||
add_subdirectory(./implot)
|
||||
|
||||
|
29
external/freetype/CMakeLists.txt
vendored
Normal file
29
external/freetype/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
if (NOT TARGET Freetype::Freetype)
|
||||
find_package(Freetype 2.12 CONFIG GLOBAL QUIET)
|
||||
|
||||
if (NOT TARGET Freetype::Freetype)
|
||||
find_package(Freetype 2.12 GLOBAL QUIET)
|
||||
endif()
|
||||
|
||||
#if (NOT TARGET Freetype::Freetype)
|
||||
# find_package(PkgConfig)
|
||||
# if (PKG_CONFIG_FOUND)
|
||||
# pkg_check_modules(freetype_PKG IMPORTED_TARGET freetype)
|
||||
|
||||
# if (TARGET PkgConfig::freetype_PKG)
|
||||
# add_library(Freetype::Freetype ALIAS PkgConfig::freetype_PKG)
|
||||
# endif()
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
if (TARGET Freetype::Freetype)
|
||||
message(STATUS "found freetype")
|
||||
else()
|
||||
message(STATUS "freetype not found")
|
||||
endif()
|
||||
endif()
|
||||
|
16
external/imgui/CMakeLists.txt
vendored
16
external/imgui/CMakeLists.txt
vendored
@ -21,6 +21,22 @@ add_library(imgui
|
||||
target_compile_definitions(imgui PUBLIC IMGUI_USE_WCHAR32)
|
||||
target_compile_features(imgui PUBLIC cxx_std_11)
|
||||
|
||||
if (TARGET Freetype::Freetype)
|
||||
message(STATUS "Freetype detected, enabling support in imgui")
|
||||
target_sources(imgui PUBLIC
|
||||
imgui/misc/freetype/imgui_freetype.h
|
||||
imgui/misc/freetype/imgui_freetype.cpp
|
||||
)
|
||||
target_link_libraries(imgui PUBLIC Freetype::Freetype) # public in case of static
|
||||
target_compile_definitions(imgui PUBLIC IMGUI_ENABLE_FREETYPE)
|
||||
|
||||
if (TARGET plutosvg::plutosvg)
|
||||
message(STATUS "plutosvg detected, enabling support in imgui")
|
||||
target_link_libraries(imgui PUBLIC plutosvg::plutosvg) # public in case of static
|
||||
target_compile_definitions(imgui PUBLIC IMGUI_ENABLE_FREETYPE_PLUTOSVG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
target_include_directories(imgui PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/imgui") # im sad
|
||||
|
||||
|
16
external/plutosvg/CMakeLists.txt
vendored
Normal file
16
external/plutosvg/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
#makes no sense without freetype
|
||||
if (NOT TARGET plutosvg::plutosvg AND TARGET Freetype::Freetype)
|
||||
set(PLUTOSVG_ENABLE_FREETYPE ON CACHE INTERNAL "")
|
||||
set(PLUTOSVG_BUILD_EXAMPLES OFF CACHE INTERNAL "")
|
||||
FetchContent_Declare(plutosvg
|
||||
GIT_REPOSITORY https://github.com/sammycage/plutosvg.git
|
||||
GIT_TAG v0.0.6
|
||||
FIND_PACKAGE_ARGS # for the future
|
||||
)
|
||||
FetchContent_MakeAvailable(plutosvg)
|
||||
endif()
|
||||
|
Reference in New Issue
Block a user