This commit is contained in:
Jonas Zeunert
2018-09-04 23:47:56 +02:00
parent 4a715d6a6c
commit dcac238fbd
2 changed files with 40 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
<component name="ProjectDictionaryState">
<dictionary name="rhetenor" />
</component>

View File

@@ -1,3 +1,8 @@
####################### OPTIONS #########################
option(BUILD_SHARED_LIB "Build a shared lib instead of a static." OFF)
option(ENABLE_TESTING "Enables testing." ON)
option(CROSS_COMPILE "Enables crosscompiling for raspberry pi" OFF)
#################### CONFIGURATION ######################
set(OUTPUT_PATH bin)
set(LIB_DIR lib)
@@ -8,6 +13,37 @@ set(CMAKE_CXX_STANDARD 17)
# Boost configuration
set(BOOST_COMPONENTS program_options thread timer chrono)
################### CROSS_COMPILING ######################
IF(NOT RPI_ROOT)
set(RPI_ROOT $ENV{HOME}/FlippR/rpi)
set(RPI_TOOLCHAIN ${RPI_ROOT}/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin)
ENDIF()
IF(CROSS_COMPILE)
#SET(CMAKE_TOOLCHAIN_FILE ${RPI_ROOT}/Toolchain-RaspberryPi.cmake)
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
# Specify the cross compiler
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc-7)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++-7)
# Where is the target environment
#SET(CMAKE_FIND_ROOT_PATH ${RPI_ROOT}/rootfs)
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")
#SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")
#SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} --sysroot=${CMAKE_FIND_ROOT_PATH}")
# Search for programs only in the build host directories
#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Search for libraries and headers only in the target directories
#SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
#SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
ENDIF(CROSS_COMPILE)
###################### START_CMAKE #######################
cmake_minimum_required(VERSION 3.9.1)
project(FlippR-Driver VERSION 0.1.0 LANGUAGES CXX)
@@ -24,8 +60,6 @@ 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)
#set code-coverage flags if Debug mode
IF(CMAKE_BUILD_TYPE MATCHES DEBUG)
@@ -87,6 +121,7 @@ target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
## THREAD
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE ${Threads_LIBRARIES})
if(ENABLE_TESTING)
add_subdirectory(tests)
endif(ENABLE_TESTING)