Firmwares/benchmarks/dhrystone/CMakeLists.txt

59 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.12)
project(dhrystone C)
# Include BSP libwrap
include(${BSP_BASE}/libwrap/CMakeLists.txt)
# Source files
set(SOURCES
dhry_1.c
dhry_2.c
dhry_stubs.c
)
# Create executable
add_executable(dhrystone ${SOURCES})
# Include directories
target_include_directories(dhrystone PRIVATE
${BSP_BASE}/include
${BSP_BASE}/drivers
${BSP_BASE}/env
${CMAKE_CURRENT_SOURCE_DIR}
)
# Link with libwrap
target_link_libraries(dhrystone PRIVATE
LIBWRAP_TGC
)
# Add compile definitions
target_compile_definitions(dhrystone PRIVATE
BOARD_${BOARD}
)
# Set compile options
target_compile_options(dhrystone PRIVATE
-march=${RISCV_ARCH}_zicsr_zifencei
-mabi=${RISCV_ABI}
-mcmodel=medany
-ffunction-sections
-fdata-sections
-O2 # Optimization level for benchmarking
-DTIME # Enable time measurement
-DNOENUM # Disable enum usage as per dhrystone requirements
)
# Set linker options
target_link_options(dhrystone PRIVATE
-T${BSP_BASE}/env/${BOARD}/link.ld
-nostartfiles
-Wl,--gc-sections
${LIBWRAP_TGC_LDFLAGS}
)
# Install target
install(TARGETS dhrystone
RUNTIME DESTINATION bin
)