mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-10-29 21:41:37 +00:00
CMake: install files (instead of Makefile)
This commit is contained in:
parent
03ebad3cbf
commit
99aa34db6e
71
CMakeLists.txt
Executable file → Normal file
71
CMakeLists.txt
Executable file → Normal file
@ -1,5 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.27)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(ExternalProject)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Get version
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS)
|
||||
@ -12,6 +15,7 @@ project(Hyprland
|
||||
|
||||
set(HYPRLAND_VERSION ${VER})
|
||||
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
configure_file(hyprland.pc.in hyprland.pc @ONLY)
|
||||
|
||||
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
|
||||
@ -23,8 +27,6 @@ message(STATUS "Gathering git info")
|
||||
execute_process(
|
||||
COMMAND ./scripts/generateVersion.sh
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
#
|
||||
#
|
||||
|
||||
# udis
|
||||
add_subdirectory("subprojects/udis86")
|
||||
@ -32,8 +34,6 @@ add_subdirectory("subprojects/udis86")
|
||||
# wlroots
|
||||
message(STATUS "Setting up wlroots")
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILDTYPE_LOWER)
|
||||
if(BUILDTYPE_LOWER STREQUAL "release")
|
||||
@ -112,7 +112,7 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET
|
||||
hyprwayland-scanner>=0.3.4 hyprlang>=0.3.2 hyprcursor>=0.1.7
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||
file(GLOB_RECURSE SRCFILES "src/*.cpp")
|
||||
|
||||
set(TRACY_CPP_FILES "")
|
||||
if(USE_TRACY)
|
||||
@ -287,3 +287,64 @@ protocolNew("staging/ext-session-lock/ext-session-lock-v1.xml" "ext-session-lock
|
||||
# tools
|
||||
add_subdirectory(hyprctl)
|
||||
add_subdirectory(hyprpm)
|
||||
|
||||
# binary and symlink
|
||||
install(TARGETS Hyprland)
|
||||
|
||||
install(CODE "execute_process( \
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink \
|
||||
${CMAKE_INSTALL_BINDIR}/Hyprland \
|
||||
${CMAKE_INSTALL_BINDIR}/hyprland
|
||||
)"
|
||||
)
|
||||
|
||||
# session file
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/wayland-sessions)
|
||||
|
||||
# wallpapers
|
||||
file(GLOB_RECURSE WALLPAPERS "assets/wall*")
|
||||
install(FILES ${WALLPAPERS}
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/hyprland)
|
||||
|
||||
# default config
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.conf
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/hyprland)
|
||||
|
||||
# portal config
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/assets/hyprland-portals.conf
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/xdg-desktop-portal)
|
||||
|
||||
# man pages
|
||||
file(GLOB_RECURSE MANPAGES "docs/*.1")
|
||||
install(FILES ${MANPAGES}
|
||||
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
|
||||
|
||||
# pkgconfig entry
|
||||
install(FILES ${CMAKE_BINARY_DIR}/hyprland.pc
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
|
||||
|
||||
# wlroots headers
|
||||
set(HEADERS_WLR "${CMAKE_CURRENT_SOURCE_DIR}/subprojects/wlroots-hyprland/include/wlr")
|
||||
install(DIRECTORY ${HEADERS_WLR}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
||||
# config.h and version.h
|
||||
set(HEADERS_WLR_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/subprojects/wlroots-hyprland/build/include/wlr")
|
||||
install(DIRECTORY ${HEADERS_WLR_ROOT}/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland/wlr
|
||||
FILES_MATCHING PATTERN "*.h")
|
||||
|
||||
# protocol headers
|
||||
set(HEADERS_PROTO "${CMAKE_CURRENT_SOURCE_DIR}/protocols")
|
||||
install(DIRECTORY ${HEADERS_PROTO}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
|
||||
# hyprland headers
|
||||
set(HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
install(DIRECTORY ${HEADERS_SRC}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland
|
||||
FILES_MATCHING PATTERN "*.h*")
|
||||
|
63
Makefile
63
Makefile
@ -2,27 +2,27 @@ PREFIX = /usr/local
|
||||
|
||||
legacyrenderer:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --build ./build --config Release --target all
|
||||
chmod -R 777 ./build
|
||||
|
||||
legacyrendererdebug:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --build ./build --config Release --target all
|
||||
chmod -R 777 ./build
|
||||
|
||||
release:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --build ./build --config Release --target all
|
||||
chmod -R 777 ./build
|
||||
|
||||
debug:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --build ./build --config Debug --target all
|
||||
chmod -R 777 ./build
|
||||
|
||||
nopch:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --build ./build --config Release --target all
|
||||
|
||||
clear:
|
||||
rm -rf build
|
||||
@ -30,58 +30,14 @@ clear:
|
||||
rm -rf ./subprojects/wlroots-hyprland/build
|
||||
|
||||
all:
|
||||
@if [[ "$EUID" = 0 ]]; then echo -en "Avoid running $(MAKE) all as sudo.\n"; fi
|
||||
$(MAKE) clear
|
||||
$(MAKE) release
|
||||
|
||||
install:
|
||||
@if [ ! -f ./build/Hyprland ]; then echo -en "You need to run $(MAKE) all first.\n" && exit 1; fi
|
||||
@echo -en "!NOTE: Please note make install does not compile Hyprland and only installs the already built files."
|
||||
|
||||
mkdir -p ${PREFIX}/share/wayland-sessions
|
||||
mkdir -p ${PREFIX}/bin
|
||||
mkdir -p ${PREFIX}/share/hyprland
|
||||
mkdir -p ${PREFIX}/share/bash-completion/completions
|
||||
mkdir -p ${PREFIX}/share/fish/vendor_completions.d
|
||||
mkdir -p ${PREFIX}/share/zsh/site-functions
|
||||
cp -f ./build/Hyprland ${PREFIX}/bin
|
||||
cp -f ./build/hyprctl/hyprctl ${PREFIX}/bin
|
||||
cp -f ./build/hyprpm/hyprpm ${PREFIX}/bin
|
||||
cp -f ./hyprctl/hyprctl.bash ${PREFIX}/share/bash-completion/completions/hyprctl
|
||||
cp -f ./hyprctl/hyprctl.fish ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish
|
||||
cp -f ./hyprctl/hyprctl.zsh ${PREFIX}/share/zsh/site-functions/_hyprctl
|
||||
cp -f ./hyprpm/hyprpm.bash ${PREFIX}/share/bash-completion/completions/hyprpm
|
||||
cp -f ./hyprpm/hyprpm.fish ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish
|
||||
cp -f ./hyprpm/hyprpm.zsh ${PREFIX}/share/zsh/site-functions/_hyprpm
|
||||
chmod 755 ${PREFIX}/bin/Hyprland
|
||||
chmod 755 ${PREFIX}/bin/hyprctl
|
||||
chmod 755 ${PREFIX}/bin/hyprpm
|
||||
cd ${PREFIX}/bin && ln -sf Hyprland hyprland
|
||||
if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi
|
||||
cp ./assets/wall* ${PREFIX}/share/hyprland
|
||||
mkdir -p ${PREFIX}/share/xdg-desktop-portal
|
||||
cp ./assets/hyprland-portals.conf ${PREFIX}/share/xdg-desktop-portal
|
||||
|
||||
mkdir -p ${PREFIX}/share/man/man1
|
||||
install -m644 ./docs/*.1 ${PREFIX}/share/man/man1
|
||||
|
||||
$(MAKE) installheaders
|
||||
cmake --install ./build
|
||||
|
||||
uninstall:
|
||||
rm -f ${PREFIX}/share/wayland-sessions/hyprland.desktop
|
||||
rm -f ${PREFIX}/bin/Hyprland
|
||||
rm -f ${PREFIX}/bin/hyprland
|
||||
rm -f ${PREFIX}/bin/hyprctl
|
||||
rm -f ${PREFIX}/bin/hyprpm
|
||||
rm -rf ${PREFIX}/share/hyprland
|
||||
rm -f ${PREFIX}/share/man/man1/Hyprland.1
|
||||
rm -f ${PREFIX}/share/man/man1/hyprctl.1
|
||||
rm -f ${PREFIX}/share/bash-completion/completions/hyprctl
|
||||
rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish
|
||||
rm -f ${PREFIX}/share/zsh/site-functions/_hyprctl
|
||||
rm -f ${PREFIX}/share/bash-completion/completions/hyprpm
|
||||
rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish
|
||||
rm -f ${PREFIX}/share/zsh/site-functions/_hyprpm
|
||||
xargs rm < ./build/install_manifest.txt
|
||||
|
||||
pluginenv:
|
||||
@echo -en "$(MAKE) pluginenv has been deprecated.\nPlease run $(MAKE) all && sudo $(MAKE) installheaders\n"
|
||||
@ -95,7 +51,7 @@ installheaders:
|
||||
mkdir -p ${PREFIX}/include/hyprland/protocols
|
||||
mkdir -p ${PREFIX}/include/hyprland/wlroots-hyprland
|
||||
mkdir -p ${PREFIX}/share/pkgconfig
|
||||
|
||||
|
||||
find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
|
||||
cd subprojects/wlroots-hyprland/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots-hyprland && cd ../../..
|
||||
cd subprojects/wlroots-hyprland/build/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots-hyprland && cd ../../../..
|
||||
@ -143,8 +99,7 @@ asan:
|
||||
|
||||
patch -p1 < ./scripts/hyprlandStaticAsan.diff
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_ASAN:STRING=True -DUSE_TRACY:STRING=False -DUSE_TRACY_GPU:STRING=False -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --build ./build --config Debug --target all
|
||||
@echo "Hyprland done"
|
||||
|
||||
ASAN_OPTIONS="detect_odr_violation=0,log_path=asan.log" HYPRLAND_NO_CRASHREPORTER=1 ./build/Hyprland -c ~/.config/hypr/hyprland.conf
|
||||
|
||||
|
@ -5,4 +5,17 @@ project(
|
||||
DESCRIPTION "Control utility for Hyprland"
|
||||
)
|
||||
|
||||
add_executable(hyprctl "main.cpp")
|
||||
add_executable(hyprctl "main.cpp")
|
||||
|
||||
# binary
|
||||
install(TARGETS hyprctl)
|
||||
|
||||
# shell completions
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.bash
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
|
||||
RENAME hyprctl)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.fish
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/fish/vendor_completions.d)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.zsh
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
|
||||
RENAME _hyprctl)
|
||||
|
@ -1,8 +1,8 @@
|
||||
prefix="@PREFIX@"
|
||||
includedir="${prefix}/include"
|
||||
prefix=@PREFIX@
|
||||
includedir=@INCLUDEDIR@
|
||||
|
||||
Name: Hyprland
|
||||
URL: https://github.com/hyprwm/Hyprland
|
||||
Description: Hyprland header files
|
||||
Version: @HYPRLAND_VERSION@
|
||||
Cflags: -I"${includedir}/hyprland/protocols" -I"${includedir}/hyprland/wlroots-hyprland" -I"${includedir}"
|
||||
Cflags: -I${includedir} -I${includedir}/hyprland/protocols -I${includedir}/hyprland
|
||||
|
@ -14,3 +14,16 @@ pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus)
|
||||
add_executable(hyprpm ${SRCFILES})
|
||||
|
||||
target_link_libraries(hyprpm PUBLIC PkgConfig::tomlplusplus)
|
||||
|
||||
# binary
|
||||
install(TARGETS hyprpm)
|
||||
|
||||
# shell completions
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.bash
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
|
||||
RENAME hyprpm)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.fish
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/fish/vendor_completions.d)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.zsh
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
|
||||
RENAME _hyprpm)
|
||||
|
Loading…
Reference in New Issue
Block a user