diff --git a/cmake/util/util.cmake b/cmake/util/util.cmake index 0f91f21f60..312e269e37 100644 --- a/cmake/util/util.cmake +++ b/cmake/util/util.cmake @@ -82,4 +82,10 @@ endfunction() function(force_set name value type) set("${name}" "${value}" CACHE "${type}" "" FORCE) mark_as_advanced(FORCE "${name}") +endfunction() + +# Make Directory +function(set_and_mkdir name dir) + set("${name}" "${dir}" PARENT_SCOPE) + file(MAKE_DIRECTORY "${dir}") endfunction() \ No newline at end of file diff --git a/dependencies/imgui/glad/CMakeLists.txt b/dependencies/imgui/glad/CMakeLists.txt index 83edb0c87b..c652f470ca 100644 --- a/dependencies/imgui/glad/CMakeLists.txt +++ b/dependencies/imgui/glad/CMakeLists.txt @@ -1,13 +1,42 @@ project(imgui-glad) -# Setup GLAD -set(MESSAGE_QUIET TRUE) -add_subdirectory(src/cmake) -glad_add_library(glad SHARED REPRODUCIBLE QUIET API gl:compatibility=1.1) -set(MESSAGE_QUIET FALSE) +# Directories +set_and_mkdir(GLAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/glad") +set_and_mkdir(GLAD_SRC_DIR "${GLAD_DIR}/src") +set_and_mkdir(GLAD_INCLUDE_DIR "${GLAD_DIR}/include") -# Fix GL/gl.h -setup_header_dirs(glad "${CMAKE_CURRENT_SOURCE_DIR}/include") +# Files +set(GLAD_SOURCES + "${GLAD_INCLUDE_DIR}/KHR/khrplatform.h" + "${GLAD_INCLUDE_DIR}/glad/glad.h" + "${GLAD_SRC_DIR}/glad.c" +) + +# Find Python +find_package(Python REQUIRED QUIET) + +# Generate +add_custom_command( + OUTPUT ${GLAD_SOURCES} + COMMAND "${Python_EXECUTABLE}" + ARGS "-m" "glad" + "--out" "${GLAD_DIR}" + "--api" "gl=1.1" + "--generator" "c" + "--reproducible" + "--quiet" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src" + VERBATIM +) + +# Build +add_library(glad SHARED ${GLAD_SOURCES}) + +# Headers +setup_header_dirs(glad + "${GLAD_INCLUDE_DIR}" + "${CMAKE_CURRENT_SOURCE_DIR}/include" +) # Install setup_library(glad TRUE FALSE) \ No newline at end of file diff --git a/dependencies/imgui/glad/include/GL/gl.h b/dependencies/imgui/glad/include/GL/gl.h index 1b5350434b..ae1c4e16d5 100644 --- a/dependencies/imgui/glad/include/GL/gl.h +++ b/dependencies/imgui/glad/include/GL/gl.h @@ -1,2 +1,2 @@ #pragma once -#include \ No newline at end of file +#include \ No newline at end of file diff --git a/dependencies/imgui/glad/src b/dependencies/imgui/glad/src index f49229523c..e86f904573 160000 --- a/dependencies/imgui/glad/src +++ b/dependencies/imgui/glad/src @@ -1 +1 @@ -Subproject commit f49229523c58ad7698e941f7c51454e77dd9d6a8 +Subproject commit e86f90457371c6233053bacf0d6f486a51ddcd67 diff --git a/launcher/src/ui/frame.cpp b/launcher/src/ui/frame.cpp index e53b85e0df..3a96b6894e 100644 --- a/launcher/src/ui/frame.cpp +++ b/launcher/src/ui/frame.cpp @@ -18,7 +18,9 @@ Frame::Frame(const char *title, const int width, const int height) { window = create_glfw_window(title, width, height); // Load OpenGL - gladLoadGL(glfwGetProcAddress); + if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) { + ERR("Unable To Load GLAD"); + } // Disable V-Sync // (On Wayland, This Fixes Issues With The Clipboard) diff --git a/symbols/CMakeLists.txt b/symbols/CMakeLists.txt index 5f2ee4087a..14fb2a4b25 100644 --- a/symbols/CMakeLists.txt +++ b/symbols/CMakeLists.txt @@ -200,10 +200,6 @@ set(SRC ) # Directories -function(set_and_mkdir name dir) - set("${name}" "${dir}" PARENT_SCOPE) - file(MAKE_DIRECTORY "${dir}") -endfunction() set_and_mkdir(GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") set_and_mkdir(INCLUDE_OUTPUT_DIR "${GENERATED_DIR}/include") set_and_mkdir(HEADER_OUTPUT_DIR "${INCLUDE_OUTPUT_DIR}/symbols")