mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-25 06:53:40 +00:00
[client] project restructure part 1/2
This commit is contained in:
parent
7cbaf8b5be
commit
db398d41a0
BIN
c-host/looking-glass-host
Executable file
BIN
c-host/looking-glass-host
Executable file
Binary file not shown.
2
client/.gitignore
vendored
2
client/.gitignore
vendored
@ -1,3 +1,3 @@
|
||||
bin/
|
||||
.build/
|
||||
build/
|
||||
*.swp
|
||||
|
10
client/.vimrc
Normal file
10
client/.vimrc
Normal file
@ -0,0 +1,10 @@
|
||||
packadd termdebug
|
||||
|
||||
function Debug()
|
||||
!cd build && make
|
||||
if v:shell_error == 0
|
||||
TermdebugCommand build/looking-glass-client
|
||||
endif
|
||||
endfunction
|
||||
|
||||
command Debug call Debug()
|
@ -1,26 +1,39 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(looking-glass-client C)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
|
||||
|
||||
SET(CMAKE_C_FLAGS "-std=gnu99 -g -O3 -march=native -Wall -Werror -Wfatal-errors -ffast-math -fdata-sections -ffunction-sections")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--gc-sections")
|
||||
include(GNUInstallDirs)
|
||||
include(CheckCCompilerFlag)
|
||||
|
||||
option(OPTIMIZE_FOR_NATIVE "Build with -march=native" ON)
|
||||
if(OPTIMIZE_FOR_NATIVE)
|
||||
CHECK_C_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
if(COMPILER_SUPPORTS_MARCH_NATIVE)
|
||||
add_compile_options("-march=native")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_compile_options(
|
||||
"-Wall"
|
||||
"-Werror"
|
||||
"-Wfatal-errors"
|
||||
"-ffast-math"
|
||||
"-fdata-sections"
|
||||
"-ffunction-sections"
|
||||
"$<$<CONFIG:DEBUG>:-O0;-g3;-ggdb>"
|
||||
)
|
||||
set(CMAKE_EXE_LINKER FLAGS "-Wl,--gc-sections")
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PKGCONFIG REQUIRED
|
||||
sdl2
|
||||
SDL2_ttf
|
||||
gl
|
||||
glu
|
||||
egl
|
||||
spice-protocol
|
||||
fontconfig
|
||||
x11
|
||||
xfixes
|
||||
wayland-egl
|
||||
libconfig
|
||||
nettle
|
||||
hogweed
|
||||
)
|
||||
|
||||
execute_process(
|
||||
@ -33,12 +46,11 @@ execute_process(
|
||||
find_package(GMP)
|
||||
|
||||
add_definitions(-D BUILD_VERSION='"${BUILD_VERSION}"')
|
||||
add_definitions(-D USE_NETTLE)
|
||||
add_definitions(-D ATOMIC_LOCKING)
|
||||
add_definitions(-D GL_GLEXT_PROTOTYPES)
|
||||
|
||||
include_directories(
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/../common
|
||||
${PKGCONFIG_INCLUDE_DIRS}
|
||||
${GMP_INCLUDE_DIR}
|
||||
@ -51,29 +63,23 @@ link_libraries(
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
main.c
|
||||
lg-renderer.c
|
||||
lg-fonts.c
|
||||
ll.c
|
||||
utils.c
|
||||
spice/rsa.c
|
||||
spice/spice.c
|
||||
src/main.c
|
||||
src/lg-renderer.c
|
||||
src/lg-fonts.c
|
||||
src/ll.c
|
||||
src/utils.c
|
||||
clipboard/x11.c
|
||||
decoders/null.c
|
||||
decoders/yuv420.c
|
||||
renderers/opengl.c
|
||||
renderers/egl.c
|
||||
renderers/egl/shader.c
|
||||
renderers/egl/texture.c
|
||||
renderers/egl/model.c
|
||||
renderers/egl/desktop.c
|
||||
renderers/egl/cursor.c
|
||||
renderers/egl/fps.c
|
||||
renderers/egl/draw.c
|
||||
renderers/egl/splash.c
|
||||
renderers/egl/alert.c
|
||||
fonts/sdl.c
|
||||
)
|
||||
|
||||
add_subdirectory(spice)
|
||||
add_subdirectory(renderers)
|
||||
|
||||
add_executable(looking-glass-client ${SOURCES})
|
||||
target_compile_options(looking-glass-client PUBLIC ${PKGCONFIG_CFLAGS_OTHER})
|
||||
target_link_libraries(looking-glass-client
|
||||
spice
|
||||
renderers
|
||||
)
|
||||
|
@ -17,7 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lg-clipboard.h"
|
||||
#include "interface/clipboard.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
|
@ -17,7 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lg-decoder.h"
|
||||
#include "interface/decoder.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "memcpySSE.h"
|
||||
|
@ -17,7 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lg-decoder.h"
|
||||
#include "interface/decoder.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "memcpySSE.h"
|
||||
|
@ -20,7 +20,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lg-font.h"
|
||||
#include "interface/font.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include <SDL2/SDL_ttf.h>
|
||||
|
@ -19,7 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "lg-renderer.h"
|
||||
#include "renderer.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
@ -21,7 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lg-clipboard.h"
|
||||
#include "interface/clipboard.h"
|
||||
|
||||
extern const LG_Clipboard LGC_X11;
|
||||
|
@ -18,7 +18,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "lg-decoder.h"
|
||||
#include "interface/decoder.h"
|
||||
|
||||
extern const LG_Decoder LGD_NULL;
|
||||
extern const LG_Decoder LGD_YUV420;
|
@ -18,6 +18,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "lg-font.h"
|
||||
#include "interface/font.h"
|
||||
|
||||
extern const LG_Font * LG_Fonts[];
|
@ -18,7 +18,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "lg-renderer.h"
|
||||
#include "interface/renderer.h"
|
||||
|
||||
extern const LG_Renderer LGR_EGL;
|
||||
extern const LG_Renderer LGR_OpenGL;
|
11
client/renderers/CMakeLists.txt
Normal file
11
client/renderers/CMakeLists.txt
Normal file
@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(renderers LANGUAGES C)
|
||||
|
||||
add_subdirectory(opengl)
|
||||
add_subdirectory(egl)
|
||||
|
||||
add_library(renderers INTERFACE)
|
||||
target_link_libraries(renderers INTERFACE
|
||||
renderer_opengl
|
||||
renderer_egl
|
||||
)
|
31
client/renderers/egl/CMakeLists.txt
Normal file
31
client/renderers/egl/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
project(renderer_egl LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(RENDERER_EGL_PKGCONFIG REQUIRED
|
||||
egl
|
||||
wayland-egl
|
||||
)
|
||||
|
||||
add_library(renderer_egl STATIC
|
||||
egl.c
|
||||
shader.c
|
||||
texture.c
|
||||
model.c
|
||||
desktop.c
|
||||
cursor.c
|
||||
fps.c
|
||||
draw.c
|
||||
splash.c
|
||||
alert.c
|
||||
)
|
||||
|
||||
target_link_libraries(renderer_egl
|
||||
${RENDERER_EGL_PKGCONFIG_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(renderer_egl
|
||||
PRIVATE
|
||||
src
|
||||
${RENDERER_EGL_PKGCONFIG_INCLUDE_DIRS}
|
||||
)
|
@ -20,7 +20,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "lg-renderer.h"
|
||||
|
||||
#include "interface/renderer.h"
|
||||
|
||||
typedef struct EGL_Cursor EGL_Cursor;
|
||||
|
||||
|
@ -21,7 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lg-renderer.h"
|
||||
#include "interface/renderer.h"
|
||||
|
||||
typedef struct EGL_Desktop EGL_Desktop;
|
||||
|
||||
|
@ -17,7 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lg-renderer.h"
|
||||
#include "interface/renderer.h"
|
||||
|
||||
#include "debug.h"
|
||||
#include "utils.h"
|
||||
@ -30,13 +30,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <wayland-egl.h>
|
||||
#endif
|
||||
|
||||
#include "egl/model.h"
|
||||
#include "egl/shader.h"
|
||||
#include "egl/desktop.h"
|
||||
#include "egl/cursor.h"
|
||||
#include "egl/fps.h"
|
||||
#include "egl/splash.h"
|
||||
#include "egl/alert.h"
|
||||
#include "model.h"
|
||||
#include "shader.h"
|
||||
#include "desktop.h"
|
||||
#include "cursor.h"
|
||||
#include "fps.h"
|
||||
#include "splash.h"
|
||||
#include "alert.h"
|
||||
|
||||
#define SPLASH_FADE_TIME 1000000
|
||||
#define ALERT_TIMEOUT 2000000
|
22
client/renderers/opengl/CMakeLists.txt
Normal file
22
client/renderers/opengl/CMakeLists.txt
Normal file
@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
project(renderer_opengl LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(RENDERER_OPENGL_PKGCONFIG REQUIRED
|
||||
gl
|
||||
glu
|
||||
)
|
||||
|
||||
add_library(renderer_opengl STATIC
|
||||
opengl.c
|
||||
)
|
||||
|
||||
target_link_libraries(renderer_opengl
|
||||
${RENDERER_OPENGL_PKGCONFIG_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(renderer_opengl
|
||||
PRIVATE
|
||||
src
|
||||
${RENDERER_OPENGL_PKGCONFIG_INCLUDE_DIRS}
|
||||
)
|
@ -17,7 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lg-renderer.h"
|
||||
#include "interface/renderer.h"
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
29
client/spice/CMakeLists.txt
Normal file
29
client/spice/CMakeLists.txt
Normal file
@ -0,0 +1,29 @@
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
project(spice LANGUAGES C)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(SPICE_PKGCONFIG REQUIRED
|
||||
spice-protocol
|
||||
nettle
|
||||
hogweed
|
||||
)
|
||||
|
||||
add_definitions(-D USE_NETTLE)
|
||||
|
||||
add_library(spice STATIC
|
||||
src/spice.c
|
||||
src/rsa.c
|
||||
)
|
||||
|
||||
target_link_libraries(spice
|
||||
${SPICE_PKGCONFIG_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories(spice
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
PRIVATE
|
||||
src
|
||||
${SPICE_PKGCONFIG_INCLUDE_DIRS}
|
||||
)
|
1
client/spice/include/spice
Symbolic link
1
client/spice/include/spice
Symbolic link
@ -0,0 +1 @@
|
||||
.
|
@ -17,8 +17,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "lg-renderer.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
bool LG_RendererValidatorBool(const char * value)
|
Loading…
Reference in New Issue
Block a user