Skip to content

Commit

Permalink
Rework
Browse files Browse the repository at this point in the history
-registrar abstraction
-remove cursor (for now)
-support many output
-support many seats

Signed-off-by: Joel Winarske <[email protected]>
  • Loading branch information
jwinarske committed Apr 23, 2024
1 parent e974ba1 commit 366a57d
Show file tree
Hide file tree
Showing 247 changed files with 58,988 additions and 2,056 deletions.
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,25 @@ message(STATUS "Build Type ............. ${CMAKE_BUILD_TYPE}")
include(compiler)
include(utils)

include_directories(include)

#
# libraries
#
include(wayland)
add_subdirectory(third_party)


#
# library
#
add_subdirectory(src)

#
# Demos
# Examples
#
add_subdirectory(demo)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()

if (BUILD_UNIT_TESTS)
enable_testing()
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ This project requires the following packages/libraries:
- libwayland-dev
- libxkbcommon-dev
- wayland-protocols
- cairo-dev
- glib-2.0

### If your graphics driver is supported by Mesa, then use:
- mesa-common-dev
- libgles2-mesa-dev
- libegl1-mesa-dev
Expand Down
11 changes: 1 addition & 10 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,7 @@ COMPILER_FLAGS_APPEND(RELEASE " -fno-omit-frame-pointer" "-f(no-)?omit-frame-poi
COMPILER_FLAGS_APPEND(RELEASE " -Wformat=2" "-Wformat(=[0-9]+)?")
COMPILER_FLAGS_APPEND(RELEASE " -D_FORTIFY_SOURCE=2" "-D_FORTIFY_SOURCE(=[0-9]+)?")

if (BUILD_PLUGIN_FIREBASE_CORE OR
BUILD_PLUGIN_CLOUD_FIRESTORE OR
BUILD_PLUGIN_FIREBASE_AUTH OR
BUILD_PLUGIN_FIREBASE_STORAGE OR
BUILD_CRASH_HANDLER OR
BUILD_PLUGIN_FILAMENT_VIEW)
string(APPEND CMAKE_CXX_FLAGS " -frtti")
else ()
string(APPEND CMAKE_CXX_FLAGS " -fno-rtti")
endif ()
string(APPEND CMAKE_CXX_FLAGS " -frtti")

string(APPEND CMAKE_EXE_LINKER_FLAGS " -Wl,--build-id=sha1")

Expand Down
7 changes: 7 additions & 0 deletions cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
# limitations under the License.
#


#
# Examples
#
option(BUILD_EXAMPLES "Build Examples" ON)
MESSAGE(STATUS "Build Examples ......... ${BUILD_EXAMPLES}")

#
# Unit Tests
#
Expand Down
92 changes: 81 additions & 11 deletions cmake/wayland.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -48,36 +48,90 @@ endmacro()

set(WAYLAND_PROTOCOL_SOURCES)

wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
${CMAKE_CURRENT_BINARY_DIR}/xdg-shell-client-protocol)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/protocols)

wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
${CMAKE_CURRENT_BINARY_DIR}/xdg-decoration-unstable-client-protocol)
${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
${CMAKE_CURRENT_BINARY_DIR}/protocols/xdg-shell-client-protocol)

wayland_generate(
${CMAKE_SOURCE_DIR}/third_party/agl/protocol/agl-shell.xml
${CMAKE_CURRENT_BINARY_DIR}/agl-shell-client-protocol)
${CMAKE_CURRENT_BINARY_DIR}/protocols/agl-shell-client-protocol)
wayland_generate(
${CMAKE_SOURCE_DIR}/third_party/agl/protocol/agl-shell-desktop.xml
${CMAKE_CURRENT_BINARY_DIR}/agl-shell-desktop-client-protocol)
${CMAKE_CURRENT_BINARY_DIR}/protocols/agl-shell-desktop-client-protocol)
wayland_generate(
${CMAKE_SOURCE_DIR}/third_party/agl/protocol/agl-screenshooter.xml
${CMAKE_CURRENT_BINARY_DIR}/agl-screenshooter-client-protocol)
${CMAKE_CURRENT_BINARY_DIR}/protocols/agl-screenshooter-client-protocol)

wayland_generate(
${CMAKE_SOURCE_DIR}/third_party/weston/protocol/ivi-application.xml
${CMAKE_CURRENT_BINARY_DIR}/ivi-application-client-protocol)
${CMAKE_CURRENT_BINARY_DIR}/protocols/ivi-application-client-protocol)
wayland_generate(
${CMAKE_SOURCE_DIR}/third_party/weston/protocol/ivi-wm.xml
${CMAKE_CURRENT_BINARY_DIR}/ivi-wm-client-protocol)
${CMAKE_CURRENT_BINARY_DIR}/protocols/ivi-wm-client-protocol)

#
# Optional
#
set(WAYLAND_PROTOCOL_HAS_XDG_DECORATION OFF)
if (EXISTS ${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml)
set(WAYLAND_PROTOCOL_HAS_XDG_DECORATION ON)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
${CMAKE_CURRENT_BINARY_DIR}/protocols/xdg-decoration-unstable-client-protocol)
endif ()
message(STATUS "XDG Decoration ........ ${WAYLAND_PROTOCOL_HAS_XDG_DECORATION}")

set(WAYLAND_PROTOCOL_HAS_FRACTIONAL_SCALE OFF)
if (EXISTS ${WAYLAND_PROTOCOLS_BASE}/staging/fractional-scale/fractional-scale-v1.xml)
set(WAYLAND_PROTOCOL_HAS_FRACTIONAL_SCALE ON)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/staging/fractional-scale/fractional-scale-v1.xml
${CMAKE_CURRENT_BINARY_DIR}/protocols/fractional-scale-v1-client-protocol)
endif ()
message(STATUS "Fractional Scale ...... ${WAYLAND_PROTOCOL_HAS_FRACTIONAL_SCALE}")

