Skip to content

Commit

Permalink
reorganizing into year
Browse files Browse the repository at this point in the history
  • Loading branch information
K20shores committed Dec 5, 2024
1 parent e3c7cae commit d6d2cfb
Show file tree
Hide file tree
Showing 50 changed files with 85 additions and 34 deletions.
18 changes: 0 additions & 18 deletions .clang-format

This file was deleted.

4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
build
src/2023/inputs
src/2024/inputs
inputs
inputs
31 changes: 31 additions & 0 deletions 2023/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
################################################################################
# Preamble
cmake_minimum_required(VERSION 3.21)

project(
aoc
VERSION 0.0.2023
LANGUAGES CXX
)

message(STATUS "CMake build configuration for ${PROJECT_NAME} (${CMAKE_BUILD_TYPE}) ${PROJECT_VERSION}")

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake")

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

################################################################################
# dependencies

include(cmake/dependencies.cmake)

################################################################################
# targets

enable_testing()
add_subdirectory(src)

################################################################################
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions CMakeLists.txt → 2024/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,10 @@ message(STATUS "CMake build configuration for ${PROJECT_NAME} (${CMAKE_BUILD_TYP
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR}/cmake")

# Set the minimum required C++ standard to C++20
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

################################################################################
# options

option(AOC_2023 "Build the AoC 2023 project" OFF)
option(AOC_2024 "Build the AoC 2023 project" ON)

################################################################################
# dependencies

Expand Down
12 changes: 12 additions & 0 deletions 2024/cmake/dependencies.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
include(FetchContent)

set(BENCHMARK_DOWNLOAD_DEPENDENCIES ON)
set(BENCHMARK_ENABLE_TESTING OFF)
# Fetch Google Benchmark
FetchContent_Declare(
benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.8.3
)

FetchContent_MakeAvailable(benchmark)
40 changes: 40 additions & 0 deletions 2024/cmake/test_util.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
################################################################################
# build and add a standard test

function(create_standard_test)
set(prefix TEST)
set(singleValues NAME WORKING_DIRECTORY YEAR)
set(multiValues SOURCES LIBRARIES)

include(CMakeParseArguments)
cmake_parse_arguments(${prefix} " " "${singleValues}" "${multiValues}" ${ARGN})

if(NOT DEFINED TEST_YEAR)
message(FATAL_ERROR "TEST_YEAR must be specified")
endif()

add_executable(test_${TEST_NAME} ${TEST_SOURCES})

set_target_properties(test_${TEST_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${TEST_YEAR}"
)

target_link_libraries(test_${TEST_NAME} PUBLIC benchmark ${TEST_LIBRARIES})

if(NOT DEFINED TEST_WORKING_DIRECTORY)
set(TEST_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${TEST_YEAR}")
endif()

add_aoc_test(${TEST_NAME} test_${TEST_NAME} "" ${TEST_WORKING_DIRECTORY})
endfunction(create_standard_test)

################################################################################
# Add a test

function(add_aoc_test test_name test_binary test_args working_dir)
add_test(NAME ${test_name}
COMMAND ${test_binary} ${test_args}
WORKING_DIRECTORY ${working_dir})
endfunction(add_aoc_test)

################################################################################
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions src/CMakeLists.txt

This file was deleted.

0 comments on commit d6d2cfb

Please sign in to comment.