Clone and initialize the repository (you can do it via Git or using GitHub Desktop):
git clone --recurse-submodules -j8 https://github.com/upf-gti/ACGFrameworkStudent.git
The framework provided is compatible with all operating systems. The steps for each platform are mandatory to be able to build the framework. The mandatory C++ IDEs are the following:
- MS Visual Studio Community (Windows)
- XCode (Mac)
- Visual Studio Code (Linux, optional for other platforms)
Detailed installation information can be seen below.
MS Visual Studio Community can be downloaded from here. Make sure you select "Desktop Development with C++".
In addition you need to install CMake which can be downloaded from here. Select "Windows x64 Installer" for the last version. Remember to set "Add CMake to PATH" when asked while installing, otherwhise you won't be able to call CMake from the terminal.
Once you have all required open a Windows Terminal, go to the project folder and do this steps:
mkdir build
cd build
cmake ..
This will generate a Visual Studio project inside the folder build/
(.sln) that you can use to compile and debug the framework.
Caution
CMake: The C Compiler is not able to compile a simple test program
This may happens because the path of the project is too long. Try to clone the project in a less deep directory and build again. If the error persist, open the file CMakeLists.txt and add the following code in the second line of the file:
set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY")
You need XCode installed in your system (you may need to update MacOS version), Homebrew to install the missing libraries and also CMake.
To install Homebrew open a terminal and run this command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Continue by installing cmake using this command:
brew install cmake
Once you have all required open a MacOS Terminal, go to the project folder and do this steps:
mkdir build && cd build
cmake -G "Xcode" ..
This will generate a XCode project inside the folder build/
that you can use to compile and debug the framework.
Lastly, it is likely to fail to compile because of XCode. You need to change the path to the assets from "res/meshes/sphere.obj"
to "../../res/meshes/sphere.obj"
.
If this process leads to cmake errors, 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 ..
Install cmake and needed libraries using this command:
sudo apt install cmake
sudo apt install build-essential
sudo apt install -y libglu1-mesa-dev freeglut3-dev mesa-common-dev libgl1-mesa-dev
Once you have all required open a Linux Terminal, go to the project folder and do this steps:
mkdir build && cd build
cmake ..
This will generate a Makefile inside the folder build/
that you can use to compile framework.
Use make
to compile. You can speed-up compilation using more threads with -j(num threads)
, for example: make -j8
.
After installing all the libs for your platform, if you need a more light weight IDEs which can be used in any platform (included Linux), this is your better option.
Visual Studio Code can be downloaded for each platform here.
After the 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
Check this link to learn how to debug the framework in Visual Studio Code.
First, open the project folder where the CMakeLists.txt is located, then open the CMake tab on the left, configure and build the project.