restructured

This commit is contained in:
Jonas Zeunert
2018-07-10 21:03:14 +02:00
parent c9e3b9e0c3
commit 9a0168cb40
97 changed files with 203 additions and 136 deletions

View File

@@ -1,9 +1,9 @@
build build
src/Debug CMakeFiles
/Debug/
.settings/*
CMakeCache.txt CMakeCache.txt
bin
*.log
.settings/*
*.bin *.bin
*.cmake *.cmake
*.out *.out
FlippR-Driver/CMakeFiles/*

View File

@@ -0,0 +1,61 @@
#################### CONFIGURATION ######################
set(OUTPUT_PATH bin)
set(LIB_DIR lib)
set(DEFAULT_BUILD_TYPE Debug)
set(CMAKE_CXX_STANDARD 17)
# Boost configuration
set(BOOST_COMPONENTS program_options)
###################### START_CMAKE #######################
cmake_minimum_required(VERSION 3.9.1)
project(FlippR-Driver VERSION 0.1.0 LANGUAGES CXX)
# Compile library to output_path
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/${OUTPUT_PATH})
# Default to Release build
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE ${DEFAULT_BUILD_TYPE})
endif(NOT CMAKE_BUILD_TYPE)
option(BUILD_SHARED_LIB "Build a shared lib instead of a static." OFF)
option(ENABLE_TESTING "Enables testing." ON)
#################### Adding Library #####################
file(GLOB_RECURSE SOURCES src/*.cpp)
if(BUILD_SHARED_LIB)
add_library(${PROJECT_NAME} SHARED ${SOURCES})
else()
add_library(${PROJECT_NAME} STATIC ${SOURCES})
endif(BUILD_SHARED_LIB)
######################### BOOST #########################
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
if(Boost_FOUND)
# Include and link with boost
target_include_directories(${PROJECT_NAME} PUBLIC ${Boost_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})
message ("Boost found and linked.")
else()
message (FATAL_ERROR "Can't find Boost.")
endif(Boost_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)
# Set libraries include path
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/${LIB_DIR})
##################### WIRING_PI ##########################
find_library(wiringPi NAMES libwiringPi)
target_link_libraries(${PROJECT_NAME} PRIVATE wiringPi)
if(ENABLE_TESTING)
add_subdirectory(tests)
endif(ENABLE_TESTING)
####################### END_CMAKE ########################

View File

@@ -1,58 +0,0 @@
cmake_minimum_required(VERSION 3.9.1)
project(flippr-driver)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") # enable C++11 standard
add_definitions(-lcrypt)
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
set(SOURCE_DIR ../src)
set(LIB_DIR ${SOURCE_DIR}/lib)
set(EASYLOGGING_INCLUDE_DIR ${LIB_DIR}/easylogging)
add_library(Easylogging STATIC ${EASYLOGGING_INCLUDE_DIR}/easylogging++.cc)
include_directories(${EASYLOGGING_INCLUDE_DIR})
add_library(libwiringPi SHARED IMPORTED )
set_property(TARGET libwiringPi PROPERTY IMPORTED_LOCATION ${LIB_DIR}/libwiringPi.so.2.44)
#set_property(TARGET libwiringPi PROPERTY INTERFACE_INCLUDE_DIRECTORIES ../src/lib/wiringPi)
find_package(Threads REQUIRED)
find_package(Boost COMPONENTS system thread timer chrono REQUIRED)
include_directories(${SOURCE_DIR}/input)
include_directories(${SOURCE_DIR}/output)
include_directories(${SOURCE_DIR}/lib)
include_directories(${SOURCE_DIR}/utilities)
include_directories(${Boost_INCLUDE_DIRS})
file(GLOB SOURCES ${SOURCE_DIR}/*/*.cpp)
add_library(flippr_driver STATIC ${SOURCES})
target_link_libraries(flippr_driver ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(flippr_driver ${Boost_LIBRARIES})
target_link_libraries(flippr_driver libwiringPi)
target_link_libraries(flippr_driver Easylogging)
enable_testing(TRUE)
#Prepare "Catch" library for other executables
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src/tests)
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR}/*)
#Make test executable
set(TEST_SOURCES ${SOURCE_DIR}/../tests)
include_directories(${TEST_SOURCES})
file(GLOB SOURCES ${TEST_SOURCES}/*/*.cpp)
file(GLOB HEADER_SOURCES ${TEST_SOURCES}/*/*.hpp)
add_executable(tests ${SOURCES} ${HEADER_SOURCES})
target_link_libraries(tests Easylogging)
target_link_libraries(tests flippr_driver)
target_link_libraries(tests Catch)

View File

@@ -1,21 +0,0 @@
{
"input":
{
"row":
{
"A":"GPIO_13",
"B":"GPIO_14",
"C":"GPIO_15",
},
"column":
{
"A":"GPIO_17",
"B":"GPIO_18",
"C":"GPIO_19",
"input":"GPIO_20"
}
},
"output":
{
}
}

View File

@@ -1,16 +0,0 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 3.9
# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/johannes/git/flippr-code/FlippR-Driver")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/johannes/git/flippr-code/FlippR-Driver")
# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})

View File

@@ -1,34 +0,0 @@
# Install script for directory: /home/johannes/git/flippr-code/FlippR-Driver/json_example
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()

Binary file not shown.

View File

@@ -0,0 +1,8 @@
Input/Detector.o: ../Input/Detector.cpp ../Input/Detector.h \
../Input/InputEvent.h ../Input/InputEventHandler.h
../Input/Detector.h:
../Input/InputEvent.h:
../Input/InputEventHandler.h:

Binary file not shown.

View File

@@ -0,0 +1,8 @@
Input/main.o: ../Input/main.cpp ../Input/InputEvent.h \
../Input/InputEventHandler.h ../Input/Detector.h
../Input/InputEvent.h:
../Input/InputEventHandler.h:
../Input/Detector.h:

Binary file not shown.

View File

@@ -0,0 +1,27 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../Input/Detector.cpp \
../Input/main.cpp
OBJS += \
./Input/Detector.o \
./Input/main.o
CPP_DEPS += \
./Input/Detector.d \
./Input/main.d
# Each subdirectory must supply rules for building sources it contributes
Input/%.o: ../Input/%.cpp
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '

View File

@@ -0,0 +1,58 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include Input/subdir.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: FlippR-Driver
# Tool invocations
FlippR-Driver: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -o "FlippR-Driver" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) FlippR-Driver
-@echo ' '
.PHONY: all clean dependents
-include ../makefile.targets

View File

@@ -0,0 +1,8 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS :=
LIBS := -lpthread

View File

@@ -0,0 +1,27 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
C_UPPER_SRCS :=
CXX_SRCS :=
C++_SRCS :=
OBJ_SRCS :=
CC_SRCS :=
ASM_SRCS :=
CPP_SRCS :=
C_SRCS :=
O_SRCS :=
S_UPPER_SRCS :=
CC_DEPS :=
C++_DEPS :=
EXECUTABLES :=
C_UPPER_DEPS :=
CXX_DEPS :=
OBJS :=
CPP_DEPS :=
C_DEPS :=
# Every subdirectory with source files must be described here
SUBDIRS := \
Input \

View File

@@ -9,7 +9,7 @@
#define SRC_INPUT_IEVENTNOTIFIER_H_ #define SRC_INPUT_IEVENTNOTIFIER_H_
#include "Event.h" #include "Event.h"
#include "IEventHandler.h" #include "utilities/IEventHandler.h"
namespace Input namespace Input
{ {

View File

@@ -8,7 +8,7 @@
#ifndef SRC_INPUT_IINPUTDRIVER_H_ #ifndef SRC_INPUT_IINPUTDRIVER_H_
#define SRC_INPUT_IINPUTDRIVER_H_ #define SRC_INPUT_IINPUTDRIVER_H_
#include "IEventHandler.h" #include "utilities/IEventHandler.h"
#include "IEventNotifier.h" #include "IEventNotifier.h"
namespace Input { namespace Input {

View File