From 15a7acce5604768704e01d131f019df9e9f1500f Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Thu, 1 Jul 2021 11:57:39 +0200 Subject: [PATCH] DOC: update README_SETUP for installation --- .gitlab-ci.yml | 3 +-- CMakeLists.txt | 37 +++++++++++++++++++++---------------- README_SETUP.md | 29 +++++++++++++++++++++++++++-- 3 files changed, 49 insertions(+), 20 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09ccc84..11d4e8f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -127,7 +127,6 @@ trigger_inttest: script: - mkdir -p build - cd build - - conan install .. - cmake .. - cmake --build . --target doc-sphinx - cp -r doc/sphinx_out ../public @@ -139,7 +138,7 @@ pages: <<: *pages_prepare only: refs: - - /^release-.*$/i + - main artifacts: paths: - public diff --git a/CMakeLists.txt b/CMakeLists.txt index 37bb5f1..021c71c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,23 +41,28 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) set(PROJECT_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include") -find_program(iwyu NAMES include-what-you-use iwyu PATHS ${CMAKE_SOURCE_DIR}/tools/include-what-you-use/${iwyu_os}/bin) -if(NOT iwyu) - message(STATUS "include-what-you-use: Not found") +option(LINTING ON) +if(LINTING) + find_program(iwyu NAMES include-what-you-use iwyu PATHS ${CMAKE_SOURCE_DIR}/tools/include-what-you-use/${iwyu_os}/bin) + if(NOT iwyu) + message(STATUS "include-what-you-use: Not found") + else() + message(STATUS "include-what-you-use: ${iwyu}") + set(_CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${iwyu}) + endif() + + find_program(clang_tidy NAMES clang-tidy clang-tidy-11) + if(NOT clang_tidy) + message(STATUS "clang-tidy: Not found") + else() + message(STATUS "clang-tidy: ${clang_tidy}") + set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}" + "--header-filter=caosdb/.*[^\(\.pb\.h\)]$" + "--checks=*,-fuchsia-*,-llvm-include-order,-llvmlibc-*" + "--warnings-as-errors=*") + endif() else() - message(STATUS "include-what-you-use: ${iwyu}") - set(_CMAKE_CXX_INCLUDE_WHAT_YOU_USE ${iwyu}) -endif() - -find_program(clang_tidy NAMES clang-tidy clang-tidy-11) -if(NOT clang_tidy) - message(STATUS "clang-tidy: Not found") -else() - message(STATUS "clang-tidy: ${clang_tidy}") - set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}" - "--header-filter=caosdb/.*[^\(\.pb\.h\)]$" - "--checks=*,-fuchsia-*,-llvm-include-order,-llvmlibc-*" - "--warnings-as-errors=*") + message(STATUS "LINTING is OFF") endif() add_subdirectory(src) diff --git a/README_SETUP.md b/README_SETUP.md index a537665..27090f4 100644 --- a/README_SETUP.md +++ b/README_SETUP.md @@ -4,10 +4,35 @@ We use [cmake](https://cmake.org) as build tool. -1. `cmake -B build` -2. `cd build` +1. `mkdir build && cd build/` +2. `cmake -B . ..` 3. `cmake --build .` +### Troubleshooting + +#### protobufConfig.cmake not found + +If you encounter something like `protobufConfig.cmake` when doing `cmake ..` your system doesn't have the gRPC library installed at all or your installation doesn't have the required `protobufConfig.cmake` file. One approach is to fetch and build gRPC and ProtoBuf with cmake locally: + +1. Go to the build directory if you are not there +2. `cmake -B . -D LINTING=OFF -D GRPC_FETCHCONTENT=ON ..` + + ``` + -- include-what-you-use: /usr/lib/llvm/11/bin/include-what-you-use + -- clang-tidy: /usr/lib/llvm/11/bin/clang-tidy + -- Using gRPC via add_subdirectory (FetchContent). + + ... (A LOT OF STUFF) + + -- Configuring done + -- Generating done + -- Build files have been written to: /home/tf/src/caosdb/caosdb-cpplib/build + ``` + + Note: We turn linting off because we don't want to lint the third-party projects. +3. Because we don't want to download and build everything again each time we + wipe our build directory: `cmake --install . --prefix $HOME/.local/` + ## Unit Tests ### Run -- GitLab