mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 04:56:00 +01:00
CMake: fmt
This commit is contained in:
parent
949f105f53
commit
00d6f0f820
1 changed files with 68 additions and 62 deletions
|
@ -5,10 +5,10 @@ string(STRIP ${VER_RAW} AQUAMARINE_VERSION)
|
||||||
|
|
||||||
add_compile_definitions(AQUAMARINE_VERSION="${AQUAMARINE_VERSION}")
|
add_compile_definitions(AQUAMARINE_VERSION="${AQUAMARINE_VERSION}")
|
||||||
|
|
||||||
project(aquamarine
|
project(
|
||||||
|
aquamarine
|
||||||
VERSION ${AQUAMARINE_VERSION}
|
VERSION ${AQUAMARINE_VERSION}
|
||||||
DESCRIPTION "A very light linux rendering backend library"
|
DESCRIPTION "A very light linux rendering backend library")
|
||||||
)
|
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
@ -21,14 +21,21 @@ set(LIBDIR ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
find_package(OpenGL REQUIRED COMPONENTS "GLES2")
|
find_package(OpenGL REQUIRED COMPONENTS "GLES2")
|
||||||
find_package(hyprwayland-scanner 0.4.0 REQUIRED)
|
find_package(hyprwayland-scanner 0.4.0 REQUIRED)
|
||||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET
|
pkg_check_modules(
|
||||||
libseat>=0.8.0 libinput>=1.26.0
|
deps
|
||||||
wayland-client wayland-protocols
|
REQUIRED
|
||||||
|
IMPORTED_TARGET
|
||||||
|
libseat>=0.8.0
|
||||||
|
libinput>=1.26.0
|
||||||
|
wayland-client
|
||||||
|
wayland-protocols
|
||||||
hyprutils>=0.1.5
|
hyprutils>=0.1.5
|
||||||
pixman-1
|
pixman-1
|
||||||
libdrm gbm libudev
|
libdrm
|
||||||
libdisplay-info hwdata
|
gbm
|
||||||
)
|
libudev
|
||||||
|
libdisplay-info
|
||||||
|
hwdata)
|
||||||
|
|
||||||
configure_file(aquamarine.pc.in aquamarine.pc @ONLY)
|
configure_file(aquamarine.pc.in aquamarine.pc @ONLY)
|
||||||
|
|
||||||
|
@ -47,19 +54,13 @@ file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp" "include/*.hpp")
|
||||||
file(GLOB_RECURSE PUBLIC_HEADERS CONFIGURE_DEPENDS "include/*.hpp")
|
file(GLOB_RECURSE PUBLIC_HEADERS CONFIGURE_DEPENDS "include/*.hpp")
|
||||||
|
|
||||||
add_library(aquamarine SHARED ${SRCFILES})
|
add_library(aquamarine SHARED ${SRCFILES})
|
||||||
target_include_directories( aquamarine
|
target_include_directories(
|
||||||
|
aquamarine
|
||||||
PUBLIC "./include"
|
PUBLIC "./include"
|
||||||
PRIVATE "./src" "./src/include" "./protocols" "${CMAKE_BINARY_DIR}"
|
PRIVATE "./src" "./src/include" "./protocols" "${CMAKE_BINARY_DIR}")
|
||||||
)
|
set_target_properties(aquamarine PROPERTIES VERSION ${AQUAMARINE_VERSION}
|
||||||
set_target_properties(aquamarine PROPERTIES
|
SOVERSION 0)
|
||||||
VERSION ${AQUAMARINE_VERSION}
|
target_link_libraries(aquamarine OpenGL::EGL OpenGL::GL PkgConfig::deps)
|
||||||
SOVERSION 0
|
|
||||||
)
|
|
||||||
target_link_libraries(aquamarine
|
|
||||||
OpenGL::EGL
|
|
||||||
OpenGL::GL
|
|
||||||
PkgConfig::deps
|
|
||||||
)
|
|
||||||
|
|
||||||
check_include_file("sys/timerfd.h" HAS_TIMERFD)
|
check_include_file("sys/timerfd.h" HAS_TIMERFD)
|
||||||
pkg_check_modules(epoll IMPORTED_TARGET epoll-shim)
|
pkg_check_modules(epoll IMPORTED_TARGET epoll-shim)
|
||||||
|
@ -74,7 +75,7 @@ pkg_get_variable(WAYLAND_CLIENT_DIR wayland-client pkgdatadir)
|
||||||
message(STATUS "Found wayland-client at ${WAYLAND_CLIENT_DIR}")
|
message(STATUS "Found wayland-client at ${WAYLAND_CLIENT_DIR}")
|
||||||
|
|
||||||
function(protocolNew protoPath protoName external)
|
function(protocolNew protoPath protoName external)
|
||||||
if (external)
|
if(external)
|
||||||
set(path ${CMAKE_SOURCE_DIR}/${protoPath})
|
set(path ${CMAKE_SOURCE_DIR}/${protoPath})
|
||||||
else()
|
else()
|
||||||
set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath})
|
set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath})
|
||||||
|
@ -82,37 +83,38 @@ function(protocolNew protoPath protoName external)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_SOURCE_DIR}/protocols/${protoName}.cpp
|
OUTPUT ${CMAKE_SOURCE_DIR}/protocols/${protoName}.cpp
|
||||||
${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp
|
${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp
|
||||||
COMMAND hyprwayland-scanner --client ${path}/${protoName}.xml ${CMAKE_SOURCE_DIR}/protocols/
|
COMMAND hyprwayland-scanner --client ${path}/${protoName}.xml
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
${CMAKE_SOURCE_DIR}/protocols/
|
||||||
)
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
target_sources(aquamarine PRIVATE protocols/${protoName}.cpp protocols/${protoName}.hpp)
|
target_sources(aquamarine PRIVATE protocols/${protoName}.cpp
|
||||||
|
protocols/${protoName}.hpp)
|
||||||
endfunction()
|
endfunction()
|
||||||
function(protocolWayland)
|
function(protocolWayland)
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_SOURCE_DIR}/protocols/wayland.cpp
|
OUTPUT ${CMAKE_SOURCE_DIR}/protocols/wayland.cpp
|
||||||
${CMAKE_SOURCE_DIR}/protocols/wayland.hpp
|
${CMAKE_SOURCE_DIR}/protocols/wayland.hpp
|
||||||
COMMAND hyprwayland-scanner --wayland-enums --client ${WAYLAND_CLIENT_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/
|
COMMAND hyprwayland-scanner --wayland-enums --client
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
${WAYLAND_CLIENT_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/
|
||||||
)
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
target_sources(aquamarine PRIVATE protocols/wayland.cpp protocols/wayland.hpp)
|
target_sources(aquamarine PRIVATE protocols/wayland.cpp protocols/wayland.hpp)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
protocolWayland()
|
protocolwayland()
|
||||||
|
|
||||||
protocolNew("stable/xdg-shell" "xdg-shell" false)
|
protocolnew("stable/xdg-shell" "xdg-shell" false)
|
||||||
protocolNew("stable/linux-dmabuf" "linux-dmabuf-v1" false)
|
protocolnew("stable/linux-dmabuf" "linux-dmabuf-v1" false)
|
||||||
|
|
||||||
# Generate hwdata info
|
# Generate hwdata info
|
||||||
pkg_get_variable(HWDATA_DIR hwdata pkgdatadir)
|
pkg_get_variable(HWDATA_DIR hwdata pkgdatadir)
|
||||||
message(STATUS "Running ${CMAKE_SOURCE_DIR}/data/hwdata.sh < ${HWDATA_DIR}/pnp.ids")
|
message(
|
||||||
|
STATUS "Running ${CMAKE_SOURCE_DIR}/data/hwdata.sh < ${HWDATA_DIR}/pnp.ids")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND /bin/sh -c "${CMAKE_SOURCE_DIR}/data/hwdata.sh < ${HWDATA_DIR}/pnp.ids"
|
COMMAND /bin/sh -c
|
||||||
|
"${CMAKE_SOURCE_DIR}/data/hwdata.sh < ${HWDATA_DIR}/pnp.ids"
|
||||||
RESULT_VARIABLE HWDATA_PNP_RESULT
|
RESULT_VARIABLE HWDATA_PNP_RESULT
|
||||||
OUTPUT_VARIABLE HWDATA_PNP_IDS
|
OUTPUT_VARIABLE HWDATA_PNP_IDS ENCODING UTF8)
|
||||||
ENCODING UTF8
|
|
||||||
)
|
|
||||||
|
|
||||||
if (NOT HWDATA_PNP_RESULT MATCHES 0)
|
if(NOT HWDATA_PNP_RESULT MATCHES 0)
|
||||||
message(WARNING "hwdata gathering pnps failed")
|
message(WARNING "hwdata gathering pnps failed")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -123,10 +125,14 @@ add_custom_target(tests)
|
||||||
|
|
||||||
add_executable(simpleWindow "tests/SimpleWindow.cpp")
|
add_executable(simpleWindow "tests/SimpleWindow.cpp")
|
||||||
target_link_libraries(simpleWindow PRIVATE PkgConfig::deps aquamarine)
|
target_link_libraries(simpleWindow PRIVATE PkgConfig::deps aquamarine)
|
||||||
add_test(NAME "simpleWindow" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests COMMAND simpleWindow "simpleWindow")
|
add_test(
|
||||||
|
NAME "simpleWindow"
|
||||||
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests
|
||||||
|
COMMAND simpleWindow "simpleWindow")
|
||||||
add_dependencies(tests simpleWindow)
|
add_dependencies(tests simpleWindow)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
install(TARGETS aquamarine)
|
install(TARGETS aquamarine)
|
||||||
install(DIRECTORY "include/aquamarine" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
install(DIRECTORY "include/aquamarine" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/aquamarine.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
install(FILES ${CMAKE_BINARY_DIR}/aquamarine.pc
|
||||||
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||||
|
|
Loading…
Reference in a new issue