add_executable(demo
    aclock/aclock.c
    ant/ant.c
    bf/bf.c
    cmatrix/cmatrix.c
    donut/donut.c
    galton/galton.c
    hanoi/hanoi.c
    life/life.c
    main.c
)
target_include_directories(demo PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_link_libraries(demo PRIVATE am-${ARCH} klib npcgcc)

# -- Extract binary file from ELF
add_custom_command(TARGET demo
    COMMAND ${CMAKE_OBJCOPY} ARGS  -S --set-section-flags .bss=alloc,contents -O binary demo demo.bin)

install(TARGETS demo RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/demo.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)
