0
I’m trying to develop a game in OpenGL
, but the IDE I use makes use of the CMake
and I’m not getting to set up the project. I’m totally lost. I searched several tutorials of Cmake on the internet, but they are very confusing and it seems that each one does it in a different way. I need help setting up Cmake as correctly as possible.
This is the structure of my project (I followed the idea that article)
├── CMakeLists.txt
├── libs
│ ├── GLEW
│ │ ├── include
│ │ │ └── GL
│ │ │ ├── eglew.h
│ │ │ ├── glew.h
│ │ │ ├── glxew.h
│ │ │ └── wglew.h
│ │ └── lib
│ │ └── libGLEW.a
│ ├── GLFW
│ │ ├── include
│ │ │ └── GLFW
│ │ │ ├── glfw3.h
│ │ │ └── glfw3native.h
│ │ └── lib
│ │ └── libglfw3.a
│ └── Logging
│ ├── include
│ │ └── Logging
│ │ └── Logger.hpp
│ └── src
│ └── Logger.cpp
└── src
└── main.cpp
That’s the main.cpp
#include <GLFW/glfw3.h>
#include <Logging/Logger.hpp>
int main(void)
{
Logger logger;
GLFWwindow* window;
/* Initialize the library */
if (!glfwInit())
return -1;
/* Create a windowed mode window and its OpenGL context */
window = glfwCreateWindow(640, 480, "Hello World", NULL, NULL);
if (!window)
{
logger.error("Failed to create a window");
glfwTerminate();
return -1;
}
/* Make the window's context current */
glfwMakeContextCurrent(window);
/* Loop until the user closes the window */
while (!glfwWindowShouldClose(window))
{
/* Render here */
glClear(GL_COLOR_BUFFER_BIT);
/* Swap front and back buffers */
glfwSwapBuffers(window);
/* Poll for and process events */
glfwPollEvents();
}
glfwTerminate();
return 0;
}
Please refer me to a well structured Cmake tutorial. I need to learn how to use it correctly.