-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Touch: Make detection into a library
Split the detection script into a library to allow other apps to cleanly use it. Also add optional Conan support.
- Loading branch information
1 parent
cf0a151
commit ce77102
Showing
30 changed files
with
359 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
touch-detect/build/debug/bin/touch-detect usr/lib/debug/usr/bin/ | ||
touch-detect/build/debug/lib/*.so usr/lib/debug/usr/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
touch-detect/include/* usr/include/ | ||
touch-detect/build/release/lib/*.a usr/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
touch-detect/touch-detect usr/bin/ | ||
touch-detect/*.sh usr/share/kano-peripherals/scripts/ | ||
conf/xorg.conf.d/* usr/share/kano-peripherals/xorg.conf.d/ | ||
touch-detect/build/release/bin/touch-detect usr/bin/ | ||
touch-detect/build/release/lib/*.so usr/lib/ | ||
touch-detect/scripts/*.sh usr/share/kano-peripherals/scripts/ | ||
touch-detect/conf/xorg.conf.d/* usr/share/kano-peripherals/xorg.conf.d/ | ||
touch-detect/conf/etc/* etc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
project(TouchDetect CXX) | ||
|
||
if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
endif() | ||
|
||
|
||
if (APPLE) # OS X | ||
set(LINK_LIBS "") | ||
set(PLATFORM_SRC lib/platforms/macosx) | ||
elseif (UNIX AND NOT APPLE) # Linux | ||
set(LINK_LIBS X11 Xi) | ||
set(PLATFORM_SRC lib/platforms/linux) | ||
endif() | ||
|
||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) | ||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib) | ||
|
||
|
||
add_library(touch_detect_lib SHARED | ||
${PLATFORM_SRC}/touch_detect.cpp | ||
) | ||
target_link_libraries(touch_detect_lib ${LINK_LIBS}) | ||
set_target_properties(touch_detect_lib PROPERTIES OUTPUT_NAME "touch_detect") | ||
target_include_directories(touch_detect_lib PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
|
||
|
||
add_library(touch_detect_lib_static STATIC | ||
${PLATFORM_SRC}/touch_detect.cpp | ||
) | ||
target_link_libraries(touch_detect_lib_static ${LINK_LIBS}) | ||
set_target_properties(touch_detect_lib_static PROPERTIES OUTPUT_NAME "touch_detect") | ||
target_include_directories(touch_detect_lib_static PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> | ||
$<INSTALL_INTERFACE:include> | ||
) | ||
|
||
|
||
add_executable(touch_detect | ||
src/main.cpp | ||
) | ||
set_target_properties(touch_detect PROPERTIES OUTPUT_NAME "touch-detect") | ||
target_link_libraries(touch_detect | ||
touch_detect_lib | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
all: debug release | ||
|
||
release: | ||
mkdir -p build/release | ||
cd build/release && cmake -DCMAKE_BUILD_TYPE=Release ../.. && make | ||
|
||
debug: | ||
mkdir -p build/debug | ||
cd build/debug && cmake -DCMAKE_BUILD_TYPE=Debug ../.. && make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Touch Detect | ||
|
||
## Building | ||
|
||
Create the build directory | ||
|
||
``` | ||
mkdir -p build | ||
cd build | ||
``` | ||
|
||
(Optional) Install dependencies with `conan` (otherwise ensure that you have | ||
the dependencies available to the build system) | ||
|
||
``` | ||
conan install .. | ||
``` | ||
|
||
Build | ||
|
||
``` | ||
cmake .. | ||
make | ||
``` | ||
|
||
## Conan (Experimental) | ||
|
||
This package has been created to be (optionally) shipped with a conan package, | ||
hence you can do an operation like: | ||
|
||
``` | ||
cd build | ||
conan create .. KanoComputing/stable | ||
``` | ||
|
||
This can then be pushed to the artifactory and used as a dependency of another | ||
project. | ||
|
||
To use this package, make sure that your `conanfile.txt` looks like this | ||
|
||
``` | ||
[requires] | ||
touch-detect/4.2.0@KanoComputing/stable | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# conanfile.py | ||
# | ||
# Copyright (C) 2018 Kano Computing Ltd. | ||
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPL v2 | ||
# | ||
# Specifies the touch-detect package for Conan | ||
# | ||
|
||
|
||
from conans import ConanFile, CMake | ||
|
||
|
||
class TouchdetectConan(ConanFile): | ||
name = "touch-detect" | ||
version = "4.2.0" | ||
license = "<Put the package license here>" | ||
url = "<Package recipe repository url here, for issues about the package>" | ||
description = "<Description of Touchdetect here>" | ||
settings = "os", "compiler", "build_type", "arch" | ||
options = {"shared": [True, False]} | ||
default_options = "shared=False" | ||
generators = "cmake" | ||
exports_sources = "src/*", "lib/*", "include/*", "CMakeLists.txt" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure(source_folder="") | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy("*.h", dst="include", src="include") | ||
self.copy("*.lib", dst="lib", keep_path=False) | ||
self.copy("*.dll", dst="bin", keep_path=False) | ||
self.copy("*.dylib*", dst="lib", keep_path=False) | ||
self.copy("*.so", dst="lib", keep_path=False) | ||
self.copy("*.a", dst="lib", keep_path=False) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["touch_detect"] | ||
|
||
def deploy(self): | ||
self.copy("*.h") | ||
self.copy("*.lib") | ||
self.copy("*.dll") | ||
self.copy("*.dylib*") | ||
self.copy("*.so") | ||
self.copy("*.a") |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* touch_detect.h | ||
* | ||
* Copyright (C) 2018 Kano Computing Ltd. | ||
* License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2 | ||
* | ||
* vim: filetype=cpp | ||
* | ||
* Detect if a touch device is present | ||
* | ||
*/ | ||
|
||
|
||
#pragma once | ||
|
||
|
||
namespace Kano | ||
{ | ||
namespace TouchDetect | ||
{ | ||
bool isTouchSupported(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* touch_detect.cpp | ||
* | ||
* Copyright (C) 2018 Kano Computing Ltd. | ||
* License: http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2 | ||
* | ||
* Detect if a touch device is present | ||
* | ||
*/ | ||
|
||
|
||
#include <Kano/TouchDetect/touch_detect.h> | ||
|
||
#include <iostream> | ||
|
||
|
||
bool Kano::TouchDetect::isTouchSupported() { | ||
std::cout << "Not implemented for OSX, returning true\n"; | ||
return true; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.