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

Question re compilation #320

Open
haesleinhuepf opened this issue Jul 12, 2024 · 4 comments
Open

Question re compilation #320

haesleinhuepf opened this issue Jul 12, 2024 · 4 comments

Comments

@haesleinhuepf
Copy link
Member

In the readme, it currently mentions this command:

cmake -S . -B ./build -D CMAKE_INSTALL_PREFIX=/path/to/installation/folder

What should I enter for /path/to/installation/folder? Could we write a sentence to guide new users where this foloder should point at?

@StRigaud
Copy link
Member

Nothing, you can run the cmake command without the -D CMAKE_INSTALL_PREFIX=/path/to/installation/folder. This is if you want to install the library in your system.

Simply use cmake -S . -B ./build, I will update the read me. But usually, with CMake being integrated inside IDE, little to no-one runs this command anymore.

You already ask this if I recall 😜

@thawn
Copy link
Collaborator

thawn commented Jul 12, 2024

I will update the read me. But usually, with CMake being integrated inside IDE, little to no-one runs this command anymore.

For me, it would be great, if you could document the exact steps how to get compilation from within VSCode to work. So far I was always trying a few random things and at some point is just worked but I never quite figured out the exact steps needed to get it to work.

@StRigaud
Copy link
Member

This is something I want to avoid because, a bit like Java or other language, people have their own way of building, IDE, etc.
And before we know it, we have a tutorial for building on VSCode, MSV, XCode, Eclipse, Makefile, etc ...

But here a quick tuto based on my setup:

My config for VSCode:

  • MSV 17 or Ninja or Makefile
  • CMake (>= 3.20) install and available in PATH and CLI (open a prompt, and you should be able to run the cmd cmake
  • in VSCode, get the following extention: C/C++ extension Pack & CMake Tools from Microsoft

image

This should enable VSCode to call CMake for configuration and build. And It will use the cmake presets to select the build you want to do (like Debug, Release, etc.)
You can tune the build configuration using the option in the bottom bar (the status bar):

image

You then select the build type you want:

  • Ninja, win-msvc17, make file
  • Debug, Release build
  • Debug, Release tests

I am relying on Ninja (installed on my system) and build and test in Debug for development.

Note: these are presets stored in the cmake>presets and are not exaustive to all type of configuration. Hence, the use of the commande line in the README.

Once this is done, you can build in VSCode with ctrl+shift+p and type cmake: build

image

This should make VSCode call cmake with the correct command line based on the presets you selected:

image

This work fairly easy for Unix system (linux and mac) especially with all the building tools like ninja and cmake can be install with brew or apt.
For windows, things may be a bit more bumpy, and I am less familliar. hence the command line README to avoid using an IDE or the use of CMake GUI for simpler configuration.

Hope that's help. And of course, if needed, we can find 5 min for a quick Visio to catch up and debug your build setup :)

@thawn
Copy link
Collaborator

thawn commented Jul 12, 2024

Thanks, @StRigaud that is a great explanation ❤️

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

No branches or pull requests

3 participants