Skip to content

Commit

Permalink
fix plutosvg install
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Oct 27, 2024
1 parent 50a2563 commit 2f8f8d7
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions hello_imgui_cmake/hello_imgui_build_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -452,26 +452,31 @@ function(_him_add_freetype_to_imgui)
if (IMGUI_ENABLE_FREETYPE_PLUTOSVG)
set(backup_shared_lib ${BUILD_SHARED_LIBS})

set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
include(FetchContent)

# Fetch plutovg & MakeAvailable
FetchContent_Declare(plutovg
GIT_REPOSITORY https://github.com/sammycage/plutovg
GIT_TAG v0.0.8
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(plutovg)

set(PLUTOSVG_ENABLE_FREETYPE ON CACHE BOOL "" FORCE)
FetchContent_Declare(plutosvg
GIT_REPOSITORY https://github.com/sammycage/plutosvg
GIT_TAG v0.0.2
GIT_PROGRESS TRUE
# Fetch plutosvg and compile manually (the stock CMakeLists of plutosvg is not compatible with a custom install of freetype)
FetchContent_Declare(
plutosvg
GIT_REPOSITORY https://github.com/sammycage/plutosvg
GIT_TAG v0.0.2
GIT_PROGRESS TRUE
)
FetchContent_MakeAvailable(plutosvg)
FetchContent_GetProperties(plutosvg)
add_library(plutosvg ${plutosvg_SOURCE_DIR}/source/plutosvg.c)
target_include_directories(plutosvg PUBLIC $<BUILD_INTERFACE:${plutosvg_SOURCE_DIR}/source>)
target_compile_definitions(plutosvg PUBLIC PLUTOSVG_HAS_FREETYPE)
target_link_libraries(plutosvg PUBLIC ${freetype_linked_library} plutovg)
him_add_installable_dependency(plutosvg)

target_link_libraries(imgui PUBLIC plutosvg)
set(BUILD_SHARED_LIBS ${backup_shared_lib} CACHE BOOL "" FORCE)

target_compile_definitions(imgui PUBLIC IMGUI_ENABLE_FREETYPE IMGUI_ENABLE_FREETYPE_PLUTOSVG)
else() # if not IMGUI_ENABLE_FREETYPE_PLUTOSVG -> use lunasvg
if(NOT TARGET lunasvg)
Expand Down

0 comments on commit 2f8f8d7

Please sign in to comment.