set(monoformat_SOURCES
    monoformat_schema.cpp
    monoformat_parseonly.cpp
    monoformat_fontreader.cpp
)
set(monoformat_HEADERS
    monoformat_schema.hpp
    monoformat_parsehelpers.hpp
    monoformat_parseonly.hpp
    monoformat_fontreader.hpp
    monoformat_gfx.hpp
    monoformat_utf8.hpp
)

option(MONOFORMAT_EMBEDDED "Only build for embedded devices" FALSE)

if(NOT MONOFORMAT_EMBEDDED)
    find_package(nlohmann_json REQUIRED)

    list(APPEND monoformat_SOURCES
        monoformat_structured.cpp
    )

    list(APPEND monoformat_HEADERS
        monoformat_structured.hpp
    )
endif()

add_library(monoformat ${monoformat_SOURCES} ${monoformat_HEADERS})
target_compile_features(monoformat PUBLIC cxx_std_23)
target_include_directories(monoformat PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(NOT MONOFORMAT_EMBEDDED)
    target_link_libraries(monoformat PUBLIC nlohmann_json::nlohmann_json)
endif()

install(TARGETS monoformat
        RUNTIME DESTINATION bin
        ARCHIVE DESTINATION lib
        LIBRARY DESTINATION lib)
install(FILES ${monoformat_HEADERS}
        DESTINATION include)
