refactor: use cmake macros to do objcopy, install and tests
All checks were successful
Build nix packages / build-matrix (am-kernels) (push) Successful in 2m26s
Build nix packages / build-matrix (rv32Cross.am-kernels-nemu) (push) Successful in 2m23s
Build nix packages / build-matrix (rv32Cross.am-kernels-npc) (push) Successful in 2m21s

This commit is contained in:
xinyangli 2024-08-15 17:52:04 +08:00
parent f6c3a13e7f
commit 8630fe7667
Signed by: xin
SSH key fingerprint: SHA256:qZ/tzd8lYRtUFSrfBDBMcUqV4GHKxqeqRA3huItgvbk
12 changed files with 64 additions and 54 deletions

View file

@ -4,10 +4,5 @@ add_executable(hello
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)
create_binary(hello)
install_target_and_binary(hello)