aux/ogl: Introduce a single small OpenGL library

This commit is contained in:
Jakob Bornecrantz 2019-10-09 16:39:38 +01:00
parent 420f25c7f7
commit e327d56bf4
12 changed files with 65 additions and 11 deletions

View file

@ -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})

View file

@ -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(

View file

@ -4,7 +4,7 @@
* @file
* @brief OpenGL API wrapper.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @ingroup comp_client
* @ingroup aux_ogl
*/
#include "glad/gl.c"

View file

@ -4,7 +4,7 @@
* @file
* @brief OpenGL API wrapper header.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @ingroup comp_client
* @ingroup aux_ogl
*/
#pragma once

View file

@ -0,0 +1,25 @@
// Copyright 2019, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Header with just documentation.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @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.
*/

View file

@ -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

View file

@ -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"

View file

@ -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',

View file

@ -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}
$<TARGET_OBJECTS:aux_os>
$<TARGET_OBJECTS:aux_ogl>
$<TARGET_OBJECTS:aux_util>
$<TARGET_OBJECTS:aux_math>
$<TARGET_OBJECTS:st_prober>

View file

@ -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,

View file

@ -32,6 +32,7 @@ add_library(${RUNTIME_TARGET} SHARED
${MANIFEST_PATH}
${SOURCE_FILES}
$<TARGET_OBJECTS:aux_os>
$<TARGET_OBJECTS:aux_ogl>
$<TARGET_OBJECTS:aux_util>
$<TARGET_OBJECTS:aux_math>
$<TARGET_OBJECTS:comp>

View file

@ -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,