build: add more tests to build system
This commit is contained in:
parent
2f559823a6
commit
9d41ac2f7b
12 changed files with 107 additions and 17 deletions
29
tests/alu-tests/CMakeLists.txt
Normal file
29
tests/alu-tests/CMakeLists.txt
Normal file
|
@ -0,0 +1,29 @@
|
|||
# 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)
|
|
@ -114,7 +114,7 @@ int exclude(type t, char* op, int x, int y)
|
|||
int main(void)
|
||||
{
|
||||
printf("#include <stdio.h>\n");
|
||||
printf("int main(void) {\n");
|
||||
printf("int main(const char *) {\n");
|
||||
printf(" int exit_code = 0;\n");
|
||||
|
||||
FOR_SET_ALL(signed int, vsi);
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
find_package(am-${ARCH})
|
||||
find_package(klib)
|
||||
|
||||
set(SOURCES
|
||||
add.c
|
||||
add-longlong.c
|
||||
|
@ -42,12 +39,12 @@ foreach(SOURCE IN LISTS SOURCES)
|
|||
get_filename_component(SOURCE_NAME ${SOURCE} NAME_WLE)
|
||||
add_executable(${SOURCE_NAME}
|
||||
${SOURCE})
|
||||
target_link_libraries(${SOURCE_NAME} PRIVATE am-${ARCH})
|
||||
target_link_libraries(${SOURCE_NAME} PRIVATE am-${ARCH} klib)
|
||||
|
||||
# -- Extract binary file from ELF
|
||||
add_custom_command(TARGET ${SOURCE_NAME}
|
||||
COMMAND ${CMAKE_OBJCOPY} ARGS -S --set-section-flags .bss=alloc,contents -O binary ${SOURCE_NAME} ${SOURCE_NAME}.bin)
|
||||
|
||||
install(TARGETS ${SOURCE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_DATADIR}/elf)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_NAME}.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/binary)
|
||||
install(TARGETS ${SOURCE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_NAME}.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)
|
||||
endforeach()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue