diff --git a/src/xrt/auxiliary/CMakeLists.txt b/src/xrt/auxiliary/CMakeLists.txt index e95e8a491..9168599f2 100644 --- a/src/xrt/auxiliary/CMakeLists.txt +++ b/src/xrt/auxiliary/CMakeLists.txt @@ -10,6 +10,12 @@ set(MATH_SOURCE_FILES math/m_quatexpmap.cpp ) +set(OGL_SOURCE_FILES + ogl/ogl_api.c + ogl/ogl_api.h + ogl/ogl_documentation.h + ) + set(OS_SOURCE_FILES os/os_documentation.h os/os_hid.h @@ -63,6 +69,15 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) +# OpenGL library. +# Use OBJECT to not create a archive, since it just gets in the way. +add_library(aux_ogl OBJECT ${OGL_SOURCE_FILES}) +set_property(TARGET aux_ogl PROPERTY POSITION_INDEPENDENT_CODE ON) +target_include_directories(aux_ogl SYSTEM + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../../external + ) + # Util library. # Use OBJECT to not create a archive, since it just gets in the way. add_library(aux_util OBJECT ${UTIL_SOURCE_FILES}) diff --git a/src/xrt/auxiliary/meson.build b/src/xrt/auxiliary/meson.build index 2c4fba5d7..fadffc0b3 100644 --- a/src/xrt/auxiliary/meson.build +++ b/src/xrt/auxiliary/meson.build @@ -38,6 +38,24 @@ aux_util = declare_dependency( link_whole: lib_aux_util, ) +lib_aux_ogl = static_library( + 'aux_ogl', + files( + 'ogl/ogl_api.h', + 'ogl/ogl_api.c', + 'ogl/ogl_documentation.h', + ), + include_directories: [ + xrt_include, + external_include, + ], +) + +aux_ogl = declare_dependency( + include_directories: aux_include, + link_whole: lib_aux_ogl, +) + lib_aux_os = static_library( 'aux_os', files( diff --git a/src/xrt/compositor/client/comp_gl_api.c b/src/xrt/auxiliary/ogl/ogl_api.c similarity index 88% rename from src/xrt/compositor/client/comp_gl_api.c rename to src/xrt/auxiliary/ogl/ogl_api.c index 62f2fef4e..ba7a9e980 100644 --- a/src/xrt/compositor/client/comp_gl_api.c +++ b/src/xrt/auxiliary/ogl/ogl_api.c @@ -4,7 +4,7 @@ * @file * @brief OpenGL API wrapper. * @author Jakob Bornecrantz - * @ingroup comp_client + * @ingroup aux_ogl */ #include "glad/gl.c" diff --git a/src/xrt/compositor/client/comp_gl_api.h b/src/xrt/auxiliary/ogl/ogl_api.h similarity index 89% rename from src/xrt/compositor/client/comp_gl_api.h rename to src/xrt/auxiliary/ogl/ogl_api.h index 6a6b9b091..a56509f24 100644 --- a/src/xrt/compositor/client/comp_gl_api.h +++ b/src/xrt/auxiliary/ogl/ogl_api.h @@ -4,7 +4,7 @@ * @file * @brief OpenGL API wrapper header. * @author Jakob Bornecrantz - * @ingroup comp_client + * @ingroup aux_ogl */ #pragma once diff --git a/src/xrt/auxiliary/ogl/ogl_documentation.h b/src/xrt/auxiliary/ogl/ogl_documentation.h new file mode 100644 index 000000000..80abd6676 --- /dev/null +++ b/src/xrt/auxiliary/ogl/ogl_documentation.h @@ -0,0 +1,25 @@ +// Copyright 2019, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief Header with just documentation. + * @author Jakob Bornecrantz + * @ingroup aux_ogl + */ + +#pragma once + + +/*! + * @defgroup aux_ogl OpenGL bindings + * @ingroup aux + * + * @brief OpenGL bindings helper library. + */ + +/*! + * @dir auxiliary/ogl + * @ingroup aux + * + * @brief OpenGL bindings helper library. + */ diff --git a/src/xrt/compositor/CMakeLists.txt b/src/xrt/compositor/CMakeLists.txt index e13640bb0..5e7f85e04 100644 --- a/src/xrt/compositor/CMakeLists.txt +++ b/src/xrt/compositor/CMakeLists.txt @@ -10,8 +10,6 @@ spirv_shaders(SHADER_HEADERS set(GL_SOURCE_FILES ${SHADER_HEADERS} - client/comp_gl_api.c - client/comp_gl_api.h client/comp_gl_client.c client/comp_gl_client.h client/comp_vk_client.c diff --git a/src/xrt/compositor/client/comp_gl_client.c b/src/xrt/compositor/client/comp_gl_client.c index 01d1b7884..e5a35a774 100644 --- a/src/xrt/compositor/client/comp_gl_client.c +++ b/src/xrt/compositor/client/comp_gl_client.c @@ -13,7 +13,7 @@ #include "util/u_misc.h" -#include "client/comp_gl_api.h" +#include "ogl/ogl_api.h" #include "client/comp_gl_client.h" diff --git a/src/xrt/compositor/meson.build b/src/xrt/compositor/meson.build index 9a7eab74d..7e2a78fcb 100644 --- a/src/xrt/compositor/meson.build +++ b/src/xrt/compositor/meson.build @@ -6,8 +6,6 @@ subdir('shaders') compositor_deps = [aux, shaders, vulkan] compositor_srcs = [ - 'client/comp_gl_api.c', - 'client/comp_gl_api.h', 'client/comp_gl_client.c', 'client/comp_gl_client.h', 'client/comp_vk_client.c', diff --git a/src/xrt/targets/gui/CMakeLists.txt b/src/xrt/targets/gui/CMakeLists.txt index 4f101e609..19a742db1 100644 --- a/src/xrt/targets/gui/CMakeLists.txt +++ b/src/xrt/targets/gui/CMakeLists.txt @@ -27,8 +27,6 @@ set(SOURCE_FILES gui_sdl2_imgui.c gui_sdl2_main.c gui_sdl2_prober.c - ../../../external/glad/gl.h - ../../../external/glad/gl.c ../../../external/imgui/cimgui.cpp ../../../external/imgui/cimgui.h ../../../external/imgui/imconfig.h @@ -50,6 +48,7 @@ set(SOURCE_FILES add_executable(gui ${SOURCE_FILES} $ + $ $ $ $ diff --git a/src/xrt/targets/gui/meson.build b/src/xrt/targets/gui/meson.build index 833f0acd0..a3e215aa5 100644 --- a/src/xrt/targets/gui/meson.build +++ b/src/xrt/targets/gui/meson.build @@ -29,8 +29,6 @@ gui = executable( 'gui_sdl2_imgui.c', 'gui_sdl2_main.c', 'gui_sdl2_prober.c', - '../../../external/glad/gl.h', - '../../../external/glad/gl.c', '../../../external/imgui/cimgui.cpp', '../../../external/imgui/cimgui.h', '../../../external/imgui/imconfig.h', @@ -50,6 +48,7 @@ gui = executable( ), link_whole: [ lib_aux_os, + lib_aux_ogl, lib_aux_util, lib_aux_math, lib_st_prober, diff --git a/src/xrt/targets/openxr/CMakeLists.txt b/src/xrt/targets/openxr/CMakeLists.txt index 4527ed8cd..953eb0dfc 100644 --- a/src/xrt/targets/openxr/CMakeLists.txt +++ b/src/xrt/targets/openxr/CMakeLists.txt @@ -32,6 +32,7 @@ add_library(${RUNTIME_TARGET} SHARED ${MANIFEST_PATH} ${SOURCE_FILES} $ + $ $ $ $ diff --git a/src/xrt/targets/openxr/meson.build b/src/xrt/targets/openxr/meson.build index 9b784d889..c646e3bb6 100644 --- a/src/xrt/targets/openxr/meson.build +++ b/src/xrt/targets/openxr/meson.build @@ -21,6 +21,7 @@ openxr = library( files('target.c'), link_whole: [ lib_aux_os, + lib_aux_ogl, lib_aux_util, lib_aux_math, lib_comp,