mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-22 18:39:46 +00:00
Give the window backends the engine include surface
VoxelWindowBase only got the src include directory, so BaseInput.cpp could not find glm/vec2.hpp through window/input.hpp on macOS, where glm lives in a prefix outside the default include path. VoxelGLFW had glm linked, which hid the problem on Linux, where glm sits in /usr/include anyway. The backends now link a single interface target carrying the engine sources and the third-party headers their public headers pull in, instead of each backend keeping its own list.
This commit is contained in:
parent
aac0bfa44a
commit
b9a13c853d
3 changed files with 21 additions and 18 deletions
|
|
@ -116,6 +116,21 @@ set(VOXEL_COMPILE_OPTIONS
|
||||||
-Wduplicated-cond
|
-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.
|
||||||
|
add_library(VoxelCoreInterface INTERFACE)
|
||||||
|
|
||||||
|
target_include_directories(VoxelCoreInterface INTERFACE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(VoxelCoreInterface INTERFACE
|
||||||
|
glfw
|
||||||
|
GLEW::GLEW
|
||||||
|
OpenGL::GL
|
||||||
|
glm::glm)
|
||||||
|
|
||||||
option(VOXELCORE_WAYLAND "Build the native Wayland window backend" ON)
|
option(VOXELCORE_WAYLAND "Build the native Wayland window backend" ON)
|
||||||
|
|
||||||
add_subdirectory(window/detail)
|
add_subdirectory(window/detail)
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,12 @@ project(VoxelWindowBackends)
|
||||||
# Input state shared by the window backends.
|
# Input state shared by the window backends.
|
||||||
add_library(VoxelWindowBase STATIC BaseInput.cpp)
|
add_library(VoxelWindowBase STATIC BaseInput.cpp)
|
||||||
|
|
||||||
target_include_directories(VoxelWindowBase PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
|
||||||
|
|
||||||
target_compile_options(VoxelWindowBase PRIVATE ${VOXEL_COMPILE_OPTIONS})
|
target_compile_options(VoxelWindowBase PRIVATE ${VOXEL_COMPILE_OPTIONS})
|
||||||
|
|
||||||
|
target_link_libraries(VoxelWindowBase PRIVATE VoxelCoreInterface)
|
||||||
|
|
||||||
add_library(VoxelGLFW STATIC GLFWWindow.cpp)
|
add_library(VoxelGLFW STATIC GLFWWindow.cpp)
|
||||||
|
|
||||||
target_include_directories(VoxelGLFW PRIVATE ${CMAKE_SOURCE_DIR}/src)
|
|
||||||
|
|
||||||
target_compile_options(VoxelGLFW PRIVATE ${VOXEL_COMPILE_OPTIONS})
|
target_compile_options(VoxelGLFW PRIVATE ${VOXEL_COMPILE_OPTIONS})
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(VoxelGLFW PRIVATE VoxelWindowBase VoxelCoreInterface)
|
||||||
VoxelGLFW
|
|
||||||
PRIVATE VoxelWindowBase
|
|
||||||
glfw
|
|
||||||
OpenGL::GL
|
|
||||||
GLEW::GLEW
|
|
||||||
glm::glm)
|
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,7 @@ function(voxel_add_wayland_backend)
|
||||||
|
|
||||||
add_library(VoxelWayland STATIC ${wayland_sources} ${WAYLAND_SOURCES})
|
add_library(VoxelWayland STATIC ${wayland_sources} ${WAYLAND_SOURCES})
|
||||||
|
|
||||||
target_include_directories(VoxelWayland
|
target_include_directories(VoxelWayland PRIVATE ${WAYLAND_GENERATED})
|
||||||
PRIVATE ${CMAKE_SOURCE_DIR}/src ${WAYLAND_GENERATED})
|
|
||||||
|
|
||||||
target_compile_options(VoxelWayland PRIVATE ${VOXEL_COMPILE_OPTIONS})
|
target_compile_options(VoxelWayland PRIVATE ${VOXEL_COMPILE_OPTIONS})
|
||||||
|
|
||||||
|
|
@ -71,14 +70,11 @@ function(voxel_add_wayland_backend)
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
VoxelWayland
|
VoxelWayland
|
||||||
PRIVATE VoxelWindowBase
|
PRIVATE VoxelWindowBase
|
||||||
|
VoxelCoreInterface
|
||||||
PkgConfig::wayland-client
|
PkgConfig::wayland-client
|
||||||
PkgConfig::xkbcommon
|
PkgConfig::xkbcommon
|
||||||
PkgConfig::egl
|
PkgConfig::egl
|
||||||
${WAYLAND_EGL_LIBRARY}
|
${WAYLAND_EGL_LIBRARY})
|
||||||
glfw
|
|
||||||
OpenGL::GL
|
|
||||||
GLEW::GLEW
|
|
||||||
glm::glm)
|
|
||||||
|
|
||||||
if(libsystemd_FOUND)
|
if(libsystemd_FOUND)
|
||||||
target_compile_definitions(VoxelWayland PRIVATE VOXELCORE_SDBUS=1)
|
target_compile_definitions(VoxelWayland PRIVATE VOXELCORE_SDBUS=1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue