[all] cmake: standardize indentation to 2 spaces

This commit is contained in:
Quantum 2022-05-28 14:45:13 -04:00 committed by Geoffrey McRae
parent 0799910e70
commit a8521b821e
18 changed files with 381 additions and 382 deletions

View File

@ -4,13 +4,13 @@ project(looking-glass-client C CXX)
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE) get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR message(FATAL_ERROR
"\n" "\n"
"In-source builds are not supported\n" "In-source builds are not supported\n"
"See build instructions provided in: " "See build instructions provided in: "
"${PROJECT_TOP}/doc/build.rst\n" "${PROJECT_TOP}/doc/build.rst\n"
"Refusing to continue" "Refusing to continue"
) )
endif() endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/") list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/")
@ -101,52 +101,51 @@ add_definitions(-D ATOMIC_LOCKING)
add_definitions(-D GL_GLEXT_PROTOTYPES) add_definitions(-D GL_GLEXT_PROTOTYPES)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/version.c OUTPUT ${CMAKE_BINARY_DIR}/version.c
${CMAKE_BINARY_DIR}/_version.c ${CMAKE_BINARY_DIR}/_version.c
COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P
${PROJECT_TOP}/version.cmake ${PROJECT_TOP}/version.cmake
) )
include_directories( include_directories(
${PROJECT_TOP} ${PROJECT_TOP}
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/include
${PROJECT_TOP}/repos/nanosvg/src
${PROJECT_TOP}/repos/nanosvg/src
) )
link_libraries( link_libraries(
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
rt rt
m m
) )
set(SOURCES set(SOURCES
${CMAKE_BINARY_DIR}/version.c ${CMAKE_BINARY_DIR}/version.c
src/main.c src/main.c
src/core.c src/core.c
src/app.c src/app.c
src/audio.c src/audio.c
src/config.c src/config.c
src/keybind.c src/keybind.c
src/util.c src/util.c
src/clipboard.c src/clipboard.c
src/kb.c src/kb.c
src/gl_dynprocs.c src/gl_dynprocs.c
src/egl_dynprocs.c src/egl_dynprocs.c
src/eglutil.c src/eglutil.c
src/overlay_utils.c src/overlay_utils.c
src/render_queue.c src/render_queue.c
src/overlay/splash.c src/overlay/splash.c
src/overlay/alert.c src/overlay/alert.c
src/overlay/fps.c src/overlay/fps.c
src/overlay/graphs.c src/overlay/graphs.c
src/overlay/help.c src/overlay/help.c
src/overlay/config.c src/overlay/config.c
src/overlay/msg.c src/overlay/msg.c
src/overlay/status.c src/overlay/status.c
) )
# Force cimgui to build as a static library. # Force cimgui to build as a static library.
@ -166,29 +165,29 @@ add_executable(looking-glass-client ${SOURCES})
target_compile_definitions(looking-glass-client PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1) target_compile_definitions(looking-glass-client PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
target_link_libraries(looking-glass-client target_link_libraries(looking-glass-client
${EXE_FLAGS} ${EXE_FLAGS}
PkgConfig::FONTCONFIG PkgConfig::FONTCONFIG
lg_resources lg_resources
lg_common lg_common
displayservers displayservers
lgmp lgmp
purespice purespice
renderers renderers
cimgui cimgui
) )
if (ENABLE_PIPEWIRE OR ENABLE_PULSEAUDIO) if (ENABLE_PIPEWIRE OR ENABLE_PULSEAUDIO)
add_definitions(-D ENABLE_AUDIO) add_definitions(-D ENABLE_AUDIO)
add_subdirectory(audiodevs) add_subdirectory(audiodevs)
pkg_check_modules(SAMPLERATE REQUIRED IMPORTED_TARGET samplerate) pkg_check_modules(SAMPLERATE REQUIRED IMPORTED_TARGET samplerate)
target_link_libraries(looking-glass-client target_link_libraries(looking-glass-client
PkgConfig::SAMPLERATE PkgConfig::SAMPLERATE
audiodevs audiodevs
) )
endif() endif()
install(TARGETS looking-glass-client install(TARGETS looking-glass-client
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT binary) COMPONENT binary)
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)

View File

