file(GLOB_RECURSE PSEMEK_FONTS_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "include/*.hpp")
file(GLOB_RECURSE PSEMEK_FONTS_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "source/*.cpp")

list(REMOVE_ITEM PSEMEK_FONTS_SOURCES "source/freetype.cpp")

if(PSEMEK_USE_FREETYPE)
	find_package(Freetype REQUIRED)
	list(APPEND PSEMEK_FONTS_SOURCES "source/freetype.cpp")
endif()

psemek_add_library(psemek-fonts ${PSEMEK_FONTS_HEADERS} ${PSEMEK_FONTS_SOURCES})
target_include_directories(psemek-fonts PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ${FREETYPE_INCLUDE_DIRS})
target_link_libraries(psemek-fonts PUBLIC psemek-util psemek-math psemek-gfx rapidjson ${FREETYPE_LIBRARY})
if(PSEMEK_GRAPHICS_API STREQUAL WEBGPU)
	target_link_libraries(psemek-fonts PUBLIC psemek-wgpu)
endif()

psemek_glob_resources(psemek-fonts resources psemek/fonts/resources)
