Skip to content

Latest commit

 

History

History
77 lines (59 loc) · 4.14 KB

Getting Started.md

File metadata and controls

77 lines (59 loc) · 4.14 KB

Quick Start

Tech Setup1

We'll use the most-up-to-date tools to build/develop C++ projects:

  1. Install/Update Visual studio 2022 - Community Edition2 (make sure checkboxes at right panel are checked, especially 'MSVC' and 'Windows 10 SDK')

vs2022-installer-workloads

  1. Install/Update CMake (official site) (use the .msi, and make sure you install CMake after installing VS, not before),
  2. Install/Update Git (official site),
  3. Install/Update Powershell (Microsoft Store)
    • Needs VPN (in some countries 🤔)
    • Or from GitHub repo
  4. Add cmake and git to PATH environmental variable (for system, not for user), these are the default paths
    • C:\Program Files\CMake\bin (at top of the list),
    • C:\Program Files\Git\bin
  5. Add msbuild to PATH,
    • To find msbuild.exe: Open Visual Studio 2022 -> Tools menu -> Command Line -> Developer Command Prompt -> Run where msbuild -> copy the path3 and add it to PATH
    • This allows you to build any .sln from command-line (ex. powershell), so you don't have to open the solution (.sln) in VS in order to build the projects (especially if you do clone opensource projects a lot 😄)
  6. NOTES:
    • In some cases, after pwsh.exe is not recognized by cmd.. to verify, open cmd, type pwsh --version, if you got an error message, open windows start menu -> pwsh -> open file location -> copy the location and add it to PATH (see next step)
    • When changing PATH entries, you should restart open sessions (restart visual studio if opened, restart powershell if opened)

Build projects in this repo

Run the following commands in Powershell (one by one)

cd ~\desktop # go to desktop
mkdir opensource && cd opensource
git clone https://github.com/MuhammadSulaiman001/opengl-lab
cd opengl-lab\OpenGLab # move to .sln location
msbuild OpenGLab.sln # build the solution

Now, you can find the build output inside project folder (ex. LabDemos.exe can be found in LabDemos\x64\Debug\ folder)

Build projects in LearnOpenGL repo

cmake --version # verify cmake is installed
git --version # verify git is installed
cd ~\desktop\opensource
mkdir opensource && cd opensource
git clone https://github.com/JoeyDeVries/LearnOpenGL
cd LearnOpenGL
mkdir build && cd build # create/move to build directory
cmake .. # build the build system :)
msbuild LearnOpenGL.sln # It took 4 minutes on my device to build all the projects
cd ..\bin # move to output location
explorer . # open in windows explorer!
# now, you can check project's output, run .exe files

You can find .exe files in projects folders..

Great, you have built/run many opengl projects, without writing any C++ code (or opening visual studio at all).

Next:

  1. Get familiar with the build system and the IDE
  2. Learn C++
  3. Learn OpenGL
  4. Learn the basics of Git, Poweshell 7.x.x and CMake

Footnotes

  1. Please note that the following configuration is not opengl-specific!

  2. If you have some other C++ compiler installed (ex. MinGW, CLang, etc..) please uninstall them before installing VS (this will avoid you some CMake errors)

  3. There might be 2 paths, one for visual studio and one for .NetFramework, choose the visual studio one.