@ -3,19 +3,19 @@ project(audiodev_PipeWire LANGUAGES C)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(AUDIODEV_PipeWire REQUIRED IMPORTED_TARGET pkg_check_modules(AUDIODEV_PipeWire REQUIRED IMPORTED_TARGET
libpipewire-0.3 libpipewire-0.3
) )
add_library(audiodev_PipeWire STATIC add_library(audiodev_PipeWire STATIC
pipewire.c pipewire.c
) )
target_link_libraries(audiodev_PipeWire target_link_libraries(audiodev_PipeWire
PkgConfig::AUDIODEV_PipeWire PkgConfig::AUDIODEV_PipeWire
lg_common lg_common
) )
target_include_directories(audiodev_PipeWire target_include_directories(audiodev_PipeWire
PRIVATE PRIVATE
src src
) )

View File

@ -3,19 +3,19 @@ project(audiodev_PulseAudio LANGUAGES C)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(AUDIODEV_PulseAudio REQUIRED IMPORTED_TARGET pkg_check_modules(AUDIODEV_PulseAudio REQUIRED IMPORTED_TARGET
libpulse libpulse
) )
add_library(audiodev_PulseAudio STATIC add_library(audiodev_PulseAudio STATIC
pulseaudio.c pulseaudio.c
) )
target_link_libraries(audiodev_PulseAudio target_link_libraries(audiodev_PulseAudio
PkgConfig::AUDIODEV_PulseAudio PkgConfig::AUDIODEV_PulseAudio
lg_common lg_common
) )
target_include_directories(audiodev_PulseAudio target_include_directories(audiodev_PulseAudio
PRIVATE PRIVATE
src src
) )

View File

