Skip to content

Commit

Permalink
Vendor glad library
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkewley committed Jan 7, 2025
1 parent 65d265a commit 812ef74
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 48 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.15)

project(osc VERSION 0.5.17 LANGUAGES CXX)
project(osc VERSION 0.5.17 LANGUAGES CXX C)


# -------------- gather user-facing build cache vars ---------------- #
Expand Down
19 changes: 10 additions & 9 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,6 @@ googletest
- Licensed under the BSD 3-Clause "New" or "Revised" License
- Copyright 2008, Google Inc.

glad
----

- https://github.com/Dav1dde/glad
- The `glad` code included in OpenSim Creator, generated via https://glad.dav1d.de/
is any of public domain, WTFPL, or CC0 license. The headers also contain code from
Khronos, which is Apache 2.0 licensed.
- Author: David Herberth <github@dav1d.de>

sdl
---

Expand Down Expand Up @@ -137,3 +128,13 @@ ImGuizmo
it to fix various application-specific issues (e.g. ability to reset the global context)
in a backwards-compatibility-breaking way. It was then subsequently refactored to match the
rest of the project.

glad
----

- https://github.com/Dav1dde/glad
- The `glad` code included in OpenSim Creator, generated via https://glad.dav1d.de/
is any of public domain, WTFPL, or CC0 license. The headers also contain code from
Khronos, which is Apache 2.0 licensed.
- The generated code was copied + pasted into OpenSim Creator's graphics backend
- Author: David Herberth <github@dav1d.de>
2 changes: 1 addition & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ The libraries are split into several targets. The intent of each is:
| Directory | Description | Depends on |
| - | - | - |
| `OpenSimCreator/` | Implements the OpenSim Creator UI by integrating [osim](https://github.com/ComputationalBiomechanicsLab/osim) against `oscar`. Also includes the demo tabs for testing/verification. | `oscar`, `oscar_demos`, `osim` |
| `oscar/` | Core engine for creating scientific tooling UIs | `glad`, `SDL3`, `nativefiledialog`, `imgui`, `implot`, `stb`, `lunasvg`, `tomlplusplus`, `unordered_dense` |
| `oscar/` | Core engine for creating scientific tooling UIs | `SDL3`, `nativefiledialog`, `imgui`, `implot`, `stb`, `lunasvg`, `tomlplusplus`, `unordered_dense` |
| `oscar_demos/` | Demos that uses the `oscar` API to provide something interesting/useful, such as implement https://learnopengl.com/ in terms of the `oscar` API | `oscar` |
5 changes: 3 additions & 2 deletions src/oscar/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ if (NOT ${OSC_EMSCRIPTEN})
# These libraries are either provided by emscripten later on, or aren't
# supported by the emscripten build (they're #ifdef'd out in `oscar`'s
# source code).
find_package(glad REQUIRED CONFIG)
find_package(SDL3 REQUIRED CONFIG)
find_package(nativefiledialog REQUIRED CONFIG)
endif()
Expand Down Expand Up @@ -114,6 +113,9 @@ add_library(oscar STATIC
Graphics/Materials/MeshPhongMaterial.cpp
Graphics/Materials/MeshPhongMaterial.h

Graphics/OpenGL/Detail/glad.c
Graphics/OpenGL/Detail/glad.h
Graphics/OpenGL/Detail/khrplatform.h
Graphics/OpenGL/CPUDataTypeOpenGLTraits.h
Graphics/OpenGL/CPUImageFormatOpenGLTraits.h
Graphics/OpenGL/DepthStencilRenderBufferFormatOpenGLTraits.h
Expand Down Expand Up @@ -663,7 +665,6 @@ target_include_directories(oscar PUBLIC
target_link_libraries(oscar PRIVATE
# these libraries are either provided by emscripten later on, or aren't
# supported by the emscripten build (they're #ifdef'd out)
$<$<NOT:$<BOOL:${OSC_EMSCRIPTEN}>>:glad>
$<$<NOT:$<BOOL:${OSC_EMSCRIPTEN}>>:SDL3::SDL3>
$<$<NOT:$<BOOL:${OSC_EMSCRIPTEN}>>:nativefiledialog>

Expand Down
2 changes: 1 addition & 1 deletion src/oscar/Graphics/GraphicsImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <oscar/Graphics/Mesh.h>
#include <oscar/Graphics/MeshFunctions.h>
#include <oscar/Graphics/MeshTopology.h>
#include <oscar/Graphics/OpenGL/Detail/glad.h>
#include <oscar/Graphics/OpenGL/CPUDataTypeOpenGLTraits.h>
#include <oscar/Graphics/OpenGL/CPUImageFormatOpenGLTraits.h>
#include <oscar/Graphics/OpenGL/DepthStencilRenderBufferFormatOpenGLHelpers.h>
Expand Down Expand Up @@ -89,7 +90,6 @@
#include <oscar/Utils/UID.h>

#include <ankerl/unordered_dense.h>
#include <glad/glad.h>
#include <SDL3/SDL_error.h>
#include <SDL3/SDL_opengl.h>
#include <SDL3/SDL_video.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,11 @@
Too many extensions
*/

#include <oscar/Graphics/OpenGL/Detail/glad.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glad/glad.h>

struct gladGLversionStruct GLVersion = { 0, 0 };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,8 @@ typedef void* (* GLADloadproc)(const char *name);
GLAPI struct gladGLversionStruct GLVersion;
GLAPI int gladLoadGLLoader(GLADloadproc);

#include <KHR/khrplatform.h>
#include <oscar/Graphics/OpenGL/Detail/khrplatform.h>

typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef unsigned int GLbitfield;
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions src/oscar/Graphics/OpenGL/Gl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <oscar/Graphics/OpenGL/Detail/glad.h>
#include <oscar/Maths/Mat3.h>
#include <oscar/Maths/Mat4.h>
#include <oscar/Maths/MatFunctions.h>
Expand All @@ -10,8 +11,6 @@
#include <oscar/Shims/Cpp20/bit.h>
#include <oscar/Utils/Concepts.h>

#include <glad/glad.h>

#include <concepts>
#include <cstddef>
#include <exception>
Expand Down
25 changes: 0 additions & 25 deletions third_party/glad/CMakeLists.txt

This file was deleted.

5 changes: 0 additions & 5 deletions third_party/glad/gladConfig.cmake.in

This file was deleted.

0 comments on commit 812ef74

Please sign in to comment.