diff --git a/FlippR-Driver/CMakeLists.txt b/FlippR-Driver/CMakeLists.txt index 9608a45..a7b3b92 100644 --- a/FlippR-Driver/CMakeLists.txt +++ b/FlippR-Driver/CMakeLists.txt @@ -46,6 +46,8 @@ ENDIF(CROSS_COMPILE) cmake_minimum_required(VERSION 3.0.1) project(FlippR-Driver VERSION 0.1.0)# LANGUAGES CXX) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + #set easylogging flags add_definitions(-DELPP_NO_DEFAULT_LOG_FILE) diff --git a/FlippR-Driver/cmake/CXX1x.cmake b/FlippR-Driver/cmake/CXX1x.cmake new file mode 100644 index 0000000..5f48eb7 --- /dev/null +++ b/FlippR-Driver/cmake/CXX1x.cmake @@ -0,0 +1,81 @@ +# Copyright (c) 2013 Nathan Osman + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Determines whether the compiler supports C++11 +macro(check_for_cxx11_compiler _VAR) + message(STATUS "Checking for C++11 compiler") + set(${_VAR}) + try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON) + if(NOT _COMPILER_TEST_RESULT AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON) + if(_COMPILER_TEST_RESULT) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + else() + message(STATUS "To enable C++11 install libc++ standard library from https://libcxx.llvm.org/") + endif() + endif() + if(_COMPILER_TEST_RESULT AND ((MSVC AND (MSVC10 OR MSVC11 OR MSVC12 OR MSVC14)) OR + (CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.8.1) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.3) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))) + set(${_VAR} 1) + message(STATUS "Checking for C++11 compiler - available") + else() + message(STATUS "Checking for C++11 compiler - unavailable") + endif() +endmacro() + +# Sets the appropriate flag to enable C++11 support +macro(enable_cxx11) + set (CMAKE_CXX_STANDARD 11) + set (CMAKE_CXX_STANDARD_REQUIRED ON) + add_definitions(-DPOCO_ENABLE_CPP11) +endmacro() + +# Determines whether the compiler supports C++14 +macro(check_for_cxx14_compiler _VAR) + message(STATUS "Checking for C++14 compiler") + set(${_VAR}) + try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=ON) + if(NOT _COMPILER_TEST_RESULT AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + try_compile(_COMPILER_TEST_RESULT ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/test_compiler.cpp CMAKE_FLAGS -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=14 -DCMAKE_CXX_STANDARD_REQUIRED=ON) + if(_COMPILER_TEST_RESULT) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + else() + message(STATUS "To enable C++14 install libc++ standard library from https://libcxx.llvm.org/") + endif() + endif() + if(_COMPILER_TEST_RESULT AND ((MSVC AND (MSVC14)) OR + (CMAKE_COMPILER_IS_GNUCXX AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4.9.2) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND NOT ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.4) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"))) + set(${_VAR} 1) + message(STATUS "Checking for C++14 compiler - available") + else() + message(STATUS "Checking for C++14 compiler - unavailable") + endif() +endmacro() + +# Sets the appropriate flag to enable C++14 support +macro(enable_cxx14) + set (CMAKE_CXX_STANDARD 14) + set (CMAKE_CXX_STANDARD_REQUIRED ON) + add_definitions(-DPOCO_ENABLE_CPP14) +endmacro() diff --git a/FlippR-Driver/cmake/DefinePlatformSpecifc.cmake b/FlippR-Driver/cmake/DefinePlatformSpecifc.cmake new file mode 100644 index 0000000..b296405 --- /dev/null +++ b/FlippR-Driver/cmake/DefinePlatformSpecifc.cmake @@ -0,0 +1,132 @@ +# http://www.cmake.org/Wiki/CMake_Useful_Variables : +# CMAKE_BUILD_TYPE +# Choose the type of build. CMake has default flags for these: +# +# * None (CMAKE_C_FLAGS or CMAKE_CXX_FLAGS used) +# * Debug (CMAKE_C_FLAGS_DEBUG or CMAKE_CXX_FLAGS_DEBUG) +# * Release (CMAKE_C_FLAGS_RELEASE or CMAKE_CXX_FLAGS_RELEASE) +# * RelWithDebInfo (CMAKE_C_FLAGS_RELWITHDEBINFO or CMAKE_CXX_FLAGS_RELWITHDEBINFO +# * MinSizeRel (CMAKE_C_FLAGS_MINSIZEREL or CMAKE_CXX_FLAGS_MINSIZEREL) + +# Setting CXX Flag /MD or /MT and POSTFIX values i.e MDd / MD / MTd / MT / d +# +# For visual studio the library naming is as following: +# Dynamic libraries: +# - PocoX.dll for release library +# - PocoXd.dll for debug library +# +# Static libraries: +# - PocoXmd.lib for /MD release build +# - PocoXtmt.lib for /MT release build +# +# - PocoXmdd.lib for /MD debug build +# - PocoXmtd.lib for /MT debug build + +if(MSVC) + if(POCO_MT) + set(CompilerFlags + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_RELEASE + CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_RELEASE + ) + foreach(CompilerFlag ${CompilerFlags}) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") + endforeach() + + set(STATIC_POSTFIX "mt" CACHE STRING "Set static library postfix" FORCE) + else(POCO_MT) + set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE) + endif(POCO_MT) + + if (ENABLE_MSVC_MP) + add_definitions(/MP) + endif() + +else(MSVC) + # Other compilers then MSVC don't have a static STATIC_POSTFIX at the moment + set(STATIC_POSTFIX "" CACHE STRING "Set static library postfix" FORCE) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") +endif(MSVC) + + + +# Add a d postfix to the debug libraries +if(POCO_STATIC) + set(CMAKE_DEBUG_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set Debug library postfix" FORCE) + set(CMAKE_RELEASE_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set Release library postfix" FORCE) + set(CMAKE_MINSIZEREL_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set MinSizeRel library postfix" FORCE) + set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) +else(POCO_STATIC) + set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set Debug library postfix" FORCE) + set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set Release library postfix" FORCE) + set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "Set MinSizeRel library postfix" FORCE) + set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "Set RelWithDebInfo library postfix" FORCE) +endif() + + +# OS Detection +include(CheckTypeSize) +find_package(Cygwin) + +if(WIN32) + add_definitions( -DPOCO_OS_FAMILY_WINDOWS -DUNICODE -D_UNICODE -D__LCC__) #__LCC__ define used by MySQL.h +endif(WIN32) + +if (CYGWIN) + add_definitions(-DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING) + add_definitions(-D_XOPEN_SOURCE=500 -D__BSD_VISIBLE) +else (CYGWIN) + if (UNIX AND NOT ANDROID ) + add_definitions( -DPOCO_OS_FAMILY_UNIX ) + # Standard 'must be' defines + if (APPLE) + add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_STAT64) + set(SYSLIBS ${CMAKE_DL_LIBS}) + else (APPLE) + add_definitions( -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ) + if (QNX) + add_definitions( -DPOCO_HAVE_FD_POLL) + set(SYSLIBS m socket) + else (QNX) + add_definitions( -D_XOPEN_SOURCE=500) + if (${CMAKE_SYSTEM} MATCHES "AIX") + add_definitions( -DPOCO_HAVE_FD_POLL) + else() + add_definitions( -DPOCO_HAVE_FD_EPOLL) + endif() + set(SYSLIBS pthread ${CMAKE_DL_LIBS} rt) + endif (QNX) + endif (APPLE) + endif(UNIX AND NOT ANDROID ) +endif (CYGWIN) + +if (CMAKE_SYSTEM MATCHES "SunOS") + add_definitions( -DPOCO_OS_FAMILY_UNIX ) + # Standard 'must be' defines + add_definitions( -D_XOPEN_SOURCE=500 -D_REENTRANT -D_THREAD_SAFE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 ) + set(SYSLIBS pthread socket xnet nsl resolv rt ${CMAKE_DL_LIBS}) +endif(CMAKE_SYSTEM MATCHES "SunOS") + +if (CMAKE_COMPILER_IS_MINGW) + add_definitions(-DWC_NO_BEST_FIT_CHARS=0x400 -DPOCO_WIN32_UTF8) + add_definitions(-D_WIN32 -DMINGW32 -DWINVER=0x500 -DODBCVER=0x0300 -DPOCO_THREAD_STACK_SIZE) +endif (CMAKE_COMPILER_IS_MINGW) + +# SunPro C++ +if (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") + add_definitions( -D_BSD_SOURCE -library=stlport4) +endif (${CMAKE_CXX_COMPILER_ID} MATCHES "SunPro") + +# iOS +if (IOS) + add_definitions( -DPOCO_HAVE_IPv6 -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_STAT64 -DPOCO_NO_SHAREDLIBS -DPOCO_NO_NET_IFTYPES ) +endif(IOS) + +#Android +if (ANDROID) + add_definitions( -DPOCO_NO_FPENVIRONMENT -DPOCO_NO_WSTRING -DPOCO_NO_SHAREDMEMORY ) +endif(ANDROID) diff --git a/FlippR-Driver/cmake/ExecuteOnAndroid.cmake b/FlippR-Driver/cmake/ExecuteOnAndroid.cmake new file mode 100644 index 0000000..e944c23 --- /dev/null +++ b/FlippR-Driver/cmake/ExecuteOnAndroid.cmake @@ -0,0 +1,29 @@ + +get_filename_component(UNITTEST_FILENAME ${UNITTEST} NAME) +message(STATUS "Cleanup /data/local/tmp ...") +execute_process(COMMAND ${ANDROID_NDK}/../platform-tools/adb shell "rm -r /data/local/tmp/*" OUTPUT_QUIET) +foreach(_TEST_DATA IN ITEMS ${TEST_FILES}) + message(STATUS "Push ${_TEST_DATA} to android ...") + execute_process(COMMAND ${ANDROID_NDK}/../platform-tools/adb push ${_TEST_DATA} /data/local/tmp/ OUTPUT_QUIET) +endforeach() +message(STATUS "Push ${LIBRARY_DIR} to android ...") +execute_process(COMMAND ${ANDROID_NDK}/../platform-tools/adb push ${LIBRARY_DIR} /data/local/tmp/ OUTPUT_QUIET) +message(STATUS "Push ${UNITTEST} to android ...") +execute_process(COMMAND ${ANDROID_NDK}/../platform-tools/adb push ${UNITTEST} /data/local/tmp/ OUTPUT_QUIET) +message(STATUS "Execute ${UNITTEST_FILENAME} ${TEST_PARAMETER} on android ...") +execute_process( + COMMAND ${ANDROID_NDK}/../platform-tools/adb shell "cd /data/local/tmp;su root sh -c 'LD_LIBRARY_PATH=/data/local/tmp/lib TMPDIR=/data/local/tmp HOME=/data/local/tmp ./${UNITTEST_FILENAME} ${TEST_PARAMETER};echo exit code $?'" + RESULT_VARIABLE _RESULT + OUTPUT_VARIABLE _OUT + ERROR_VARIABLE _ERR +) + +if(_RESULT) + message(FATAL_ERROR "Execution of ${UNITTEST_FILENAME} failed") +else() + string(REGEX MATCH "exit code ([0-9]+)" _EXIT_CODE ${_OUT}) + if(NOT "${CMAKE_MATCH_1}" EQUAL 0) + string(REGEX REPLACE "exit code [0-9]+" "" _PRINT_OUT ${_OUT}) + message(FATAL_ERROR "${UNITTEST_FILENAME} execution error: ${_PRINT_OUT} ${_ERR}") + endif() +endif() diff --git a/FlippR-Driver/cmake/FindAPR.cmake b/FlippR-Driver/cmake/FindAPR.cmake new file mode 100644 index 0000000..3a7a11c --- /dev/null +++ b/FlippR-Driver/cmake/FindAPR.cmake @@ -0,0 +1,94 @@ +# -*- cmake -*- + +# - Find Apache Portable Runtime +# Find the APR includes and libraries +# This module defines +# APR_INCLUDE_DIR and APRUTIL_INCLUDE_DIR, where to find apr.h, etc. +# APR_LIBRARIES and APRUTIL_LIBRARIES, the libraries needed to use APR. +# APR_FOUND and APRUTIL_FOUND, If false, do not try to use APR. +# also defined, but not for general use are +# APR_LIBRARY and APRUTIL_LIBRARY, where to find the APR library. + +# APR first. + +FIND_PATH(APR_INCLUDE_DIR apr.h +/usr/local/include/apr-1 +/usr/local/include/apr-1.0 +/usr/include/apr-1 +/usr/include/apr-1.0 +) + +SET(APR_NAMES ${APR_NAMES} apr-1) +FIND_LIBRARY(APR_LIBRARY + NAMES ${APR_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (APR_LIBRARY AND APR_INCLUDE_DIR) + SET(APR_LIBRARIES ${APR_LIBRARY}) + SET(APR_FOUND "YES") +ELSE (APR_LIBRARY AND APR_INCLUDE_DIR) + SET(APR_FOUND "NO") +ENDIF (APR_LIBRARY AND APR_INCLUDE_DIR) + + +IF (APR_FOUND) + IF (NOT APR_FIND_QUIETLY) + MESSAGE(STATUS "Found APR: ${APR_LIBRARIES}") + ENDIF (NOT APR_FIND_QUIETLY) +ELSE (APR_FOUND) + IF (APR_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find APR library") + ENDIF (APR_FIND_REQUIRED) +ENDIF (APR_FOUND) + +# Deprecated declarations. +SET (NATIVE_APR_INCLUDE_PATH ${APR_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_APR_LIB_PATH ${APR_LIBRARY} PATH) + +MARK_AS_ADVANCED( + APR_LIBRARY + APR_INCLUDE_DIR + ) + +# Next, APRUTIL. + +FIND_PATH(APRUTIL_INCLUDE_DIR apu.h +/usr/local/include/apr-1 +/usr/local/include/apr-1.0 +/usr/include/apr-1 +/usr/include/apr-1.0 +) + +SET(APRUTIL_NAMES ${APRUTIL_NAMES} aprutil-1) +FIND_LIBRARY(APRUTIL_LIBRARY + NAMES ${APRUTIL_NAMES} + PATHS /usr/lib /usr/local/lib + ) + +IF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + SET(APRUTIL_LIBRARIES ${APRUTIL_LIBRARY}) + SET(APRUTIL_FOUND "YES") +ELSE (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + SET(APRUTIL_FOUND "NO") +ENDIF (APRUTIL_LIBRARY AND APRUTIL_INCLUDE_DIR) + + +IF (APRUTIL_FOUND) + IF (NOT APRUTIL_FIND_QUIETLY) + MESSAGE(STATUS "Found APRUTIL: ${APRUTIL_LIBRARIES}") + ENDIF (NOT APRUTIL_FIND_QUIETLY) +ELSE (APRUTIL_FOUND) + IF (APRUTIL_FIND_REQUIRED) + MESSAGE(STATUS "Could not find APRUTIL library") + ENDIF (APRUTIL_FIND_REQUIRED) +ENDIF (APRUTIL_FOUND) + +# Deprecated declarations. +SET (NATIVE_APRUTIL_INCLUDE_PATH ${APRUTIL_INCLUDE_DIR} ) +GET_FILENAME_COMPONENT (NATIVE_APRUTIL_LIB_PATH ${APRUTIL_LIBRARY} PATH) + +MARK_AS_ADVANCED( + APRUTIL_LIBRARY + APRUTIL_INCLUDE_DIR + ) diff --git a/FlippR-Driver/cmake/FindApache2.cmake b/FlippR-Driver/cmake/FindApache2.cmake new file mode 100644 index 0000000..ea1dd02 --- /dev/null +++ b/FlippR-Driver/cmake/FindApache2.cmake @@ -0,0 +1,31 @@ +# -*- cmake -*- + +# - Find Apache Runtime +# Find the APACHE includes and libraries +# This module defines +# APACHE_INCLUDE_DIR and APACHEUTIL_INCLUDE_DIR, where to find APACHE.h, etc. +# APACHE_LIBRARIES and APACHEUTIL_LIBRARIES, the libraries needed to use APACHE. +# APACHE_FOUND and APACHEUTIL_FOUND, If false, do not try to use APACHE. +# also defined, but not for general use are +# APACHE_LIBRARY and APACHEUTIL_LIBRARY, where to find the APACHE library. + +FIND_PATH(APACHE_INCLUDE_DIR httpd.h +/usr/local/include/apache2 +/usr/include/apache2 +) + +IF (APACHE_INCLUDE_DIR) + SET(APACHE_FOUND "YES") +ELSE (APACHE_LIBRARY AND APACHE_INCLUDE_DIR) + SET(APACHE_FOUND "NO") +ENDIF (APACHE_INCLUDE_DIR) + + +IF (APACHE_FOUND) + MESSAGE(STATUS "Found APACHE: ${APACHE_INCLUDE_DIR}") +ENDIF (APACHE_FOUND) + +MARK_AS_ADVANCED( + APACHE_INCLUDE_DIR + ) + diff --git a/FlippR-Driver/cmake/FindMySQL.cmake b/FlippR-Driver/cmake/FindMySQL.cmake new file mode 100644 index 0000000..7499723 --- /dev/null +++ b/FlippR-Driver/cmake/FindMySQL.cmake @@ -0,0 +1,94 @@ +SET(BINDIR32_ENV_NAME "ProgramFiles(x86)") +SET(BINDIR32 $ENV{${BINDIR32_ENV_NAME}}) + +find_path(MYSQL_INCLUDE_DIR mysql.h + /usr/include/mysql + /usr/local/include/mysql + /opt/mysql/mysql/include + /opt/mysql/mysql/include/mysql + /usr/local/mysql/include + /usr/local/mysql/include/mysql + $ENV{MYSQL_INCLUDE_DIR} + $ENV{MYSQL_DIR}/include + $ENV{ProgramFiles}/MySQL/*/include + ${BINDIR32}/MySQL/include + $ENV{SystemDrive}/MySQL/*/include) + +if (NOT MYSQL_INCLUDE_DIR) + find_path(MARIADB_INCLUDE_DIR mysql.h + /usr/include/mariadb + /usr/local/include/mariadb + /opt/mariadb/mariadb/include + /opt/mariadb/mariadb/include/mariadb + /usr/local/mariadb/include + /usr/local/mariadb/include/mariadb + $ENV{MARIADB_INCLUDE_DIR} + $ENV{MARIADB_DIR}/include) +endif (NOT MYSQL_INCLUDE_DIR) + +if (WIN32) + if (CMAKE_BUILD_TYPE STREQUAL Debug) + set(libsuffixDist debug) + set(libsuffixBuild Debug) + else (CMAKE_BUILD_TYPE STREQUAL Debug) + set(libsuffixDist opt) + set(libsuffixBuild Release) + add_definitions(-DDBUG_OFF) + endif (CMAKE_BUILD_TYPE STREQUAL Debug) + + find_library(MYSQL_LIB NAMES mysqlclient + PATHS + $ENV{MYSQL_DIR}/lib/${libsuffixDist} + $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild} + $ENV{MYSQL_DIR}/client/${libsuffixBuild} + $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist} + ${BINDIR32}/MySQL/lib + $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}) +else (WIN32) + find_library(MYSQL_LIB NAMES mysqlclient mysqlclient_r + PATHS + /usr/lib/mysql + /usr/local/lib/mysql + /usr/local/mysql/lib + /usr/local/mysql/lib/mysql + /opt/mysql/mysql/lib + /opt/mysql/mysql/lib/mysql + $ENV{MYSQL_DIR}/libmysql_r/.libs + $ENV{MYSQL_DIR}/lib + $ENV{MYSQL_DIR}/lib/mysql) + + if (NOT MYSQL_LIB) + find_library(MARIADB_LIB NAMES mariadbclient + PATHS + /usr/lib/mariadb + /usr/local/lib/mariadb + /usr/local/mariadb/lib + /usr/local/mariadb/lib/mariadb + /opt/mariadb/mariadb/lib + /opt/mariadb/mariadb/lib/mariadb + $ENV{MARIADB_DIR}/libmariadb/.libs + $ENV{MARIADB_DIR}/lib + $ENV{MARIADB_DIR}/lib/mariadb) + endif (NOT MYSQL_LIB) +endif (WIN32) + +if (MYSQL_INCLUDE_DIR AND MYSQL_LIB) + get_filename_component(MYSQL_LIB_DIR ${MYSQL_LIB} PATH) + set(MYSQL_FOUND TRUE) + message(STATUS "Found MySQL Include directory: ${MYSQL_INCLUDE_DIR} library directory: ${MYSQL_LIB_DIR}") + include_directories(${MYSQL_INCLUDE_DIR}) + link_directories(${MYSQL_LIB_DIR}) +elseif((MARIADB_INCLUDE_DIR OR MYSQL_INCLUDE_DIR) AND MARIADB_LIB) + get_filename_component(MYSQL_LIB_DIR ${MARIADB_LIB} PATH) + set(MYSQL_FOUND TRUE) + set(MYSQL_LIB ${MARIADB_LIB}) + if(MARIADB_INCLUDE_DIR) + set(MYSQL_INCLUDE_DIR ${MARIADB_INCLUDE_DIR}) + endif(MARIADB_INCLUDE_DIR) + message(STATUS "Found MariaDB Include directory: ${MYSQL_INCLUDE_DIR} library directory: ${MYSQL_LIB_DIR}") + message(STATUS "Use MariaDB for MySQL Support") + include_directories(${MYSQL_INCLUDE_DIR} ) + link_directories(${MYSQL_LIB_DIR}) +else ((MARIADB_INCLUDE_DIR OR MYSQL_INCLUDE_DIR) AND MARIADB_LIB) + message(STATUS "Couldn't find MySQL or MariaDB") +endif (MYSQL_INCLUDE_DIR AND MYSQL_LIB) diff --git a/FlippR-Driver/cmake/FindODBC.cmake b/FlippR-Driver/cmake/FindODBC.cmake new file mode 100644 index 0000000..b655b02 --- /dev/null +++ b/FlippR-Driver/cmake/FindODBC.cmake @@ -0,0 +1,61 @@ +# +# Find the ODBC driver manager includes and library. +# +# ODBC is an open standard for connecting to different databases in a +# semi-vendor-independent fashion. First you install the ODBC driver +# manager. Then you need a driver for each separate database you want +# to connect to (unless a generic one works). VTK includes neither +# the driver manager nor the vendor-specific drivers: you have to find +# those yourself. +# +# This module defines +# ODBC_INCLUDE_DIRECTORIES, where to find sql.h +# ODBC_LIBRARIES, the libraries to link against to use ODBC +# ODBC_FOUND. If false, you cannot build anything that requires MySQL. + +find_path(ODBC_INCLUDE_DIRECTORIES + NAMES sql.h + HINTS + /usr/include + /usr/include/odbc + /usr/include/iodbc + /usr/local/include + /usr/local/include/odbc + /usr/local/include/iodbc + /usr/local/odbc/include + /usr/local/iodbc/include + "C:/Program Files/ODBC/include" + "C:/Program Files/Microsoft SDKs/Windows/v7.0/include" + "C:/Program Files/Microsoft SDKs/Windows/v6.0a/include" + "C:/ODBC/include" + DOC "Specify the directory containing sql.h." +) + +find_library(ODBC_LIBRARIES + NAMES iodbc odbc odbcinst odbc32 + HINTS + /usr/lib + /usr/lib/odbc + /usr/local/lib + /usr/local/lib/odbc + /usr/local/odbc/lib + "C:/Program Files/ODBC/lib" + "C:/ODBC/lib/debug" + "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Lib" + DOC "Specify the ODBC driver manager library here." +) + +# MinGW find usually fails +if(MINGW) + set(ODBC_INCLUDE_DIRECTORIES ".") + set(ODBC_LIBRARIES odbc32) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ODBC + DEFAULT_MSG + ODBC_INCLUDE_DIRECTORIES + ODBC_LIBRARIES + ) + +mark_as_advanced(ODBC_FOUND ODBC_LIBRARIES ODBC_INCLUDE_DIRECTORIES) diff --git a/FlippR-Driver/cmake/FindPCRE.cmake b/FlippR-Driver/cmake/FindPCRE.cmake new file mode 100644 index 0000000..41a99cb --- /dev/null +++ b/FlippR-Driver/cmake/FindPCRE.cmake @@ -0,0 +1,33 @@ +# +# - Find pcre +# Find the native PCRE includes and library +# +# PCRE_INCLUDE_DIRS - where to find pcre.h, etc. +# PCRE_LIBRARIES - List of libraries when using pcre. +# PCRE_FOUND - True if pcre found. + + +IF (PCRE_INCLUDE_DIRS) + # Already in cache, be silent + SET(PCRE_FIND_QUIETLY TRUE) +ENDIF (PCRE_INCLUDE_DIRS) + +FIND_PATH(PCRE_INCLUDE_DIR pcre.h) + +SET(PCRE_NAMES pcre) +FIND_LIBRARY(PCRE_LIBRARY NAMES ${PCRE_NAMES} ) + +# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY PCRE_INCLUDE_DIR) + +IF(PCRE_FOUND) + SET( PCRE_LIBRARIES ${PCRE_LIBRARY} ) + SET( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} ) +ELSE(PCRE_FOUND) + SET( PCRE_LIBRARIES ) + SET( PCRE_INCLUDE_DIRS ) +ENDIF(PCRE_FOUND) + +MARK_AS_ADVANCED( PCRE_LIBRARIES PCRE_INCLUDE_DIRS ) diff --git a/FlippR-Driver/cmake/FindPostgreSQL.cmake b/FlippR-Driver/cmake/FindPostgreSQL.cmake new file mode 100644 index 0000000..6c383f0 --- /dev/null +++ b/FlippR-Driver/cmake/FindPostgreSQL.cmake @@ -0,0 +1,66 @@ +# - Find libpq +# Find the native PostgreSQL includes and library +# +# PGSQL_INCLUDE_DIR - where to find libpq-fe.h, etc. +# PGSQL_LIBRARIES - List of libraries when using PGSQL. +# PGSQL_FOUND - True if PGSQL found. + +MACRO(FIND_PGSQL) +IF (PGSQL_INCLUDE_DIR) + # Already in cache, be silent + SET(PostgreSQL_FIND_QUIETLY TRUE) +ENDIF (PGSQL_INCLUDE_DIR) + +FIND_PATH(PGSQL_INCLUDE_DIR libpq-fe.h + $ENV{ProgramFiles}/PostgreSQL/*/include + $ENV{SystemDrive}/PostgreSQL/*/include + /usr/local/pgsql/include + /usr/local/postgresql/include + /usr/local/include/pgsql + /usr/local/include/postgresql + /usr/local/include + /usr/include/pgsql + /usr/include/postgresql + /usr/include + /usr/pgsql/include + /usr/postgresql/include +) + +SET(PGSQL_NAMES pq libpq) +SET(PGSQL_SEARCH_LIB_PATHS + ${PGSQL_SEARCH_LIB_PATHS} + $ENV{ProgramFiles}/PostgreSQL/*/lib + $ENV{SystemDrive}/PostgreSQL/*/lib + /usr/local/pgsql/lib + /usr/local/lib + /usr/lib +) +FIND_LIBRARY(PGSQL_LIBRARY + NAMES ${PGSQL_NAMES} + PATHS ${PGSQL_SEARCH_LIB_PATHS} +) + +IF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY) + SET(PGSQL_FOUND TRUE) + SET( PGSQL_LIBRARIES ${PGSQL_LIBRARY} ) +ELSE (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY) + SET(PGSQL_FOUND FALSE) + SET( PGSQL_LIBRARIES ) +ENDIF (PGSQL_INCLUDE_DIR AND PGSQL_LIBRARY) + +IF (PGSQL_FOUND) + IF (NOT PostgreSQL_FIND_QUIETLY) + MESSAGE(STATUS "Found PostgreSQL: ${PGSQL_LIBRARY}") + ENDIF (NOT PostgreSQL_FIND_QUIETLY) +ELSE (PGSQL_FOUND) + IF (PostgreSQL_FIND_REQUIRED) + MESSAGE(STATUS "Looked for PostgreSQL libraries named ${PGSQL_NAMES}.") + MESSAGE(FATAL_ERROR "Could NOT find PostgreSQL library") + ENDIF (PostgreSQL_FIND_REQUIRED) +ENDIF (PGSQL_FOUND) + +MARK_AS_ADVANCED( + PGSQL_LIBRARY + PGSQL_INCLUDE_DIR +) +ENDMACRO(FIND_PGSQL) \ No newline at end of file diff --git a/FlippR-Driver/cmake/FindSQLite3.cmake b/FlippR-Driver/cmake/FindSQLite3.cmake new file mode 100644 index 0000000..aa650e3 --- /dev/null +++ b/FlippR-Driver/cmake/FindSQLite3.cmake @@ -0,0 +1,87 @@ +# - Try to find Sqlite3 +# Once done this will define +# +# SQLITE3_FOUND - system has Sqlite3 +# SQLITE3_INCLUDE_DIRS - the Sqlite3 include directory +# SQLITE3_LIBRARIES - Link these to use Sqlite3 +# SQLITE3_DEFINITIONS - Compiler switches required for using Sqlite3 +# +# Copyright (c) 2008 Andreas Schneider +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + + +if (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS) + # in cache already + set(SQLITE3_FOUND TRUE) +else (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + include(UsePkgConfig) + pkgconfig(sqlite3 _SQLITE3_INCLUDEDIR _SQLITE3_LIBDIR _SQLITE3_LDFLAGS _SQLITE3_CFLAGS) + else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(_SQLITE3 sqlite3) + endif (PKG_CONFIG_FOUND) + endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4) + find_path(SQLITE3_INCLUDE_DIR + NAMES + sqlite3.h + PATHS + ${_SQLITE3_INCLUDEDIR} + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + + find_library(SQLITE3_LIBRARY + NAMES + sqlite3 + PATHS + ${_SQLITE3_LIBDIR} + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + if (SQLITE3_LIBRARY) + set(SQLITE3_FOUND TRUE) + endif (SQLITE3_LIBRARY) + + set(SQLITE3_INCLUDE_DIRS + ${SQLITE3_INCLUDE_DIR} + ) + + if (SQLITE3_FOUND) + set(SQLITE3_LIBRARIES + ${SQLITE3_LIBRARIES} + ${SQLITE3_LIBRARY} + ) + endif (SQLITE3_FOUND) + + if (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES) + set(SQLITE3_FOUND TRUE) + endif (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES) + + if (SQLITE3_FOUND) + if (NOT Sqlite3_FIND_QUIETLY) + message(STATUS "Found Sqlite3: ${SQLITE3_LIBRARIES}") + endif (NOT Sqlite3_FIND_QUIETLY) + else (SQLITE3_FOUND) + if (Sqlite3_FIND_REQUIRED) + message(FATAL_ERROR "Could not find Sqlite3") + endif (Sqlite3_FIND_REQUIRED) + endif (SQLITE3_FOUND) + + # show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view + mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) + +endif (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS) + diff --git a/FlippR-Driver/cmake/PocoConfig.cmake.in b/FlippR-Driver/cmake/PocoConfig.cmake.in new file mode 100644 index 0000000..173eacd --- /dev/null +++ b/FlippR-Driver/cmake/PocoConfig.cmake.in @@ -0,0 +1,53 @@ +if (CMAKE_VERSION VERSION_LESS 2.8.9) + message(FATAL_ERROR "Poco requires at least CMake version 2.8.9") +endif() + +if (NOT Poco_FIND_COMPONENTS) + set(Poco_NOT_FOUND_MESSAGE "The Poco package requires at least one component") + set(Poco_FOUND False) + return() +endif() + +set(_Poco_FIND_PARTS_REQUIRED) +if (Poco_FIND_REQUIRED) + set(_Poco_FIND_PARTS_REQUIRED REQUIRED) +endif() +set(_Poco_FIND_PARTS_QUIET) +if (Poco_FIND_QUIETLY) + set(_Poco_FIND_PARTS_QUIET QUIET) +endif() + +get_filename_component(_Poco_install_prefix "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE) + +set(_Poco_NOTFOUND_MESSAGE) + +# Let components find each other, but don't overwrite CMAKE_PREFIX_PATH +set(_Poco_CMAKE_PREFIX_PATH_old ${CMAKE_PREFIX_PATH}) +set(CMAKE_PREFIX_PATH ${_Poco_install_prefix}) + +foreach(module ${Poco_FIND_COMPONENTS}) + find_package(Poco${module} + ${_Poco_FIND_PARTS_QUIET} + ${_Poco_FIND_PARTS_REQUIRED} + PATHS "${_Poco_install_prefix}" NO_DEFAULT_PATH + ) + if (NOT Poco${module}_FOUND) + if (Poco_FIND_REQUIRED_${module}) + set(_Poco_NOTFOUND_MESSAGE "${_Poco_NOTFOUND_MESSAGE}Failed to find Poco component \"${module}\" config file at \"${_Poco_install_prefix}/Poco${module}/Poco${module}Config.cmake\"\n") + elseif(NOT Poco_FIND_QUIETLY) + message(WARNING "Failed to find Poco component \"${module}\" config file at \"${_Poco_install_prefix}/Poco${module}/Poco${module}Config.cmake\"") + endif() + endif() + + # For backward compatibility set the LIBRARIES variable + list(APPEND Poco_LIBRARIES "Poco::${module}") +endforeach() + +# Restore the original CMAKE_PREFIX_PATH value +set(CMAKE_PREFIX_PATH ${_Poco_CMAKE_PREFIX_PATH_old}) + +if (_Poco_NOTFOUND_MESSAGE) + set(Poco_NOT_FOUND_MESSAGE "${_Poco_NOTFOUND_MESSAGE}") + set(Poco_FOUND False) +endif() + diff --git a/FlippR-Driver/cmake/PocoConfigVersion.cmake.in b/FlippR-Driver/cmake/PocoConfigVersion.cmake.in new file mode 100644 index 0000000..98f292c --- /dev/null +++ b/FlippR-Driver/cmake/PocoConfigVersion.cmake.in @@ -0,0 +1,11 @@ +set(PACKAGE_VERSION @APPLICATION_VERSION@) + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() diff --git a/FlippR-Driver/cmake/PocoMacros.cmake b/FlippR-Driver/cmake/PocoMacros.cmake new file mode 100644 index 0000000..4490b7b --- /dev/null +++ b/FlippR-Driver/cmake/PocoMacros.cmake @@ -0,0 +1,304 @@ +# Copyright Siemens AG, 2014 +# Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +# and Contributors. +# +# SPDX-License-Identifier: BSL-1.0 +# +# Collection of common functionality for Poco CMake + +# Find the Microsoft mc.exe message compiler +# +# CMAKE_MC_COMPILER - where to find mc.exe +if (WIN32) + # cmake has CMAKE_RC_COMPILER, but no message compiler + if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") + # this path is only present for 2008+, but we currently require PATH to + # be set up anyway + get_filename_component(sdk_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH) + get_filename_component(kit_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot]" REALPATH) + get_filename_component(kit81_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot81]" REALPATH) + get_filename_component(kit10_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH) + get_filename_component(kit10wow_dir "[HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" REALPATH) + file(GLOB kit10_list ${kit10_dir}/bin/10.* ${kit10wow_dir}/bin/10.*) + if (X64) + set(sdk_bindir "${sdk_dir}/bin/x64") + set(kit_bindir "${kit_dir}/bin/x64") + set(kit81_bindir "${kit81_dir}/bin/x64") + foreach (tmp_elem ${kit10_list}) + if (IS_DIRECTORY ${tmp_elem}) + list(APPEND kit10_bindir "${tmp_elem}/x64") + endif() + endforeach() + else (X64) + set(sdk_bindir "${sdk_dir}/bin") + set(kit_bindir "${kit_dir}/bin/x86") + set(kit81_bindir "${kit81_dir}/bin/x86") + foreach (tmp_elem ${kit10_list}) + if (IS_DIRECTORY ${tmp_elem}) + list(APPEND kit10_bindir "${tmp_elem}/x86") + endif() + endforeach() + endif (X64) + endif () + find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} + DOC "path to message compiler") + if (NOT CMAKE_MC_COMPILER) + message(FATAL_ERROR "message compiler not found: required to build") + endif (NOT CMAKE_MC_COMPILER) + message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") + mark_as_advanced(CMAKE_MC_COMPILER) +endif(WIN32) + +#=============================================================================== +# Macros for Source file management +# +# POCO_SOURCES_PLAT - Adds a list of files to the sources of a components +# Usage: POCO_SOURCES_PLAT( out name platform sources) +# INPUT: +# out the variable the sources are added to +# name: the name of the components +# platform: the platform this sources are for (ON = All, OFF = None, WIN32, UNIX ...) +# sources: a list of files to add to ${out} +# Example: POCO_SOURCES_PLAT( SRCS Foundation ON src/Foundation.cpp ) +# +# POCO_SOURCES - Like POCO_SOURCES_PLAT with platform = ON (Built on all platforms) +# Usage: POCO_SOURCES( out name sources) +# Example: POCO_SOURCES( SRCS Foundation src/Foundation.cpp) +# +# POCO_SOURCES_AUTO - Like POCO_SOURCES but the name is read from the file header // Package: X +# Usage: POCO_SOURCES_AUTO( out sources) +# Example: POCO_SOURCES_AUTO( SRCS src/Foundation.cpp) +# +# POCO_SOURCES_AUTO_PLAT - Like POCO_SOURCES_PLAT but the name is read from the file header // Package: X +# Usage: POCO_SOURCES_AUTO_PLAT(out platform sources) +# Example: POCO_SOURCES_AUTO_PLAT( SRCS WIN32 src/Foundation.cpp) +# +# +# POCO_HEADERS - Adds a list of files to the headers of a components +# Usage: POCO_HEADERS( out name headers) +# INPUT: +# out the variable the headers are added to +# name: the name of the components +# headers: a list of files to add to HDRSt +# Example: POCO_HEADERS( HDRS Foundation include/Poco/Foundation.h ) +# +# POCO_HEADERS_AUTO - Like POCO_HEADERS but the name is read from the file header // Package: X +# Usage: POCO_HEADERS_AUTO( out headers) +# Example: POCO_HEADERS_AUTO( HDRS src/Foundation.cpp) +# +# +# POCO_MESSAGES - Adds a list of files to the messages of a components +# and adds the generated headers to the header list of the component. +# On platforms other then Windows this does nothing +# Usage: POCO_MESSAGES( out name messages) +# INPUT: +# out the variable the message and the resulting headers are added to +# name: the name of the components +# messages: a list of files to add to MSGS +# Example: POCO_MESSAGES( HDRS Foundation include/Poco/Foundation.mc ) +# + + +macro(POCO_SOURCES_PLAT out name platform) + source_group("${name}\\Source Files" FILES ${ARGN}) + list(APPEND ${out} ${ARGN}) + if(NOT (${platform})) + set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + endif() +endmacro() + +macro(POCO_SOURCES out name) + POCO_SOURCES_PLAT( ${out} ${name} ON ${ARGN}) +endmacro() + +macro(POCO_SOURCES_AUTO out) + POCO_SOURCES_AUTO_PLAT( ${out} ON ${ARGN}) +endmacro() + +macro(POCO_SOURCES_AUTO_PLAT out platform) + foreach( f ${ARGN}) + + get_filename_component(fname ${f} NAME) + + # Read the package name from the source file + file(STRINGS ${f} package REGEX "// Package: (.*)") + if(package) + string(REGEX REPLACE ".*: (.*)" "\\1" name ${package}) + + # Files of the Form X_UNIX.cpp are treated as headers + if(${fname} MATCHES ".*_.*\\..*") + #message(STATUS "Platform: ${name} ${f} ${platform}") + POCO_SOURCES_PLAT( ${out} ${name} OFF ${f}) + else() + #message(STATUS "Source: ${name} ${f} ${platform}") + POCO_SOURCES_PLAT( ${out} ${name} ${platform} ${f}) + endif() + else() + #message(STATUS "Source: Unknown ${f} ${platform}") + POCO_SOURCES_PLAT( ${out} Unknown ${platform} ${f}) + endif() + endforeach() +endmacro() + + +macro(POCO_HEADERS_AUTO out) + foreach( f ${ARGN}) + + get_filename_component(fname ${f} NAME) + + # Read the package name from the source file + file(STRINGS ${f} package REGEX "// Package: (.*)") + if(package) + string(REGEX REPLACE ".*: (.*)" "\\1" name ${package}) + #message(STATUS "Header: ${name} ${f}") + POCO_HEADERS( ${out} ${name} ${f}) + else() + #message(STATUS "Header: Unknown ${f}") + POCO_HEADERS( ${out} Unknown ${f}) + endif() + endforeach() +endmacro() + +macro(POCO_HEADERS out name) + set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + source_group("${name}\\Header Files" FILES ${ARGN}) + list(APPEND ${out} ${ARGN}) +endmacro() + + +macro(POCO_MESSAGES out name) + if (WIN32) + foreach(msg ${ARGN}) + get_filename_component(msg_name ${msg} NAME) + get_filename_component(msg_path ${msg} ABSOLUTE) + string(REPLACE ".mc" ".h" hdr ${msg_name}) + set_source_files_properties(${hdr} PROPERTIES GENERATED TRUE) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${hdr} + DEPENDS ${msg} + COMMAND ${CMAKE_MC_COMPILER} + ARGS + -h ${CMAKE_CURRENT_BINARY_DIR} + -r ${CMAKE_CURRENT_BINARY_DIR} + ${msg_path} + VERBATIM # recommended: p260 + ) + + # Add the generated file to the include directory + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + + # Add the generated headers to POCO_HEADERS of the component + POCO_HEADERS( ${out} ${name} ${CMAKE_CURRENT_BINARY_DIR}/${hdr}) + + endforeach() + + set_source_files_properties(${ARGN} PROPERTIES HEADER_FILE_ONLY TRUE) + source_group("${name}\\Message Files" FILES ${ARGN}) + list(APPEND ${out} ${ARGN}) + + endif (WIN32) +endmacro() + + +#=============================================================================== +# Macros for Package generation +# +# POCO_GENERATE_PACKAGE - Generates *Config.cmake +# Usage: POCO_GENERATE_PACKAGE(target_name) +# INPUT: +# target_name the name of the target. e.g. Foundation for PocoFoundation +# Example: POCO_GENERATE_PACKAGE(Foundation) +macro(POCO_GENERATE_PACKAGE target_name) +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake" + VERSION ${PROJECT_VERSION} + COMPATIBILITY AnyNewerVersion +) +if ("${CMAKE_VERSION}" VERSION_LESS "3.0.0") + if (NOT EXISTS "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake") + export(TARGETS "${target_name}" APPEND + FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake" + NAMESPACE "${PROJECT_NAME}::" + ) + endif () +else () + export(EXPORT "${target_name}Targets" + FILE "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake" + NAMESPACE "${PROJECT_NAME}::" + ) +endif () +configure_file("cmake/Poco${target_name}Config.cmake" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake" + @ONLY +) + +set(ConfigPackageLocation "lib/cmake/${PROJECT_NAME}") + +install( + EXPORT "${target_name}Targets" + FILE "${PROJECT_NAME}${target_name}Targets.cmake" + NAMESPACE "${PROJECT_NAME}::" + DESTINATION "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}" + ) + +install( + FILES + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake" + "${CMAKE_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake" + DESTINATION "lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}" + COMPONENT Devel + ) + +endmacro() + +#=============================================================================== +# Macros for simplified installation +# +# POCO_INSTALL - Install the given target +# Usage: POCO_INSTALL(target_name) +# INPUT: +# target_name the name of the target. e.g. Foundation for PocoFoundation +# Example: POCO_INSTALL(Foundation) +macro(POCO_INSTALL target_name) +install( + DIRECTORY include/Poco + DESTINATION include + COMPONENT Devel + PATTERN ".svn" EXCLUDE + ) + +install( + TARGETS "${target_name}" EXPORT "${target_name}Targets" + LIBRARY DESTINATION lib${LIB_SUFFIX} + ARCHIVE DESTINATION lib${LIB_SUFFIX} + RUNTIME DESTINATION bin + INCLUDES DESTINATION include + ) + +if (MSVC) +# install the targets pdb + POCO_INSTALL_PDB(${target_name}) +endif() + +endmacro() + +# POCO_INSTALL_PDB - Install the given target's companion pdb file (if present) +# Usage: POCO_INSTALL_PDB(target_name) +# INPUT: +# target_name the name of the target. e.g. Foundation for PocoFoundation +# Example: POCO_INSTALL_PDB(Foundation) +# +# This is an internal macro meant only to be used by POCO_INSTALL. +macro(POCO_INSTALL_PDB target_name) + + get_property(type TARGET ${target_name} PROPERTY TYPE) + if ("${type}" STREQUAL "SHARED_LIBRARY" OR "${type}" STREQUAL "EXECUTABLE") + install( + FILES $ + DESTINATION bin + COMPONENT Devel + OPTIONAL + ) + endif() +endmacro() diff --git a/FlippR-Driver/cmake/README b/FlippR-Driver/cmake/README new file mode 100644 index 0000000..fae4a15 --- /dev/null +++ b/FlippR-Driver/cmake/README @@ -0,0 +1,36 @@ +CMAKE Files contributed by Andrew J. P. Maclean + + +Put the following files in the directory where your source code is: + CMakeLists.txt + PocoConfig.cmake. + +Edit CMakeLists.txt to include your source and header files. The sections of interest are: +# Add any source files here. +SET( EXE_SRCS + "My File.cpp" +) +# Add any include files here. +SET( EXE_INCS + "My File.h" +) + +Then create a subdirectory called build. +In Linux: +cd build +ccmake .. +or +ccmake -GKDevelop3 .. +(This will set up everything so you can use KDevelop3). + +In Windows: +run CMakeSetup.exe and set the source code directory and where to build the libraries. + +If CMake cannot find Poco, you will see that the variable Poco_INCLUDE_DIR has the value Poco_INCLUDE_DIR-NOTFOUND. Just set this value to the top level direcotry of where the Poco includes are. + +If there is a different version of Poco, you may have to add edit the variables SUFFIX_FOR_INCLUDE_PATH, and SUFFIX_FOR_LIBRARY_PATH adding in the new Poco version in a similar manner to the existing ones in the file PocoConfig.cmake. + +Finally: +In Linux + Either type "make" or if you are using KDevelop, click on the .kdevelop file. +In Windows just use your IDE or nmake if you use nmake. diff --git a/FlippR-Driver/cmake/cmake_uninstall.cmake.in b/FlippR-Driver/cmake/cmake_uninstall.cmake.in new file mode 100644 index 0000000..03137d5 --- /dev/null +++ b/FlippR-Driver/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,22 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF("${rm_retval}" STREQUAL 0) + ELSE("${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF("${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) diff --git a/FlippR-Driver/cmake/test_compiler.cpp b/FlippR-Driver/cmake/test_compiler.cpp new file mode 100644 index 0000000..d9b7398 --- /dev/null +++ b/FlippR-Driver/cmake/test_compiler.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main() +{ + std::string str = "Try to compile"; + std::cout << str << '\n'; + return 0; +} diff --git a/FlippR-Driver/contrib/json_example/output/Sound_Config.json b/FlippR-Driver/contrib/json_example/output/Sound_Config.json index ebda109..67b236c 100644 --- a/FlippR-Driver/contrib/json_example/output/Sound_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Sound_Config.json @@ -188,7 +188,162 @@ "address" : "50", "description" : "Speech 1: \"You're good! But I'm still the Champ!\"", "extender" : "extender_0" + }, + { + "id" : 29, + "address" : "51", + "description" : "Speech 2: \"Twenty\"", + "extender" : "extender_0" + }, + { + "id" : 30, + "address" : "52", + "description" : "Speech 3: \"Seconds\"", + "extender" : "extender_0" + }, + { + "id" : 31, + "address" : "53", + "description" : "Speech 4: \"Five, Four, Three, Two, One.\"", + "extender" : "extender_0" + }, + { + "id" : 32, + "address" : "54", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 33, + "address" : "55", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 34, + "address" : "56", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 35, + "address" : "57", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 36, + "address" : "58", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 37, + "address" : "59", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 38, + "address" : "60", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 39, + "address" : "61", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 40, + "address" : "62", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 41, + "address" : "63", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 42, + "address" : "64", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 43, + "address" : "65", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 44, + "address" : "66", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 45, + "address" : "67", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 46, + "address" : "68", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 47, + "address" : "69", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 48, + "address" : "70", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 49, + "address" : "71", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 50, + "address" : "72", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 51, + "address" : "73", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 52, + "address" : "74", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 53, + "address" : "75", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" + }, + { + "id" : 54, + "address" : "76", + "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "extender" : "extender_0" } - ] } diff --git a/FlippR-Driver/networking/CMakeLists.txt b/FlippR-Driver/networking/CMakeLists.txt index b06a041..a67d5cb 100644 --- a/FlippR-Driver/networking/CMakeLists.txt +++ b/FlippR-Driver/networking/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.6.2) project(flippR_driver_networking) -set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/cli/networking) +set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin/networking) set(SOURCES input/InputSocketHandler.cpp output/OutputRequestHandler.cpp diff --git a/FlippR-Driver/networking/FlippRServer.cpp b/FlippR-Driver/networking/FlippRServer.cpp index 9b70795..2fd8697 100644 --- a/FlippR-Driver/networking/FlippRServer.cpp +++ b/FlippR-Driver/networking/FlippRServer.cpp @@ -57,7 +57,7 @@ void FlippRServer::parse_server_config_file() try { - config.open("./server_config.json"); + config.open(this->server_config); } catch(const std::exception e) { @@ -85,6 +85,15 @@ void FlippRServer::parse_server_config_file() config.close(); } +void FlippRServer::uninitialize() +{ + this->output_driver->deactivate_all_lamps(); + this->output_driver->deactivate_displays(); + this->output_server->stop(); + + ServerApplication::uninitialize(); +} + /** * Initially called before main. */ @@ -93,10 +102,14 @@ void FlippRServer::initialize(Application &self) //Todo May restructure with subsystems //make this one application and subsystems ServerApplications - this->initialize_output_driver(); this->initialize_input_driver(); + this->output_server = std::unique_ptr(this->build_output_server()); + this->output_server->start(); + + this->input_server = std::unique_ptr(this->build_input_server()); + //https://gist.github.com/NIPE-SYSTEMS/5a06428c0880ed7ff3cc4304be436e3e ServerApplication::initialize(self); } @@ -162,7 +175,6 @@ int FlippRServer::main(const std::vector& args) this->output_driver->deactivate_all_lamps(); this->output_driver->deactivate_displays(); output_server->stop(); - return Application::EXIT_OK; } @@ -189,8 +201,6 @@ TCPServer* FlippRServer::build_input_server() return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), port); } - - void FlippRServer::defineOptions(OptionSet& options) { ServerApplication::defineOptions(options); @@ -249,6 +259,12 @@ void FlippRServer::defineOptions(OptionSet& options) .repeatable(false) .callback(OptionCallback(this, &FlippRServer::handle_config_file)) .argument("display-config", true)); + + options.addOption(Option("server-config", "s", "Specify where the server-config file is located. Only needed when not in this folder.") + .required(this->display_config == "Not set") + .repeatable(false) + .callback(OptionCallback(this, &FlippRServer::handle_config_file)) + .argument("server-config", true)); } void FlippRServer::handle_config_file(const std::string &name, const std::string &value) @@ -269,6 +285,8 @@ void FlippRServer::handle_config_file(const std::string &name, const std::string this->input_port = std::stoi(value); else if(name == "output-port") this->output_port = std::stoi(value); + else if(name == "server-config") + this->server_config = value; else { logger().information("Configuration \"" + name + "\" is not known."); @@ -298,6 +316,8 @@ std::string FlippRServer::get_runtime_dir() { runtime_dir = DEFAULT_RUNTIME_DIR; } + + return runtime_dir; } } diff --git a/FlippR-Driver/networking/FlippRServer.h b/FlippR-Driver/networking/FlippRServer.h index 743262b..54bfaa3 100644 --- a/FlippR-Driver/networking/FlippRServer.h +++ b/FlippR-Driver/networking/FlippRServer.h @@ -24,6 +24,7 @@ public: int main(const std::vector& args); void initialize(Poco::Util::Application& self); + void uninitialize(); void defineOptions(Poco::Util::OptionSet& options); void handle_help(const std::string &name, const std::string &port); @@ -38,7 +39,6 @@ private: Poco::Net::HTTPServer* build_output_server(); Poco::Net::TCPServer* build_input_server(); - private: const std::string DEFAULT_RUNTIME_DIR = "/tmp/flippR_driver-runtime/"; const std::string SOCKET_NAME = "S.flippR_driver"; @@ -53,9 +53,14 @@ private: std::string solenoid_config; std::string sound_config; std::string display_config; + std::string server_config; std::shared_ptr input_driver; std::shared_ptr output_driver; + + std::unique_ptr output_server; + std::unique_ptr input_server; + }; }; diff --git a/FlippR-Driver/networking/output/OutputRequestHandler.cpp.autosave b/FlippR-Driver/networking/output/OutputRequestHandler.cpp.autosave new file mode 100644 index 0000000..06bd662 --- /dev/null +++ b/FlippR-Driver/networking/output/OutputRequestHandler.cpp.autosave @@ -0,0 +1,261 @@ +// +// Created by rhetenor on 3/6/19. +// + + +#include +#include +#include + +#include + +#include "OutputRequestHandler.h" + +namespace flippR_driver +{ +namespace networking +{ + +using namespace Poco; +using namespace Poco::Net; + +OutputRequestHandler::OutputRequestHandler(std::shared_ptr output_driver) : + output_driver(output_driver) + {} + + /** + * Handles a REST request with a URI form of: + * + * address/{item_type}/[item_name]/[action]/[score] + * + * Where + * {item_type} is either solenoids, lamps, sounds, displays, or one of the two special events: activate and deactivate + * [item_name] is the string name of an item (optional if you want to get the list of all available items) + * [action] is the particular action for the item: + * solenoids: trigger + * lamps: activate, deactivate, status + * sounds: play + * displays: write_score (for this is the additional optional attribute [score] + * + * @param request + * @param response + */ +void OutputRequestHandler::handleRequest(HTTPServerRequest &request, + HTTPServerResponse &response) +{ + auto path_segments = getPathSegments(URI(request.getURI())); + + // fill up vector + for(int i = path_segments.size(); i < 4; i++) + { + path_segments.emplace_back(""); + } + + std::string item_type = path_segments.at(0); + std::string item_name = path_segments.at(1); + std::string action = path_segments.at(2); + std::string score = path_segments.at(3); + + if(item_type == "deactivate") + { + this->output_driver->deactivate_displays(); + this->output_driver->deactivate_all_lamps(); + return; + } + + if(item_type == "activate") + { + this->output_driver->activate_displays(); + return; + } + + response.setContentType("text/json"); + response.setStatus(HTTPServerResponse::HTTP_OK); + + try + { + boost::optional json_response = parseRequest(item_type, item_name, action, score); + if(json_response) + { + std::ostream& ostr = response.send(); + json_response->stringify(ostr); + } + } + catch(const NotFoundException &e) + { + response.setStatusAndReason(HTTPServerResponse::HTTP_NOT_FOUND, e.displayText()); + } + catch(const Poco::InvalidArgumentException &e) + { + response.setStatusAndReason(HTTPServerResponse::HTTP_BAD_REQUEST, e.displayText()); + } +} + +boost::optional OutputRequestHandler::parseRequest(const std::string& item_type, const std::string& item_name, const std::string& action, const std::string& score) +{ + if(item_type == "solenoids") + { + return parseSolenoid(item_name, action); + } + else if(item_type == "lamps") + { + return parseLamp(item_name, action); + } + else if(item_type == "sounds") + { + return parseSound(item_name, action); + } + else if(item_type == "displays") + { + return parseDisplay(item_name, action, score); + } + else + { + throw new Poco::NotFoundException("No item type called " + item_type); + } +} + +boost::optional OutputRequestHandler::parseSolenoid(const std::string& item_name, const std::string& action) +{ + if(item_name == "") + { + Poco::JSON::Object response; + response.set("solenoids", this->output_driver->get_solenoids()); + return response; + } + + auto opt_solenoid = this->output_driver->get_solenoid(item_name); + + if(!opt_solenoid) + { + throw new Poco::NotFoundException("No solenoid with name \"" + item_name + "\"!"); + } + + auto solenoid = opt_solenoid->get(); + + if(action == "trigger") + { + solenoid->trigger(); + } + else + { + throw new Poco::NotFoundException("No action with name \"" + action + "\" on solenoids!"); + } + + return {}; +} + +boost::optional OutputRequestHandler::parseLamp(const std::string& item_name, const std::string& action) +{ + if(item_name == "") + { + Poco::JSON::Object response; + response.set("lamps", this->output_driver->get_lamps()); + return response; + } + + auto opt_lamp = this->output_driver->get_lamp(item_name); + + if(!opt_lamp) + { + throw new Poco::NotFoundException("No lamp with name \"" + item_name + "\"!"); + } + + auto lamp = opt_lamp->get(); + + if(action == "activate") + { + lamp->activate(); + } + else if(action == "deactivate") + { + lamp->deactivate(); + } + else + { + throw new Poco::NotFoundException("No action with name \"" + action + "\" on lamps!"); + } + + return {}; +} + +boost::optional OutputRequestHandler::parseSound(const std::string& item_name, const std::string& action) +{ + if(item_name == "") + { + Poco::JSON::Object response; + response.set("sounds", this->output_driver->get_sounds()); + return response; + } + + auto opt_sound = this->output_driver->get_sound(item_name); + + if(!opt_sound) + { + throw new Poco::NotFoundException("No sound with name \"" + item_name + "\"!"); + } + + auto sound = opt_sound->get(); + + if(action == "play") + { + sound->play(); + } + else + { + throw new Poco::NotFoundException("No action with name \"" + action + "\" on sounds!"); + } + + return {}; +} + +boost::optional OutputRequestHandler::parseDisplay(const std::string& item_name, const std::string& action, const std::string& score) +{ + if(item_name == "") + { + Poco::JSON::Object response; + response.set("displays", this->output_driver->get_displays()); + return response; + } + + uint8_t display_number = std::stoi(item_name); + auto opt_display = this->output_driver->get_display(display_number); + + if(!opt_display) + { + throw new Poco::NotFoundException("No display with number \"" + item_name + "\"!"); + } + + auto display = opt_display->get(); + + + if(action == "write_score") + { + try + { + unsigned int numerical_score = std::stoi(score); + display->write_score(numerical_score); + } + catch(std::invalid_argument &e) + { + throw new Poco::InvalidArgumentException("Could not convert " + score + " to a number!\n" + e.what()); + } + } + else + { + throw new Poco::NotFoundException("No Action with name \"" + action + "\" on sounds!"); + } + + return {}; +} + +std::vector OutputRequestHandler::getPathSegments(Poco::URI uri) +{ + std::vector path_segments; + uri.getPathSegments(path_segments); + return path_segments; +} + +} +} + diff --git a/FlippR-Driver/src/output/detail/DriverBoardPinController.cpp b/FlippR-Driver/src/output/detail/DriverBoardPinController.cpp index 2a9215d..1b03e6f 100644 --- a/FlippR-Driver/src/output/detail/DriverBoardPinController.cpp +++ b/FlippR-Driver/src/output/detail/DriverBoardPinController.cpp @@ -18,7 +18,6 @@ namespace detail DriverBoardPinController::DriverBoardPinController(std::shared_ptr output_item_mutex) : output_item_mutex(std::move(output_item_mutex)) { - CLOG(INFO, OUTPUT_LOGGER) << "Created DriverBoardPinController."; }