From d24899e0848c2cae43593b34863544679d13dac3 Mon Sep 17 00:00:00 2001 From: NukeBird Date: Sat, 8 Mar 2025 20:37:26 +0300 Subject: [PATCH] init --- .clang-format | 14 ++++++++++++++ .gitignore | 3 +++ CMakeLists.txt | 31 +++++++++++++++++++++++++++++++ clang_profile | 18 ++++++++++++++++++ conanfile.txt | 9 +++++++++ s2ga.hpp | 4 ++++ tests/test.cpp | 10 ++++++++++ 7 files changed, 89 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 clang_profile create mode 100644 conanfile.txt create mode 100644 s2ga.hpp create mode 100644 tests/test.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..2d7c3fb --- /dev/null +++ b/.clang-format @@ -0,0 +1,14 @@ +BasedOnStyle: LLVM +BreakBeforeBraces: Allman +AccessModifierOffset: -4 +IndentWidth: 4 +AlwaysBreakTemplateDeclarations: Yes +NamespaceIndentation: All +SpaceAfterTemplateKeyword: false +PointerAlignment: Left +ReferenceAlignment: Left +SpaceAfterControlStatementKeyword: false +AllowShortFunctionsOnASingleLine: false +SpaceBeforeCtorInitializerColon: false +SpaceBeforeInheritanceColon: false +SpaceBeforeRangeBasedForLoopColon: false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2a8066 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +.cache/ +CMakeUserPresets.json diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..881633c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.22.0) + +set(PROJECT_NAME s2ga) + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +set(CMAKE_CXX_FLAGS "-Wall -Wextra") +set(CMAKE_CXX_FLAGS_DEBUG "-g") +set(CMAKE_CXX_FLAGS_RELEASE "-O3") + +project(${PROJECT_NAME}) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +option(BUILD_ZECSY_TESTS "Build tests?" ON) + +add_library(s2ga STATIC s2ga.hpp) +set_target_properties(s2ga PROPERTIES LINKER_LANGUAGE CXX) + +####################################################### +if(${BUILD_ZECSY_TESTS}) + find_package(Catch2 REQUIRED) + file(GLOB TEST_SRC ./tests/*.cpp ./tests/*.hpp ./tests/*.h) + add_executable(tests ${TEST_SRC}) + target_link_libraries(tests PRIVATE Catch2::Catch2WithMain s2ga) + + include(CTest) + include(Catch) + catch_discover_tests(tests) +endif() diff --git a/clang_profile b/clang_profile new file mode 100644 index 0000000..e68cc71 --- /dev/null +++ b/clang_profile @@ -0,0 +1,18 @@ +[settings] +os=Windows +arch=x86_64 +build_type=Release +compiler=clang +compiler.version=19 +compiler.cppstd=gnu20 +compiler.runtime=static +compiler.runtime_type=Release +compiler.runtime_version=v143 + +[buildenv] +CC=clang +CXX=clang +RC=clang + +[conf] +tools.cmake.cmaketoolchain:generator=Ninja diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..30594fc --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,9 @@ +[requires] +catch2/3.8.0 + +[generators] +CMakeDeps +CMakeToolchain + +[layout] +cmake_layout diff --git a/s2ga.hpp b/s2ga.hpp new file mode 100644 index 0000000..f8bed49 --- /dev/null +++ b/s2ga.hpp @@ -0,0 +1,4 @@ +inline void foo() +{ + +} diff --git a/tests/test.cpp b/tests/test.cpp new file mode 100644 index 0000000..cd0874c --- /dev/null +++ b/tests/test.cpp @@ -0,0 +1,10 @@ +#include "../s2ga.hpp" +#include +#include +#include + +TEST_CASE("Should pass") +{ + std::cout << "HI" << std::endl; + REQUIRE_NOTHROW(foo()); +}