@ -3,99 +3,99 @@ project(displayserver_Wayland LANGUAGES C)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(DISPLAYSERVER_Wayland REQUIRED IMPORTED_TARGET pkg_check_modules(DISPLAYSERVER_Wayland REQUIRED IMPORTED_TARGET
wayland-client wayland-client
wayland-cursor wayland-cursor
xkbcommon xkbcommon
) )
set(DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES "") set(DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES "")
set(displayserver_Wayland_SHELL_SRC "") set(displayserver_Wayland_SHELL_SRC "")
if (ENABLE_LIBDECOR) if (ENABLE_LIBDECOR)
pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED IMPORTED_TARGET pkg_check_modules(DISPLAYSERVER_Wayland_LIBDECOR REQUIRED IMPORTED_TARGET
libdecor-0 libdecor-0
) )
list(APPEND DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES PkgConfig::DISPLAYSERVER_Wayland_LIBDECOR) list(APPEND DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES PkgConfig::DISPLAYSERVER_Wayland_LIBDECOR)
list(APPEND displayserver_Wayland_SHELL_SRC shell_libdecor.c) list(APPEND displayserver_Wayland_SHELL_SRC shell_libdecor.c)
add_compile_definitions(ENABLE_LIBDECOR) add_compile_definitions(ENABLE_LIBDECOR)
else() else()
list(APPEND displayserver_Wayland_SHELL_SRC shell_xdg.c) list(APPEND displayserver_Wayland_SHELL_SRC shell_xdg.c)
endif() endif()
add_library(displayserver_Wayland STATIC add_library(displayserver_Wayland STATIC
activation.c activation.c
clipboard.c clipboard.c
cursor.c cursor.c
gl.c gl.c
idle.c idle.c
input.c input.c
output.c output.c
poll.c poll.c
presentation.c presentation.c
state.c state.c
registry.c registry.c
wayland.c wayland.c
window.c window.c
${displayserver_Wayland_SHELL_SRC} ${displayserver_Wayland_SHELL_SRC}
) )
target_link_libraries(displayserver_Wayland target_link_libraries(displayserver_Wayland
PkgConfig::DISPLAYSERVER_Wayland PkgConfig::DISPLAYSERVER_Wayland
${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES} ${DISPLAYSERVER_Wayland_OPT_PKGCONFIG_LIBRARIES}
lg_common lg_common
) )
target_include_directories(displayserver_Wayland target_include_directories(displayserver_Wayland
PRIVATE PRIVATE
src src
) )
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner) find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
macro(wayland_generate protocol_file output_file) macro(wayland_generate protocol_file output_file)
add_custom_command(OUTPUT "${output_file}.h" add_custom_command(OUTPUT "${output_file}.h"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_file}" "${output_file}.h" COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" client-header "${protocol_file}" "${output_file}.h"
DEPENDS "${protocol_file}" DEPENDS "${protocol_file}"
VERBATIM) VERBATIM)
add_custom_command(OUTPUT "${output_file}.c" add_custom_command(OUTPUT "${output_file}.c"
COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_file}" "${output_file}.c" COMMAND "${WAYLAND_SCANNER_EXECUTABLE}" private-code "${protocol_file}" "${output_file}.c"
DEPENDS "${protocol_file}" DEPENDS "${protocol_file}"
VERBATIM) VERBATIM)
target_sources(displayserver_Wayland PRIVATE "${output_file}.h" "${output_file}.c") target_sources(displayserver_Wayland PRIVATE "${output_file}.h" "${output_file}.c")
endmacro() endmacro()
set(WAYLAND_PROTOCOLS_BASE "${PROJECT_TOP}/repos/wayland-protocols") set(WAYLAND_PROTOCOLS_BASE "${PROJECT_TOP}/repos/wayland-protocols")
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/wayland") file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/wayland")
include_directories("${CMAKE_BINARY_DIR}/wayland") include_directories("${CMAKE_BINARY_DIR}/wayland")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml" "${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-xdg-shell-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-xdg-shell-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/stable/presentation-time/presentation-time.xml" "${WAYLAND_PROTOCOLS_BASE}/stable/presentation-time/presentation-time.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-presentation-time-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-presentation-time-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml" "${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-viewporter-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-viewporter-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" "${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-xdg-decoration-unstable-v1-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-xdg-decoration-unstable-v1-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml" "${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-relative-pointer-unstable-v1-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-relative-pointer-unstable-v1-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml" "${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-pointer-constraints-unstable-v1-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-pointer-constraints-unstable-v1-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml" "${WAYLAND_PROTOCOLS_BASE}/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-keyboard-shortcuts-inhibit-unstable-v1-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-keyboard-shortcuts-inhibit-unstable-v1-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml" "${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-idle-inhibit-unstable-v1-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-idle-inhibit-unstable-v1-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-output/xdg-output-unstable-v1.xml" "${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-output/xdg-output-unstable-v1.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-xdg-output-unstable-v1-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-xdg-output-unstable-v1-client-protocol")
wayland_generate( wayland_generate(
"${WAYLAND_PROTOCOLS_BASE}/staging/xdg-activation/xdg-activation-v1.xml" "${WAYLAND_PROTOCOLS_BASE}/staging/xdg-activation/xdg-activation-v1.xml"
"${CMAKE_BINARY_DIR}/wayland/wayland-xdg-activation-v1-client-protocol") "${CMAKE_BINARY_DIR}/wayland/wayland-xdg-activation-v1-client-protocol")

View File

@ -3,29 +3,29 @@ project(displayserver_X11 LANGUAGES C)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(DISPLAYSERVER_X11 REQUIRED IMPORTED_TARGET pkg_check_modules(DISPLAYSERVER_X11 REQUIRED IMPORTED_TARGET
x11 x11
xi xi
xfixes xfixes
xscrnsaver xscrnsaver
xinerama xinerama
xcursor xcursor
xpresent xpresent
) )
add_library(displayserver_X11 STATIC add_library(displayserver_X11 STATIC
x11.c x11.c
atoms.c atoms.c
clipboard.c clipboard.c
) )
add_definitions(-D GLX_GLXEXT_PROTOTYPES) add_definitions(-D GLX_GLXEXT_PROTOTYPES)
target_link_libraries(displayserver_X11 target_link_libraries(displayserver_X11
PkgConfig::DISPLAYSERVER_X11 PkgConfig::DISPLAYSERVER_X11
lg_common lg_common
) )
target_include_directories(displayserver_X11 target_include_directories(displayserver_X11
PRIVATE PRIVATE
src src
) )

View File

@ -3,114 +3,114 @@ project(renderer_EGL LANGUAGES C CXX)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(RENDERER_EGL REQUIRED IMPORTED_TARGET pkg_check_modules(RENDERER_EGL REQUIRED IMPORTED_TARGET
egl egl
gl gl
) )
pkg_check_modules(RENDERER_EGL_OPT IMPORTED_TARGET pkg_check_modules(RENDERER_EGL_OPT IMPORTED_TARGET
wayland-egl wayland-egl
) )
find_program(AWK NAMES gawk mawk original-awk awk) find_program(AWK NAMES gawk mawk original-awk awk)
if(AWK MATCHES ".+-NOTFOUND") if(AWK MATCHES ".+-NOTFOUND")
message(FATAL_ERROR "FATAL: some known version of awk couldn't be found (${AWK}).") message(FATAL_ERROR "FATAL: some known version of awk couldn't be found (${AWK}).")
else() else()
message(STATUS "Using awk: ${AWK}") message(STATUS "Using awk: ${AWK}")
endif() endif()
include(MakeObject) include(MakeObject)
function(build_shaders header_dir) function(build_shaders header_dir)
file(GLOB headers "${header_dir}/*.h") file(GLOB headers "${header_dir}/*.h")
set(EGL_SHADER_PROCESSED) set(EGL_SHADER_PROCESSED)
foreach(shader ${ARGN}) foreach(shader ${ARGN})
set(out_f "${CMAKE_CURRENT_BINARY_DIR}/${shader}") set(out_f "${CMAKE_CURRENT_BINARY_DIR}/${shader}")
add_custom_command(OUTPUT "${out_f}" add_custom_command(OUTPUT "${out_f}"
COMMAND "${AWK}" -f "${CMAKE_CURRENT_SOURCE_DIR}/glsl.include.awk" COMMAND "${AWK}" -f "${CMAKE_CURRENT_SOURCE_DIR}/glsl.include.awk"
"${CMAKE_CURRENT_SOURCE_DIR}/${shader}" > "${out_f}" "${CMAKE_CURRENT_SOURCE_DIR}/${shader}" > "${out_f}"
MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${shader}" MAIN_DEPENDENCY "${CMAKE_CURRENT_SOURCE_DIR}/${shader}"
DEPENDS ${headers} DEPENDS ${headers}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/shader" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/shader"
COMMENT "Preprocessing shader ${shader}" COMMENT "Preprocessing shader ${shader}"
VERBATIM VERBATIM
) )
endforeach() endforeach()
set(CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}") set(CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}")
make_object( make_object(
EGL_SHADER EGL_SHADER
${ARGN} ${ARGN}
) )
set(EGL_SHADER_OBJS "${EGL_SHADER_OBJS}" PARENT_SCOPE) set(EGL_SHADER_OBJS "${EGL_SHADER_OBJS}" PARENT_SCOPE)
set(EGL_SHADER_INCS "${EGL_SHADER_INCS}" PARENT_SCOPE) set(EGL_SHADER_INCS "${EGL_SHADER_INCS}" PARENT_SCOPE)
endfunction() endfunction()
build_shaders( build_shaders(
shader shader
shader/desktop.vert shader/desktop.vert
shader/desktop_rgb.frag shader/desktop_rgb.frag
shader/cursor.vert shader/cursor.vert
shader/cursor_rgb.frag shader/cursor_rgb.frag
shader/cursor_mono.frag shader/cursor_mono.frag
shader/damage.vert shader/damage.vert
shader/damage.frag shader/damage.frag
shader/basic.vert shader/basic.vert
shader/ffx_cas.frag shader/ffx_cas.frag
shader/ffx_fsr1_easu.frag shader/ffx_fsr1_easu.frag
shader/ffx_fsr1_rcas.frag shader/ffx_fsr1_rcas.frag
shader/downscale.frag shader/downscale.frag
shader/downscale_lanczos2.frag shader/downscale_lanczos2.frag
shader/downscale_linear.frag shader/downscale_linear.frag
) )
make_defines( make_defines(
"${CMAKE_CURRENT_SOURCE_DIR}/shader/desktop_rgb.frag" "${CMAKE_CURRENT_SOURCE_DIR}/shader/desktop_rgb.frag"
"${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgb.def.h" "${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgb.def.h"
) )
add_library(renderer_EGL STATIC add_library(renderer_EGL STATIC
egl.c egl.c
egldebug.c egldebug.c
shader.c shader.c
texture_util.c texture_util.c
texture.c texture.c
texture_buffer.c texture_buffer.c
texture_framebuffer.c texture_framebuffer.c
texture_dmabuf.c texture_dmabuf.c
model.c model.c
desktop.c desktop.c
desktop_rects.c desktop_rects.c
cursor.c cursor.c
damage.c damage.c
framebuffer.c framebuffer.c
postprocess.c postprocess.c
ffx.c ffx.c
filter.c filter.c
filter_ffx_cas.c filter_ffx_cas.c
filter_ffx_fsr1.c filter_ffx_fsr1.c
filter_downscale.c filter_downscale.c
${EGL_SHADER_OBJS} ${EGL_SHADER_OBJS}
"${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgb.def.h" "${CMAKE_CURRENT_BINARY_DIR}/shader/desktop_rgb.def.h"
${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl3.cpp ${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl3.cpp
) )
target_compile_definitions(renderer_EGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 IMGUI_IMPL_OPENGL_ES3) target_compile_definitions(renderer_EGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1 IMGUI_IMPL_OPENGL_ES3)
target_link_libraries(renderer_EGL target_link_libraries(renderer_EGL
PkgConfig::RENDERER_EGL PkgConfig::RENDERER_EGL
lg_common lg_common
cimgui cimgui
) )
if(RENDERER_EGL_OPT_FOUND) if(RENDERER_EGL_OPT_FOUND)
target_link_libraries(renderer_EGL target_link_libraries(renderer_EGL
PkgConfig::RENDERER_EGL_OPT PkgConfig::RENDERER_EGL_OPT
) )
endif() endif()
target_include_directories(renderer_EGL target_include_directories(renderer_EGL
PRIVATE PRIVATE
src src
${EGL_SHADER_INCS} ${EGL_SHADER_INCS}
) )

View File

@ -3,24 +3,24 @@ project(renderer_Opengl LANGUAGES C CXX)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(RENDERER_OPENGL REQUIRED IMPORTED_TARGET pkg_check_modules(RENDERER_OPENGL REQUIRED IMPORTED_TARGET
gl gl
) )
add_library(renderer_OpenGL STATIC add_library(renderer_OpenGL STATIC
opengl.c opengl.c
${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl2.cpp ${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl2.cpp
) )
target_compile_definitions(renderer_OpenGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1) target_compile_definitions(renderer_OpenGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
target_link_libraries(renderer_OpenGL target_link_libraries(renderer_OpenGL
PkgConfig::RENDERER_OPENGL PkgConfig::RENDERER_OPENGL
lg_common lg_common
cimgui cimgui
) )
target_include_directories(renderer_OpenGL target_include_directories(renderer_OpenGL
PRIVATE PRIVATE
src src
) )

View File

@ -4,7 +4,7 @@ project(lg_common LANGUAGES C)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
) )
add_definitions(-D_GNU_SOURCE) add_definitions(-D_GNU_SOURCE)
@ -42,8 +42,8 @@ add_library(lg_common STATIC ${COMMON_SOURCES})
target_link_libraries(lg_common lg_common_platform) target_link_libraries(lg_common lg_common_platform)
target_include_directories(lg_common target_include_directories(lg_common
INTERFACE INTERFACE
include include
PRIVATE PRIVATE
src src
) )

View File

@ -2,21 +2,21 @@ cmake_minimum_required(VERSION 3.0)
project(lg_common_platform_code LANGUAGES C) project(lg_common_platform_code LANGUAGES C)
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${PROJECT_TOP} ${PROJECT_TOP}
) )
add_library(lg_common_platform_code STATIC add_library(lg_common_platform_code STATIC
debug.c debug.c
crash.c crash.c
sysinfo.c sysinfo.c
thread.c thread.c
event.c event.c
ivshmem.c ivshmem.c
time.c time.c
paths.c paths.c
open.c open.c
cpuinfo.c cpuinfo.c
) )
if(ENABLE_BACKTRACE) if(ENABLE_BACKTRACE)
@ -25,7 +25,7 @@ if(ENABLE_BACKTRACE)
endif() endif()
target_link_libraries(lg_common_platform_code target_link_libraries(lg_common_platform_code
lg_common lg_common
pthread pthread
rt rt
) )

View File

@ -2,49 +2,49 @@ cmake_minimum_required(VERSION 3.0)
project(lg_common_platform_code LANGUAGES C) project(lg_common_platform_code LANGUAGES C)
include_directories( include_directories(
${PROJECT_TOP}/vendor/ivshmem ${PROJECT_TOP}/vendor/ivshmem
) )
# allow use of functions for Windows 7 or later # allow use of functions for Windows 7 or later
add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601) add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601)
if (MINGW) if (MINGW)
# Build our own ntdll.dll import library # Build our own ntdll.dll import library
# This tricks MinGW into not linking stuff like memcpy from ntdll.dll instead of mscvrt.dll # This tricks MinGW into not linking stuff like memcpy from ntdll.dll instead of mscvrt.dll
if(NOT CMAKE_DLLTOOL) if(NOT CMAKE_DLLTOOL)
# cmake older than 3.16 doesn't know how to find dlltool # cmake older than 3.16 doesn't know how to find dlltool
find_program(CMAKE_DLLTOOL NAMES "x86_64-w64-mingw32-dlltool" "dlltool.exe" DOC "dlltool executable") find_program(CMAKE_DLLTOOL NAMES "x86_64-w64-mingw32-dlltool" "dlltool.exe" DOC "dlltool executable")
endif() endif()
add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/ntdll.a" add_custom_command(OUTPUT "${PROJECT_BINARY_DIR}/ntdll.a"
COMMAND "${CMAKE_DLLTOOL}" -d "${PROJECT_SOURCE_DIR}/ntdll.def" -l "${PROJECT_BINARY_DIR}/ntdll.a" COMMAND "${CMAKE_DLLTOOL}" -d "${PROJECT_SOURCE_DIR}/ntdll.def" -l "${PROJECT_BINARY_DIR}/ntdll.a"
MAIN_DEPENDENCY "${PROJECT_SOURCE_DIR}/ntdll.def" MAIN_DEPENDENCY "${PROJECT_SOURCE_DIR}/ntdll.def"
COMMENT "Building import library ntdll.a" COMMENT "Building import library ntdll.a"
VERBATIM VERBATIM
) )
add_custom_target(ntdll_target DEPENDS "${PROJECT_BINARY_DIR}/ntdll.a") add_custom_target(ntdll_target DEPENDS "${PROJECT_BINARY_DIR}/ntdll.a")
add_library(ntdll STATIC IMPORTED GLOBAL) add_library(ntdll STATIC IMPORTED GLOBAL)
add_dependencies(ntdll ntdll_target) add_dependencies(ntdll ntdll_target)
set_target_properties(ntdll PROPERTIES IMPORTED_LOCATION "${PROJECT_BINARY_DIR}/ntdll.a") set_target_properties(ntdll PROPERTIES IMPORTED_LOCATION "${PROJECT_BINARY_DIR}/ntdll.a")
endif() endif()
add_library(lg_common_platform_code STATIC add_library(lg_common_platform_code STATIC
debug.c debug.c
crash.c crash.c
sysinfo.c sysinfo.c
thread.c thread.c
event.c event.c
windebug.c windebug.c
ivshmem.c ivshmem.c
time.c time.c
cpuinfo.c cpuinfo.c
) )
target_link_libraries(lg_common_platform_code target_link_libraries(lg_common_platform_code
lg_common lg_common
setupapi setupapi
ntdll ntdll
) )
if (ENABLE_BACKTRACE) if (ENABLE_BACKTRACE)
target_link_libraries(lg_common_platform_code dbghelp) target_link_libraries(lg_common_platform_code dbghelp)
endif() endif()

View File

@ -4,13 +4,13 @@ project(looking-glass-host C)
get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE) get_filename_component(PROJECT_TOP "${PROJECT_SOURCE_DIR}/.." ABSOLUTE)
if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)
message(FATAL_ERROR message(FATAL_ERROR
"\n" "\n"
"In-source builds are not supported\n" "In-source builds are not supported\n"
"See build instructions provided in: " "See build instructions provided in: "
"${PROJECT_TOP}/doc/build.rst\n" "${PROJECT_TOP}/doc/build.rst\n"
"Refusing to continue" "Refusing to continue"
) )
endif() endif()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/") list(APPEND CMAKE_MODULE_PATH "${PROJECT_TOP}/cmake/" "${PROJECT_SOURCE_DIR}/cmake/")
@ -62,16 +62,16 @@ if(ENABLE_UBSAN)
endif() endif()
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/version.c OUTPUT ${CMAKE_BINARY_DIR}/version.c
${CMAKE_BINARY_DIR}/include/version.h ${CMAKE_BINARY_DIR}/include/version.h
${CMAKE_BINARY_DIR}/_version.c ${CMAKE_BINARY_DIR}/_version.c
COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P
${PROJECT_TOP}/version.cmake ${PROJECT_TOP}/version.cmake
) )
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/include
) )
#link_libraries( #link_libraries(
@ -84,8 +84,8 @@ endif()
set(SOURCES set(SOURCES
${CMAKE_BINARY_DIR}/version.c ${CMAKE_BINARY_DIR}/version.c
src/app.c src/app.c
) )
add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common") add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common")
@ -104,9 +104,9 @@ else()
add_executable(looking-glass-host ${SOURCES}) add_executable(looking-glass-host ${SOURCES})
endif() endif()
target_link_libraries(looking-glass-host target_link_libraries(looking-glass-host
lg_common lg_common
platform platform
lgmp lgmp
) )
if(WIN32) if(WIN32)
@ -116,7 +116,7 @@ else()
endif() endif()
install(TARGETS looking-glass-host install(TARGETS looking-glass-host
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT binary) COMPONENT binary)
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)

