bemanproject / exemplar

Example Beman project
Other
11 stars 16 forks source link

Re-enable all examples #56

Closed neatudarius closed 1 week ago

neatudarius commented 1 month ago

Closes #41 - re-enable example with ranges support. It is skipped on compilers with no ranges support or when using C++17 or older.

Log sample:

# with ranges support
$ rm -rf build/ && cmake -B build -S . -DCMAKE_CXX_STANDARD=20 && cmake --build build && ctest --test-dir build && cmake --install build --prefix /opt/beman.exemplar
...
-- Looking for __cpp_lib_ranges
-- Looking for __cpp_lib_ranges - found
Examples to be built: identity_direct_usage;identity_as_default_projection
-- Configuring done (2.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/dariusn/git/Beman/exemplar/build

[ 75%] Building CXX object examples/CMakeFiles/beman.exemplar.examples.identity_direct_usage.dir/identity_direct_usage.cpp.o
[ 83%] Linking CXX executable beman.exemplar.examples.identity_direct_usage
[ 83%] Built target beman.exemplar.examples.identity_direct_usage
[ 91%] Building CXX object examples/CMakeFiles/beman.exemplar.examples.identity_as_default_projection.dir/identity_as_default_projection.cpp.o
...
$ tree build/examples/
build/examples/
├── CMakeFiles
│   ├── CMakeDirectoryInformation.cmake
│   ├── beman.exemplar.examples.identity_as_default_projection.dir
│   │   ├── DependInfo.cmake
│   │   ├── build.make
│   │   ├── cmake_clean.cmake
│   │   ├── compiler_depend.make
│   │   ├── compiler_depend.ts
│   │   ├── depend.make
│   │   ├── flags.make
│   │   ├── identity_as_default_projection.cpp.o
│   │   ├── identity_as_default_projection.cpp.o.d
│   │   ├── link.txt
│   │   └── progress.make
│   ├── beman.exemplar.examples.identity_direct_usage.dir
│   │   ├── DependInfo.cmake
│   │   ├── build.make
│   │   ├── cmake_clean.cmake
│   │   ├── compiler_depend.make
│   │   ├── compiler_depend.ts
│   │   ├── depend.make
│   │   ├── flags.make
│   │   ├── identity_direct_usage.cpp.o
│   │   ├── identity_direct_usage.cpp.o.d
│   │   ├── link.txt
│   │   └── progress.make
│   └── progress.marks
├── CTestTestfile.cmake
├── Makefile
├── beman.exemplar.examples.identity_as_default_projection
├── beman.exemplar.examples.identity_direct_usage
└── cmake_install.cmake

# no ranges support
$ rm -rf build/ && cmake -B build -S . -DCMAKE_CXX_STANDARD=17 && cmake --build build && ctest --test-dir build && cmake --install build --prefix /opt/beman.exemplar
...
-- Looking for __cpp_lib_ranges
-- Looking for __cpp_lib_ranges - not found
CMake Warning at examples/CMakeLists.txt:12 (message):
  Missing range support! Skip: identity_as_default_projection

Examples to be built: identity_direct_usage
-- Configuring done (2.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/dariusn/git/Beman/exemplar/build
...
[ 90%] Building CXX object examples/CMakeFiles/beman.exemplar.examples.identity_direct_usage.dir/identity_direct_usage.cpp.o
...

$ tree build/examples/
build/examples/
├── CMakeFiles
│   ├── CMakeDirectoryInformation.cmake
│   ├── beman.exemplar.examples.identity_direct_usage.dir
│   │   ├── DependInfo.cmake
│   │   ├── build.make
│   │   ├── cmake_clean.cmake
│   │   ├── compiler_depend.make
│   │   ├── compiler_depend.ts
│   │   ├── depend.make
│   │   ├── flags.make
│   │   ├── identity_direct_usage.cpp.o
│   │   ├── identity_direct_usage.cpp.o.d
│   │   ├── link.txt
│   │   └── progress.make
│   └── progress.marks
├── CTestTestfile.cmake
├── Makefile
├── beman.exemplar.examples.identity_direct_usage
└── cmake_install.cmake
camio commented 1 month ago

Note the CI build failures.

wusatosi commented 1 month ago

Note the CI build failures.

I can give some insight into the CI failure here. The failed CI ("defaults") are those that doesn't have a C++ version defined.

This came up to me during refactoring as it's a weird setup, without setting C++ version CMake fallbacks into a platform defined (old) C++ version. I forgot to bring these up.

Basically they fall back to a version < 17 and failed to compile, thus the broken checks.

I don't know why it's broken now instead of earlier.

Given the cmake C++ standard conflict @camio mentioned before, we are prob not putting required minimum version in CMake scripts. Thus we should supply the C++ version for all command line invocation of CMake.

Those tests are in some sense erroneous.

Edit: or maybe the version detection code is erroneous?

wusatosi commented 1 month ago

Given we will start to conditionally run tests and examples based on C++ versions, we prob want to extend sanitizer-enabled CI tests to all versions as well. I can file this as a separate PR.

See: #57

wusatosi commented 1 week ago

Any interest in progressing this? I can come update it. @neatudarius

neatudarius commented 1 week ago

Any interest in progressing this? I can come update it. @neatudarius

You can take over. I'm busy with iterator_interface this week.

wusatosi commented 1 week ago

Should be working now, see: Unit: gcc 17 Default, that reports identity_as_default_projection is not being build. while Unit: gcc 20 Default no longer report this.

wusatosi commented 1 week ago

Updated default C++ version in preset to C++ 20 (previously C++17) so that all examples are built by default.

wusatosi commented 1 week ago

Should be ready! requesting review from original PR author @neatudarius