mirror of
https://github.com/progsource/maddy.git
synced 2026-03-24 23:40:39 +01:00
Add benchmark
Some checks failed
run-checks / run-clang-format (push) Has been cancelled
run-tests / test-on-ubuntu (push) Has been cancelled
run-tests / test-on-windows (push) Has been cancelled
run-tests / test-on-osx (push) Has been cancelled
Some checks failed
run-checks / run-clang-format (push) Has been cancelled
run-tests / test-on-ubuntu (push) Has been cancelled
run-tests / test-on-windows (push) Has been cancelled
run-tests / test-on-osx (push) Has been cancelled
* add benchmark option * updated changelog * added benchmark info to readme * add bench folder to format.py
This commit is contained in:
50
bench/CMakeLists.txt
Normal file
50
bench/CMakeLists.txt
Normal file
@@ -0,0 +1,50 @@
|
||||
# This project is licensed under the MIT license. For more information see the
|
||||
# LICENSE file.
|
||||
|
||||
if (UNIX AND NOT APPLE)
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER}
|
||||
-fuse-ld=gold -Wl,--version
|
||||
ERROR_QUIET OUTPUT_VARIABLE ld_version)
|
||||
if ("${ld_version}" MATCHES "GNU gold")
|
||||
message(STATUS "Found Gold linker, use faster linker")
|
||||
set(CMAKE_EXE_LINKER_FLAGS
|
||||
"${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS
|
||||
"${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold ")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
include(FetchContent)
|
||||
|
||||
FetchContent_Declare(
|
||||
nanobench
|
||||
GIT_REPOSITORY https://github.com/martinus/nanobench.git
|
||||
GIT_TAG v4.3.11
|
||||
GIT_SHALLOW TRUE
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(nanobench)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
file(GLOB_RECURSE MADDY_BENCHMARK_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
add_executable(
|
||||
maddy_benchmark
|
||||
${MADDY_BENCHMARK_FILES}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
)
|
||||
target_include_directories(maddy_benchmark PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
target_link_libraries(maddy_benchmark maddy nanobench::nanobench)
|
||||
set_target_properties(maddy_benchmark PROPERTIES
|
||||
CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -O2 -Wall -Wno-ignored-qualifiers -Wpedantic -Wextra -Wno-deprecated -fno-exceptions -fno-rtti"
|
||||
)
|
||||
Reference in New Issue
Block a user