am-kernels/tests/alu-tests/CMakeLists.txt

30 lines
1.1 KiB
Text
Raw Normal View History

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)
target_link_libraries(alu_test PRIVATE am-${ARCH} klib npcgcc)
target_compile_options(alu_test PRIVATE -nostdlib -nodefaultlibs)
target_link_options(alu_test PRIVATE -nostdlib -nodefaultlibs)
# -- 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)