am-kernels/kernels/hello/CMakeLists.txt
xinyangli f6c3a13e7f
All checks were successful
Build nix packages / build-matrix (am-kernels) (push) Successful in 2m24s
Build nix packages / build-matrix (rv32Cross.am-kernels-nemu) (push) Successful in 2m20s
Build nix packages / build-matrix (rv32Cross.am-kernels-npc) (push) Successful in 2m21s
build: fix unneeded dependency on npcgcc
2024-08-15 16:42:02 +08:00

13 lines
526 B
CMake

add_executable(hello
hello.c
)
target_include_directories(hello PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
target_link_libraries(hello PRIVATE am-${ARCH} klib)
# -- Extract binary file from ELF
add_custom_command(TARGET hello
COMMAND ${CMAKE_OBJCOPY} ARGS -S --set-section-flags .bss=alloc,contents -O binary hello hello.bin)
install(TARGETS hello RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/hello.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)