mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-22 21:43:40 +00:00
[client] egl: generate header file with #define for desktop shader
Instead of duplicating the #defines from the shader into the C code, this commit adds a custom CMake rule that exports all the #defines from a shader into a C header.
This commit is contained in:
parent
ba6f26393f
commit
e46cadb211
@ -32,3 +32,11 @@ function(make_object out_var)
|
||||
set(${out_var}_OBJS "${result}" PARENT_SCOPE)
|
||||
set(${out_var}_INCS "${result_h}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(make_defines in_file out_file)
|
||||
add_custom_command(OUTPUT ${out_file}
|
||||
COMMAND grep "^#define" "${in_file}" > "${out_file}"
|
||||
DEPENDS ${in_file}
|
||||
COMMENT "Creating #defines from ${in_file}"
|
||||
)
|
||||
endfunction()
|
||||
|
@ -34,6 +34,11 @@ make_object(
|
||||
shader/splash_logo.frag
|
||||
)
|
||||
|
||||
make_defines(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/shader/desktop_rgb.frag"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgh.def.h"
|
||||
)
|
||||
|
||||
add_library(renderer_EGL STATIC
|
||||
egl.c
|
||||
egldebug.c
|
||||
@ -48,6 +53,7 @@ add_library(renderer_EGL STATIC
|
||||
splash.c
|
||||
alert.c
|
||||
${EGL_SHADER_OBJS}
|
||||
"${EGL_SHADER_INCS}/desktop_rgh.def.h"
|
||||
)
|
||||
|
||||
target_link_libraries(renderer_EGL
|
||||
|
@ -33,9 +33,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
// these headers are auto generated by cmake
|
||||
#include "desktop.vert.h"
|
||||
#include "desktop_rgb.frag.h"
|
||||
|
||||
#define LG_SCALE_NEAREST 0
|
||||
#define LG_SCALE_LINEAR 1
|
||||
#include "desktop_rgh.def.h"
|
||||
|
||||
struct DesktopShader
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user