diff options
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/2015/day1/aoc.cpp | 0 | ||||
-rw-r--r-- | src/2015/day1/aoc.h | 1 | ||||
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/common.cpp | 13 | ||||
-rw-r--r-- | src/common.h | 11 | ||||
-rw-r--r-- | test/CMakeLists.txt | 1 |
7 files changed, 39 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 08d3226..42c46ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,13 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wno-unused-para set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS Off) +set(COMMON_FILES + "src/common.cpp" +) + +add_library(common SHARED ${COMMON_FILES}) +add_subdirectory(src) + enable_testing() add_subdirectory(test) diff --git a/src/2015/day1/aoc.cpp b/src/2015/day1/aoc.cpp new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/2015/day1/aoc.cpp diff --git a/src/2015/day1/aoc.h b/src/2015/day1/aoc.h new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/src/2015/day1/aoc.h @@ -0,0 +1 @@ +#pragma once diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..7b0b9c7 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,6 @@ +set(SOLUTION_FILES + "2015/day1/aoc.cpp" +) + +add_library(solution SHARED ${SOLUTION_FILES}) +target_include_directories(solution PRIVATE ${PROJECT_SOURCE_DIR}/src) diff --git a/src/common.cpp b/src/common.cpp new file mode 100644 index 0000000..8ac3a96 --- /dev/null +++ b/src/common.cpp @@ -0,0 +1,13 @@ +#include "common.h" + +#include <fcntl.h> +#include <sys/mman.h> +#include <sys/stat.h> + +line_view load_file(const char* path) { + return {nullptr, 0}; +} + +line_view next_line(const char* file, size_t offset) { + return {nullptr, 0}; +} diff --git a/src/common.h b/src/common.h new file mode 100644 index 0000000..f242f48 --- /dev/null +++ b/src/common.h @@ -0,0 +1,11 @@ +#pragma once + +#include <stdlib.h> + +struct line_view { + char* line; + size_t length; +}; + +line_view load_file(const char*); +line_view next_line(const char*, size_t); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index cce5378..8b4c564 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,6 +5,7 @@ set(TEST_FILES add_executable(aoc ${TEST_FILES}) target_include_directories(aoc PRIVATE ${PROJECT_SOURCE_DIR}/include) +target_link_libraries(aoc PRIVATE common solution) add_test(NAME test_aoc COMMAND aoc) |