Skip to content

upf-gti/CGFrameworkStudent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Computer Graphics

Follow the instructions below to clone, configure, and build the project.

Clone and initialize the repository:

git clone --recurse-submodules -j8 https://github.com/upf-gti/CGFrameworkStudent.git

Once cloned, you can optionally work on your own repository.

The framework provided is compatible with all operating systems. Here are the steps for each platform:

  1. Windows
  2. Mac
  3. Linux

Windows

  1. Install MS Visual Studio Community
    → Select "Desktop Development with C++"
  2. Install CMake
    → Select "Windows x64 Installer" for the last version.
    → Enable "Add CMake to PATH" during installation (otherwise CMake won't work in the terminal)

Configure the project:

Open a Windows Terminal, go to the project folder, and run:

cd CGFrameworkStudent
mkdir build
cd build
cmake .. -DCMAKE_POLICY_VERSION_MINIMUM=3.12

Double click on the .sln VS project inside the build/ folder.

You are all set!

Remember you can optionally create your own repository.

Mac

  1. Install XCode (you may need to update MacOS version)
  2. Install Homebrew (to install the missing libraries). Open a terminal and run this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install CMake:
brew install cmake

Configure the project:

Open a MacOS Terminal, go to the project folder, and run:

cd CGFrameworkStudent
mkdir build && cd build
cmake -G "Xcode" ..

This will generate a XCode project inside the folder build/.

You are all set!

Remember you can optionally create your own repository.

How to solve errors in Mac build

If CMake fails, run this command an try again:

sudo xcode-select --reset

If the error says that it cannot find C/C++ compilers, find them using:

xcrun -find c++
xcrun -find cc

Then, try to build again (inside the build directory) specifying the paths:

cmake -D CMAKE_C_COMPILER="Path_of_C_compiler" -D CMAKE_CXX_COMPILER="Path_of_C++_compiler" -G Xcode ..

Linux

  1. Install CMake, libraries and compilers using these commands:
sudo apt install cmake
sudo apt install build-essential
sudo apt install -y libglu1-mesa-dev freeglut3-dev mesa-common-dev libgl1-mesa-dev

Configure the project:

Open a Linux Terminal, go to the project folder, and run:

cd CGFrameworkStudent
mkdir build && cd build
cmake ..

This will generate a Makefile inside the folder build/.

Use make to compile. You can speed-up compilation using more threads with -j(num threads), for example: make -j8.

Remember you can optionally create your own repository.

Visual Studio Code (Linux)

After installing all the libs for your platform, if you need a more light weight IDE which can be used in any platform (included Linux), this is your better option.

Visual Studio Code can be downloaded for each platform here.

NOTE: you must have a C/C++ compiler installed and added to the path before progressing with the installation.

Configuring VSCode

After VSCode and the requirements for each platform are installed (the steps for each platform are mandatory!), the following extensions are needed to work with C++ code:

C/C++
C/C++ Extension Pack
C/C++ Themes
Cmake Tools

Then, on VSCode, open the project folder where the CMakeLists.txt is located and the configuration of the project should start automatically. At this point you should be able to build and run the project using the VSCode interface.

If not, then open the CMake tab on the left of VSCode, and select the configure and build the project options.

Check this link to learn how to debug the framework in Visual Studio Code.

Creating your own repository

If you want to push your local copy to your own GitHub repo:

  1. Create an empty private repository on GitHub
  2. Open the terminal
  3. Go to the CGFrameworkStudent cloned repository folder:
  cd CGFrameworkStudent
  1. Point your local repo to your newly created GitHub repo:
  git remote set-url origin <your-repository-url.git>
  1. IMPORTANT: verify both "fetch" and "push" are pointing to your repository:
  git remote -v

  You should see:

  origin  <your-repository-url.git> (fetch)
  origin  <your-repository-url.git> (push)
  1. Update changes to the remote
  git push

About

C++ Framework for Computer Graphics Course at UPF

Topics

Resources

Stars

Watchers

Forks

Contributors 6