mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
Fix the issues found while reviewing the build files
Install the Wayland development packages in both workflows and bundle the runtime libraries in the AppImage: the release build had no native Wayland backend at all, and the engine silently fell back to GLFW there. Build the window backends on every platform that is not Windows and not Apple, glob the wayland sources with CONFIGURE_DEPENDS, and report a missing Wayland dependency with the list of what is missing. Also drop the dead nested project() calls and the duplicate -no-pie option, make .dirIcon the file appimagetool expects, and describe the real Linux dependencies in the README.
This commit is contained in:
parent
3a574ade8c
commit
b6f6235249
10 changed files with 46 additions and 26 deletions
3
.github/workflows/appimage.yml
vendored
3
.github/workflows/appimage.yml
vendored
|
|
@ -31,7 +31,8 @@ jobs:
|
|||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential libglfw3-dev libglfw3 libglew-dev libglew2.2 \
|
||||
libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev \
|
||||
libcurl4-openssl-dev libssl-dev libgtest-dev libfreetype6-dev cmake squashfs-tools valgrind
|
||||
libcurl4-openssl-dev libssl-dev libgtest-dev libfreetype6-dev cmake squashfs-tools valgrind \
|
||||
libwayland-dev libxkbcommon-dev libegl1-mesa-dev libsystemd-dev
|
||||
# fix luajit paths
|
||||
sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a
|
||||
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
|
||||
|
|
|
|||
3
.github/workflows/cmake.yml
vendored
3
.github/workflows/cmake.yml
vendored
|
|
@ -39,7 +39,8 @@ jobs:
|
|||
# make && make install INSTALL_INC=/usr/include/lua
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libgtest-dev libcurl4-openssl-dev libssl-dev libfreetype6-dev
|
||||
# the Wayland backend is on by default on Linux (VOXELCORE_WAYLAND)
|
||||
sudo apt-get install libglfw3-dev libglfw3 libglew-dev libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libgtest-dev libcurl4-openssl-dev libssl-dev libfreetype6-dev libwayland-dev libxkbcommon-dev libegl1-mesa-dev libsystemd-dev
|
||||
# fix luajit paths
|
||||
sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua-5.1.a
|
||||
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
|
||||
|
|
|
|||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,8 +1,6 @@
|
|||
Debug/src/**/*.d
|
||||
Debug/src/**/*.o
|
||||
|
||||
Debug/voxel_engine
|
||||
|
||||
/build
|
||||
/cmake-build-**
|
||||
/screenshots
|
||||
|
|
@ -36,6 +34,7 @@ Debug/voxel_engine
|
|||
/Default/
|
||||
AppDir
|
||||
appimage-build/
|
||||
*.AppImage*
|
||||
|
||||
# macOS folder attributes
|
||||
*.DS_Store
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ set(CMAKE_CXX_STANDARD 17)
|
|||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --version)
|
||||
|
||||
option(VOXELENGINE_BUILD_APPDIR "Pack linux build" OFF)
|
||||
option(VOXELENGINE_BUILD_TESTS "Build tests" OFF)
|
||||
|
||||
|
|
@ -36,8 +34,6 @@ endif()
|
|||
target_link_libraries(VoxelCore PRIVATE VoxelCoreSrc
|
||||
$<$<PLATFORM_ID:Windows>:winmm>)
|
||||
|
||||
target_link_options(VoxelCore PRIVATE $<$<CXX_COMPILER_ID:GNU>:-no-pie>)
|
||||
|
||||
# Deploy res to build dir
|
||||
add_custom_command(
|
||||
TARGET VoxelCore
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -27,7 +27,7 @@ sudo make install
|
|||
|
||||
```sh
|
||||
su -
|
||||
apt-get install libglfw3-devel libGLEW-devel libglm-devel libpng-devel libvorbis-devel libopenal-devel libluajit-devel libstdc++13-devel-static libcurl-devel libfreetype-devel libssl-devel
|
||||
apt-get install entt-devel libglfw3-devel libGLEW-devel libglm-devel libpng-devel libvorbis-devel libopenal-devel libluajit-devel libstdc++13-devel-static libcurl-devel libfreetype-devel libssl-devel
|
||||
```
|
||||
|
||||
#### Debian based distros
|
||||
|
|
@ -58,9 +58,12 @@ sudo pacman -S glfw glew glm libpng libvorbis openal luajit curl freetype2 opens
|
|||
|
||||
#### Wayland
|
||||
|
||||
On Linux the engine draws the window frame itself and needs `wayland-client`,
|
||||
`wayland-egl`, `wayland-scanner`, `wayland-protocols`, `libxkbcommon` and EGL.
|
||||
Build with `-DVOXELCORE_WAYLAND=OFF` to fall back to GLFW.
|
||||
On Linux the engine draws the window frame itself and needs `libwayland-dev`
|
||||
(with `libwayland-bin` for `wayland-scanner`), `libxkbcommon-dev` and
|
||||
`libegl-dev`. The protocol XML descriptions are vendored in
|
||||
`src/window/wayland/protocols`, so the `wayland-protocols` package is not used.
|
||||
`libsystemd-dev` is optional and adds the window button layout read through
|
||||
sd-bus. Build with `-DVOXELCORE_WAYLAND=OFF` to fall back to GLFW.
|
||||
|
||||
### Building engine with CMake
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ AppDir:
|
|||
- libvorbisfile3
|
||||
- libluajit-5.1-2
|
||||
- libfreetype6
|
||||
- libwayland-client0
|
||||
- libwayland-cursor0
|
||||
- libwayland-egl1
|
||||
- libxkbcommon0
|
||||
exclude:
|
||||
- hicolor-icon-theme
|
||||
- sound-theme-freedesktop
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/VoxelCore)
|
|||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/res DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/VoxelCore)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/dev/VoxelCore.png DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/icons/hicolor/256x256)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/dev/VoxelCore.png DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/dev/VoxelCore.png DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/.dirIcon)
|
||||
# .dirIcon is the icon of the AppDir itself and has to be a file, not a directory
|
||||
file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/.dirIcon)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/dev/VoxelCore.png
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/AppDir/.dirIcon COPYONLY)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/dev/VoxelCore.desktop DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/share/applications)
|
||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/dev/VoxelCore.desktop DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/)
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/AppDir/usr/lib)
|
||||
|
|
|
|||
|
|
@ -116,10 +116,10 @@ set(VOXEL_COMPILE_OPTIONS
|
|||
-Wduplicated-cond
|
||||
>)
|
||||
|
||||
# Everything the engine sources and their public headers include: the backends
|
||||
# compile against the same surface, and a missing include directory shows up as
|
||||
# a build failure only on the platforms that keep the library outside the
|
||||
# default include path.
|
||||
# The include directory and the window/render dependencies shared by the engine
|
||||
# and the window backends: glfw, GLEW, OpenGL and glm. The remaining engine
|
||||
# dependencies (luajit, EnTT, OpenAL, zlib and others) are linked to VoxelCoreSrc
|
||||
# only, even though the public headers pull them in.
|
||||
add_library(VoxelCoreInterface INTERFACE)
|
||||
|
||||
target_include_directories(VoxelCoreInterface INTERFACE
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
project(VoxelWindowBackends)
|
||||
|
||||
# Input state shared by the window backends.
|
||||
add_library(VoxelWindowBase STATIC BaseInput.cpp)
|
||||
|
||||
|
|
@ -17,7 +15,7 @@ target_link_libraries(
|
|||
# On X11 the window manager moves and resizes the window when the engine draws
|
||||
# the frame. A wayland-only build of GLFW does not answer, and the frame then
|
||||
# falls back to moving the window itself.
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
find_package(X11)
|
||||
if(X11_FOUND)
|
||||
target_compile_definitions(VoxelGLFW PRIVATE VOXEL_X11_FRAME=1)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
project(VoxelWayland)
|
||||
|
||||
# The library is linked from the parent directory, so the imported targets of
|
||||
# its dependencies have to be visible outside of this directory too.
|
||||
function(voxel_wayland_pkg_config MODULE)
|
||||
|
|
@ -32,9 +30,25 @@ function(voxel_add_wayland_backend)
|
|||
find_library(WAYLAND_EGL_LIBRARY NAMES wayland-egl libwayland-egl.so.1)
|
||||
find_program(WAYLAND_SCANNER wayland-scanner)
|
||||
|
||||
if(NOT wayland-client_FOUND OR NOT xkbcommon_FOUND OR NOT egl_FOUND
|
||||
OR NOT WAYLAND_EGL_LIBRARY OR NOT WAYLAND_SCANNER)
|
||||
message(STATUS "Wayland backend is off: dependencies are not found")
|
||||
set(wayland_missing)
|
||||
if(NOT wayland-client_FOUND)
|
||||
list(APPEND wayland_missing wayland-client)
|
||||
endif()
|
||||
if(NOT xkbcommon_FOUND)
|
||||
list(APPEND wayland_missing xkbcommon)
|
||||
endif()
|
||||
if(NOT egl_FOUND)
|
||||
list(APPEND wayland_missing egl)
|
||||
endif()
|
||||
if(NOT WAYLAND_EGL_LIBRARY)
|
||||
list(APPEND wayland_missing wayland-egl)
|
||||
endif()
|
||||
if(NOT WAYLAND_SCANNER)
|
||||
list(APPEND wayland_missing wayland-scanner)
|
||||
endif()
|
||||
if(wayland_missing)
|
||||
list(JOIN wayland_missing ", " wayland_missing)
|
||||
message(WARNING "Wayland backend is off: not found: ${wayland_missing}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
|
@ -56,7 +70,8 @@ function(voxel_add_wayland_backend)
|
|||
# tablet is referenced by cursor-shape-v1
|
||||
voxel_wayland_protocol(tablet-unstable-v2.xml tablet-unstable-v2)
|
||||
|
||||
file(GLOB wayland_sources ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
file(GLOB wayland_sources CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
|
||||
|
||||
add_library(VoxelWayland STATIC ${wayland_sources} ${WAYLAND_SOURCES})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue