diff --git a/.clang-tidy b/.clang-tidy index 2c37bc7..07ccb91 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,4 @@ Checks: 'clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,modernize-*,-modernize-use-trailing-return-type,readability-*' -WarningsAsErrors: '*' CheckOptions: - { key: readability-identifier-naming.NamespaceCase, value: lower_case } - { key: readability-identifier-naming.ClassCase, value: CamelCase } diff --git a/CMakeLists.txt b/CMakeLists.txt index 884260b..1ae64bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.12) project(yadro-task VERSION 0.1 LANGUAGES CXX) @@ -9,13 +9,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) find_program(CLANG_TIDY_EXE NAMES clang-tidy REQUIRED) set(CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_EXE}) -file(GLOB SOURCES src/*.cpp) +enable_testing() -add_executable(${PROJECT_NAME} ${SOURCES}) - -target_include_directories(${PROJECT_NAME} - PRIVATE - ${PROJECT_SOURCE_DIR}/include -) - -set_property(TARGET ${PROJECT_NAME} PROPERTY COMPILE_WARNINGS_AS_ERRORS ON) +add_subdirectory(src) +add_subdirectory(bin) +add_subdirectory(tests) diff --git a/bin/CMakeLists.txt b/bin/CMakeLists.txt new file mode 100644 index 0000000..5a59aed --- /dev/null +++ b/bin/CMakeLists.txt @@ -0,0 +1,2 @@ +add_executable(ftsort ${PROJECT_SOURCE_DIR}/bin/ftsort.cpp) +target_link_libraries(ftsort PRIVATE tapelib) diff --git a/src/main.cpp b/bin/ftsort.cpp similarity index 100% rename from src/main.cpp rename to bin/ftsort.cpp diff --git a/include/filetape.h b/include/tapelib/filetape.h similarity index 100% rename from include/filetape.h rename to include/tapelib/filetape.h diff --git a/include/tape.h b/include/tapelib/tape.h similarity index 100% rename from include/tape.h rename to include/tapelib/tape.h diff --git a/include/tapeconfig.h b/include/tapelib/tape_config.h similarity index 100% rename from include/tapeconfig.h rename to include/tapelib/tape_config.h diff --git a/include/tapeutil.h b/include/tapelib/tape_util.h similarity index 100% rename from include/tapeutil.h rename to include/tapelib/tape_util.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..fe4f8de --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,4 @@ +file(GLOB SOURCES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/src/*.cpp) + +add_library(tapelib ${SOURCES}) +target_include_directories(tapelib PUBLIC ${PROJECT_SOURCE_DIR}/include/tapelib) diff --git a/src/tapeconfig.cpp b/src/tape_config.cpp similarity index 94% rename from src/tapeconfig.cpp rename to src/tape_config.cpp index 1fa42d3..629b92f 100644 --- a/src/tapeconfig.cpp +++ b/src/tape_config.cpp @@ -1,4 +1,4 @@ -#include "tapeconfig.h" +#include "tape_config.h" #include "filetape.h" #include diff --git a/src/tapeutil.cpp b/src/tape_util.cpp similarity index 67% rename from src/tapeutil.cpp rename to src/tape_util.cpp index 382abe8..38217b8 100644 --- a/src/tapeutil.cpp +++ b/src/tape_util.cpp @@ -1,3 +1,3 @@ -#include "tapeutil.h" +#include "tape_util.h" void tape::sort(Tape &input, Tape &output) {} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..16dc957 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(filetape_tests ${PROJECT_SOURCE_DIR}/tests/filetape_tests.cpp) +target_link_libraries(filetape_tests PRIVATE tapelib) + +add_test(filetape_tests filetape_tests) diff --git a/tests/filetape_tests.cpp b/tests/filetape_tests.cpp new file mode 100644 index 0000000..44e82e2 --- /dev/null +++ b/tests/filetape_tests.cpp @@ -0,0 +1 @@ +int main(int argc, char *argv[]) { return 0; }