Skip to content

Commit

Permalink
Getting benchmark environment set up
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriele A. Ron committed Aug 16, 2022
1 parent 9f9c930 commit bfcecda
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,5 @@ compile_commands.json
CTestTestfile.cmake
_deps

### Python stuff
venv/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "benchmark/extern/CppBenchmark"]
path = benchmark/extern/CppBenchmark
url = https://github.com/chronoxor/CppBenchmark
44 changes: 44 additions & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.20)
project(HeapBenchmark VERSION 0.0.0 LANGUAGES CXX)

find_package(FibonacciHeap 1.0.0 REQUIRED)

add_executable(${PROJECT_NAME} app/main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE GRon::FibonacciHeap)

find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/../.git")
# Update submodules as needed
option(GIT_SUBMODULE "Check submodules during build" ON)
if(GIT_SUBMODULE)
message(STATUS "Submodule update")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE GIT_SUBMOD_RESULT)
if(NOT GIT_SUBMOD_RESULT EQUAL "0")
message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
endif()
endif()
endif()

if(NOT EXISTS "${PROJECT_SOURCE_DIR}/extern/CppBenchmark/CMakeLists.txt")
message(FATAL_ERROR "The submodules were not downloaded! GIT_SUBMODULE was turned off or failed. Please update submodules and try again.")
endif()

add_subdirectory(extern/CppBenchmark)
target_link_libraries(${PROJECT_NAME} PRIVATE CppBenchmark)

set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
PREFIX ""
)

target_include_directories(${PROJECT_NAME}
INTERFACE
$<INSTALL_INTERFACE:include/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)


12 changes: 12 additions & 0 deletions benchmark/app/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "GRon/FibonacciHeap/FibonacciHeap.hpp"


#include <iostream>
#include <queue>


int main(int argc, char* argv[]) {
std::cout << "Hello World!" << std::endl;

return 0;
}
1 change: 1 addition & 0 deletions benchmark/extern/CppBenchmark
Submodule CppBenchmark added at 936a5b

0 comments on commit bfcecda

Please sign in to comment.