cmake_minimum_required(VERSION 3.12) project(coremark C) # Include BSP libwrap include(${BSP_BASE}/libwrap/CMakeLists.txt) # Source files set(SOURCES core_portme.c cvt.c ee_printf.c cm/core_list_join.c cm/core_main.c cm/core_matrix.c cm/core_state.c cm/core_util.c ) # Create executable add_executable(coremark ${SOURCES}) # Include directories target_include_directories(coremark PRIVATE ${BSP_BASE}/include ${BSP_BASE}/drivers ${BSP_BASE}/env ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cm ) # Link with libwrap target_link_libraries(coremark PRIVATE LIBWRAP_TGC ) # Add compile definitions target_compile_definitions(coremark PRIVATE BOARD_${BOARD} PERFORMANCE_RUN=1 ITERATIONS=1000 COMPILER_FLAGS="${CMAKE_C_FLAGS}" COMPILER_VERSION="${CMAKE_C_COMPILER_VERSION}" ) # Set compile options target_compile_options(coremark PRIVATE -march=${RISCV_ARCH}_zicsr_zifencei -mabi=${RISCV_ABI} -mcmodel=medany -ffunction-sections -fdata-sections -O2 # Optimization level for benchmarking ) # Set linker options target_link_options(coremark PRIVATE -T${BSP_BASE}/env/${BOARD}/link.ld -nostartfiles -Wl,--gc-sections ${LIBWRAP_TGC_LDFLAGS} ) # Install target install(TARGETS coremark RUNTIME DESTINATION bin )