From f092f5585517d32f4a13c695ac30590d80792046 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Fri, 21 May 2021 00:42:38 +0200 Subject: [PATCH] add licence header --- CMakeLists.txt | 20 ++++++++++++++++++++ cmake/CodeCoverage.cmake | 3 +++ cmake/FetchGTest.cmake | 30 ++++++++++++++++++++++++++++++ doc/CMakeLists.txt | 19 +++++++++++++++++++ doc/api/header_file.rst.in | 22 ++++++++++++++++++++++ doc/api/index.rst | 21 +++++++++++++++++++++ doc/index.rst | 22 ++++++++++++++++++++++ include/CMakeLists.txt | 23 +++++++++++++++++++++++ include/caosdb_config.h.in | 22 ++++++++++++++++++++++ include/connection.h | 22 ++++++++++++++++++++++ src/CMakeLists.txt | 32 +++++++++++++++++++++++--------- src/caosdbcli.cpp | 22 ++++++++++++++++++++++ src/connection.cpp | 22 ++++++++++++++++++++++ test/CMakeLists.txt | 25 ++++++++++++++++++++++++- test/test_connection.cpp | 22 ++++++++++++++++++++++ 15 files changed, 317 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d1da6f6..3ec3178 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,23 @@ +# +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> +# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + cmake_minimum_required(VERSION 3.13) set(libcaosdb_VERSION 0.0.1) diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake index fa51bc1..10d2743 100644 --- a/cmake/CodeCoverage.cmake +++ b/cmake/CodeCoverage.cmake @@ -79,6 +79,9 @@ # 2021-05-10, Martin Stump # - Check if the generator is multi-config before warning about non-Debug builds # +# 2021-05-20, Timm Fitschen <t.fitschen@indiscale.com> +# - Fix: this script should also accept GCC as a (plain) C compiler. +# # USAGE: # # 1. Copy this file into your cmake modules path. diff --git a/cmake/FetchGTest.cmake b/cmake/FetchGTest.cmake index b87975c..6e075cf 100644 --- a/cmake/FetchGTest.cmake +++ b/cmake/FetchGTest.cmake @@ -1,3 +1,32 @@ +# Copyright 2008, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + include(FetchContent) FetchContent_Declare( @@ -6,6 +35,7 @@ FetchContent_Declare( GIT_TAG release-1.10.0 GIT_SHALLOW 1 ) + # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 9742ff2..b35e33a 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,3 +1,22 @@ +# +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> +# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# find_package(Doxygen) diff --git a/doc/api/header_file.rst.in b/doc/api/header_file.rst.in index 94e984b..78a2414 100644 --- a/doc/api/header_file.rst.in +++ b/doc/api/header_file.rst.in @@ -1,3 +1,25 @@ +.. + # + # This file is a part of the CaosDB Project. + # + # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + # Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + # + # This program is free software: you can redistribute it and/or modify + # it under the terms of the GNU Affero General Public License as + # published by the Free Software Foundation, either version 3 of the + # License, or (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU Affero General Public License for more details. + # + # You should have received a copy of the GNU Affero General Public License + # along with this program. If not, see <https://www.gnu.org/licenses/>. + # + # + .. _api_@HEADER_FILE_NAME@: @HEADER_FILE_NAME@ diff --git a/doc/api/index.rst b/doc/api/index.rst index cd3d0f4..8a34c64 100644 --- a/doc/api/index.rst +++ b/doc/api/index.rst @@ -1,3 +1,24 @@ +.. + # + # This file is a part of the CaosDB Project. + # + # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + # Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + # + # This program is free software: you can redistribute it and/or modify + # it under the terms of the GNU Affero General Public License as + # published by the Free Software Foundation, either version 3 of the + # License, or (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU Affero General Public License for more details. + # + # You should have received a copy of the GNU Affero General Public License + # along with this program. If not, see <https://www.gnu.org/licenses/>. + # + .. _api_root: API diff --git a/doc/index.rst b/doc/index.rst index 5823401..a3d189f 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -1,3 +1,25 @@ +.. + # + # This file is a part of the CaosDB Project. + # + # Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + # Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + # + # This program is free software: you can redistribute it and/or modify + # it under the terms of the GNU Affero General Public License as + # published by the Free Software Foundation, either version 3 of the + # License, or (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU Affero General Public License for more details. + # + # You should have received a copy of the GNU Affero General Public License + # along with this program. If not, see <https://www.gnu.org/licenses/>. + # + # + .. _welcome: Welcome to |PROJECT_NAME|'s documentation! diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 0288f1a..8c59e88 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -1,8 +1,31 @@ +# +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> +# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + +# add all header files to this list set(libcaosdb_INCL include/caosdb_config.h include/connection.h ) +# pass variable to parent scope set(libcaosdb_INCL ${libcaosdb_INCL} PARENT_SCOPE) +# initialize build variables configure_file(caosdb_config.h.in caosdb_config.h) diff --git a/include/caosdb_config.h.in b/include/caosdb_config.h.in index b92fc11..3d436f9 100644 --- a/include/caosdb_config.h.in +++ b/include/caosdb_config.h.in @@ -1,3 +1,25 @@ +/* + * + * This file is a part of the CaosDB Project. + * + * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + #ifndef CAOSDB_CONFIG_H #define CAOSDB_CONFIG_H namespace caosdb { diff --git a/include/connection.h b/include/connection.h index e32dfcf..c82087d 100644 --- a/include/connection.h +++ b/include/connection.h @@ -1,3 +1,25 @@ +/* + * + * This file is a part of the CaosDB Project. + * + * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + #ifndef CONNECTION_H #define CONNECTION_H /** diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c031e9..21a98c4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,14 +1,28 @@ -# Make an explicit list of all source files in `libcaosdb_SRC`. This is important -# because CMake is not a build system: it is a build system generator. Suppose -# you add a file foo.cpp to src/ after running cmake .. . If you set -# `libcaosdb_SRC` with `file(GLOB ... )`, this is not passed to the makefile; -# the makefile doesn't know that foo.cpp exists and will not re-run cmake. Your -# collaborator's builds will fail and it will be unclear why. Whether you use -# file(GLOB ...) or not, you will need to re-run cmake, but with an explicit -# file list, you know beforehand why your code isn't compiling. +# +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> +# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + + +# add all source files to this list set(libcaosdb_SRC src/connection.cpp ) -# ... and pass the variable to the parent scope. +# pass variable to parent scope set(libcaosdb_SRC ${libcaosdb_SRC} PARENT_SCOPE) diff --git a/src/caosdbcli.cpp b/src/caosdbcli.cpp index 4562a63..3a5d725 100644 --- a/src/caosdbcli.cpp +++ b/src/caosdbcli.cpp @@ -1,3 +1,25 @@ +/* + * + * This file is a part of the CaosDB Project. + * + * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + // A simple caosdb client #include "connection.h" #include "caosdb_config.h" diff --git a/src/connection.cpp b/src/connection.cpp index e402e7e..d3022cd 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -1,3 +1,25 @@ +/* + * + * This file is a part of the CaosDB Project. + * + * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + #include "connection.h" #include <iostream> diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7790f3b..335c363 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,9 +1,31 @@ -# append all the test cases here (file name without the ".cc" suffix) +# +# This file is a part of the CaosDB Project. +# +# Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> +# Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <https://www.gnu.org/licenses/>. +# + +# append all the test cases here (file name without the ".cpp" suffix) set(test_cases test_connection ) +# download gtest library include(FetchGTest) +# add special cmake functions for gtest include(GoogleTest) # disable linting for gtest targets (not our concern) @@ -12,6 +34,7 @@ set_target_properties(gtest_main PROPERTIES CXX_CLANG_TIDY "" CXX_INCLUDE_WHAT_Y set_target_properties(gmock PROPERTIES CXX_CLANG_TIDY "" CXX_INCLUDE_WHAT_YOU_USE "") set_target_properties(gmock_main PROPERTIES CXX_CLANG_TIDY "" CXX_INCLUDE_WHAT_YOU_USE "") +# loop over all test cases and add them to the test runner list(LENGTH test_cases len_test_cases) math(EXPR len_test_cases "${len_test_cases} - 1") foreach (i RANGE "${len_test_cases}") diff --git a/test/test_connection.cpp b/test/test_connection.cpp index 8b49ddc..c2600cc 100644 --- a/test/test_connection.cpp +++ b/test/test_connection.cpp @@ -1,3 +1,25 @@ +/* + * + * This file is a part of the CaosDB Project. + * + * Copyright (C) 2021 Timm Fitschen <t.fitschen@indiscale.com> + * Copyright (C) 2021 IndiScale GmbH <info@indiscale.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + * + */ + #include "connection.h" #include <gtest/gtest-message.h> #include <gtest/gtest-test-part.h> -- GitLab