@@ -57,29 +57,15 @@ else(LAPACK_FOUND)
57
57
endif (LAPACK_FOUND)
58
58
59
59
60
- ## include BLASFEO AND HPIPM
61
- set (HPIPM_INCLUDE_DIRS "" )
62
- set (HPIPM_LIBS "" )
63
- if (HPIPM)
64
- if (DEFINED ENV{BLASFEO_DIR})
65
- if (DEFINED ENV{HPIPM_DIR})
66
- message (WARNING "...Found HPIPM and BLASFEO environment variables" )
67
- add_definitions (-DHPIPM)
68
-
69
- list (APPEND HPIPM_INCLUDE_DIRS $ENV{BLASFEO_DIR} /include )
70
- list (APPEND HPIPM_INCLUDE_DIRS $ENV{HPIPM_DIR} /include )
71
-
72
- link_directories ($ENV{BLASFEO_DIR} /lib)
73
- link_directories ($ENV{HPIPM_DIR} /lib)
74
- list (APPEND HPIPM_LIBS hpipm blasfeo)
75
-
76
- else (DEFINED ENV{HPIPM_DIR})
77
- message (WARNING "Trying to build with HPIPM, but no ENV variable for HPIPM found." )
78
- endif (DEFINED ENV{HPIPM_DIR})
79
- else (DEFINED ENV{BLASFEO_DIR})
80
- message (WARNING "Trying to build with HPIPM, but no ENV variable for Blasfeo found." )
81
- endif (DEFINED ENV{BLASFEO_DIR})
82
- endif (HPIPM)
60
+ ## include HPIPM (required: environment variables for blasfeo and hpipm set)
61
+ find_package (blasfeo QUIET )
62
+ find_package (hpipm QUIET )
63
+ if (blasfeo_FOUND AND hpipm_FOUND)
64
+ message (STATUS "Found HPIPM and BLASFEO" )
65
+ set (HPIPM ON )
66
+ add_definitions (-DHPIPM)
67
+ list (APPEND HPIPM_LIBS ${hpipm_LIBRARIES} ${blasfeo_LIBRARIES} )
68
+ endif ()
83
69
84
70
85
71
## include IPOPT (after installation via sudo apt-get install coinor-libipopt-dev)
@@ -122,7 +108,8 @@ endif()
122
108
set (ct_optcon_target_include_dirs
123
109
${ct_core_INCLUDE_DIRS}
124
110
${matlab_cpp_interface_INCLUDE_DIRS}
125
- ${HPIPM_INCLUDE_DIRS}
111
+ ${blasfeo_INCLUDE_DIRS}
112
+ ${hpipm_INCLUDE_DIRS}
126
113
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /include >
127
114
$<INSTALL_INTERFACE:include >
128
115
)
@@ -153,11 +140,9 @@ endif(USE_PRESPEC)
153
140
154
141
155
142
## create ct_optcon library
156
- add_library (ct_optcon SHARED
157
- src/ct_optcon.cpp
158
- )
159
- target_include_directories (ct_optcon PUBLIC ${ct_optcon_target_include_dirs} )
160
- target_link_libraries (ct_optcon
143
+ add_library (ct_optcon INTERFACE )
144
+ target_include_directories (ct_optcon INTERFACE ${ct_optcon_target_include_dirs} )
145
+ target_link_libraries (ct_optcon INTERFACE
161
146
ct_core
162
147
${matlab_cpp_interface_LIBRARIES}
163
148
${LAPACK_LIBS}
@@ -220,7 +205,7 @@ install(
220
205
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}
221
206
)
222
207
223
- ## create the ct_core .cmake file which holds target includes and dependencies
208
+ ## create the ct_optcon .cmake file which holds target includes and dependencies
224
209
install (EXPORT ct_optcon_export DESTINATION share/ct_optcon/cmake)
225
210
226
211
0 commit comments