Procedure for MacOS system
System set up
In the case you need to set up a personal computer on MacOS from scratch, you may follow these steps.
> Check first that g++/clang++ is installed in typing in command lineg++ -v
(Follow the installation instruction if the OS proposes to install it.)
For the other dependencies (cmake, GLFW library), the easiest way is to use the package manager Homebrew.
- Follow the instructions of the website to install it if you haven't done so (check with `brew -v`).
# CMake tool to compile brew install cmake # The Library GLFW brew install glfw
Compile and execute the code
Once your system is set up, make a test to compile a test program (commands are similar to a Linux system).- Note these steps will need to be followed for every new program.
- = the directory containing the file CMakeLists.txt - here is it the directory sample_code
# Generate the directory build/ mkdir build # Go to the build/ directory cd build # Run CMake cmake .. # A file Makefile should be generated # Compile make # Make sure the compilation succeed, a file pgm should be created # Go back to the root directory cd .. # Run the executable from the root directory # (possibly adapt to the name of your executable) build/sample_code
- - The `build/` directory contains only temporary files that are generated from cmake and during the compilation. This directory can be safely removed and re-generated if needed.
- - If a source file is modified, only make has to be called
- - If a new file is added, CMake must be called again
IDE
You are highly encouraged to use a complete IDE to edit the C++ code: it helps to use the library with auto-completion, to naviguate quickly through the files, as well as proposing debug tools.In Linux/Ubuntu, you can install QtCreator with the following command
brew cask install qt-creator