View File

@ -2,22 +2,22 @@ cmake_minimum_required(VERSION 3.0)
project(platform_Linux LANGUAGES C) project(platform_Linux LANGUAGES C)
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
) )
add_library(platform_Linux STATIC add_library(platform_Linux STATIC
src/platform.c src/platform.c
) )
add_subdirectory("capture") add_subdirectory("capture")
target_link_libraries(platform_Linux target_link_libraries(platform_Linux
m m
capture capture
pthread pthread
) )
target_include_directories(platform_Linux target_include_directories(platform_Linux
PRIVATE PRIVATE
src src
) )

View File

@ -2,17 +2,17 @@ cmake_minimum_required(VERSION 3.0)
project(capture_XCB LANGUAGES C) project(capture_XCB LANGUAGES C)
add_library(capture_XCB STATIC add_library(capture_XCB STATIC
src/xcb.c src/xcb.c
) )
target_link_libraries(capture_XCB target_link_libraries(capture_XCB
lg_common lg_common
xcb xcb
xcb-shm xcb-shm
xcb-xfixes xcb-xfixes
) )
target_include_directories(capture_XCB target_include_directories(capture_XCB
PRIVATE PRIVATE
src src
) )

View File

@ -3,23 +3,23 @@ project(capture_pipewire LANGUAGES C)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(CAPTURE_PIPEWIRE REQUIRED IMPORTED_TARGET pkg_check_modules(CAPTURE_PIPEWIRE REQUIRED IMPORTED_TARGET
gio-2.0 gio-2.0
gio-unix-2.0 gio-unix-2.0
libpipewire-0.3 libpipewire-0.3
libspa-0.2 libspa-0.2
) )
add_library(capture_pipewire STATIC add_library(capture_pipewire STATIC
src/pipewire.c src/pipewire.c
src/portal.c src/portal.c
) )
target_link_libraries(capture_pipewire target_link_libraries(capture_pipewire
PkgConfig::CAPTURE_PIPEWIRE PkgConfig::CAPTURE_PIPEWIRE
lg_common lg_common
) )
target_include_directories(capture_pipewire target_include_directories(capture_pipewire
PRIVATE PRIVATE
src src
) )

