-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
172 lines (152 loc) · 4.52 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
cmake_minimum_required(VERSION 2.8)
project( firestep )
SET(PROJECT_VERSION_MAJOR 1)
SET(PROJECT_VERSION_MINOR 9)
set(PROJECT_VERSION_PATCH 0)
set(PROJECT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
IF(WIN32)
MESSAGE(STATUS "Detecting WINDOWS build")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
# By default, do not warn when built on machines using only VS Express:
IF(NOT DEFINED CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS)
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON)
ENDIF()
ELSE(WIN32)
MESSAGE(STATUS "Detecting LINUX build")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST -D$ENV{FIREDUINO} -D$ENV{MEMORY_MODEL} -DCMAKE -fPIC -g -Wno-format-extra-args")
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -g")
ENDIF(WIN32)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_SOURCE_DIR}/cmake/Modules/")
add_definitions ("-Wall")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64")
get_property(dirs DIRECTORY . PROPERTY INCLUDE_DIRECTORIES)
message("INCLUDE_DIRECTORIES:${dirs}")
SET(BUILD_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR}/target" CACHE STRING "Put all binary output in target")
SET(EXECUTABLE_OUTPUT_PATH "${BUILD_TARGET_DIR}")
SET(RUNTIME_OUTPUT_NAME firestep)
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(FIRESTEP_LIB "lib_firestep.so")
include_directories(
${PROJECT_SOURCE_DIR}/FireStep
${PROJECT_SOURCE_DIR}/FireStep/pins
${BUILD_TARGET_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/ArduinoJson/include
${PROJECT_SOURCE_DIR}/ph5
/usr/local/include
/usr/include
)
include (InstallRequiredSystemLibraries)
SET(CPACK_RESOURCE_FILE_LICENSE
"${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
SET(CPACK_PACKAGE_GENERATED_WARNING "GENERATED FILE!!! DO NOT CHANGE!!!")
SET(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
SET(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
include (CPack)
get_property(dirs DIRECTORY . PROPERTY INCLUDE_DIRECTORIES)
message("INCLUDE_DIRECTORIES:")
foreach(dir ${dirs})
message(STATUS " dir='${dir}'")
endforeach()
configure_file (
"${PROJECT_SOURCE_DIR}/FireStep/version.h.in"
"${PROJECT_SOURCE_DIR}/FireStep/version.h"
)
message("CMAKE_PREFIX_PATH:${CMAKE_PREFIX_PATH}")
link_directories(
${BUILD_TARGET_DIR}
${PROJECT_SOURCE_DIR}/ArduinoJson/lib
/usr/lib
/usr/local/lib
)
########## lib_firestep.so: shared library ################
add_library(_firestep SHARED
FireStep/DeltaCalculator.cpp
FireStep/ProcessField.cpp
FireStep/ProgMem.cpp
FireStep/JsonCommand.cpp
FireStep/JsonController.cpp
FireStep/FPDController.cpp
FireStep/RawController.cpp
FireStep/NeoPixel.cpp
FireStep/Thread.cpp
FireStep/Stroke.cpp
FireStep/Machine.cpp
FireStep/MachineThread.cpp
)
add_dependencies(_firestep
ArduinoJson
_ph5
)
########## firestep: command line client ################
add_executable(firestep
src/FireLog.cpp
src/ArduinoUSB.cpp
src/FireStepSerial.cpp
src/FireStepClient.cpp
src/MockDuino.cpp
src/firestep.cpp
)
add_dependencies(firestep
_firestep
ArduinoJson
_ph5
)
target_link_libraries(firestep
_firestep
ArduinoJson
_ph5
)
########## test: MockDuino test program ################
add_executable(test
src/MockDuino.cpp
src/test.cpp
)
add_dependencies(test
_firestep
ArduinoJson
_ph5
)
target_link_libraries(test
_firestep
ArduinoJson
_ph5
)
if(WIN32)
add_custom_command(TARGET test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${PROJECT_SOURCE_DIR}/target/Debug/test.exe"
"${PROJECT_SOURCE_DIR}/target/test.exe"
)
endif(WIN32)
set(FIRESTEP_INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
set(FIRESTEP_INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executable")
set(FIRESTEP_INSTALL_INCLUDE_DIR include CACHE PATH "Installation directory for header files")
INSTALL(TARGETS _firestep DESTINATION ${FIRESTEP_INSTALL_LIB_DIR})
INSTALL(TARGETS firestep DESTINATION ${FIRESTEP_INSTALL_BIN_DIR})
INSTALL(FILES
FireStep/DeltaCalculator.h
FireStep/Display.h
FireStep/FPDController.h
FireStep/FireUtils.h
FireStep/JsonCommand.h
FireStep/JsonController.h
FireStep/Machine.h
FireStep/MachineThread.h
FireStep/NeoPixel.h
FireStep/ProcessField.h
FireStep/ProgMem.h
FireStep/Quad.h
FireStep/RawController.h
FireStep/Status.h
FireStep/Stroke.h
FireStep/Thread.h
FireStep/build.h
FireStep/fireduino.h
FireStep/fireduino_mega2560.h
FireStep/fireduino_due.h
FireStep/pins.h
FireStep/version.h
src/FireStep.h
DESTINATION ${FIRESTEP_INSTALL_INCLUDE_DIR}/firestep)