mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[client] use cmake to generate renderers/fonts/clipboards headers/code
This is in preperation of cmake options to enable/disable various functionallity.
This commit is contained in:
parent
b524c077a4
commit
3e021f3a6b
@ -48,6 +48,7 @@ add_definitions(-D GL_GLEXT_PROTOTYPES)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${CMAKE_BINARY_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/../common
|
||||
${PKGCONFIG_INCLUDE_DIRS}
|
||||
${GMP_INCLUDE_DIR}
|
||||
@ -62,14 +63,13 @@ link_libraries(
|
||||
set(SOURCES
|
||||
src/main.c
|
||||
src/lg-renderer.c
|
||||
src/lg-fonts.c
|
||||
src/ll.c
|
||||
src/utils.c
|
||||
)
|
||||
|
||||
add_subdirectory(spice)
|
||||
add_subdirectory(renderers)
|
||||
add_subdirectory(clipboard)
|
||||
add_subdirectory(clipboards)
|
||||
add_subdirectory(fonts)
|
||||
add_subdirectory(decoders)
|
||||
|
||||
@ -78,6 +78,6 @@ target_compile_options(looking-glass-client PUBLIC ${PKGCONFIG_CFLAGS_OTHER})
|
||||
target_link_libraries(looking-glass-client
|
||||
spice
|
||||
renderers
|
||||
clipboard
|
||||
clipboards
|
||||
fonts
|
||||
)
|
||||
|
46
client/clipboards/CMakeLists.txt
Normal file
46
client/clipboards/CMakeLists.txt
Normal file
@ -0,0 +1,46 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(clipboards LANGUAGES C)
|
||||
|
||||
set(CLIPBOARD_H "${CMAKE_BINARY_DIR}/include/dynamic/clipboards.h")
|
||||
set(CLIPBOARD_C "${CMAKE_BINARY_DIR}/src/clipboards.c")
|
||||
|
||||
file(WRITE ${CLIPBOARD_H} "#include \"interface/clipboard.h\"\n\n")
|
||||
file(APPEND ${CLIPBOARD_H} "extern LG_Clipboard * LG_Clipboards[];\n\n")
|
||||
|
||||
file(WRITE ${CLIPBOARD_C} "#include \"interface/clipboard.h\"\n\n")
|
||||
file(APPEND ${CLIPBOARD_C} "#include <stddef.h>\n\n")
|
||||
|
||||
set(CLIPBOARDS)
|
||||
set(CLIPBOARDS_LINK)
|
||||
function(add_clipboard name)
|
||||
set(CLIPBOARDS "${CLIPBOARDS};${name}" PARENT_SCOPE)
|
||||
set(CLIPBOARDS_LINK "${CLIPBOARDS_LINK};clipboard_${name}" PARENT_SCOPE)
|
||||
add_subdirectory(${name})
|
||||
endfunction()
|
||||
|
||||
# Add/remove clipboards here!
|
||||
add_clipboard(X11)
|
||||
|
||||
list(REMOVE_AT CLIPBOARDS 0)
|
||||
list(REMOVE_AT CLIPBOARDS_LINK 0)
|
||||
|
||||
list(LENGTH CLIPBOARDS CLIPBOARD_COUNT)
|
||||
file(APPEND ${CLIPBOARD_H} "#define LG_CLIPBOARD_COUNT ${CLIPBOARD_COUNT}\n")
|
||||
|
||||
foreach(clipboard ${CLIPBOARDS})
|
||||
file(APPEND ${CLIPBOARD_C} "extern LG_Clipboard LGC_${clipboard};\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${CLIPBOARD_C} "\nconst LG_Clipboard * LG_Clipboards[] =\n{\n")
|
||||
foreach(clipboard ${CLIPBOARDS})
|
||||
file(APPEND ${CLIPBOARD_C} " &LGC_${clipboard},\n")
|
||||
endforeach()
|
||||
file(APPEND ${CLIPBOARD_C} " NULL\n};\n\n")
|
||||
|
||||
add_library(clipboards STATIC
|
||||
${CLIPBOARD_C}
|
||||
)
|
||||
|
||||
target_link_libraries(clipboards
|
||||
${CLIPBOARDS_LINK}
|
||||
)
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(clipboard LANGUAGES C)
|
||||
project(clipboard_X11 LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(CLIPBOARD_PKGCONFIG REQUIRED
|
||||
@ -7,15 +7,15 @@ pkg_check_modules(CLIPBOARD_PKGCONFIG REQUIRED
|
||||
xfixes
|
||||
)
|
||||
|
||||
add_library(clipboard STATIC
|
||||
add_library(clipboard_X11 STATIC
|
||||
src/x11.c
|
||||
)
|
||||
|
||||
target_link_libraries(clipboard
|
||||
target_link_libraries(clipboard_X11
|
||||
${CLIPBOARD_PKGCONFIG_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(clipboard
|
||||
target_include_directories(clipboard_X11
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
@ -1,25 +1,46 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(fonts LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(FONTS_PKGCONFIG REQUIRED
|
||||
SDL2_ttf
|
||||
fontconfig
|
||||
)
|
||||
set(FONT_H "${CMAKE_BINARY_DIR}/include/dynamic/fonts.h")
|
||||
set(FONT_C "${CMAKE_BINARY_DIR}/src/fonts.c")
|
||||
|
||||
file(WRITE ${FONT_H} "#include \"interface/font.h\"\n\n")
|
||||
file(APPEND ${FONT_H} "extern LG_Font * LG_Fonts[];\n\n")
|
||||
|
||||
file(WRITE ${FONT_C} "#include \"interface/font.h\"\n\n")
|
||||
file(APPEND ${FONT_C} "#include <stddef.h>\n\n")
|
||||
|
||||
set(FONTS)
|
||||
set(FONTS_LINK)
|
||||
function(add_font name)
|
||||
set(FONTS "${FONTS};${name}" PARENT_SCOPE)
|
||||
set(FONTS_LINK "${FONTS_LINK};font_${name}" PARENT_SCOPE)
|
||||
add_subdirectory(${name})
|
||||
endfunction()
|
||||
|
||||
# Add/remove fonts here!
|
||||
add_font(SDL)
|
||||
|
||||
list(REMOVE_AT FONTS 0)
|
||||
list(REMOVE_AT FONTS_LINK 0)
|
||||
|
||||
list(LENGTH FONTS FONT_COUNT)
|
||||
file(APPEND ${FONT_H} "#define LG_FONT_COUNT ${FONT_COUNT}\n")
|
||||
|
||||
foreach(font ${FONTS})
|
||||
file(APPEND ${FONT_C} "extern LG_Font LGF_${font};\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${FONT_C} "\nconst LG_Font * LG_Fonts[] =\n{\n")
|
||||
foreach(font ${FONTS})
|
||||
file(APPEND ${FONT_C} " &LGF_${font},\n")
|
||||
endforeach()
|
||||
file(APPEND ${FONT_C} " NULL\n};\n\n")
|
||||
|
||||
add_library(fonts STATIC
|
||||
src/sdl.c
|
||||
${FONT_C}
|
||||
)
|
||||
|
||||
target_link_libraries(fonts
|
||||
${FONTS_PKGCONFIG_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(fonts
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
src
|
||||
${FONTS_PKGCONFIG_INCLUDE_DIRS}
|
||||
${FONTS_LINK}
|
||||
)
|
||||
|
25
client/fonts/SDL/CMakeLists.txt
Normal file
25
client/fonts/SDL/CMakeLists.txt
Normal file
@ -0,0 +1,25 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(font_SDL LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(FONT_SDL_PKGCONFIG REQUIRED
|
||||
SDL2_ttf
|
||||
fontconfig
|
||||
)
|
||||
|
||||
add_library(font_SDL STATIC
|
||||
src/sdl.c
|
||||
)
|
||||
|
||||
target_link_libraries(font_SDL
|
||||
${FONT_SDL_PKGCONFIG_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(font_SDL
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
src
|
||||
${FONT_SDL_PKGCONFIG_INCLUDE_DIRS}
|
||||
)
|
@ -1,34 +0,0 @@
|
||||
/*
|
||||
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||
https://looking-glass.hostfission.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "interface/clipboard.h"
|
||||
|
||||
extern const LG_Clipboard LGC_X11;
|
||||
|
||||
const LG_Clipboard * LG_Clipboards[] =
|
||||
{
|
||||
&LGC_X11,
|
||||
NULL
|
||||
};
|
||||
|
||||
#define LG_CLIPBOARD_COUNT ((sizeof(LG_Clipboards) / sizeof(LG_Clipboard *)) - 1)
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||
https://looking-glass.hostfission.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "interface/font.h"
|
||||
|
||||
extern const LG_Font * LG_Fonts[];
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||
https://looking-glass.hostfission.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "interface/renderer.h"
|
||||
|
||||
extern const LG_Renderer LGR_EGL;
|
||||
extern const LG_Renderer LGR_OpenGL;
|
||||
|
||||
const LG_Renderer * LG_Renderers[] =
|
||||
{
|
||||
&LGR_EGL,
|
||||
&LGR_OpenGL,
|
||||
NULL // end of array sentinal
|
||||
};
|
||||
|
||||
#define LG_RENDERER_COUNT ((sizeof(LG_Renderers) / sizeof(LG_Renderer *)) - 1)
|
@ -1,11 +1,48 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(renderers LANGUAGES C)
|
||||
|
||||
add_subdirectory(opengl)
|
||||
add_subdirectory(egl)
|
||||
set(RENDERER_H "${CMAKE_BINARY_DIR}/include/dynamic/renderers.h")
|
||||
set(RENDERER_C "${CMAKE_BINARY_DIR}/src/renderers.c")
|
||||
|
||||
add_library(renderers INTERFACE)
|
||||
target_link_libraries(renderers INTERFACE
|
||||
renderer_opengl
|
||||
renderer_egl
|
||||
file(WRITE ${RENDERER_H} "#include \"interface/renderer.h\"\n\n")
|
||||
file(APPEND ${RENDERER_H} "extern LG_Renderer * LG_Renderers[];\n\n")
|
||||
|
||||
file(WRITE ${RENDERER_C} "#include \"interface/renderer.h\"\n\n")
|
||||
file(APPEND ${RENDERER_C} "#include <stddef.h>\n\n")
|
||||
|
||||
set(RENDERERS)
|
||||
set(RENDERERS_LINK)
|
||||
function(add_renderer name)
|
||||
set(RENDERERS "${RENDERERS};${name}" PARENT_SCOPE)
|
||||
set(RENDERERS_LINK "${RENDERERS_LINK};renderer_${name}" PARENT_SCOPE)
|
||||
add_subdirectory(${name})
|
||||
endfunction()
|
||||
|
||||
# Add/remove renderers here!
|
||||
add_renderer(EGL)
|
||||
add_renderer(OpenGL)
|
||||
|
||||
list(REMOVE_AT RENDERERS 0)
|
||||
list(REMOVE_AT RENDERERS_LINK 0)
|
||||
|
||||
list(LENGTH RENDERERS RENDERER_COUNT)
|
||||
file(APPEND ${RENDERER_H} "#define LG_RENDERER_COUNT ${RENDERER_COUNT}\n")
|
||||
|
||||
foreach(renderer ${RENDERERS})
|
||||
file(APPEND ${RENDERER_C} "extern LG_Renderer LGR_${renderer};\n")
|
||||
endforeach()
|
||||
|
||||
file(APPEND ${RENDERER_C} "\nconst LG_Renderer * LG_Renderers[] =\n{\n")
|
||||
foreach(renderer ${RENDERERS})
|
||||
file(APPEND ${RENDERER_C} " &LGR_${renderer},\n")
|
||||
endforeach()
|
||||
file(APPEND ${RENDERER_C} " NULL\n};")
|
||||
|
||||
|
||||
add_library(renderers STATIC
|
||||
${RENDERER_C}
|
||||
)
|
||||
|
||||
target_link_libraries(renderers
|
||||
${RENDERERS_LINK}
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(renderer_egl LANGUAGES C)
|
||||
project(renderer_EGL LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(RENDERER_EGL_PKGCONFIG REQUIRED
|
||||
@ -29,7 +29,7 @@ make_object(
|
||||
shader/splash_logo.frag
|
||||
)
|
||||
|
||||
add_library(renderer_egl STATIC
|
||||
add_library(renderer_EGL STATIC
|
||||
egl.c
|
||||
shader.c
|
||||
texture.c
|
||||
@ -43,11 +43,12 @@ add_library(renderer_egl STATIC
|
||||
${EGL_SHADER_OBJS}
|
||||
)
|
||||
|
||||
target_link_libraries(renderer_egl
|
||||
target_link_libraries(renderer_EGL
|
||||
${RENDERER_EGL_PKGCONFIG_LIBRARIES}
|
||||
fonts
|
||||
)
|
||||
|
||||
target_include_directories(renderer_egl
|
||||
target_include_directories(renderer_EGL
|
||||
PRIVATE
|
||||
src
|
||||
${EGL_SHADER_INCS}
|
@ -21,7 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lg-fonts.h"
|
||||
#include "interface/font.h"
|
||||
|
||||
typedef struct EGL_Alert EGL_Alert;
|
||||
|
@ -21,7 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include "debug.h"
|
||||
#include "utils.h"
|
||||
#include "lg-fonts.h"
|
||||
#include "dynamic/fonts.h"
|
||||
|
||||
#include <SDL2/SDL_syswm.h>
|
||||
#include <SDL2/SDL_egl.h>
|
@ -21,7 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lg-fonts.h"
|
||||
#include "interface/font.h"
|
||||
|
||||
typedef struct EGL_FPS EGL_FPS;
|
||||
|
@ -21,8 +21,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lg-fonts.h"
|
||||
|
||||
typedef struct EGL_Splash EGL_Splash;
|
||||
|
||||
bool egl_splash_init(EGL_Splash ** splash);
|
@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(renderer_opengl LANGUAGES C)
|
||||
project(renderer_Opengl LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(RENDERER_OPENGL_PKGCONFIG REQUIRED
|
||||
@ -7,16 +7,17 @@ pkg_check_modules(RENDERER_OPENGL_PKGCONFIG REQUIRED
|
||||
glu
|
||||
)
|
||||
|
||||
add_library(renderer_opengl STATIC
|
||||
add_library(renderer_OpenGL STATIC
|
||||
opengl.c
|
||||
)
|
||||
|
||||
target_link_libraries(renderer_opengl
|
||||
target_link_libraries(renderer_OpenGL
|
||||
${RENDERER_OPENGL_PKGCONFIG_LIBRARIES}
|
||||
decoders
|
||||
fonts
|
||||
)
|
||||
|
||||
target_include_directories(renderer_opengl
|
||||
target_include_directories(renderer_OpenGL
|
||||
PRIVATE
|
||||
src
|
||||
${RENDERER_OPENGL_PKGCONFIG_INCLUDE_DIRS}
|
@ -33,7 +33,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "debug.h"
|
||||
#include "utils.h"
|
||||
#include "lg-decoders.h"
|
||||
#include "lg-fonts.h"
|
||||
#include "dynamic/fonts.h"
|
||||
#include "ll.h"
|
||||
|
||||
#define BUFFER_COUNT 2
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
Looking Glass - KVM FrameRelay (KVMFR) Client
|
||||
Copyright (C) 2017-2019 Geoffrey McRae <geoff@hostfission.com>
|
||||
https://looking-glass.hostfission.com
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
Foundation; either version 2 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along with
|
||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lg-fonts.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
extern const LG_Font LGF_SDL;
|
||||
|
||||
const LG_Font * LG_Fonts[] =
|
||||
{
|
||||
&LGF_SDL,
|
||||
NULL // end of array sentinal
|
||||
};
|
||||
|
||||
#define LG_FONT_COUNT ((sizeof(LG_Fonts) / sizeof(LG_Font *)) - 1)
|
@ -42,8 +42,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "kb.h"
|
||||
#include "ll.h"
|
||||
|
||||
#include "lg-renderers.h"
|
||||
#include "lg-clipboards.h"
|
||||
#include "dynamic/renderers.h"
|
||||
#include "dynamic/clipboards.h"
|
||||
|
||||
struct AppState
|
||||
{
|
||||
@ -1097,7 +1097,7 @@ int run()
|
||||
1
|
||||
);
|
||||
|
||||
state.lgc = &LGC_X11;
|
||||
state.lgc = LG_Clipboards[0];
|
||||
}
|
||||
} else {
|
||||
DEBUG_ERROR("Could not get SDL window information %s", SDL_GetError());
|
||||
|
Loading…
Reference in New Issue
Block a user