-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathCMakeLists.txt
138 lines (115 loc) · 4.4 KB
/
CMakeLists.txt
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
cmake_minimum_required (VERSION 2.8.8)
project (libwyliodrin)
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall")
# Appends the cmake/modules path to MAKE_MODULE_PATH variable.
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
# Dependencies
find_package (Threads)
find_package (SWIG)
if (SWIG_FOUND)
include (${SWIG_USE_FILE})
endif ()
find_package (PkgConfig REQUIRED)
find_package (Hiredis REQUIRED)
include_directories (${HIREDIS_INCLUDE_DIR})
find_package (Jansson REQUIRED)
include_directories (${JANSSON_INCLUDE_DIR})
pkg_check_modules (EVENT REQUIRED libevent)
# Version
set (VERSION_MAJOR 3)
set (VERSION_MINOR 0)
# Configuration file
configure_file (
"${PROJECT_SOURCE_DIR}/src/config.h.in"
"${PROJECT_BINARY_DIR}/config.h"
)
# Options
option (RASPBERRYPI "Build for the RaspberryPi." OFF)
option (DEVICEINTEL "Build for the Intel Galileo." OFF)
option (BEAGLEBONE "Build for the Beaglebone." OFF)
option (REDPITAYA "Build for the RedPitaya." OFF)
option (UDOONEO "Build for the UDOO NEO." OFF)
option (SERVER "Build for the Server." OFF)
# Option management
if (DEVICEINTEL)
add_definitions (-DDEVICEINTEL)
add_definitions ("-DSWIG_V8_VERSION=0x040567")
add_definitions ("-std=c++11")
pkg_check_modules (MRAA REQUIRED mraa>=0.4.0)
message (INFO "found libmraa version: ${MRAA_VERSION}")
set(FLAGS "-DDEVICEINTEL")
elseif (MINNOWBOARDMAX)
add_definitions(-DMINNOWBOARDMAX)
pkg_check_modules (MRAA REQUIRED mraa>=0.4.0)
message (INFO " found libmraa version: ${MRAA_VERSION}")
set(FLAGS "-DMINNOWBOARDMAX")
elseif (RASPBERRYPI)
add_definitions (-DRASPBERRYPI)
find_package (Wiringpi REQUIRED)
add_definitions ("-DSWIG_V8_VERSION=0x040567")
set (FLAGS "-DRASPBERRYPI")
include_directories (${WIRINGPI_INCLUDE_DIR})
elseif (BEAGLEBONE)
add_definitions (-DBEAGLEBONE)
set (FLAGS "-DBEAGLEBONE")
elseif (REDPITAYA)
add_definitions (-DREDPITAYA)
find_package (rp REQUIRED)
set (FLAGS "-DREDPITAYA")
include_directories (${REDPITAYA_INCLUDE_DIR})
elseif (UDOONEO)
add_definitions (-DUDOONEO)
add_definitions ("-DSWIG_V8_VERSION=0x032873")
set(FLAGS "-DUDOONEO")
elseif (SERVER)
add_definitions (-DSERVER)
set(FLAGS "-DSERVER")
else ()
message (FATAL_ERROR "You need to choose between -DRASPBERRYPI=ON, -DGALILEO=ON, -DEDISON=ON, -DBEAGLEBONE=ON, -DREDPITAYA=ON, -DUDOONEO=ON or -DSERVER=ON")
endif ()
add_definitions(-DBUILDING_NODE_EXTENSION)
add_definitions ("-Wall -DDEBUG")
include_directories (${PROJECT_BINARY_DIR})
# Sources
set (wyliodrin_LIB_SRCS
# Core
${PROJECT_SOURCE_DIR}/src/version.c
${PROJECT_SOURCE_DIR}/src/setup.c
${PROJECT_SOURCE_DIR}/src/wiring/BitsAndBytes.c
${PROJECT_SOURCE_DIR}/src/signals/signals.c
${PROJECT_SOURCE_DIR}/src/communication/communication.c
${PROJECT_SOURCE_DIR}/src/cmp/cmp.c
${PROJECT_SOURCE_DIR}/src/wiring/arduinogalileo.c
${PROJECT_SOURCE_DIR}/src/wiring/raspberrypi.c
${PROJECT_SOURCE_DIR}/src/wiring/server.c
${PROJECT_SOURCE_DIR}/src/wiring/i2c.c
${PROJECT_SOURCE_DIR}/src/wiring/math.c
${PROJECT_SOURCE_DIR}/src/wiring/beaglebone.c
${PROJECT_SOURCE_DIR}/src/wiring/beagleboneConfig.c
${PROJECT_SOURCE_DIR}/src/wiring/red-pitaya.c
${PROJECT_SOURCE_DIR}/src/wiring/udooneo.c
# Auxiliary
${PROJECT_SOURCE_DIR}/src/libraries/lcd.c
${PROJECT_SOURCE_DIR}/src/libraries/Print.cpp
${PROJECT_SOURCE_DIR}/src/libraries/rgb_lcd.cpp
${PROJECT_SOURCE_DIR}/src/libraries/Servo.cpp
${PROJECT_SOURCE_DIR}/src/libraries/Stepper.cpp
${PROJECT_SOURCE_DIR}/src/libraries/Stream.cpp
${PROJECT_SOURCE_DIR}/src/libraries/Wire.cpp
${PROJECT_SOURCE_DIR}/src/libraries/WString.cpp
${PROJECT_SOURCE_DIR}/src/libraries/SPI.cpp
${PROJECT_SOURCE_DIR}/src/libraries/Adafruit_MCP23008.cpp
${PROJECT_SOURCE_DIR}/src/libraries/LiquidCrystal.cpp
${PROJECT_SOURCE_DIR}/src/libraries/I2Cdev.cpp
)
add_subdirectory (src)
add_subdirectory (languages)
add_subdirectory (wylio)
if (SERVER)
else ()
install (FILES scripts/install_social DESTINATION bin/ PERMISSIONS WORLD_READ WORLD_EXECUTE)
install (FILES scripts/update_libwyliodrin DESTINATION bin/ PERMISSIONS WORLD_READ WORLD_EXECUTE)
install (FILES scripts/update_streams DESTINATION bin/ PERMISSIONS WORLD_READ WORLD_EXECUTE)
install (FILES scripts/say DESTINATION bin/ PERMISSIONS WORLD_READ WORLD_EXECUTE)
endif ()