From 53f85c63a9843fcc5d61e05f272634750e8aac7e Mon Sep 17 00:00:00 2001 From: Pascal Thomet Date: Fri, 20 Dec 2024 08:42:50 +0100 Subject: [PATCH] cmake / _him_fetch_and_compile_plutosvg: build plutovg manually (to avoid install, since we link statically) --- hello_imgui_cmake/hello_imgui_build_lib.cmake | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/hello_imgui_cmake/hello_imgui_build_lib.cmake b/hello_imgui_cmake/hello_imgui_build_lib.cmake index b3453ece..e265e3e0 100644 --- a/hello_imgui_cmake/hello_imgui_build_lib.cmake +++ b/hello_imgui_cmake/hello_imgui_build_lib.cmake @@ -461,14 +461,25 @@ function(_him_fetch_and_compile_plutosvg) set(backup_build_shared_libs ${BUILD_SHARED_LIBS}) set(BUILD_SHARED_LIBS OFF) - # Fetch & build plutovg at configure time + # Fetch & build plutovg at configure time, then compile manually at build time + # (the stock CMakeLists does install lib/ and include/ although we link to it statically) include(FetchContent) - FetchContent_Declare(plutovg + FetchContent_Populate(plutovg GIT_REPOSITORY https://github.com/sammycage/plutovg GIT_TAG v0.0.8 GIT_PROGRESS TRUE + SOURCE_DIR ${CMAKE_BINARY_DIR}/plutovg_source + BINARY_DIR ${CMAKE_BINARY_DIR}/plutovg_build ) - FetchContent_MakeAvailable(plutovg) + file(GLOB plutovg_sources ${plutovg_SOURCE_DIR}/source/*.c) + add_library(plutovg STATIC ${plutovg_sources}) + target_include_directories(plutovg PUBLIC $) + find_library(MATH_LIBRARY m) + if(MATH_LIBRARY) + target_link_libraries(plutovg PRIVATE ${MATH_LIBRARY}) + endif() + him_add_installable_dependency(plutovg) + # Fetch plutosvg at configure time, then compile manually at build time # (the stock CMakeLists of plutosvg is not compatible with a custom install of freetype)