forked from quickshell/quickshell
build: find waylandscanner and qtwaylandscanner from imported target
Removes the QTWAYLANDSCANNER env hack.
This commit is contained in:
parent
23f59ec4c3
commit
89d04f34a5
|
@ -65,8 +65,6 @@
|
||||||
++ lib.optional withPam pam
|
++ lib.optional withPam pam
|
||||||
++ lib.optional withPipewire pipewire;
|
++ lib.optional withPipewire pipewire;
|
||||||
|
|
||||||
QTWAYLANDSCANNER = lib.optionalString withWayland "${qt6.qtwayland}/libexec/qtwaylandscanner";
|
|
||||||
|
|
||||||
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
|
cmakeBuildType = if debug then "Debug" else "RelWithDebInfo";
|
||||||
|
|
||||||
cmakeFlags = [
|
cmakeFlags = [
|
||||||
|
|
|
@ -21,7 +21,6 @@ in pkgs.mkShell.override { stdenv = quickshell.stdenv; } {
|
||||||
];
|
];
|
||||||
|
|
||||||
TIDYFOX = "${tidyfox}/lib/libtidyfox.so";
|
TIDYFOX = "${tidyfox}/lib/libtidyfox.so";
|
||||||
QTWAYLANDSCANNER = quickshell.QTWAYLANDSCANNER;
|
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
|
export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
|
||||||
|
|
|
@ -1,25 +1,17 @@
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
find_package(WaylandScanner REQUIRED)
|
||||||
pkg_check_modules(wayland REQUIRED IMPORTED_TARGET wayland-client wayland-protocols)
|
pkg_check_modules(wayland REQUIRED IMPORTED_TARGET wayland-client wayland-protocols)
|
||||||
|
|
||||||
find_package(Qt6 REQUIRED COMPONENTS WaylandClient)
|
|
||||||
|
|
||||||
# wayland protocols
|
# wayland protocols
|
||||||
|
|
||||||
if (DEFINED ENV{QTWAYLANDSCANNER})
|
if(NOT TARGET Wayland::Scanner)
|
||||||
set(qtwaylandscanner $ENV{QTWAYLANDSCANNER})
|
message(FATAL_ERROR "Wayland::Scanner target not found. You might be missing the WaylandScanner CMake package.")
|
||||||
else()
|
|
||||||
find_program(qtwaylandscanner NAMES qtwaylandscanner)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (qtwaylandscanner STREQUAL "qtwaylandscanner-NOTFOUND")
|
if(NOT TARGET Qt6::qtwaylandscanner)
|
||||||
message(FATAL_ERROR "qtwaylandscanner not found. Set the QTWAYLANDSCANNER environment variable to specify its path explicity.")
|
message(FATAL_ERROR "qtwaylandscanner executable not found. Most likely there is an issue with your Qt installation.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "Found qtwaylandscanner at ${qtwaylandscanner}")
|
|
||||||
|
|
||||||
find_program(waylandscanner NAMES wayland-scanner)
|
|
||||||
message(STATUS "Found wayland-scanner at ${waylandscanner}")
|
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND pkg-config --variable=pkgdatadir wayland-protocols
|
COMMAND pkg-config --variable=pkgdatadir wayland-protocols
|
||||||
OUTPUT_VARIABLE WAYLAND_PROTOCOLS
|
OUTPUT_VARIABLE WAYLAND_PROTOCOLS
|
||||||
|
@ -32,14 +24,38 @@ function (wl_proto target name path)
|
||||||
set(PROTO_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR}/wl-proto/${name})
|
set(PROTO_BUILD_PATH ${CMAKE_CURRENT_BINARY_DIR}/wl-proto/${name})
|
||||||
make_directory(${PROTO_BUILD_PATH})
|
make_directory(${PROTO_BUILD_PATH})
|
||||||
|
|
||||||
execute_process(COMMAND ${waylandscanner} client-header ${path} ${PROTO_BUILD_PATH}/wayland-${name}-client-protocol.h)
|
set(WS_CLIENT_HEADER "${PROTO_BUILD_PATH}/wayland-${name}-client-protocol.h")
|
||||||
execute_process(COMMAND ${waylandscanner} private-code ${path} ${PROTO_BUILD_PATH}/wayland-${name}.c)
|
set(WS_CLIENT_CODE "${PROTO_BUILD_PATH}/wayland-${name}.c")
|
||||||
execute_process(COMMAND ${qtwaylandscanner} client-header ${path} OUTPUT_FILE ${PROTO_BUILD_PATH}/qwayland-${name}.h)
|
set(QWS_CLIENT_HEADER "${PROTO_BUILD_PATH}/qwayland-${name}.h")
|
||||||
execute_process(COMMAND ${qtwaylandscanner} client-code ${path} OUTPUT_FILE ${PROTO_BUILD_PATH}/qwayland-${name}.cpp)
|
set(QWS_CLIENT_CODE "${PROTO_BUILD_PATH}/qwayland-${name}.cpp")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${WS_CLIENT_HEADER}"
|
||||||
|
COMMAND Wayland::Scanner client-header "${path}" "${WS_CLIENT_HEADER}"
|
||||||
|
DEPENDS Wayland::Scanner "${path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${WS_CLIENT_CODE}"
|
||||||
|
COMMAND Wayland::Scanner private-code "${path}" "${WS_CLIENT_CODE}"
|
||||||
|
DEPENDS Wayland::Scanner "${path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${QWS_CLIENT_HEADER}"
|
||||||
|
COMMAND Qt6::qtwaylandscanner client-header "${path}" > "${QWS_CLIENT_HEADER}"
|
||||||
|
DEPENDS Qt6::qtwaylandscanner "${path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${QWS_CLIENT_CODE}"
|
||||||
|
COMMAND Qt6::qtwaylandscanner client-code "${path}" > "${QWS_CLIENT_CODE}"
|
||||||
|
DEPENDS Qt6::qtwaylandscanner "${path}"
|
||||||
|
)
|
||||||
|
|
||||||
add_library(wl-proto-${name}
|
add_library(wl-proto-${name}
|
||||||
${PROTO_BUILD_PATH}/wayland-${name}.c
|
${WS_CLIENT_HEADER} ${WS_CLIENT_CODE}
|
||||||
${PROTO_BUILD_PATH}/qwayland-${name}.cpp
|
${QWS_CLIENT_HEADER} ${QWS_CLIENT_CODE}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(wl-proto-${name} INTERFACE ${PROTO_BUILD_PATH})
|
target_include_directories(wl-proto-${name} INTERFACE ${PROTO_BUILD_PATH})
|
||||||
|
|
Loading…
Reference in a new issue