Add CMakeLists.txt and build script
This commit is contained in:
45
CMakeLists.txt
Normal file
45
CMakeLists.txt
Normal file
@@ -0,0 +1,45 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# Project name and version
|
||||
project(DynamicGraphAlgorithms VERSION 1.0)
|
||||
|
||||
# Set the C++ standard to C++20
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||
|
||||
# Enable compile commands generation
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Specify the include directories
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/third_party/nanobench
|
||||
${PROJECT_SOURCE_DIR}/third_party/doctest
|
||||
)
|
||||
|
||||
# Gather all header files from include/algorithm and include/graph directories
|
||||
file(GLOB_RECURSE ALGORITHM_HEADER_FILES ${PROJECT_SOURCE_DIR}/include/algorithm/*.h)
|
||||
file(GLOB_RECURSE GRAPH_HEADER_FILES ${PROJECT_SOURCE_DIR}/include/graph/*.h)
|
||||
file(GLOB_RECURSE RODITTY_ZWICK_HEADER ${PROJECT_SOURCE_DIR}/include/roditty_zwick.h)
|
||||
|
||||
# Gather all source files from src directory
|
||||
file(GLOB_RECURSE SOURCE_FILES ${PROJECT_SOURCE_DIR}/src/*.cpp ${PROJECT_SOURCE_DIR}/src/*.cc)
|
||||
|
||||
# Debugging output to ensure files are found
|
||||
message(STATUS "Algorithm headers: ${ALGORITHM_HEADER_FILES}")
|
||||
message(STATUS "Graph headers: ${GRAPH_HEADER_FILES}")
|
||||
message(STATUS "Roditty-Zwick header: ${RODITTY_ZWICK_HEADER}")
|
||||
message(STATUS "Source files: ${SOURCE_FILES}")
|
||||
message(STATUS "Include directories: ${PROJECT_SOURCE_DIR}/include, ${PROJECT_SOURCE_DIR}/third_party/nanobench/src/include, ${PROJECT_SOURCE_DIR}/third_party/doctest/doctest")
|
||||
|
||||
# Add the executable target
|
||||
if(SOURCE_FILES)
|
||||
add_executable(DynamicGraphAlgorithms ${SOURCE_FILES} ${ALGORITHM_HEADER_FILES} ${GRAPH_HEADER_FILES} ${RODITTY_ZWICK_HEADER})
|
||||
else()
|
||||
message(FATAL_ERROR "No source files found. Please add at least one .cpp or .cc file to the src directory.")
|
||||
endif()
|
||||
|
||||
|
||||
# Link libraries if necessary (e.g., Boost, Abseil, etc.)
|
||||
# find_package(Boost REQUIRED) # Example for Boost
|
||||
# target_link_libraries(DynamicGraphAlgorithms Boost::Boost) # Link Boost
|
||||
Reference in New Issue
Block a user