cmake: add 'libdecoration' as external project

This commit is contained in:
Christian Rauch 2020-02-09 14:01:58 +00:00
parent 30e00d4fee
commit f39d7c2e33
3 changed files with 22 additions and 0 deletions

View File

@ -36,6 +36,8 @@ cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
"UNIX;NOT APPLE" OFF)
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
"MSVC" OFF)
cmake_dependent_option(GLFW_USE_LIBDECORATION "use libdecoration" ON
"GLFW_USE_WAYLAND" OFF)
if (BUILD_SHARED_LIBS AND UNIX)
# On Unix-like systems, shared libraries can use the soname system.
@ -55,6 +57,8 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
include(ExternalProject)
find_package(Threads REQUIRED)
if (GLFW_BUILD_DOCS)

13
external/libdecoration.cmake vendored Normal file
View File

@ -0,0 +1,13 @@
ExternalProject_Add(libdecoration
GIT_REPOSITORY https://gitlab.gnome.org/jadahl/libdecoration.git
GIT_TAG master
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/extern/libdecoration"
CONFIGURE_COMMAND meson --prefix "${CMAKE_CURRENT_BINARY_DIR}/install" --libdir "lib" ../libdecoration
BUILD_COMMAND ninja
INSTALL_COMMAND ninja install
)
target_include_directories(glfw PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/install/include")
target_link_libraries(glfw PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/install/lib/libdecoration${CMAKE_SHARED_LIBRARY_SUFFIX})
add_dependencies(glfw libdecoration)

View File

@ -70,6 +70,11 @@ if (_GLFW_WAYLAND)
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
BASENAME idle-inhibit-unstable-v1)
target_sources(glfw PRIVATE ${GLFW_WAYLAND_PROTOCOL_SOURCES})
if (GLFW_USE_LIBDECORATION)
include("${CMAKE_SOURCE_DIR}/external/libdecoration.cmake")
add_definitions(-DWITH_DECORATION)
endif()
endif()
if (WIN32 AND BUILD_SHARED_LIBS)