summaryrefslogtreecommitdiff
path: root/src/CMakeLists.txt
blob: 44d2fbb595531b575e05586f344e30ea7f5a7597 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 2.6)
project(sensor-plugins-tm1 CXX)

INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(plugin_pkgs REQUIRED dlog libxml-2.0)

FOREACH(flag ${plugin_pkgs_LDFLAGS})
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
ENDFOREACH(flag)

FOREACH(flag ${plugin_pkgs_CFLAGS})
	SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
ENDFOREACH(flag)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

include_directories(${CMAKE_SOURCE_DIR}/src/lib)
include_directories(${CMAKE_SOURCE_DIR}/src/interface)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

IF("${ACCEL}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/accel)
list (APPEND SRCS "plugins/accel/accel_sensor_hal.cpp")
add_definitions(-DENABLE_ACCEL)
ENDIF()
IF("${GYRO}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/gyro)
list (APPEND SRCS "plugins/gyro/gyro_sensor_hal.cpp")
add_definitions(-DENABLE_GYRO)
ENDIF()
IF("${PROXI}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/proxi)
list (APPEND SRCS "plugins/proxi/proxi_sensor_hal.cpp")
add_definitions(-DENABLE_PROXI)
ENDIF()
IF("${LIGHT}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/light)
list (APPEND SRCS "plugins/light/light_sensor_hal.cpp")
add_definitions(-DENABLE_LIGHT)
ENDIF()
IF("${GEO}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/geo)
list (APPEND SRCS "plugins/geo/geo_sensor_hal.cpp")
add_definitions(-DENABLE_GEO)
ENDIF()
IF("${PRESSURE}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/pressure)
list (APPEND SRCS "plugins/pressure/pressure_sensor_hal.cpp")
add_definitions(-DENABLE_PRESSURE)
ENDIF()
IF("${TEMPERATURE}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/temperature)
list (APPEND SRCS "plugins/temperature/temperature_sensor_hal.cpp")
add_definitions(-DENABLE_TEMPERATURE)
ENDIF()
IF("${ULTRAVIOLET}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/ultraviolet)
list (APPEND SRCS "plugins/ultraviolet/ultraviolet_sensor_hal.cpp")
add_definitions(-DENABLE_ULTRAVIOLET)
ENDIF()
IF("${BIO_LED_RED}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/bio_led_red)
list (APPEND SRCS "plugins/bio_led_red/bio_led_red_sensor_hal.cpp")
add_definitions(-DENABLE_BIO_LED_RED)
ENDIF()
IF("${RV}" STREQUAL "ON")
include_directories(${CMAKE_SOURCE_DIR}/src/plugins/rotation_vector/rv_raw)
list (APPEND SRCS "plugins/rotation_vector/rv_raw/rv_raw_sensor_hal.cpp")
add_definitions(-DENABLE_RV_RAW)
ENDIF()

configure_file(hal_module_create.cpp.in hal_module_create.cpp)

add_library(${PROJECT_NAME} SHARED
	${SRCS}
	lib/cconfig.cpp
	lib/csensor_config.cpp
	lib/sensor_logs.cpp
	interface/sensor_hal_base.cpp
	interface/sensor_hal.h
	hal_module_create.cpp
)

target_link_libraries(${PROJECT_NAME} ${plugin_pkgs_LDFLAGS})

install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/sensor)