From c6986f931f326cdd7b296eb317577cbebdd8a766 Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Mon, 28 Oct 2024 11:25:00 +0100 Subject: [PATCH] plutosvg manual & static for windows --- hello_imgui_cmake/hello_imgui_build_lib.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hello_imgui_cmake/hello_imgui_build_lib.cmake b/hello_imgui_cmake/hello_imgui_build_lib.cmake index 6863191b..38d1e08c 100644 --- a/hello_imgui_cmake/hello_imgui_build_lib.cmake +++ b/hello_imgui_cmake/hello_imgui_build_lib.cmake @@ -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 @@ -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 $) - 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()