Conversation
97f42f3 to
a8de9f8
Compare
| set_target_properties( | ||
| beman.monadics.examples.${example} | ||
| PROPERTIES | ||
| # TODO(CK): why? CXX_EXTENSIONS OFF |
There was a problem hiding this comment.
I don't think we actually need to do that per target. I was just following recommendations.
I think it should be controlled by a consumer.
I have not verified if it is okay to mix for example consumer build with -std=gnu++20 and library has been builded with std=c++20
There was a problem hiding this comment.
you can't mix any compile flag or option, still a cmake constrain!
| "BEMAN_USE_MODULES": true, | ||
| "BEMAN_USE_STD_MODULE": true, | ||
| "CMAKE_CXX_STANDARD": "23", |
There was a problem hiding this comment.
I have mostly testing by default with C++20 and modules should be a separate preset.
Maybe we could use somehow environment variables to conditionally extend preset?
There was a problem hiding this comment.
this can be controlled like here:
https://github.com/ClausKlein/asio/blob/feature/module/.github/workflows/clang.yml
@ednolan but not with beman CI workflows?
| "environment": { | ||
| "CXX": "clang++", | ||
| "CMAKE_CXX_FLAGS": "-stdlib=libc++" |
There was a problem hiding this comment.
That comes from toolchain.
| "CXX": "clang++", | ||
| "CMAKE_CXX_FLAGS": "-stdlib=libc++" |
|
|
||
| if(BEMAN_USE_MODULES) | ||
| add_library(beman.monadics.detail) | ||
| add_library(beman.monadics_detail) |
There was a problem hiding this comment.
I thought we are using . every as a separator or does it make any difference?
There was a problem hiding this comment.
@ednolan The beman install script has some checks to force this!
| endif() | ||
|
|
||
| beman_install_library(beman.monadics) | ||
| beman_install_library(beman.monadics TARGETS beman.monadics beman.monadics_detail beman.monadics_module) |
There was a problem hiding this comment.
Hm... I am not sure I have understood why do we need all 3 targets.
If the library configured with BEMAN_USE_MODULES then we should not leak any details to a consumer, so we should not install beman.monadics_detail.
There was a problem hiding this comment.
cmake needs all headers and modules to build the BMI again for a consumer!
There was a problem hiding this comment.
Right, that is the case when library installed as system library.
|
FYI: bash-5.3$ clang-tidy examples/monadics_std_usage.cpp
949 warnings generated.
/Users/clausklein/Workspace/cpp/beman-project/monadics/examples/monadics_std_usage.cpp:10:19: warning: function 'error' has inline specifier but is implicitly inlined [readability-redundant-inline-specifier]
10 | [[nodiscard]] inline static constexpr auto error() noexcept { return std::nullopt; }
| ^~~~~~
Suppressed 948 warnings (948 in non-user code).
Use -header-filter=.* or leave it as default to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
bash-5.3$ Please check witch clang and w/o module: run-clang-tidy -checks='-*,misc-include-*' tests/beman/monadics |
FIXME: the usage of this header is strange and fragile!bash-5.3$ git ls-files ::*trait.hpp
tests/beman/monadics/enum/trait.hpp
tests/beman/monadics/expected/trait.hpp
tests/beman/monadics/optional/trait.hpp
tests/beman/monadics/raw_ptr/trait.hpp
tests/beman/monadics/shared_ptr/trait.hpp
bash-5.3$
bash-5.3$ head `git ls-files ::*trait.hpp`
==> tests/beman/monadics/enum/trait.hpp <==
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef BEMAN_MONADICS_RAW_PTR_TRAIT_HPP
#define BEMAN_MONADICS_RAW_PTR_TRAIT_HPP
#include <beman/monadics/monadics.hpp>
#include <concepts>
#include <utility>
==> tests/beman/monadics/expected/trait.hpp <==
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef BEMAN_MONADICS_EXPECTED_TRAIT_HPP
#define BEMAN_MONADICS_EXPECTED_TRAIT_HPP
#include <beman/monadics/monadics.hpp>
#include <type_traits>
#include <utility>
#include <concepts>
==> tests/beman/monadics/optional/trait.hpp <==
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef BEMAN_MONADICS_OPTIONAL_TRAIT_HPP
#define BEMAN_MONADICS_OPTIONAL_TRAIT_HPP
#include <beman/monadics/monadics.hpp>
#include <optional>
template <typename T>
==> tests/beman/monadics/raw_ptr/trait.hpp <==
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef BEMAN_MONADICS_RAW_PTR_TRAIT_HPP
#define BEMAN_MONADICS_RAW_PTR_TRAIT_HPP
#include <beman/monadics/monadics.hpp>
#include <type_traits>
template <typename Box>
==> tests/beman/monadics/shared_ptr/trait.hpp <==
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#ifndef BEMAN_MONADICS_OPTIONAL_TRAIT_HPP
#define BEMAN_MONADICS_OPTIONAL_TRAIT_HPP
#include <beman/monadics/monadics.hpp>
#include <memory>
#include <utility>
bash-5.3$ |
2b53237 to
81be02e
Compare
| "_debug-base" | ||
| ], | ||
| "cacheVariables": { | ||
| "BEMAN_USE_MODULES": false, |
There was a problem hiding this comment.
Disabled for now, it does not compile with g++-15
| "_release-base" | ||
| ], | ||
| "cacheVariables": { | ||
| "BEMAN_USE_MODULES": false, |
There was a problem hiding this comment.
Disabled for now, it does not compile with g++-15
6321b93 to
5c15262
Compare
Replace global CMAKE_CXX_STANDARD with target_compile_features. Using target_compile_features expresses the language requirement as a target usage requirement, ensuring correct propagation to dependents. Disable compiler extensions to enforce strict ISO C++20 and avoid compiler-specific behavior.
Ensure they are built with strict ISO C++ and behave consistently with the main library.
Enforce stricter builds to catch issues early.
5c15262 to
2880561
Compare
This is only a prove of concept to build an interface library (header only) and a c++20 module library together
beman library naming conventionis no clear to me. The install function does only yet acceptsbeman.xxx_yyynames