Skip to content

Commit

Permalink
Restore support for NanoSVG in the CMake build.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Feb 22, 2025
1 parent c10c27f commit 2c31451
Showing 1 changed file with 14 additions and 27 deletions.
41 changes: 14 additions & 27 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,31 +251,21 @@ endif()

if (CONFIG_NANOSVG)
set(hub https://raw.githubusercontent.com/memononen/nanosvg/master/src)
find_package(NanoSVG)
if (NanoSVG_FOUND)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nanosvg.h OR EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/nanosvgrast.h)
message(WARNING "nanosvg headers installed on the system but shadowed by src/nano*.h headers")
else()
message(STATUS "Using nanosvg headers from the system")
LIST(APPEND icewm_img_libs NanoSVG::nanosvg NanoSVG::nanosvgrast)
endif()
else()
foreach(nano src/nanosvg.h src/nanosvgrast.h)
message(STATUS "Checking for src/${nano}")
set(src ${CMAKE_SOURCE_DIR}/src/${nano})
if (NOT EXISTS ${src})
set(url ${hub}/${nano})
file(DOWNLOAD ${url} ${src} INACTIVITY_TIMEOUT 3 STATUS down)
list(GET down 0 stat)
list(GET down 1 mesg)
if(NOT ${stat} EQUAL 0 OR NOT EXISTS ${src})
message(WARNING "Cannot download ${url} to ${src}: ${mesg}")
set(CONFIG_NANOSVG off)
break()
endif()
foreach(nano nanosvg.h nanosvgrast.h)
message(STATUS "Checking for src/${nano}")
set(src ${CMAKE_SOURCE_DIR}/src/${nano})
if (NOT EXISTS ${src})
set(url ${hub}/${nano})
file(DOWNLOAD ${url} ${src} INACTIVITY_TIMEOUT 3 STATUS down)
list(GET down 0 stat)
list(GET down 1 mesg)
if(NOT ${stat} EQUAL 0 OR NOT EXISTS ${src})
message(WARNING "Cannot download ${url} to ${src}: ${mesg}")
set(CONFIG_NANOSVG off)
break()
endif()
endforeach()
endif()
endif()
endforeach()
endif()

# cursor configuration error check
Expand Down Expand Up @@ -451,9 +441,6 @@ add_library(ice STATIC ${ICE_COMMON_SRCS})
target_compile_options(ice PUBLIC ${icewm_pc_flags})
# even if not linking against some libs directly, require their include paths to be considered
target_include_directories(ice PUBLIC ${Intl_INCLUDE_DIRS})
if(TARGET NanoSVG::nanosvg)
target_link_libraries(ice NanoSVG::nanosvg)
endif()

SET(ITK_SRCS ymenu.cc ylabel.cc yscrollview.cc ymenuitem.cc bindkey.cc
yscrollbar.cc ybutton.cc ylistbox.cc yinputline.cc
Expand Down

0 comments on commit 2c31451

Please sign in to comment.