CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(sensors CXX) INCLUDE(GNUInstallDirs) SET(HRM "ON") SET(HRM_VIRT "OFF") SET(AUTO_ROTATION "ON") SET(GRAVITY "ON") SET(LINEAR_ACCEL "ON") IF(${ARCH} STREQUAL "EMULATOR") SET(RV "ON") SET(ORIENTATION "ON") ELSE() SET(RV "OFF") SET(ORIENTATION "OFF") ENDIF() SET(FUSION "OFF") SET(MOTION "OFF") INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src/shared ${CMAKE_SOURCE_DIR}/src/server ${CMAKE_CURRENT_SOURCE_DIR} ) FILE(GLOB SENSOR_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}) FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/accel/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/accel) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_ACCEL") IF("${HRM}" STREQUAL "ON") FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/hrm/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/hrm) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_HRM") ENDIF() IF("${HRM_VIRT}" STREQUAL "ON") add_subdirectory(hrm_virt) ENDIF() IF("${AUTO_ROTATION}" STREQUAL "ON") FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/auto_rotation) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_AUTO_ROTATION") ENDIF() IF("${GRAVITY}" STREQUAL "ON") FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/gravity/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/gravity) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_GRAVITY") ENDIF() IF("${LINEAR_ACCEL}" STREQUAL "ON") FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/linear_accel/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/linear_accel) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_LINEAR_ACCEL") ENDIF() IF("${ORIENTATION}" STREQUAL "ON") FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/orientation/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/orientation) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_ORIENTATION") ENDIF() IF("${RV}" STREQUAL "ON") FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector/*.cpp) SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/rotation_vector) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_ROTATION_VECTOR") ENDIF() IF("${FUSION}" STREQUAL "ON") add_subdirectory(fusion) ENDIF() IF("${MOTION}" STREQUAL "ON") add_subdirectory(motion) ENDIF() MESSAGE("${SENSOR_SRCS}") SET(SENSOR_SRCS ${SENSOR_SRCS} PARENT_SCOPE) SET(SENSOR_HEADERS ${SENSOR_HEADERS} PARENT_SCOPE) SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} PARENT_SCOPE)