find_file(KHR_PLATFORM_FILE KHR/khrplatform.h)

file(GLOB_RECURSE PSEMEK_GFX_HEADERS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "include/*.hpp" "include/*.h")
file(GLOB_RECURSE PSEMEK_GFX_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "source/*.cpp")

psemek_add_library(psemek-gfx ${PSEMEK_GFX_HEADERS} ${PSEMEK_GFX_SOURCES} "${CMAKE_CURRENT_SOURCE_DIR}/api/${PSEMEK_GL_API}/source/gl.cpp")
target_include_directories(psemek-gfx PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_SOURCE_DIR}/api/${PSEMEK_GL_API}/include")
target_link_libraries(psemek-gfx PUBLIC psemek-util psemek-math psemek-cg psemek-random psemek-io psemek-log ${PSEMEK_GL_LIBRARIES} rapidjson)
if(NOT KHR_PLATFORM_FILE)
	message(STATUS "KHR/khrplatform.h not found, using a substitute header")
	target_include_directories(psemek-gfx PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/extra/khr/include")
endif()

psemek_add_public_resources(psemek-gfx
	resources/font_9x12.png psemek/gfx/resource/font_9x12_png
	resources/font_10x12_bold.png psemek/gfx/resource/font_10x12_bold_png
)
