diff --git a/CMakeLists.txt b/CMakeLists.txt index d1da6f684c00c45526055c4e4d3370b042310d8d..3ec31782c1a0522b2f339554f2a713045d015f91 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 fa51bc1f3e0637db24a2ecafd4e25b0ccbcdf0e8..10d27438caa3960dc202f856f4d02223da10bb74 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 b87975c30e6eb28b59ef544c25d463c766f61921..6e075cff55d6c7f662d173ec55b4fd7bac7fa39b 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 9742ff213fbfbe288c6d14c81f3037fb4523a480..b35e33a50559c037d92d36205e13533d7818c1e3 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 94e984bc7e414fbb38f1e1c52afe7c8e94004652..78a24143fc6e53b3f83a55b6dddbd42a549e909e 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 cd3d0f40206589a6d7fc89e1f68ea69cf5964103..8a34c64d35cc72179a07ca96d1ba5914b0d741f1 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 58234019ffec8f19ddd90e9b635d2305e37af404..a3d189f4803b60d8710e5f0773ecb01530943a75 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 0288f1a18e631546910ad5b799399d6e53908856..8c59e885acdd1a9226541b6ca2874dd2f0acfb0f 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 b92fc11220b0428211f6cb87aa49c95bd9c95f35..3d436f9fc5af37dd47be1c180383d4b2beb9733d 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 e32dfcf5033142aea567e7cfa2386ff2bc33511e..c82087df1b0a24d975555944ad7ba42c950a32b8 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 7c031e93d25678f43c700723062c11771bf57375..21a98c489b8627c22d9d30e2300ad3b1ac655cbd 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 4562a63113b9710b153435a7df2a896ee4871682..3a5d725e8a93e179e11b146e4e33c19ada8c16b7 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 e402e7e6e5344fda69ccf9a35961ced2e68f931d..d3022cd420ad58ef94ab0734548fb7aa6293845a 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 7790f3b61fb67686705501a58b16b6fc6fd8ab35..335c36314ca493aa3309cb9e0ac8913fa324b558 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 8b49ddced86816a4d4837f327a64b8a3f51a30ad..c2600cce79756ef8fbe2ee3799025217aababa99 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>