forked from AiRT-Software/OCS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
111 lines (81 loc) · 4.48 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
cmake_minimum_required(VERSION 2.8.3)
set(SourceMessageCodesFile "${CMAKE_SOURCE_DIR}/jiminy/airt_unity/Assets/Connection/Scripts/MessageCodes.cs")
file(STRINGS "${SourceMessageCodesFile}" Contents)
foreach(Line ${Contents})
if ("${Line}" MATCHES "^.*MAJOR[ ]*=[ ]*([0-9]+),")
SET(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
endif()
if ("${Line}" MATCHES "^.*MINOR[ ]*=[ ]*([0-9]+),")
SET(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_1})
endif()
if ("${Line}" MATCHES "^.*PATCH[ ]*=[ ]*([0-9]+)$")
SET(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_1})
endif()
endforeach()
unset(SourceMessageCodesFile)
unset(Contents)
# CPack configuration
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Paco Abad (fjabad@dsic.upv.es)")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "AiRT OCS (atreyu)")
SET(CPACK_PACKAGE_VENDOR "Instituto de Automática e Informática Industrial (UPV)")
SET(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://www.ai2.upv.es")
SET(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${CMAKE_CURRENT_SOURCE_DIR}/release-files/scripts/postinst)
SET(CPACK_PACKAGE_NAME "airt-project")
SET(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}-${RELEASE}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
MESSAGE("Building version airt-system ---${CPACK_PACKAGE_VERSION}---")
INCLUDE(CPack)
PROJECT(airt-project)
# Specific build options
# If you want to build the tests, do cmake -DBUILD_TESTS=ON ..
OPTION(BUILD_TESTS "Compile for testing" OFF)
# Directories for CMake modules
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake})
# Flags for debug
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -D_DEBUG -fsanitize=address -g")
#SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -D_DEBUG -g")
# Install prefix
SET(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR})
# Flags for gcc
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_CXX_FLAGS "-Wall")
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
# If not specified, we build the project in Release
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE Release)
ENDIF(NOT CMAKE_BUILD_TYPE)
add_library( libzmq-static STATIC IMPORTED )
set_target_properties( libzmq-static PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/libzmq-static.a )
add_library( restc-cpp STATIC IMPORTED )
set_target_properties( restc-cpp PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/librestc-cpp.a )
add_library( libjpeg-turbo STATIC IMPORTED )
set_target_properties( libjpeg-turbo PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/lib/libturbojpeg.a )
add_subdirectory(external-libs)
add_subdirectory(libairt)
add_subdirectory(atreyu)
add_subdirectory(lazarus)
# Prepare MessageCodes.cs for C++
set(SourceMessageCodesFile "${CMAKE_SOURCE_DIR}/jiminy/airt_unity/Assets/Connection/Scripts/MessageCodes.cs")
set(DestinationMessageCodesFile "${CMAKE_SOURCE_DIR}/libairt/include/messages/MessageCodes.h")
file(READ ${SourceMessageCodesFile} Contents)
string(REPLACE "CommandType." "CommandType::" Contents "${Contents}")
string(REPLACE "NotificationType." "NotificationType::" Contents "${Contents}")
file(REMOVE ${DestinationMessageCodesFile})
file(WRITE ${DestinationMessageCodesFile} "/*\n\n WATCH OUT!!!! \n\nDO NOT MODIFY THIS FILE. DO NOT ADD THIS FILE TO SUBVERSION\n")
file(APPEND ${DestinationMessageCodesFile} "This file is generated automatically from the contents of\n")
file(APPEND ${DestinationMessageCodesFile} "\njiminy/airt_unity/Assets/Connection/Scripts/MessageCodes.cs\n\nAny changes ")
file(APPEND ${DestinationMessageCodesFile} "made to this file will be overriten whenever cmake rebuilds the project.\n")
file(APPEND ${DestinationMessageCodesFile} "If you add a new code to MessageCodes.cs, execute cmake again to rebuild this file\n\n*/\n\n")
file(APPEND ${DestinationMessageCodesFile} "#if defined(__cplusplus)\n")
file(APPEND ${DestinationMessageCodesFile} "#define public\n")
file(APPEND ${DestinationMessageCodesFile} "#define byte uint8_t\n")
file(APPEND ${DestinationMessageCodesFile} "#endif\n")
file(APPEND ${DestinationMessageCodesFile} "${Contents}")
file(APPEND ${DestinationMessageCodesFile} "#if defined(__cplusplus)\n")
file(APPEND ${DestinationMessageCodesFile} "#undef public\n")
file(APPEND ${DestinationMessageCodesFile} "#undef byte\n")
file(APPEND ${DestinationMessageCodesFile} "#endif\n")