Skip to content

Commit

Permalink
Benchmarks - work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterTh committed Dec 2, 2021
1 parent da1c240 commit 20b3c94
Show file tree
Hide file tree
Showing 5 changed files with 4,677 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ if(CELERITY_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()

# Benchmarks

option(CELERITY_BUILD_BENCHMARKS "Build benchmark applications" ON)
if(CELERITY_BUILD_BENCHMARKS)
add_subdirectory(benchmarks)
endif()

# Tests

enable_testing(true)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ Building can be as simple as calling `cmake && make`, depending on your setup
you might however also have to provide some library paths etc.
See our [installation guide](docs/installation.md) for more information.

The runtime comes with several [examples](examples) that are built
automatically when the `CELERITY_BUILD_EXAMPLES` CMake option is set (true by
default).
The runtime comes with [examples](examples) and [benchmarks](benchmarks) that are built
automatically when the `CELERITY_BUILD_EXAMPLES` and/pr `CELERITY_BUILD_BENCHMARKS` CMake
options are set (both are true by default).

## Using Celerity as a Library

Expand Down
39 changes: 39 additions & 0 deletions benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
cmake_minimum_required(VERSION 3.13)

if(DEFINED PROJECT_NAME)
set(INCLUDED_AS_SUBPROJECT ON)
else()
set(INCLUDED_AS_SUBPROJECT OFF)
endif()

file(STRINGS "../VERSION" Celerity_VERSION)
project(celerity_benchmarks VERSION "${Celerity_VERSION}" LANGUAGES CXX)

if(NOT INCLUDED_AS_SUBPROJECT)
find_package(Celerity "${Celerity_VERSION}")
endif()

function(add_benchmark NAME)
add_executable(
"${NAME}"
"${NAME}.cc"
)

set_property(TARGET "${NAME}" PROPERTY CXX_STANDARD 17)
set_property(TARGET "${NAME}" PROPERTY FOLDER "benchmarks")

add_celerity_to_target(
TARGET "${NAME}"
SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${NAME}.cc"
)

target_include_directories("${NAME}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../vendor")

if(MSVC)
target_compile_options("${NAME}" PRIVATE /D_CRT_SECURE_NO_WARNINGS /MP /W3)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
target_compile_options("${NAME}" PRIVATE -Wall -Wextra -Wno-unused-parameter)
endif()
endfunction()

add_benchmark(task_microbenchmark)
Loading

0 comments on commit 20b3c94

Please sign in to comment.