45 lines
1.3 KiB
CMake
45 lines
1.3 KiB
CMake
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
|
|
|
|
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)
|
|
|
|
find_package(Threads)
|
|
find_package(Boost)
|
|
|
|
include_directories(${SOURCE_DIR}/input)
|
|
include_directories(${SOURCE_DIR}/output)
|
|
include_directories(${SOURCE_DIR}/lib)
|
|
include_directories(${SOURCE_DIR}/utilities)
|
|
|
|
file(GLOB SOURCES ${SOURCE_DIR}/*/*.cpp)
|
|
|
|
add_library(flippr_driver STATIC ${SOURCES})
|
|
|
|
target_link_libraries(flippr_driver ${CMAKE_SOURCE_DIR}/lib/libwiringPi.so.2.44)
|
|
|
|
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/input)
|
|
include_directories(${TEST_SOURCES})
|
|
include_directories(${TEST_SOURCES}/mocks)
|
|
|
|
file(GLOB SOURCES ${TEST_SOURCES}/*.cpp)
|
|
file(GLOB HEADER_SOURCES ${TEST_SOURCES}/*.hpp)
|
|
|
|
add_executable(tests ${SOURCES} ${HEADER_SOURCES})
|
|
|
|
target_link_libraries(flippr_driver)
|
|
target_link_libraries(tests Catch)
|