Skip to content

Commit

Permalink
fix: moved rust code to a separate project, updated Docker image to u…
Browse files Browse the repository at this point in the history
…se that instead
  • Loading branch information
ABeltramo committed Nov 29, 2023
1 parent 53116ef commit 83aea8d
Show file tree
Hide file tree
Showing 46 changed files with 30 additions and 3,009 deletions.
8 changes: 0 additions & 8 deletions Cargo.toml

This file was deleted.

74 changes: 0 additions & 74 deletions cmake/CMakeCargo.cmake

This file was deleted.

25 changes: 0 additions & 25 deletions cmake/CMakeDetermineRustCompiler.cmake

This file was deleted.

15 changes: 0 additions & 15 deletions cmake/CMakeRustCompiler.cmake.in

This file was deleted.

106 changes: 0 additions & 106 deletions cmake/CMakeRustInformation.cmake

This file was deleted.

3 changes: 0 additions & 3 deletions cmake/CMakeTestRustCompiler.cmake

This file was deleted.

64 changes: 0 additions & 64 deletions cmake/CargoLink.cmake

This file was deleted.

20 changes: 17 additions & 3 deletions docker/wolf.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,20 @@ RUN apt-get update -y && \
libpci-dev \
&& rm -rf /var/lib/apt/lists/*

## Install Rust in order to build our custom compositor (the build will be done inside Cmake)
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
## Install Rust in order to build our custom compositor
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="$HOME/.cargo/bin:${PATH}"

WORKDIR /tmp/
RUN <<_GST_WAYLAND_DISPLAY
#!/bin/bash
set -e

git clone https://github.com/games-on-whales/gst-wayland-display
cd gst-wayland-display
cargo install cargo-c
cargo cinstall --prefix=/usr/local
_GST_WAYLAND_DISPLAY

COPY . /wolf/
WORKDIR /wolf
Expand Down Expand Up @@ -75,6 +86,9 @@ RUN apt-get update -y && \
&& rm -rf /var/lib/apt/lists/*

ENV GST_PLUGIN_PATH=/usr/local/lib/x86_64-linux-gnu/gstreamer-1.0/
# Copying out our custom compositor from the build stage
COPY --from=wolf-builder /usr/local/lib/gstreamer-1.0/* $GST_PLUGIN_PATH
COPY --from=wolf-builder /usr/local/lib/liblibgstwaylanddisplay* /usr/local/lib/

WORKDIR /wolf

Expand Down
2 changes: 1 addition & 1 deletion docs/modules/user/pages/quickstart.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ docker run \
-v /dev/input:/dev/input:rw \
-v /run/udev:/run/udev:rw \
-v /etc/wolf/ensure-groups:/opt/gow/ensure-groups:rw \
wolf/wolf:test
ghcr.io/games-on-whales/wolf:stable
....
Docker compose:
Expand Down
11 changes: 4 additions & 7 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ target_link_libraries(wolf_core PUBLIC wolf::docker)
file(GLOB CORE_HEADERS CONFIGURE_DEPENDS src/core/*.hpp)
set(CORE_SRC "")

find_package(PkgConfig)
option(LINK_RUST_WAYLAND "Link to our custom Rust wayland compositor" ON)
if (LINK_RUST_WAYLAND AND UNIX AND NOT APPLE)
# Adapted from: https://github.com/Devolutions/CMakeRust/
enable_language(Rust)
include(CMakeCargo)
add_subdirectory(rust/gst-wayland-display)
pkg_check_modules(libgstwaylanddisplay REQUIRED IMPORTED_TARGET libgstwaylanddisplay)
target_link_libraries(wolf_core PUBLIC PkgConfig::libgstwaylanddisplay)
endif ()

FetchContent_Declare(
Expand All @@ -35,8 +34,7 @@ FetchContent_MakeAvailable(immer)
target_link_libraries_system(wolf_core PUBLIC immer)
unset(FPHSA_NAME_MISMATCHED)

find_package(PkgConfig)
pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0)
pkg_check_modules(GSTREAMER REQUIRED IMPORTED_TARGET gstreamer-1.0 gstreamer-base-1.0 gstreamer-app-1.0 gstreamer-video-1.0)
pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0)

if (NOT (GSTREAMER_FOUND))
Expand All @@ -55,7 +53,6 @@ if (UNIX AND NOT APPLE)
target_link_libraries(wolf_core PUBLIC wolf::uinput)

if (LINK_RUST_WAYLAND)
target_link_libraries_system(wolf_core PUBLIC gstwaylanddisplay)
list(APPEND CORE_SRC src/platforms/linux/virtual-display/wayland-display.cpp)
else ()
message(WARNING "Missing virtual display implementation for this platform")
Expand Down
Loading

0 comments on commit 83aea8d

Please sign in to comment.