set(WAYLAND_PROTOCOL_HAS_VIEWPORTER OFF)
if (EXISTS ${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml)
set(WAYLAND_PROTOCOL_HAS_VIEWPORTER ON)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml
${CMAKE_CURRENT_BINARY_DIR}/protocols/viewporter-client-protocol)
endif ()
message(STATUS "Viewporter ............ ${WAYLAND_PROTOCOL_HAS_VIEWPORTER}")

set(WAYLAND_PROTOCOL_HAS_TEARING_CONTROL OFF)
if (EXISTS ${WAYLAND_PROTOCOLS_BASE}/staging/tearing-control/tearing-control-v1.xml)
set(WAYLAND_PROTOCOL_HAS_TEARING_CONTROL ON)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/staging/tearing-control/tearing-control-v1.xml
${CMAKE_CURRENT_BINARY_DIR}/protocols/tearing-control-v1-client-protocol)
endif ()
message(STATUS "Tearing Control ....... ${WAYLAND_PROTOCOL_HAS_TEARING_CONTROL}")

set(WAYLAND_PROTOCOL_HAS_PRESENTATION_TIME OFF)
if (EXISTS ${WAYLAND_PROTOCOLS_BASE}/stable/presentation-time/presentation-time.xml)
set(WAYLAND_PROTOCOL_HAS_PRESENTATION_TIME ON)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/stable/presentation-time/presentation-time.xml
${CMAKE_CURRENT_BINARY_DIR}/protocols/presentation-time-client-protocol)
endif ()
message(STATUS "Presentation Time ..... ${WAYLAND_PROTOCOL_HAS_PRESENTATION_TIME}")

set(WAYLAND_PROTOCOL_HAS_DRM_LEASE OFF)
if (EXISTS ${WAYLAND_PROTOCOLS_BASE}/staging/drm-lease/drm-lease-v1.xml)
set(WAYLAND_PROTOCOL_HAS_DRM_LEASE ON)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/staging/drm-lease/drm-lease-v1.xml
${CMAKE_CURRENT_BINARY_DIR}/protocols/drm-lease-v1-client-protocol)
endif ()
message(STATUS "DRM Lease ............. ${WAYLAND_PROTOCOL_HAS_DRM_LEASE}")


add_library(wayland-gen STATIC ${WAYLAND_PROTOCOL_SOURCES})
target_link_libraries(wayland-gen PUBLIC PkgConfig::WAYLAND)


if (ENABLE_XDG_CLIENT)
target_compile_definitions(wayland-gen PUBLIC ENABLE_XDG_CLIENT)
endif ()
Expand All @@ -88,6 +142,22 @@ if (ENABLE_IVI_SHELL_CLIENT)
target_compile_definitions(wayland-gen PUBLIC ENABLE_IVI_SHELL_CLIENT)
endif ()

if (WAYLAND_PROTOCOL_HAS_XDG_DECORATION)
target_compile_definitions(wayland-gen PUBLIC WAYLAND_PROTOCOL_HAS_XDG_DECORATION)
endif ()
if (WAYLAND_PROTOCOL_HAS_PRESENTATION_TIME)
target_compile_definitions(wayland-gen PUBLIC WAYLAND_PROTOCOL_HAS_PRESENTATION_TIME)
endif ()
if (WAYLAND_PROTOCOL_HAS_FRACTIONAL_SCALE)
target_compile_definitions(wayland-gen PUBLIC WAYLAND_PROTOCOL_HAS_FRACTIONAL_SCALE)
endif ()
if (WAYLAND_PROTOCOL_HAS_VIEWPORTER)
target_compile_definitions(wayland-gen PUBLIC WAYLAND_PROTOCOL_HAS_VIEWPORTER)
endif ()
if (WAYLAND_PROTOCOL_HAS_TEARING_CONTROL)
target_compile_definitions(wayland-gen PUBLIC WAYLAND_PROTOCOL_HAS_TEARING_CONTROL)
endif ()

target_include_directories(wayland-gen PUBLIC ${CMAKE_CURRENT_BINARY_DIR})

if (IPO_SUPPORT_RESULT)
Expand Down
130 changes: 0 additions & 130 deletions demo/demo.cc

This file was deleted.

26 changes: 17 additions & 9 deletions demo/CMakeLists.txt → examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@
# limitations under the License.
#

# Define variables
set(TARGET_NAME demo)
set(SOURCE_FILE demo.cc)
set(COMPILE_DEFINITIONS EGL_NO_X11 MESA_EGL_NO_X11_HEADERS)
set(LINK_LIBRARIES waypp GLESv2)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLESv2 IMPORTED_TARGET glesv2)

# Use variables in place of hard-coded values
add_executable(${TARGET_NAME} ${SOURCE_FILE})
target_compile_definitions(${TARGET_NAME} PRIVATE ${COMPILE_DEFINITIONS})
target_link_libraries(${TARGET_NAME} ${LINK_LIBRARIES})
#
# simple-egl
#
add_executable(simple-egl simple-egl.cc)
target_include_directories(simple-egl PRIVATE ${CMAKE_SOURCE_DIR}/include)

target_compile_definitions(simple-egl PRIVATE EGL_NO_X11 MESA_EGL_NO_X11_HEADERS)

target_link_libraries(simple-egl PRIVATE waypp PkgConfig::GLESv2 cxxopts::cxxopts)

if (IPO_SUPPORT_RESULT)
set_property(TARGET simple-egl PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif ()

add_sanitizers(simple-egl)
Loading

0 comments on commit 366a57d

Please sign in to comment.