Skip to content

Commit

Permalink
core: add --version and improve --help
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Sep 21, 2024
1 parent a8ebdcb commit 15932f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ else()
message(STATUS "Configuring XDPH in Release with CMake")
endif()

add_compile_definitions(XDPH_VERSION="${VER}")

include_directories(. "protocols/")

# configure
Expand Down
14 changes: 9 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
#include "core/PortalManager.hpp"

void printHelp() {
std::cout << R"#(| xdg-desktop-portal-hyprland
| --------------------------------------
| -v (--verbose) > enable trace logging
| -q (--quiet) > disable logging
| -h (--help) > print this menu
std::cout << R"#(┃ xdg-desktop-portal-hyprland
┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
┃ -v (--verbose) → enable trace logging
┃ -q (--quiet) → disable logging
┃ -h (--help) → print this menu
┃ -V (--version) → print xdph's version
)#";
}

Expand All @@ -27,6 +28,9 @@ int main(int argc, char** argv, char** envp) {
else if (arg == "--help" || arg == "-h") {
printHelp();
return 0;
} else if (arg == "--version" || arg == "-V") {
std::cout << "xdg-desktop-portal-hyprland v" << XDPH_VERSION << "\n";
return 0;
} else {
printHelp();
return 1;
Expand Down

1 comment on commit 15932f0

@MarkusVolk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this commit I see this error in spa (gcc 14.2.0, pipewire 1.2.4)

| In file included from poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/builder.h:25, | from ../git/src/shared/ScreencopyShared.hpp:6, | from ../git/src/shared/ScreencopyShared.cpp:1: | ../git/src/shared/ScreencopyShared.cpp: In function 'spa_pod* fixate_format(spa_pod_builder*, spa_video_format, uint32_t, uint32_t, uint32_t, uint64_t*)': | poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:100:60: warning: taking address of rvalue [-fpermissive] | 100 | #define SPA_RECTANGLE(width,height) ((struct spa_rectangle){ (width), (height) }) | | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:66:61: note: in definition of macro 'SPA_POD_Rectangle' | 66 | #define SPA_POD_Rectangle(val) "R",val | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:248:70: note: in expansion of macro 'SPA_RECTANGLE' | 248 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&SPA_RECTANGLE(width, height)), 0); | | ^~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:71:61: note: in definition of macro 'SPA_POD_Fraction' | 71 | #define SPA_POD_Fraction(val) "F",val | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:250:74: note: in expansion of macro 'SPA_FRACTION' | 250 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&SPA_FRACTION(0, 1)), 0); | | ^~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:27:60: note: in definition of macro 'SPA_CHOICE_RANGE' | 27 | #define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max) | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:251:59: note: in expansion of macro 'SPA_POD_CHOICE_RANGE_Fraction' | 251 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ../git/src/shared/ScreencopyShared.cpp:251:90: note: in expansion of macro 'SPA_FRACTION' | 251 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:27:66: note: in definition of macro 'SPA_CHOICE_RANGE' | 27 | #define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max) | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:251:59: note: in expansion of macro 'SPA_POD_CHOICE_RANGE_Fraction' | 251 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ../git/src/shared/ScreencopyShared.cpp:251:119: note: in expansion of macro 'SPA_FRACTION' | 251 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:27:72: note: in definition of macro 'SPA_CHOICE_RANGE' | 27 | #define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max) | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:251:59: note: in expansion of macro 'SPA_POD_CHOICE_RANGE_Fraction' | 251 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ../git/src/shared/ScreencopyShared.cpp:251:140: note: in expansion of macro 'SPA_FRACTION' | 251 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~ | ../git/src/shared/ScreencopyShared.cpp: In function 'spa_pod* build_format(spa_pod_builder*, spa_video_format, uint32_t, uint32_t, uint32_t, uint64_t*, int)': | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:100:60: warning: taking address of rvalue [-fpermissive] | 100 | #define SPA_RECTANGLE(width,height) ((struct spa_rectangle){ (width), (height) }) | | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:66:61: note: in definition of macro 'SPA_POD_Rectangle' | 66 | #define SPA_POD_Rectangle(val) "R",val | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:285:70: note: in expansion of macro 'SPA_RECTANGLE' | 285 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&SPA_RECTANGLE(width, height)), 0); | | ^~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:71:61: note: in definition of macro 'SPA_POD_Fraction' | 71 | #define SPA_POD_Fraction(val) "F",val | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:287:74: note: in expansion of macro 'SPA_FRACTION' | 287 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&SPA_FRACTION(0, 1)), 0); | | ^~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:27:60: note: in definition of macro 'SPA_CHOICE_RANGE' | 27 | #define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max) | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:288:59: note: in expansion of macro 'SPA_POD_CHOICE_RANGE_Fraction' | 288 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ../git/src/shared/ScreencopyShared.cpp:288:90: note: in expansion of macro 'SPA_FRACTION' | 288 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:27:66: note: in definition of macro 'SPA_CHOICE_RANGE' | 27 | #define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max) | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:288:59: note: in expansion of macro 'SPA_POD_CHOICE_RANGE_Fraction' | 288 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ../git/src/shared/ScreencopyShared.cpp:288:119: note: in expansion of macro 'SPA_FRACTION' | 288 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/utils/defs.h:118:55: warning: taking address of rvalue [-fpermissive] | 118 | #define SPA_FRACTION(num,denom) ((struct spa_fraction){ (num), (denom) }) | | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ | /home/flk/poky/build/tmp/work/corei7-64-poky-linux/xdg-desktop-portal-hyprland/1.3.5/recipe-sysroot/usr/include/spa-0.2/spa/pod/vararg.h:27:72: note: in definition of macro 'SPA_CHOICE_RANGE' | 27 | #define SPA_CHOICE_RANGE(def,min,max) 3,(def),(min),(max) | | ^~~ | ../git/src/shared/ScreencopyShared.cpp:288:59: note: in expansion of macro 'SPA_POD_CHOICE_RANGE_Fraction' | 288 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ../git/src/shared/ScreencopyShared.cpp:288:140: note: in expansion of macro 'SPA_FRACTION' | 288 | spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate, SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(framerate, 1), &SPA_FRACTION(1, 1), &SPA_FRACTION(framerate, 1)), 0); | | ^~~~~~~~~~~~

Please sign in to comment.