Skip to content

Commit b9525e1

Browse files
committed
first commit to the main branch
0 parents  commit b9525e1

File tree

126 files changed

+10237
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+10237
-0
lines changed

.gitignore.txt

+461
Large diffs are not rendered by default.

.gitmodules

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[submodule "imgui"]
2+
path = external/imgui
3+
url = https://github.com/ocornut/imgui.git
4+
branch = docking
5+
[submodule "glfw"]
6+
path = external/glfw
7+
url = https://github.com/glfw/glfw.git
8+
branch = master
9+
[submodule "eigen"]
10+
path = external/eigen
11+
url = https://gitlab.com/libeigen/eigen.git
12+
branch = master
13+
[submodule "glew"]
14+
path = external/glew
15+
url = https://github.com/Perlmint/glew-cmake.git
16+
branch = master
17+
[submodule "glm"]
18+
path = external/glm
19+
url = https://github.com/g-truc/glm.git
20+
branch = master
21+
[submodule "imnodes"]
22+
path = external/imnodes
23+
url = https://github.com/Nelarius/imnodes.git
24+
branch = master
25+
[submodule "implot"]
26+
path = external/implot
27+
url = https://github.com/epezent/implot.git
28+
branch = master
29+
[submodule "imnotify"]
30+
path = external/imnotify
31+
url = https://github.com/patrickcjk/imgui-notify.git
32+
branch = v2

CMakeLists.txt

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
cmake_minimum_required(VERSION 2.8.12...3.24)
2+
3+
include("${CMAKE_SOURCE_DIR}/cmake/display_system_informations.cmake")
4+
include("${CMAKE_SOURCE_DIR}/cmake/display_project_informations.cmake")
5+
6+
set(CMAKE_CXX_STANDARD 20)
7+
set(CMAKE_CXX_STANDARD_REQUIRED True)
8+
9+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
10+
11+
project(
12+
"PROJECT"
13+
VERSION 1.0
14+
DESCRIPTION "A template project"
15+
HOMEPAGE_URL "")
16+
17+
configure_file(cmake/PROJECTConfigure.h.in PROJECTConfigure.h)
18+
19+
# internal targets
20+
option(PROJECT_WITH_EXECUTABLES "Compile main executables" ON)
21+
option(PROJECT_WITH_TESTS "Compile tests" ON)
22+
option(PROJECT_BUILD_DOC "Build documentation" ON)
23+
24+
# external dependencies
25+
option(PROJECT_CLONE_GLEW "Initialize glew from remote repository as git submodule" ON)
26+
option(PROJECT_CLONE_GLFW "Initialize glfw from remote repository as git submodule" ON)
27+
option(PROJECT_CLONE_GLM "Initialize glm from remote repository as git submodule" ON)
28+
option(PROJECT_CLONE_EIGEN "Initialize Eigen3 from remote repository as git submodule" ON)
29+
option(PROJECT_CLONE_IMGUI "Initialize imgui from remote repository as git submodule" ON)
30+
31+
display_system_informations()
32+
display_project_informations()
33+
34+
add_subdirectory(external)
35+
add_subdirectory(src)
36+
37+
if (PROJECT_WITH_EXECUTABLES)
38+
add_subdirectory (mains)
39+
endif ()
40+
41+
if (PROJECT_WITH_TESTS)
42+
enable_testing ()
43+
add_subdirectory (tests)
44+
endif ()
45+
46+
if (PROJECT_BUILD_DOC)
47+
add_subdirectory(doc)
48+
endif()
49+
50+
# Include CPack
51+
include(CPack)
52+
53+
# Set some CPack options
54+
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
55+
set(CPACK_PACKAGE_VENDOR "PROJECT_COMPANY")
56+
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "PROJECT Installer")
57+
set(CPACK_RESOURCE_FILE_LICENSE "LICENSE.md")
58+
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
59+
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
60+
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
61+
set(CPACK_GENERATOR "NSIS")

README.md

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Imgui - OpenGL - Linear algebra - CMake C++ template
2+
3+
![licence](https://img.shields.io/static/v1?label=Licence&message=MIT&color=yellow)
4+
![os support](https://img.shields.io/static/v1?label=Supports&message=Windows|Linux|MacOS&color=blue)
5+
![repo size](https://img.shields.io/github/repo-size/Hardcode3/Imgui-OpenGL-Linear-Algebra-starter)
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

Comments
 (0)