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
2
kernels/CMakeLists.txt
Normal file
2
kernels/CMakeLists.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
add_subdirectory(hello)
|
||||
add_subdirectory(demo)
|
1
kernels/demo/CMakeLists.txt
Normal file
1
kernels/demo/CMakeLists.txt
Normal file
|
@ -0,0 +1 @@
|
|||
add_subdirectory(src)
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __DRAW_H__
|
||||
|
||||
#define HAS_GUI
|
||||
// #define HAS_GUI
|
||||
|
||||
#include <stdio.h>
|
||||
#include <am.h>
|
||||
|
|
20
kernels/demo/src/CMakeLists.txt
Normal file
20
kernels/demo/src/CMakeLists.txt
Normal file
|
@ -0,0 +1,20 @@
|
|||
add_executable(demo
|
||||
aclock/aclock.c
|
||||
ant/ant.c
|
||||
bf/bf.c
|
||||
cmatrix/cmatrix.c
|
||||
donut/donut.c
|
||||
galton/galton.c
|
||||
hanoi/hanoi.c
|
||||
life/life.c
|
||||
main.c
|
||||
)
|
||||
target_include_directories(demo PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
target_link_libraries(demo PRIVATE am-${ARCH} klib npcgcc)
|
||||
|
||||
# -- Extract binary file from ELF
|
||||
add_custom_command(TARGET demo
|
||||
COMMAND ${CMAKE_OBJCOPY} ARGS -S --set-section-flags .bss=alloc,contents -O binary demo demo.bin)
|
||||
|
||||
install(TARGETS demo RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/demo.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)
|
14
kernels/hello/CMakeLists.txt
Normal file
14
kernels/hello/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
add_executable(hello
|
||||
hello.c
|
||||
)
|
||||
target_include_directories(hello PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
target_link_libraries(hello PRIVATE am-${ARCH} klib npcgcc)
|
||||
target_compile_options(hello PRIVATE -nostdlib -nodefaultlibs)
|
||||
target_link_options(hello PRIVATE -nostdlib -nodefaultlibs)
|
||||
|
||||
# -- 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)
|
Loading…
Add table
Add a link
Reference in a new issue