cmake_minimum_required(VERSION 4.2)
project(blend2d_vendor)

# I can't use fetchcontent here because belnd2d assumes asmjit is in
# a path relative to the cmake source dir (or something like that).
#
# That tar.gz file was built by cloning the blend2d source repo and
# then cloning asmjit into the proper place per the blend2d instructions.

set(BLEND2D_SRC "${CMAKE_CURRENT_SOURCE_DIR}/blend2d")

find_package(ament_cmake REQUIRED)

execute_process(
    COMMAND tar xvzf ${CMAKE_CURRENT_SOURCE_DIR}/blend2d.tar.gz
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    COMMAND_ERROR_IS_FATAL ANY
)

add_subdirectory(${BLEND2D_SRC})

ament_export_dependencies(blend2d)
ament_package()
