mirror of
https://github.com/bdnugget/xautoclick.git
synced 2026-11-07 09:17:31 +00:00
Make libevdev and x11 optional dependencies...
...but at least one have to be satisfied for build
This commit is contained in:
1 parent
444efa1521
commit
3f4a0d3fd5
3 files changed
+50
-13
No files matched your search
+17
-4
@@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
project(xautoclick VERSION 0.34)
|
||||
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
check_include_file("unistd.h" HAVE_UNISTD)
|
||||
if(${HAVE_UNISTD})
|
||||
@@ -11,20 +9,35 @@ if(${HAVE_UNISTD})
|
||||
# TODO add_compile_definitions(HAVE_UNISTD_H)
|
||||
endif()
|
||||
|
||||
find_package(X11)
|
||||
if(X11_FOUND)
|
||||
add_library(x11clicker STATIC
|
||||
x11clicker.c
|
||||
x11clicker.h
|
||||
)
|
||||
target_link_libraries(x11clicker ${X11_LIBRARIES} ${X11_XTest_LIB})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_X11_CLICKER")
|
||||
list(APPEND CLICKERS x11clicker)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(LIBEVDEV libevdev)
|
||||
if(LIBEVDEV_FOUND)
|
||||
add_library(udevclicker STATIC
|
||||
udevclicker.c
|
||||
udevclicker.h
|
||||
)
|
||||
target_include_directories(udevclicker PRIVATE ${LIBEVDEV_INCLUDE_DIRS})
|
||||
target_link_libraries(udevclicker ${LIBEVDEV_LIBRARIES})
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_UDEV_CLICKER")
|
||||
list(APPEND CLICKERS udevclicker)
|
||||
endif(LIBEVDEV_FOUND)
|
||||
endif(PKG_CONFIG_FOUND)
|
||||
|
||||
if(NOT clickers)
|
||||
message(FATAL_ERROR "No clicker engines could be built.")
|
||||
endif()
|
||||
|
||||
add_library(clicker STATIC
|
||||
clicker.c
|
||||
@@ -37,7 +50,7 @@ add_library(clicker STATIC
|
||||
options.h
|
||||
osdep.h
|
||||
)
|
||||
target_link_libraries(clicker udevclicker x11clicker)
|
||||
target_link_libraries(clicker ${CLICKERS})
|
||||
|
||||
add_executable(aautoclick
|
||||
guiascii.c
|
||||
|
||||
@@ -26,19 +26,31 @@ Currently, xAutoClick has GUI front-ends for X11/CLI, X11/FLTK, X11/GTK+ 3.0 and
|
||||
|
||||
## Compilation
|
||||
|
||||
### Dependencies
|
||||
|
||||
Dependency | Debian / Ubuntu
|
||||
-- | --
|
||||
CMake | `cmake`
|
||||
CMake | `cmake`
|
||||
|
||||
At least one of clicker engines
|
||||
|
||||
X11 clicker engine | Debian / Ubuntu
|
||||
-- | --
|
||||
libxtst | `libxtst-dev`
|
||||
|
||||
Udev clicker engine | Debian / Ubuntu
|
||||
-- | --
|
||||
libevdev | `libevdev-dev`
|
||||
libxtst | `libxtst-dev`
|
||||
pkg-config | `pkgconf` or `pkg-config`
|
||||
|
||||
Optional | Debian / Ubuntu
|
||||
Optional GUI | Debian / Ubuntu
|
||||
-- | --
|
||||
FLTK | `libfltk1.3-dev`
|
||||
GTK3 | `libgtk-3-dev`
|
||||
Qt5 | `qtbase5-dev`
|
||||
|
||||
### Build
|
||||
|
||||
To prepare, run:
|
||||
|
||||
```sh
|
||||
@@ -53,6 +65,16 @@ To build if all is fine (at least one GUI must be set to yes), run:
|
||||
cmake --build .
|
||||
```
|
||||
|
||||
### Install
|
||||
|
||||
To install, run:
|
||||
|
||||
```sh
|
||||
sudo cmake --build . --target install
|
||||
```
|
||||
|
||||
### Run
|
||||
|
||||
To run without installation, use one of compiled executables in `./build` according to:
|
||||
|
||||
GUI | Executable
|
||||
@@ -63,12 +85,6 @@ FLTK | `fltkautoclick`
|
||||
GTK | `gautoclick3`
|
||||
Qt | `qt5autoclick`
|
||||
|
||||
To install, run:
|
||||
|
||||
```sh
|
||||
sudo cmake --build . --target install
|
||||
```
|
||||
|
||||
## Authors
|
||||
|
||||
Core, ASCII, GTK1, GTK2, QT3, QT4, FLTK, Command Line, build system: [Ivo van Poorten](https://github.com/ivop) <ivop@euronet.nl> <ivop@free.fr>
|
||||
|
||||
@@ -21,8 +21,12 @@
|
||||
|
||||
#include "clicker.h"
|
||||
|
||||
#ifdef HAVE_UDEV_CLICKER
|
||||
#include "udevclicker.h"
|
||||
#endif
|
||||
#ifdef HAVE_X11_CLICKER
|
||||
#include "x11clicker.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -39,8 +43,12 @@ static clicker_t* clicker_create(clicker_type_t type) {
|
||||
return NULL;
|
||||
|
||||
switch (type) {
|
||||
#ifdef HAVE_UDEV_CLICKER
|
||||
case CLICKER_UDEV: udev_clicker_init(clicker); break;
|
||||
#endif
|
||||
#ifdef HAVE_X11_CLICKER
|
||||
case CLICKER_X11: x11_clicker_init(clicker); break;
|
||||
#endif
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user