Home

Lab Negative One - Setting up the development environment

IMPORTANT! In this course, your project must be cross-platform. Follow these guidelines.

Once you set up your environment properly, you should be able to run the lab code and see the following in the console:

Welcome to Computer Graphics!

First, download the lab here, and then extract the zip file to a suitable folder. Then go to the section corresponding to your development environment.

Miscellaneous tips:

  1. Depending on the environment, things may not go smoothly if the path contains special characters. Therefore, I recommend against using SPACE, &, etc. in your path.
  2. Whenever you change your environment variables, you need to restart CMake and your IDE.
  3. Because CMake caches your last-used settings, it must be cleared before running again. Run the command rm -r * from the build folder to delete the cache.

Setting up Windows

Download and install these programs.

Setting up macOS

This has been tested on Big Sur and Monterey. Earlier versions may or may not work. Both Intel and M\(1\) Macs are supported.

Download and install the following. You can use homebrew/macports or install these manually.

Make sure the commands g++ and cmake work from the command prompt.

Setting up Linux

This is for Ubuntu Linux 16.04.1 LTS. Setting up other distributions will be similar but may be slightly different.

You’ll need the following if you don’t have them already.

> sudo apt-get update
> sudo apt-get install g++
> sudo apt-get install cmake

Run with Visual Studio

  1. Extract L-1.zip into a folder of your choice.

  2. Run CMake (GUI).

    1. Click on “Browse Source…” and point to the folder you extracted, containing the CMakeLists.txt file.
    2. Copy and paste the path from above to “Where to build the binaries.” Append “build” to it.
    3. Click on “Configure.” Click on “Yes” if it asks if you want to create a directory. Select the Visual Studio version that is installed on your machine (e.g., “Visual Studio 16.2.5 2019”) and click on “Finish.” You should see “Configuring done” in the scroll panel.
    4. Click on “Generate.” You should see “Generating done” in the scroll panel. Close CMake.
  3. There should now be a file called L-1.sln in the build folder. Double click it to open it with Visual Studio.

    1. Right-click on L-1 and select “Set as StartUp Project.”
    2. Right-click again on L-1 and select “Properties.” Go to “Debugging” then “Command Arguments” and then type in the command line arguments (e.g., ../resources). Click “OK.”
    3. Go to the “Build” menu and click “Build Solution [F7].”
    4. Go to the “Debug” menu and click “Start Debugging [F5].”
    5. To run in Release mode, change the solution configuration by clicking on “Debug” in the drop-down menu.

Run with Xcode

  1. Extract L-1.zip into a folder of your choice.

  2. In the folder that contains CMakeLists.txt, run the following.

     > mkdir build
     > cd build

    Then run the following from the build folder.

     > cmake -G Xcode ..

    This will generate L-1.xcodeproj project that you can open with Xcode.

  3. Open L-1.xcodeproj with Xcode.

    1. Change the target by clicking on “ALL_BUILD” and selecting L-1.
    2. Edit the scheme by going to “Product” -> “Scheme” -> “Edit Scheme” to add command-line arguments (e.g., ../../resources).
    3. Press Command+B to build.
    4. Press Command+R to run.
    5. To run in release mode, edit the scheme again and go to the “info” tab.

Run with Makefile

  1. Extract L-1.zip into a folder of your choice.

  2. In the folder that contains CMakeLists.txt, run the following.

     > mkdir build
     > cd build

    Then run the following from the build folder.

     > cmake ..

    This will generate a Makefile that you can use to compile your code.

  3. To compile the code, run the generated Makefile.

     > make -j4

    The -j argument speeds up the compilation by multithreading the compiler. This will generate an executable, which you can run by typing

     > ./L-1

    You can add arguments to the line above as needed.

    To build in release mode, use ccmake .. and change CMAKE_BUILD_TYPE to Release. Press ‘c’ to configure then ‘g’ to generate. Now make -j4 will build in release mode.


Generated on Wed Feb 9 13:51:10 CST 2022