am-kernels/CMakeLists.txt

44 lines
1.3 KiB
CMake
Raw Permalink Normal View History

2024-03-25 08:49:08 +00:00
cmake_minimum_required(VERSION 3.22)
project(am-kernels)
set(CMAKE_C_STANDARD 11)
enable_language(C ASM)
include(CheckPIESupported)
2024-07-09 09:42:46 +00:00
include(GNUInstallDirs)
2024-03-25 08:49:08 +00:00
if(${ARCH} STREQUAL "native")
include(CTest)
endif()
2024-07-09 09:42:46 +00:00
find_package(am-${ARCH})
find_package(klib)
check_pie_supported()
2024-03-25 08:49:08 +00:00
# -- Helper functions
macro(create_binary target_name)
if(NOT ${ARCH} STREQUAL "native")
add_custom_command(
TARGET ${target_name} POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -S --set-section-flags .bss=alloc,contents -O binary ${target_name} ${target_name}.bin
COMMENT "Creating binary file ${target_name}.bin"
)
endif()
endmacro(create_binary)
macro(install_target_and_binary target_name)
if(NOT ${ARCH} STREQUAL "native")
install(TARGETS ${target_name} RUNTIME DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/am-kernels)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${target_name}.bin DESTINATION ${CMAKE_INSTALL_DATADIR}/am-kernels)
else()
install(TARGETS ${target_name})
add_test(NAME ${target_name}_test COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${target_name})
endif()
endmacro(install_target_and_binary)
2024-07-09 09:42:46 +00:00
add_subdirectory(tests/cpu-tests)
# add_subdirectory(tests/alu-tests)
add_subdirectory(tests/am-tests)
2024-07-09 09:42:46 +00:00
add_subdirectory(benchmarks/microbench)
add_subdirectory(kernels)