2024-07-09 09:42:46 +00:00
|
|
|
# TODO: CMake does not support multiple toolchain in one run. We need a seperate
|
|
|
|
# project for native binary compilation
|
|
|
|
|
|
|
|
# cmake_minimum_required(VERSION 3.22)
|
|
|
|
|
|
|
|
# project(alu-tests)
|
|
|
|
# set(CMAKE_C_STANDARD 11)
|
|
|
|
# enable_language(C ASM)
|
|
|
|
# include(GNUInstallDirs)
|
|
|
|
|
|
|
|
# add_executable(gen_alu_test gen_alu_test.c)
|
|
|
|
|
|
|
|
# add_custom_command(TARGET gen_alu_test POST_BUILD
|
|
|
|
# BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/alu_test.c
|
|
|
|
# COMMAND $<TARGET_FILE:gen_alu_test> > alu_test.c)
|
|
|
|
|
|
|
|
add_executable(alu_test alu_test.c)
|
|
|
|
|
|
|
|
target_include_directories(alu_test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
2024-08-15 08:42:02 +00:00
|
|
|
target_link_libraries(alu_test PRIVATE am-${ARCH} klib)
|
|
|
|
|
2024-07-09 09:42:46 +00:00
|
|
|
|
|
|
|
# -- Extract binary file from ELF
|
|
|
|
add_custom_command(TARGET alu_test
|
|
|
|
COMMAND ${CMAKE_OBJCOPY} ARGS -S --set-section-flags .bss=alloc,contents -O binary alu_test alu_test.bin)
|
|
|
|
|
|
|
|
install(TARGETS alu_test RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/alu_test.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)
|