-
Notifications
You must be signed in to change notification settings - Fork 11
/
FindACADO.cmake
158 lines (137 loc) · 4.32 KB
/
FindACADO.cmake
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
################################################################################
#
# Description:
# ACADO Toolkit package configuration file
#
# Defines:
# - Variable: ACADO_INCLUDE_DIRS
# - Variable: ACADO_LIBRARY_DIRS
# - Variable: ACADO_STATIC_LIBS_FOUND
# - Variable: ACADO_STATIC_LIBRARIES
# - Variable: ACADO_SHARED_LIBS_FOUND
# - Variable: ACADO_SHARED_LIBRARIES
#
# Authors:
# Milan Vukov, [email protected]
#
# Year:
# 2011 - 2013.
#
# NOTE:
# - This script is for Linux/Unix use only.
# - Use this script only (and only :)) if you do not want to install ACADO
# toolkit. If you install ACADO toolkit you do not need this script.
#
# - PREREQUISITE: sourced acado_env.sh in your ~/.bashrc file. This script
# will try to find ACADO folders, libraries etc., but looking for them
# in enviromental variables.
#
# Usage:
# - Linux/Unix: TODO
#
################################################################################
################################################################################
#
# Search for package components
#
################################################################################
MESSAGE( STATUS "********************************************************************************" )
MESSAGE( STATUS "---> Looking for ACADO toolkit:" )
#
# Include folders
#
SET( ACADO_INCLUDE_DIRS $ENV{ACADO_ENV_INCLUDE_DIRS} )
IF( ACADO_INCLUDE_DIRS )
MESSAGE( STATUS "Found ACADO toolkit include directories: ${ACADO_INCLUDE_DIRS}" )
SET( ACADO_INCLUDE_DIRS_FOUND TRUE )
ELSE( ACADO_INCLUDE_DIRS )
MESSAGE( STATUS "Could not find ACADO toolkit include directories" )
ENDIF( ACADO_INCLUDE_DIRS )
#
# Library folders
#
SET( ACADO_LIBRARY_DIRS $ENV{ACADO_ENV_LIBRARY_DIRS} )
IF( ACADO_LIBRARY_DIRS )
MESSAGE( STATUS "Found ACADO toolkit library directories: ${ACADO_LIBRARY_DIRS}" )
SET( ACADO_LIBRARY_DIRS_FOUND TRUE )
ELSE( ACADO_LIBRARY_DIRS )
MESSAGE( STATUS "Could not find ACADO toolkit library directories" )
ENDIF( ACADO_LIBRARY_DIRS )
#
# Static libs
#
SET ( STATIC_TMP $ENV{ACADO_ENV_STATIC_LIBRARIES})
IF ( NOT STATIC_TMP )
MESSAGE( STATUS "Could not find ACADO static library." )
SET( ACADO_STATIC_LIBS_FOUND FALSE )
ELSE()
SET( ACADO_STATIC_LIBS_FOUND TRUE )
UNSET( ACADO_STATIC_LIBRARIES )
FOREACH( LIB $ENV{ACADO_ENV_STATIC_LIBRARIES} )
UNSET( ACADO_TOOLKIT_STATIC_${LIB} )
FIND_LIBRARY( ACADO_TOOLKIT_STATIC_${LIB}
NAMES ${LIB}
PATHS ${ACADO_LIBRARY_DIRS}
NO_DEFAULT_PATH
)
IF( ACADO_TOOLKIT_STATIC_${LIB} )
MESSAGE( STATUS "Found ACADO static library: ${LIB}" )
SET( ACADO_STATIC_LIBRARIES
${ACADO_STATIC_LIBRARIES} ${ACADO_TOOLKIT_STATIC_${LIB}}
)
ELSE( )
MESSAGE( STATUS "Could not find ACADO static library: ${LIB}" )
SET( ACADO_STATIC_LIBS_FOUND FALSE )
ENDIF( )
ENDFOREACH()
ENDIF()
SET( ACADO_BUILD_STATIC ${ACADO_STATIC_LIBS_FOUND} )
IF( VERBOSE )
MESSAGE( STATUS "Static libraries: ${ACADO_STATIC_LIBRARIES}\n" )
ENDIF()
#
# Shared libs
#
SET( SHARED_TMP $ENV{ACADO_ENV_SHARED_LIBRARIES} )
IF ( NOT SHARED_TMP )
MESSAGE( STATUS "Could not find ACADO shared library." )
SET( ACADO_SHARED_LIBS_FOUND FALSE )
ELSE()
SET( ACADO_SHARED_LIBS_FOUND TRUE )
UNSET( ACADO_SHARED_LIBRARIES )
FOREACH( LIB $ENV{ACADO_ENV_SHARED_LIBRARIES} )
UNSET( ACADO_TOOLKIT_SHARED_${LIB} )
FIND_LIBRARY( ACADO_TOOLKIT_SHARED_${LIB}
NAMES ${LIB}
PATHS ${ACADO_LIBRARY_DIRS}
NO_DEFAULT_PATH
)
IF( ACADO_TOOLKIT_SHARED_${LIB} )
MESSAGE( STATUS "Found ACADO shared library: ${LIB}" )
SET( ACADO_SHARED_LIBRARIES
${ACADO_SHARED_LIBRARIES} ${ACADO_TOOLKIT_SHARED_${LIB}}
)
ELSE( )
MESSAGE( STATUS "Could not find ACADO shared library: ${LIB}" )
SET( ACADO_SHARED_LIBS_FOUND FALSE )
ENDIF( )
ENDFOREACH()
ENDIF()
SET( ACADO_BUILD_SHARED ${ACADO_SHARED_LIBS_FOUND} )
IF( VERBOSE )
MESSAGE( STATUS "${ACADO_SHARED_LIBRARIES}\n" )
ENDIF()
#
# qpOASES embedded source files and include folders
# TODO: checks
#
SET( ACADO_QPOASES_EMBEDDED_SOURCES $ENV{ACADO_ENV_QPOASES_EMBEDDED_SOURCES} )
SET( ACADO_QPOASES_EMBEDDED_INC_DIRS $ENV{ACADO_ENV_QPOASES_EMBEDDED_INC_DIRS} )
#
# And finally set found flag...
#
IF( ACADO_INCLUDE_DIRS_FOUND AND ACADO_LIBRARY_DIRS_FOUND
AND (ACADO_STATIC_LIBS_FOUND OR ACADO_SHARED_LIBS_FOUND) )
SET( ACADO_FOUND TRUE )
ENDIF()
MESSAGE( STATUS "********************************************************************************" )