View File

@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 3.0)
project(platform_Windows LANGUAGES C) project(platform_Windows LANGUAGES C)
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
) )
add_library(platform_Windows STATIC add_library(platform_Windows STATIC
src/platform.c src/platform.c
src/service.c src/service.c
src/mousehook.c src/mousehook.c
src/force_compose.c src/force_compose.c
) )
# allow use of functions for Windows 7 or later # allow use of functions for Windows 7 or later
@ -18,21 +18,21 @@ add_compile_definitions(WINVER=0x0601 _WIN32_WINNT=0x0601)
add_subdirectory("capture") add_subdirectory("capture")
target_link_libraries(platform_Windows target_link_libraries(platform_Windows
lg_common lg_common
capture capture
userenv userenv
wtsapi32 wtsapi32
psapi psapi
shlwapi shlwapi
powrprof powrprof
rpcrt4 rpcrt4
avrt avrt
) )
target_include_directories(platform_Windows target_include_directories(platform_Windows
PRIVATE PRIVATE
src src
) )
# these are for the nsis installer generator # these are for the nsis installer generator

View File

@ -2,24 +2,24 @@ cmake_minimum_required(VERSION 3.0)
project(capture_DXGI LANGUAGES C) project(capture_DXGI LANGUAGES C)
add_library(capture_DXGI STATIC add_library(capture_DXGI STATIC
src/dxgi.c src/dxgi.c
src/d3d11.c src/d3d11.c
src/d3d12.c src/d3d12.c
src/ods_capture.c src/ods_capture.c
src/util.c src/util.c
) )
add_definitions("-DCOBJMACROS -DINITGUID") add_definitions("-DCOBJMACROS -DINITGUID")
target_link_libraries(capture_DXGI target_link_libraries(capture_DXGI
lg_common lg_common
d3d11 d3d11
dxgi dxgi
dwmapi dwmapi
) )
target_include_directories(capture_DXGI target_include_directories(capture_DXGI
PRIVATE PRIVATE
src src
"${PROJECT_TOP}/vendor/directx" "${PROJECT_TOP}/vendor/directx"
) )

