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

added a cmake presets #28

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

added a cmake presets #28

wants to merge 2 commits into from

Conversation

phreed
Copy link

@phreed phreed commented Jul 28, 2023

Newer versions of cmake support CMakePresets.json which provide a convenient way of specifying platform and toolchain settings.
This PR provides is a simple example which works with Ubuntu 20.04

I think it would be useful to update the documentation to indicate that llvm v16 is required and which packages are needed.

https://apt.llvm.org/

Here is the /etc/apt/sources.list.d/llvm.list

deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main
deb-src http://apt.llvm.org/jammy/ llvm-toolchain-jammy-16 main

And, here the signatures.

sudo wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc

Here are the packages I installed to get this to work.

sudo wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
sudo apt-get install clang-16 lldb-16 lld-16
sudo apt-get install libllvm-16-ocaml-dev libllvm16 llvm-16 llvm-16-dev llvm-16-doc llvm-16-examples llvm-16-runtime
sudo apt-get install clang-16 clang-tools-16 clang-16-doc libclang-common-16-dev libclang-16-dev libclang1-16 clang-format-16 python3-clang-16 clangd-16 clang-tidy-16

Then to configure and build.

cmake --preset hello
cmake --build --preset hello

I have not added a test to run the generated executable.

"version": 7,
"cmakeMinimumRequired": {
"major": 3,
"minor": 27,
Copy link
Owner

Choose a reason for hiding this comment

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

@banach-space
Copy link
Owner

Thanks for working on this!

I think it would be useful to update the documentation to indicate that llvm v16 is required and which packages are needed.

I don't follow - that's already documented: https://github.com/banach-space/clang-tutor#platform-support-and-requirements. What am I missing?

I have not added a test to run the generated executable.

Please add a test. You could update https://github.com/banach-space/clang-tutor/blob/main/.github/workflows/x86-ubuntu.yml to build HelloWorld with and without CMake presets.

@phreed
Copy link
Author

phreed commented Jul 28, 2023

You are right the Ubuntu documentation is correct. I do not know what I was thinking.

I will add the ctest.

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