Migrated to cmake.

This commit is contained in:
2025-01-21 12:05:41 -07:00
parent f7acdb3f41
commit 56e10892c7
4 changed files with 28 additions and 4 deletions

2
.gitignore vendored
View File

@ -363,3 +363,5 @@ MigrationBackup/
FodyWeavers.xsd
log.txt
build/

View File

@ -68,7 +68,6 @@ unsigned int shaderProgram;
void GLAPIENTRY MessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userparam) {
if (type == GL_DEBUG_TYPE_ERROR) {
ERR("GL CALLBACK: ** GL ERROR ** type = {}, severity = {}, message = {}", type, severity, message);
__debugbreak();
} else {
DEBUG("GL CALLBACK: type = {}, severity = {}, message = {}", type, severity, message);
}
@ -83,7 +82,7 @@ void openGLContextInit() {
INFO("GLAD Initialized");
int flags; glGetIntegerv(GL_CONTEXT_FLAGS, &flags);
if (!(flags & GL_CONTEXT_FLAG_DEBUG_BIT)){
ERROR("Failed to create Debug Context");
ERR("Failed to create Debug Context");
}
glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
@ -209,7 +208,6 @@ int main() {
init();
std::thread renderThread(render);
Sleep(10);
update();
renderThread.join();

18
CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.10)
project(2dGameProject)
file(GLOB 2dGameProject_SRC
"2dGameProject/*.h"
"2dGameProject/*.cpp"
)
find_package(OpenGL REQUIRED)
add_subdirectory(deps/glfw)
add_subdirectory(deps/glad)
add_executable(2dGameProject ${2dGameProject_SRC})
target_include_directories(2dGameProject PUBLIC
"${PROJECT_SOURCE_DIR}/deps/glfw/include"
"${PROJECT_SOURCE_DIR}/deps/glad/include"
"${PROJECT_SOURCE_DIR}/deps/glm"
"${PROJECT_SOURCE_DIR}/deps/spdlog/include"
)
target_link_libraries(2dGameProject PUBLIC glfw glad ${OPENGL_LIBRARIES})

6
deps/glad/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,6 @@
cmake_minimum_required(VERSION 3.10)
project(glad)
add_library(glad src/glad.c)
target_include_directories(glad PUBLIC
"${PROJECT_SOURCE_DIR}/include"
)