Skip to content

Commit

Permalink
plutosvg manual & static for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
pthom committed Oct 28, 2024
1 parent 10e4bfe commit c6986f9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hello_imgui_cmake/hello_imgui_build_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,10 @@ function(_him_add_freetype_plutosvg_to_imgui)
message(WARNING "Cannot add plutosvg because fetching is forbidden")
return()
endif()

set(backup_build_shared_libs ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)

# Fetch & build plutovg at configure time
include(FetchContent)
FetchContent_Declare(plutovg
Expand All @@ -478,16 +482,20 @@ function(_him_add_freetype_plutosvg_to_imgui)
plutosvg
GIT_REPOSITORY https://github.com/sammycage/plutosvg
GIT_TAG v0.0.2
SOURCE_DIR ${CMAKE_BINARY_DIR}/plutosvg_source
BINARY_DIR ${CMAKE_BINARY_DIR}/plutosvg_build
)
add_library(plutosvg ${plutosvg_SOURCE_DIR}/source/plutosvg.c)
add_library(plutosvg STATIC ${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_compile_definitions(plutosvg PUBLIC PLUTOSVG_HAS_FREETYPE PLUTOSVG_BUILD_STATIC)
target_link_libraries(plutosvg PUBLIC ${HIM_FREETYPE_LINKED_LIBRARY} plutovg)
him_add_installable_dependency(plutosvg)

target_link_libraries(imgui PUBLIC plutosvg)
target_compile_definitions(imgui PUBLIC IMGUI_ENABLE_FREETYPE_PLUTOSVG)

set(BUILD_SHARED_LIBS ${backup_build_shared_libs})

# Prepare Log info
set(HELLOIMGUI_FREETYPE_SELECTED_INFO "${HELLOIMGUI_FREETYPE_SELECTED_INFO} - downloaded plutosvg" CACHE INTERNAL "" FORCE)
endfunction()
Expand Down

0 comments on commit c6986f9

Please sign in to comment.