View File

@ -2,20 +2,20 @@ cmake_minimum_required(VERSION 3.0)
project(capture_NVFBC LANGUAGES C CXX) project(capture_NVFBC LANGUAGES C CXX)
add_library(capture_NVFBC STATIC add_library(capture_NVFBC STATIC
src/nvfbc.c src/nvfbc.c
src/wrapper.cpp src/wrapper.cpp
) )
file(TO_CMAKE_PATH "${NVFBC_SDK}" nvfbc_sdk) file(TO_CMAKE_PATH "${NVFBC_SDK}" nvfbc_sdk)
include_directories(file, "${nvfbc_sdk}/inc") include_directories(file, "${nvfbc_sdk}/inc")
target_link_libraries(capture_NVFBC target_link_libraries(capture_NVFBC
platform_Windows platform_Windows
dwmapi dwmapi
d3d9 d3d9
) )
target_include_directories(capture_NVFBC target_include_directories(capture_NVFBC
PRIVATE PRIVATE
src src
) )

View File

@ -31,46 +31,46 @@ set(EXE_FLAGS "-Wl,--gc-sections")
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(OBS_PLUGIN_DIR 64bit) set(OBS_PLUGIN_DIR 64bit)
else() else()
set(OBS_PLUGIN_DIR 32bit) set(OBS_PLUGIN_DIR 32bit)
endif() endif()
if(USER_INSTALL) if(USER_INSTALL)
if(DEFINED ENV{XDG_CONFIG_HOME}) if(DEFINED ENV{XDG_CONFIG_HOME})
set(OBS_PLUGIN_PREFIX $ENV{XDG_CONFIG_HOME}) set(OBS_PLUGIN_PREFIX $ENV{XDG_CONFIG_HOME})
else() else()
set(OBS_PLUGIN_PREFIX $ENV{HOME}/.config) set(OBS_PLUGIN_PREFIX $ENV{HOME}/.config)
endif() endif()
set(OBS_PLUGIN_PREFIX ${OBS_PLUGIN_PREFIX}/obs-studio/plugins) set(OBS_PLUGIN_PREFIX ${OBS_PLUGIN_PREFIX}/obs-studio/plugins)
else() else()
set(OBS_PLUGIN_PREFIX ${CMAKE_INSTALL_DATADIR}/obs/obs-plugins) set(OBS_PLUGIN_PREFIX ${CMAKE_INSTALL_DATADIR}/obs/obs-plugins)
endif() endif()
add_definitions(-D ATOMIC_LOCKING) add_definitions(-D ATOMIC_LOCKING)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/version.c OUTPUT ${CMAKE_BINARY_DIR}/version.c
${CMAKE_BINARY_DIR}/_version.c ${CMAKE_BINARY_DIR}/_version.c
COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P COMMAND ${CMAKE_COMMAND} -D PROJECT_TOP=${PROJECT_TOP} -P
${PROJECT_TOP}/version.cmake ${PROJECT_TOP}/version.cmake
) )
include_directories( include_directories(
${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include
${CMAKE_BINARY_DIR}/include ${CMAKE_BINARY_DIR}/include
) )
link_libraries( link_libraries(
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
rt rt
m m
) )
set(SOURCES set(SOURCES
${CMAKE_BINARY_DIR}/version.c ${CMAKE_BINARY_DIR}/version.c
main.c main.c
lg.c lg.c
) )
add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common") add_subdirectory("${PROJECT_TOP}/common" "${CMAKE_BINARY_DIR}/common")
@ -78,13 +78,13 @@ add_subdirectory("${PROJECT_TOP}/repos/LGMP/lgmp" "${CMAKE_BINARY_DIR}/lgmp" )
add_library(looking-glass-obs SHARED ${SOURCES}) add_library(looking-glass-obs SHARED ${SOURCES})
target_link_libraries(looking-glass-obs target_link_libraries(looking-glass-obs
${EXE_FLAGS} ${EXE_FLAGS}
lg_common lg_common
lgmp lgmp
) )
install(TARGETS looking-glass-obs install(TARGETS looking-glass-obs
LIBRARY DESTINATION ${OBS_PLUGIN_PREFIX}/${CMAKE_PROJECT_NAME}/bin/${OBS_PLUGIN_DIR} LIBRARY DESTINATION ${OBS_PLUGIN_PREFIX}/${CMAKE_PROJECT_NAME}/bin/${OBS_PLUGIN_DIR}
) )
feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES) feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)