Development Environment: Tools

To work on the code in the class, you need the following command-line tools:

The exercises and projects use cmake, a build-file generator, to create the proper build file for your system. CMake can generate the build files for make, ninja, and even Visual Studio. We will use git for code and version management.

The following additional command-line tools are very useful:

Use the following for your particular development environment. Some commands have a button to copy to the clipboard so you can easily copy and paste them into the shell.

Windows: WSL

To use Windows, you must set up WSL (Windows Subsystem for Linux). WSL gives you a proper Linux distribution with a bash shell. While git bash is sufficient for entering git commands, it does not provide a good environment to add or use the other necessary tools.

To install WSL, follow the instructions at Install WSL

After you have installed WSL, you can do the rest of the WSL setup at Set Up WSL.

After that, open a WSL shell and enter the following command to see which Linux distribution you are using:

Now, follow the instructions for Linux & WSL.

Linux & WSL

Enter the following commands into a Linux (or WSL) shell. Each command may ask you to confirm before completion.

  1. Update and upgrade your system:

  2. Install git, g++, make, and ninja:

  3. The cmake build tool Ubuntu installs is typically outdated, and using the most recent version of cmake should always be preferred. Kitware has its APT repository for Ubuntu with current cmake versions. Add the Kitware APT repository to your installation using the following commands. For more details, see apt.kitware.com.

    a. Install needed packages:

    b. Obtain a copy of the signing key:

    c. Add the repository to your sources list and update:

    d. Install the kitware-archive-keyring package to ensure that your keyring stays up to date as KitWare updates its keys:

  4. Now install cmake:

  5. Finally, individually verify that you have all these tools installed:

    For cmake, you should have a minimum version of 3.30.2

macOS

Enter the following commands in a macOS terminal shell. You can access one by the Terminal app in the Applications folder in the subfolder Utilities. You probably want to drag the Terminal app to your Dock to access it easily.

  1. The command-line tools for git, g++, and make on macOS are part of the Xcode Command Line Tools. You do not have to install the Xcode IDE to use them.

    The easiest way to install the Xcode Command Line Tools without Xcode is to install Homebrew, which you will need in the following steps.

    Follow the installation instructions at Homebrew. As part of the installation, if you haven't already installed the Xcode Command Line Tools, you'll see a message: "The Xcode Command Line Tools will be installed."

  2. One more issue with brew on Apple Silicon (i.e., M1/M2/M3/M4) Macs. The brew binaries are placed in the /opt/homebrew/bin directory, which is not on the default path used to look for commands. So, for an Apple Silicon Mac only (not an Intel Mac), enter the following command:

    Close this shell and bring up a fresh one when you are done.

  3. After you upgrade, you can install ninja, cmake, and gh via brew:

  4. Finally, individually verify that you have all these tools installed:

    For cmake, you should have a minimum version of 3.31.0

    Note that the command g++ on macOS runs the clang compiler, not the gcc-c++ compiler. The clang compiler is preferred on macOS because it is optimized to produce binaries for both Intel and Apple Silicon Macs. Also, clang can generate both Intel and Apple Silicon binaries on an Intel Mac or an Apple Silicon Mac.