Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable all examples #56

Merged
merged 8 commits into from
Nov 13, 2024
Merged

Conversation

neatudarius
Copy link
Contributor

@neatudarius neatudarius commented Oct 21, 2024

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

cmake/CompilerFeatureTest.cmake Outdated Show resolved Hide resolved

check_cxx_source_compiles(
"
#include <ranges> // C++20 ranges; note that __cpp_lib_ranges is not defined for all compilers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What compiler doesn't define it?

BTW, when searching for __cpp_lib_ranges using GitHub code search I found this alternative way to check.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have adopted this in my latest contribution.

@camio

This comment was marked as resolved.

@wusatosi

This comment was marked as resolved.

@wusatosi

This comment was marked as resolved.

@wusatosi
Copy link
Member

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

@neatudarius
Copy link
Contributor Author

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

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

@wusatosi
Copy link
Member

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
Copy link
Member

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

@wusatosi
Copy link
Member

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

@wusatosi wusatosi requested a review from camio November 13, 2024 21:22
@neatudarius neatudarius merged commit 849f0bd into beman-project:main Nov 13, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reenable broken example - identity_as_default_projection
3 participants