From dc7c2d88e5a0d94a3c70c799f3cf06fe8be4d25b Mon Sep 17 00:00:00 2001 From: eddyxorb <hans-peter.gmuerr@freenet.de> Date: Sat, 27 Aug 2022 14:05:16 +0200 Subject: [PATCH] Basic structure of repo created using conanfile, cmakelists and gtest. --- .clang-format | 9 +++++++++ .gitignore | 2 ++ CMakeLists.txt | 18 ++++++++++++++++++ README.md | 1 + conanfile.py | 30 ++++++++++++++++++++++++++++++ include/magic_params.hpp | 6 ++++++ src/main.cpp | 8 ++++++++ tests/test.cpp | 11 +++++++++++ 8 files changed, 85 insertions(+) create mode 100644 .clang-format create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 README.md create mode 100644 conanfile.py create mode 100644 include/magic_params.hpp create mode 100644 src/main.cpp create mode 100644 tests/test.cpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..7db1246 --- /dev/null +++ b/.clang-format @@ -0,0 +1,9 @@ +AccessModifierOffset: -3 +BasedOnStyle: Chromium +BreakBeforeBraces: Allman +ColumnLimit: '120' +IndentWidth: '3' +Language: Cpp +MaxEmptyLinesToKeep: '1' +NamespaceIndentation: None +UseTab: Never \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1899660 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +.vscode \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7e240dc --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.13) + +PROJECT("magicparams") + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_executable(magicparams) +add_executable(magicparamstests) + +target_link_libraries(magicparamstests PRIVATE CONAN_PKG::gtest) + +target_include_directories(magicparams PUBLIC include) +target_include_directories(magicparamstests PRIVATE include) + +target_sources(magicparams PUBLIC include/magic_params.hpp) +target_sources(magicparams PRIVATE src/main.cpp) +target_sources(magicparamstests PRIVATE tests/test.cpp) \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..56b3318 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# MagicParams \ No newline at end of file diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..a4f5ea4 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,30 @@ +from importlib.metadata import requires +from conans import ConanFile, CMake, tools + + +class MagicParams(ConanFile): + name = "magicparams" + version = "1.0" + author = "EddyXorb" + description = "Map enum values to different plain old datatypes and string and check and set and retrieve them without having to remember which parameter maps to which type. " + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + generators = "cmake" + exports_sources = "*" + requires = "gtest/1.12.1" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def build(self): + cmake = CMake(self) + cmake.configure(".") + cmake.build() + + def package(self): + self.copy("*.hpp", dst="include", src="include") + + def package_info(self): + self.cpp_info.libs = ["enummap"] diff --git a/include/magic_params.hpp b/include/magic_params.hpp new file mode 100644 index 0000000..1abd36b --- /dev/null +++ b/include/magic_params.hpp @@ -0,0 +1,6 @@ +#include <unordered_map> + +class MagicParams +{ + +}; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..d7c88b2 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,8 @@ + +#include <iostream> +#include <magic_params.hpp> + +int main() +{ + std::cout << "HELLO!"; +} diff --git a/tests/test.cpp b/tests/test.cpp new file mode 100644 index 0000000..b6155a6 --- /dev/null +++ b/tests/test.cpp @@ -0,0 +1,11 @@ +#include "gtest/gtest.h" + +#include "magic_params.hpp" +class MagicParamsTester : public ::testing::Test +{ +}; + +TEST_F(MagicParamsTester, simpletest) +{ + EXPECT_TRUE(true); +}; \ No newline at end of file