diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..f1f2028 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.16 FATAL_ERROR) +project("light" LANGUAGES CXX) + +include(tools/cmake/preliminary.cmake) + +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_option(ENABLE_SANITIZERS "Enables fsan sanitizers") +add_option(ENABLE_STATIC_ANALYSIS "Enables clang-tidy static analysis") + +find_package(benchmark REQUIRED) +find_package(GTest REQUIRED) + +if(ENABLE_STATIC_ANALYSIS) + find_program(CLANG_TIDY_EXE NAMES "clang-tidy" REQUIRED) +endif() + +add_subdirectory(docs) +add_subdirectory(modules) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..ec68f06 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,36 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain + +class LightRecipe(ConanFile): + name = "light" + + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps" + + requires = [ + "benchmark/1.8.4", + "gtest/1.14.0", + ] + + tool_requires = [ + "cmake/3.30.0" + ] + + options = { + "enable_static_analysis": [True, False], + "enable_sanitizers": [True, False], + } + + default_options = { + "enable_static_analysis": True, + "enable_sanitizers": False, + } + + def generate(self): + tc = CMakeToolchain(self) + + tc.cache_variables["CMAKE_EXPORT_COMPILE_COMMANDS"] = True + tc.cache_variables["ENABLE_SANITIZERS"] = self.options.enable_sanitizers + tc.cache_variables["ENABLE_STATIC_ANALYSIS"] = self.options.enable_static_analysis + + tc.generate() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt new file mode 100644 index 0000000..61f5fbc --- /dev/null +++ b/docs/CMakeLists.txt @@ -0,0 +1 @@ +message("TODO: implement doc generation") diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 0000000..a0025dd --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(utilities/preliminary) +add_subdirectory(light) diff --git a/modules/light/.gitkeep b/modules/light/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/light/CMakeLists.txt b/modules/light/CMakeLists.txt new file mode 100644 index 0000000..75d113c --- /dev/null +++ b/modules/light/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(light ${CMAKE_CURRENT_SOURCE_DIR}/src/entrypoint.cpp) + +target_link_libraries(light PRIVATE preliminary) diff --git a/modules/light/src/entrypoint.cpp b/modules/light/src/entrypoint.cpp new file mode 100644 index 0000000..dd06efd --- /dev/null +++ b/modules/light/src/entrypoint.cpp @@ -0,0 +1,6 @@ +auto main() -> lt::i32 +{ + std::cout << "Light built and ran fine..."; + + return 0; +} diff --git a/modules/utilities/preliminary/CMakeLists.txt b/modules/utilities/preliminary/CMakeLists.txt new file mode 100644 index 0000000..680a173 --- /dev/null +++ b/modules/utilities/preliminary/CMakeLists.txt @@ -0,0 +1,3 @@ +add_library(preliminary INTERFACE) +target_precompile_headers(preliminary INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/src/pch.hpp) +target_include_directories(preliminary INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/) diff --git a/modules/utilities/preliminary/include/preliminary/types.hpp b/modules/utilities/preliminary/include/preliminary/types.hpp new file mode 100644 index 0000000..d104ec7 --- /dev/null +++ b/modules/utilities/preliminary/include/preliminary/types.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +namespace lt { + +using i8 = int8_t; +using i16 = int16_t; +using i32 = int32_t; +using i64 = int64_t; + +using u8 = uint8_t; +using u16 = uint16_t; +using u32 = uint32_t; +using u64 = uint64_t; + +template +using vec = std::vector; + +} // namespace lt diff --git a/modules/utilities/preliminary/src/pch.hpp b/modules/utilities/preliminary/src/pch.hpp new file mode 100644 index 0000000..4145db8 --- /dev/null +++ b/modules/utilities/preliminary/src/pch.hpp @@ -0,0 +1,66 @@ +#pragma once + +#include + +/* utilities */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* numerics */ +#include +#include +#include +#include + +/* containers */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* algorithms */ +#include + +/* input/output */ +#include +#include +#include + +/* regular expression */ +#include + +/* thread support */ +#include +#include +#include +#include +#include + +/* string */ +#include +#include +#include + +/* filesystem */ +#include diff --git a/tools/cmake/preliminary.cmake b/tools/cmake/preliminary.cmake new file mode 100644 index 0000000..fa40b63 --- /dev/null +++ b/tools/cmake/preliminary.cmake @@ -0,0 +1,10 @@ +macro(add_option option help) + option(${option} ${help}) + + if(${option}) + message(STATUS "${option}: ON") + add_compile_definitions(${option}=1) + else() + message(STATUS "${option}: OFF") + endif() +endmacro()