@@ -34,6 +34,7 @@ if(NOT HYPR_SHADER_GEN_RESULT EQUAL 0)
3434endif ()
3535
3636find_package (PkgConfig REQUIRED )
37+ find_package (Python3 COMPONENTS Interpreter QUIET )
3738
3839# Try to find canihavesomecoffee's udis86 using pkgconfig vmd/udis86 does not
3940# provide a .pc file and won't be detected this way
@@ -268,7 +269,8 @@ pkg_check_modules(
268269 gio-2.0
269270 re2
270271 muparser
271- lcms2 )
272+ lcms2
273+ lua55 )
272274
273275find_package (hyprwayland-scanner 0.3.10 REQUIRED )
274276
@@ -437,6 +439,28 @@ endif()
437439
438440# used by `make installheaders`, to ensure the headers are generated
439441add_custom_target (generate-protocol-headers )
442+
443+ if (Python3_Interpreter_FOUND)
444+ add_custom_target (
445+ generate-lua-stubs ALL
446+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR } /meta/generateLuaStubs.py --root ${CMAKE_SOURCE_DIR }
447+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR }
448+ COMMENT "Generating Lua API stubs for LuaLS"
449+ VERBATIM )
450+
451+ add_dependencies (hyprland_lib generate-lua-stubs )
452+ add_dependencies (Hyprland generate-lua-stubs )
453+
454+ add_custom_target (
455+ check-lua-stubs
456+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR } /meta/generateLuaStubs.py --root ${CMAKE_SOURCE_DIR } --check
457+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR }
458+ COMMENT "Checking Lua API stubs are up to date"
459+ VERBATIM )
460+ else ()
461+ message (FATAL_ERROR "Python3 interpreter not found, which is required for the build" )
462+ endif ()
463+
440464set (PROTOCOL_SOURCES "" )
441465
442466function (protocolnew protoPath protoName external )
@@ -605,6 +629,10 @@ install(FILES ${INSTALLABLE_ASSETS}
605629install (FILES ${CMAKE_SOURCE_DIR } /example/hyprland.conf
606630 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /hypr)
607631
632+ # LuaLS stubs
633+ install (FILES ${CMAKE_SOURCE_DIR } /meta/hl.meta.lua
634+ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /hypr/stubs)
635+
608636# portal config
609637install (FILES ${CMAKE_SOURCE_DIR } /assets/hyprland-portals.conf
610638 DESTINATION ${CMAKE_INSTALL_DATAROOTDIR} /xdg-desktop-portal)
0 commit comments