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

Add CMake presets #59

Merged
merged 6 commits into from
Jan 30, 2025
Merged

Add CMake presets #59

merged 6 commits into from
Jan 30, 2025

Conversation

wusatosi
Copy link
Member

This is directly fetched from exemplar.

@ClausKlein
Copy link
Contributor

This kind of presets are very restricted, but not usable

I don´t use apple clang compiler. It does not support current std's!

I use gcc-14 and clang-19.

I you keep the presets as they are, disable presets not intended for this build host OS.

If not, this may happen:

cmake --lists-presets

Available configure presets:

  "gcc-debug"          - GCC Debug Build
  "gcc-release"        - GCC Release Build
  "appleclang-debug"   - xcode Debug Build
  "appleclang-release" - xcode Release Build
  "msvc-debug"         - MSVC Debug Build
  "msvc-release"       - MSVC Release Build
bash-5.2$ gvim CMakePresets.json 
bash-5.2$ cmake --workflow gcc-debug
Executing workflow step 1 of 3: configure preset "gcc-debug"

Preset CMake variables:

  BEMAN_BUILDSYS_SANITIZER="MaxSan"
  CMAKE_BUILD_TYPE="Debug"
  CMAKE_CXX_STANDARD="20"
  CMAKE_TOOLCHAIN_FILE="cmake/gnu-toolchain.cmake"

-- The CXX compiler identification is AppleClang 16.0.0.16000026
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is AppleClang 16.0.0.16000026
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python3: /usr/local/Frameworks/Python.framework/Versions/3.13/bin/python3.13 (found version "3.13.1") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
Examples to be built: fibonacci
-- Configuring done (16.5s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/beman-project/inplace_vector/build/gcc-debug

Executing workflow step 2 of 3: build preset "gcc-debug"

[1/20] Building CXX object _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o
FAILED: _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o 
ccache /usr/bin/g++  -isystem /Users/clausklein/Workspace/cpp/beman-project/inplace_vector/build/gcc-debug/_deps/googletest-src/googletest/include -isystem /Users/clausklein/Workspace/cpp/beman-project/inplace_vector/build/gcc-debug/_deps/googletest-src/googletest -fsanitize=address -fsanitize=leak -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined -g -std=c++20 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -mmacosx-version-min=14.7  -DGTEST_HAS_PTHREAD=1 -MD -MT _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o -MF _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o.d -o _deps/googletest-build/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o -c /Users/clausklein/Workspace/cpp/beman-project/inplace_vector/build/gcc-debug/_deps/googletest-src/googletest/src/gtest_main.cc
clang++: error: unsupported option '-fsanitize=leak' for target 'x86_64-apple-darwin23.6.0'

@ClausKlein
Copy link
Contributor

The appleclang presets doest use apple-clang`?

bash-5.2$ cmake --workflow appleclang-debug
Executing workflow step 1 of 3: configure preset "appleclang-debug"

Preset CMake variables:

  BEMAN_BUILDSYS_SANITIZER="MaxSan"
  CMAKE_BUILD_TYPE="Debug"
  CMAKE_CXX_STANDARD="20"
  CMAKE_TOOLCHAIN_FILE="cmake/appleclang-toolchain.cmake"

-- The CXX compiler identification is Clang 19.1.7
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/opt/llvm/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The C compiler identification is Clang 19.1.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/opt/llvm/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found Python3: /usr/local/Frameworks/Python.framework/Versions/3.13/bin/python3.13 (found version "3.13.1") found components: Interpreter
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
Examples to be built: fibonacci
-- Configuring done (24.3s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/clausklein/Workspace/cpp/beman-project/inplace_vector/build/appleclang-debug

Executing workflow step 2 of 3: build preset "appleclang-debug"
...

@wusatosi
Copy link
Member Author

wusatosi commented Jan 25, 2025

apple clang doesn't have a specific binary location. It uses the default clang++'s location. It is impossible to avoid collision here, the only thing we can do is add a check in the main CMake file to fail if clang is detected when apple clang is requested.

@wusatosi
Copy link
Member Author

you keep the presets as they are, disable presets not intended for this build host OS.

I see your point. But I don't think this kind of hand-holding brings that much value. Plus, I do want my end user to know msvc and apple clang is officially supported.

If you have such a strong opinion, provide a patch upstream to exemplar and we can collect more feedback from other ppl, maybe I am wrong.

@wusatosi
Copy link
Member Author

I use gcc-14 and clang-19.

Good for you, use gcc-debug. We will add a clang-debug in the future, but not this PR.

I don´t use apple clang compiler. It does not support current std's!

My aim for this library is to support as much ecosystem as possible within a reasonable maintenance burden.

This kind of presets are very restricted, but not usable

If you have a better idea, submit a clean, helpful, standalone, reviewable PR to exemplar. This repo is for inplace vector and I don't want to deal with infrastructure other than syncing to exemplar or very minor changes.

CK, most of your input has been a waste of our time. If you want to create an impact for the open source community, I suggest you observe and learn how other contributors provide value before eagerly spreading your CMake best practices.

@wusatosi
Copy link
Member Author

Removing appleclang and MSVC support temporarily

@wusatosi wusatosi merged commit daf6f62 into main Jan 30, 2025
35 checks passed
@wusatosi wusatosi deleted the preset branch January 30, 2025 20:41
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.

2 participants