# Standalone test build of the Qwen4 token mixers (q4_gdn / q4_attn on the Flash-Next kernels at the q4_lite geometry).  Not part of the main CMake.
#   cmake -S engine/src/q4lite/attn_tests -B build -DCMAKE_CUDA_ARCHITECTURES=86 && cmake --build build -j
cmake_minimum_required(VERSION 3.18)
project(q4_attn_tests LANGUAGES CXX CUDA)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CUDA_STANDARD 17)
get_filename_component(engine_root "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)

set(STRATA_GEOMETRY "q4_lite" CACHE STRING "" FORCE)
include(${engine_root}/cmake/strata_geometry.cmake)
include(${engine_root}/src/q4lite/q4_mixer_sources.cmake)

add_library(q4k STATIC ${Q4_MIXER_KERNELS})
target_include_directories(q4k PUBLIC ${engine_root}/include ${engine_root}/third_party/ggml)
target_compile_definitions(q4k PUBLIC ${Q4_MIXER_DEFS})
target_compile_options(q4k PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:--expt-relaxed-constexpr>)
set_source_files_properties(${Q4_MIXER_FASTMATH} PROPERTIES COMPILE_OPTIONS "--use_fast_math")

add_executable(q4_attn_test ${engine_root}/tests/q4lite/q4_attn_test.cu)
target_link_libraries(q4_attn_test PRIVATE q4k)
