|
| 1 | +# Imgui - OpenGL - Linear algebra - CMake C++ template |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +A template project using [Imgui](external/imgui) as graphical user interface ([glfw](external/glfw), [glm](external/glm), [glew](external/glew) and [OpenGL](https://www.opengl.org/)), and [Eigen3](external/eigen) as linear algebra library. |
| 8 | +For more details about the Apach 2.0 licence, visit [tldrlegal.com](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)). |
| 9 | +For more details about the MIT licence, visit [tldrlegal.com](https://tldrlegal.com/license/mit-license) |
| 10 | + |
| 11 | +## Dependencies |
| 12 | + |
| 13 | +The code is build to run with the following libraries (included in the repository under [external](external/)): |
| 14 | + |
| 15 | +- [OpenGL](https://www.opengl.org/) (specification) |
| 16 | +- [GLEW](https://glew.sourceforge.net/) (included) |
| 17 | +- [GLFW](https://www.glfw.org/) (included) |
| 18 | +- [GLM](https://github.com/g-truc/glm) (included) |
| 19 | +- [ImGui](https://github.com/ocornut/imgui) (included) |
| 20 | +- [Eigen](https://eigen.tuxfamily.org/index.php?title=Main_Page) (included) |
| 21 | + |
| 22 | +## Structure |
| 23 | + |
| 24 | +An organized structure has been chosen for this template. |
| 25 | + |
| 26 | +- [cmake](cmake) contains a configure file to get the minor and major versions of the current project. |
| 27 | +- [external](external) code goes into external folder at the root of the project. |
| 28 | +- [include](include) gather every self written header file. |
| 29 | +- [mains](mains) contains the main executable i.e. cpp file that drives all the project. |
| 30 | +- [src](src) gather every self written cpp file of the project. |
| 31 | +- [tests](tests) uses CTests to use a test driven approach during the development of the project. |
| 32 | + |
| 33 | +## Cloning |
| 34 | + |
| 35 | +This repository contains submodules meaning that a recursive cloning can be done. |
| 36 | +To clone this repository, make sure you have git installed and clone the project into the chosen folder using |
| 37 | + |
| 38 | +```git bash |
| 39 | +git clone --recursive https://github.com/Hardcode3/Imgui_with_eigen_cmake_template.git |
| 40 | +``` |
| 41 | + |
| 42 | +If no recursive statement, cmake updated the module and clones it. |
| 43 | + |
| 44 | +## Configuring and generating |
| 45 | + |
| 46 | +The build steps has been tested and runs fine on: |
| 47 | + |
| 48 | +- Microsoft Windows 10, 11 |
| 49 | +- MacOSX |
| 50 | +- Linux Ubuntu |
| 51 | + |
| 52 | +### Configuration steps on Linux |
| 53 | + |
| 54 | +Configuration on Linux requires additional libraries: |
| 55 | +If required, run the following commands to install needed libraries (detailed in the cmake configuration and building process): |
| 56 | + |
| 57 | +```bash |
| 58 | +sudo apt-get update -y |
| 59 | +``` |
| 60 | + |
| 61 | +Install OpenGL if needed: |
| 62 | + |
| 63 | +```bash |
| 64 | +sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev |
| 65 | +``` |
| 66 | + |
| 67 | +```bash |
| 68 | +sudo apt-get install -y libxrandr-dev |
| 69 | +``` |
| 70 | + |
| 71 | +```bash |
| 72 | +sudo apt-get install -y libxinerama-dev |
| 73 | +``` |
| 74 | + |
| 75 | +```bash |
| 76 | +sudo apt-get install -y libxcursor-dev |
| 77 | +``` |
| 78 | + |
| 79 | +```bash |
| 80 | +sudo apt-get install -y libxi-dev |
| 81 | +``` |
| 82 | + |
| 83 | +### Configuration steps on macOS |
| 84 | + |
| 85 | +There is no additional configuration step on macOS. |
| 86 | + |
| 87 | +### Configuration steps on Windows |
| 88 | + |
| 89 | +There is no additional configuration step on Windows. |
| 90 | + |
| 91 | +### General configuration & build process |
| 92 | + |
| 93 | +Make sure you have CMake installed and inside the clone repo, type: |
| 94 | + |
| 95 | +```bash cmd terminal |
| 96 | +mkdir build |
| 97 | +cd build |
| 98 | +cmake .. |
| 99 | +cmake --build . |
| 100 | +``` |
| 101 | + |
| 102 | +Or use CMakeGui for this. |
| 103 | +For more details, check [cmake.org](https://cmake.org/) |
| 104 | + |
| 105 | +Generating the RUNTESTS executable (CTests) should output something like this if everything is well configured: |
| 106 | + |
| 107 | +```text |
| 108 | +1> Start 1: imgui_test |
| 109 | +1>1/4 Test #1: imgui_test ....................... Passed 0.67 sec |
| 110 | +1> Start 2: eigen_test |
| 111 | +1>2/4 Test #2: eigen_test ....................... Passed 0.02 sec |
| 112 | +1> Start 3: glew_glfw_test |
| 113 | +1>3/4 Test #3: glew_glfw_test ................... Passed 0.65 sec |
| 114 | +1> Start 4: glm_test |
| 115 | +1>4/4 Test #4: glm_test ......................... Passed 0.04 sec |
| 116 | +1> |
| 117 | +1>100% tests passed, 0 tests failed out of 4 |
| 118 | +1> |
| 119 | +1>Total Test time (real) = 1.38 sec |
| 120 | +``` |
0 commit comments