IMPORTANT! In this course, your project must be cross-platform. Follow these guidelines.
.cpp
and .h
files, always add them manually to the src
folder and rerun CMake. Do not use the “add” feature of your IDE to add files to your project.windows.h
)./
instead of \
).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.
rm -r *
from the build
folder to delete the cache.Download and install these programs.
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.
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
Extract L-1.zip
into a folder of your choice.
Run CMake (GUI).
CMakeLists.txt
file.There should now be a file called L-1.sln
in the build
folder. Double click it to open it with Visual Studio.
L-1
and select “Set as StartUp Project.”
L-1
and select “Properties.” Go to “Debugging” then “Command Arguments” and then type in the command line arguments (e.g., ../resources
). Click “OK.”
Extract L-1.zip
into a folder of your choice.
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.
Open L-1.xcodeproj
with Xcode.
L-1
.
../../resources
).
Extract L-1.zip
into a folder of your choice.
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.
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.