CMakeLists.txt 18.8 KB
Newer Older
1
2
cmake_minimum_required (VERSION 2.6)

3
4
5
6
7
8

#Only set project name if CoMISo is built as stand-alone library
if("${PROJECT_NAME}" STREQUAL "")
    project(CoMISo)
endif()

9
10

# add our macro directory to cmake search path
11
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Jane Tournois's avatar
Jane Tournois committed
12
set (CMAKE_DEBUG_POSTFIX "d")
13
14
15
16
17
18
19
20
21
22

include (ACGCommon)


# Flag to enable or disable QT widgets in CoMISo
set( WANT_COMISO_QT ON CACHE BOOL "Enable Qt support in CoMISo" )


if( WANT_COMISO_QT )

Jan Möbius's avatar
Jan Möbius committed
23
  acg_qt5 ()
24

Jan Möbius's avatar
Jan Möbius committed
25
  if( QT5_FOUND)
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
    add_definitions (-DQT5_FOUND)
    set (COMISO_QT_CONFIG_FILE_SETTINGS "#define COMISO_QT_AVAILABLE 1" )
  else()
    set (COMISO_QT_CONFIG_FILE_SETTINGS "#define COMISO_QT_AVAILABLE 0" )
  endif()
  
endif( WANT_COMISO_QT )

acg_get_version ()

include (ACGOutput)

set(COMISO_INCLUDE_DIRECTORIES "")
set(COMISO_LINK_DIRECTORIES "")
set(COMISO_LINK_LIBRARIES "")
set(NEED_LAPACK "")

FIND_PACKAGE( Boost 1.42.0 COMPONENTS system filesystem regex QUIET)
if(Boost_FOUND)
  set (COMISO_BOOST_CONFIG_FILE_SETTINGS "#define COMISO_BOOST_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_DIRECTORIES    ${Boost_LIBRARY_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES  ${Boost_LIBRARIES} )
49

50
  option(Boost_USE_STATIC_LIBS "Link with static Boost libraries" OFF)
51
52
53
54
55
56
57
58
59
  mark_as_advanced(Boost_USE_STATIC_LIBS)
  if(Boost_USE_STATIC_LIBS)
    set(Boost_USE_STATIC_LIBS ON)
  else()
      # One must add -DBOOST_ALL_DYN_LINK to DEFINITIONS to use Boost
      # auto-link with shared libraries.
    add_definitions( -DBOOST_ALL_DYN_LINK )
  endif()

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
else()
  set (COMISO_BOOST_CONFIG_FILE_SETTINGS "#define COMISO_BOOST_AVAILABLE 0" )
  message (STATUS "Boost not found!")
endif ()


find_package (GMM)
if (GMM_FOUND)
  set (COMISO_GMM_CONFIG_FILE_SETTINGS "#define COMISO_GMM_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${GMM_INCLUDE_DIR} )
  list (APPEND NEED_LAPACK "GMM")
else()
  set (COMISO_GMM_CONFIG_FILE_SETTINGS "#define COMISO_GMM_AVAILABLE 0" )
  message (FATAL_ERROR "GMM not found!")
endif ()



find_package (BLAS)
if (BLAS_FOUND )
  set (COMISO_BLAS_CONFIG_FILE_SETTINGS "#define COMISO_BLAS_AVAILABLE 1" )
  
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${BLAS_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_DIRECTORIES   ${BLAS_LIBRARY_DIRS} ${BLAS_LIBRARY_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES  ${BLAS_LIBRARIES} )
else()
  set (COMISO_BLAS_CONFIG_FILE_SETTINGS "#define COMISO_BLAS_AVAILABLE 0" )
  message (STATUS "BLAS not found!")
endif ()

find_package (ADOLC)
if (ADOLC_FOUND)
  set (COMISO_ADOLC_CONFIG_FILE_SETTINGS "#define COMISO_ADOLC_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${ADOLC_INCLUDE_DIR} )
  list( APPEND COMISO_LINK_DIRECTORIES   ${ADOLC_LIBRARY_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES  ${ADOLC_LIBRARIES} )
else ()
  set (COMISO_ADOLC_CONFIG_FILE_SETTINGS "#define COMISO_ADOLC_AVAILABLE 0" )
  message (STATUS "ADOLC not found!")
endif ()

find_package (SUITESPARSE)
if (SUITESPARSE_FOUND )
  list (APPEND NEED_LAPACK "SUITESPARSE")
  
  set (COMISO_SUITESPARSE_CONFIG_FILE_SETTINGS "#define COMISO_SUITESPARSE_AVAILABLE 1" )
  
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${SUITESPARSE_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_DIRECTORIES   ${SUITESPARSE_LIBRARY_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${SUITESPARSE_LIBRARIES} )
else ()
  message (STATUS "SUITESPARSE not found!")
  set (COMISO_SUITESPARSE_CONFIG_FILE_SETTINGS "#define COMISO_SUITESPARSE_AVAILABLE 0" )
endif ()
# special handling, since spqr is incorrect in several distributions
if(SUITESPARSE_SPQR_VALID)
  set (COMISO_SUITESPARSE_SPQR_CONFIG_FILE_SETTINGS "#define COMISO_SUITESPARSE_SPQR_AVAILABLE 1" )
else()
  message (STATUS "SUITESPARSE SPQR seems to be invalid!")
  set (COMISO_SUITESPARSE_SPQR_CONFIG_FILE_SETTINGS "#define COMISO_SUITESPARSE_SPQR_AVAILABLE 0" )
endif()

122
123
124
125
126
127
128
129
130
131
if(NOT DISABLE_MPI)
  find_package (MPI)
  if (MPI_FOUND )
    set (COMISO_MPI_CONFIG_FILE_SETTINGS "#define COMISO_MPI_AVAILABLE 1" )
    list( APPEND COMISO_INCLUDE_DIRECTORIES ${MPI_INCLUDE_PATH} )
    list( APPEND COMISO_LINK_LIBRARIES  ${MPI_CXX_LIBRARIES} )
  else ()
    message (STATUS "MPI not found!")
    set (COMISO_MPI_CONFIG_FILE_SETTINGS "#define COMISO_MPI_AVAILABLE 0" )
  endif ()
132
else ()
133
  message (STATUS "MPI disabled!")
134
135
136
  set (COMISO_MPI_CONFIG_FILE_SETTINGS "#define COMISO_MPI_AVAILABLE 0" )
endif ()

137
138
139
140
141
142
143
144
145
146
if(NOT DISABLE_PETSC)
  find_package (PETSC)
  if (PETSC_FOUND AND MPI_FOUND)
    set (COMISO_PETSC_CONFIG_FILE_SETTINGS "#define COMISO_PETSC_AVAILABLE 1" )
    list( APPEND COMISO_INCLUDE_DIRECTORIES ${PETSC_INCLUDE_DIRS} )
    list( APPEND COMISO_LINK_LIBRARIES  ${PETSC_LIBRARY} )
  else ()
    message (STATUS "PETSC or MPI not found!")
    set (COMISO_PETSC_CONFIG_FILE_SETTINGS "#define COMISO_PETSC_AVAILABLE 0" )
  endif ()
147
else ()
148
  message (STATUS "PETSC disabled!")
149
  set (COMISO_PETSC_CONFIG_FILE_SETTINGS "#define COMISO_PETSC_AVAILABLE 0" )
150
endif()
151
152


153
154
155
156
157
158
159
160
161
162
163
if(NOT DISABLE_TAO)
  find_package (TAO)
  if (TAO_FOUND AND PETSC_FOUND AND MPI_FOUND)
    set (COMISO_TAO_CONFIG_FILE_SETTINGS "#define COMISO_TAO_AVAILABLE 1" )
    list( APPEND COMISO_INCLUDE_DIRECTORIES ${TAO_INCLUDE_DIRS} )
    list( APPEND COMISO_LINK_DIRECTORIES ${TAO_LIBRARY_DIR} )
    list( APPEND COMISO_LINK_LIBRARIES  ${TAO_LIBRARY} )
  else ()
    message (STATUS "TAO or PETSC or MPI not found!")
    set (COMISO_TAO_CONFIG_FILE_SETTINGS "#define COMISO_TAO_AVAILABLE 0" )
  endif ()
164
else ()
165
  message (STATUS "TAO disabled!")
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
  set (COMISO_TAO_CONFIG_FILE_SETTINGS "#define COMISO_TAO_AVAILABLE 0" )
endif ()

find_package (METIS)
if (METIS_FOUND )
  set (COMISO_METIS_CONFIG_FILE_SETTINGS "#define COMISO_METIS_AVAILABLE 1" )
  
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${METIS_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_DIRECTORIES   ${METIS_LIBRARY_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${METIS_LIBRARIES} )
else()
  set (COMISO_METIS_CONFIG_FILE_SETTINGS "#define COMISO_METIS_AVAILABLE 0" )
  message (STATUS "METIS not found!")
endif ()

find_package (MUMPS)
if (MUMPS_FOUND )
  set (COMISO_MUMPS_CONFIG_FILE_SETTINGS "#define COMISO_MUMPS_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${MUMPS_INCLUDE_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES ${MUMPS_LIBRARY} )
else ()
  message (STATUS "MUMPS not found!")
  set (COMISO_MUMPS_CONFIG_FILE_SETTINGS "#define COMISO_MUMPS_AVAILABLE 0" )
endif ()

find_package (IPOPT)
if (IPOPT_FOUND)
  set (COMISO_IPOPT_CONFIG_FILE_SETTINGS "#define COMISO_IPOPT_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${IPOPT_INCLUDE_DIR} )
  list( APPEND COMISO_LINK_DIRECTORIES ${IPOPT_LIBRARY_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES ${IPOPT_LIBRARY} )
  if ( IPOPT_HSL_LIBRARY_DIR )
	set (COMISO_HSL_CONFIG_FILE_SETTINGS "#define COMISO_HSL_AVAILABLE 1" )
  else ()
	set (COMISO_HSL_CONFIG_FILE_SETTINGS "#define COMISO_HSL_AVAILABLE 0" )
  endif()
else ()
  message (STATUS "IPOPT or dependency not found!")
  set (COMISO_IPOPT_CONFIG_FILE_SETTINGS "#define COMISO_IPOPT_AVAILABLE 0" )
  set (COMISO_HSL_CONFIG_FILE_SETTINGS "#define COMISO_HSL_AVAILABLE 0" )
endif ()

find_package (EIGEN3)
if (EIGEN3_FOUND )
  set (COMISO_EIGEN3_CONFIG_FILE_SETTINGS "#define COMISO_EIGEN3_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${EIGEN3_INCLUDE_DIR} )
else ()
  message (FATAL_ERROR "EIGEN3 not found!")
  set (COMISO_EIGEN3_CONFIG_FILE_SETTINGS "#define COMISO_EIGEN3_AVAILABLE 0" )
endif ()

find_package (DCO)
if (DCO_FOUND )
  set (COMISO_DCO_CONFIG_FILE_SETTINGS "#define COMISO_DCO_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${DCO_INCLUDE_DIR} )
else ()
  message (STATUS "DCO not found!")
  set (COMISO_DCO_CONFIG_FILE_SETTINGS "#define COMISO_DCO_AVAILABLE 0" )
endif ()

find_package (CBC)
if (CBC_FOUND )
  set (COMISO_CBC_CONFIG_FILE_SETTINGS "#define COMISO_CBC_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${CBC_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${CBC_LIBRARIES} )
else ()
  message (STATUS "CBC not found!")
  set (COMISO_CBC_CONFIG_FILE_SETTINGS "#define COMISO_CBC_AVAILABLE 0" )
endif ()

find_package (CLP)
if (CLP_FOUND )
  set (COMISO_CLP_CONFIG_FILE_SETTINGS "#define COMISO_CLP_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${CLP_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${CLP_LIBRARIES} )
else ()
  message (STATUS "CLP not found!")
  set (COMISO_CLP_CONFIG_FILE_SETTINGS "#define COMISO_CLP_AVAILABLE 0" )
endif ()

find_package (CGL)
if (CGL_FOUND )
  set (COMISO_CGL_CONFIG_FILE_SETTINGS "#define COMISO_CGL_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${CGL_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${CGL_LIBRARIES} )
else ()
  message (STATUS "CGL not found!")
  set (COMISO_CGL_CONFIG_FILE_SETTINGS "#define COMISO_CGL_AVAILABLE 0" )
endif ()

find_package (COINUTILS)
if (COINUTILS_FOUND )
  set (COMISO_COINUTILS_CONFIG_FILE_SETTINGS "#define COMISO_COINUTILS_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${COINUTILS_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${COINUTILS_LIBRARIES} )
else ()
  message (STATUS "COINUTILS not found!")
  set (COMISO_COINUTILS_CONFIG_FILE_SETTINGS "#define COMISO_COINUTILS_AVAILABLE 0" )
endif ()

find_package (OSI)
if (OSI_FOUND )
  set (COMISO_OSI_CONFIG_FILE_SETTINGS "#define COMISO_OSI_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${OSI_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${OSI_LIBRARIES} )
else ()
  message (STATUS "OSI not found!")
  set (COMISO_OSI_CONFIG_FILE_SETTINGS "#define COMISO_OSI_AVAILABLE 0" )
endif ()

find_package (Taucs)
277
278
set (SUPRESS_TAUCS OFF CACHE BOOL "Set to ON if CoMISo should be built without TAUCS.")
if (TAUCS_FOUND AND NOT SUPRESS_TAUCS)
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
  list (APPEND NEED_LAPACK "Tacus")
  set (COMISO_TAUCS_CONFIG_FILE_SETTINGS "#define COMISO_TAUCS_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${TAUCS_INCLUDE_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES  ${TAUCS_LIBRARY} )
   
else ()
  message (STATUS "TAUCS not found!")
  set (COMISO_TAUCS_CONFIG_FILE_SETTINGS "#define COMISO_TAUCS_AVAILABLE 0" )
endif ()

find_package (GUROBI)
if (GUROBI_FOUND )
  set (COMISO_GUROBI_CONFIG_FILE_SETTINGS "#define COMISO_GUROBI_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${GUROBI_INCLUDE_DIRS} )
#  list( APPEND COMISO_LINK_DIRECTORIES    ${GUROBI_LIBRARY_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES  ${GUROBI_LIBRARIES} )
else ()
  message (STATUS "GUROBI not found!")
  set (COMISO_GUROBI_CONFIG_FILE_SETTINGS "#define COMISO_GUROBI_AVAILABLE 0" )
endif ()

David Bommes's avatar
David Bommes committed
300
301
302
303
304
305
306
307
308
309
310
311
find_package (MOSEK)
if (MOSEK_FOUND )
  set (COMISO_MOSEK_CONFIG_FILE_SETTINGS "#define COMISO_MOSEK_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${MOSEK_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_DIRECTORIES    ${MOSEK_LIBRARY_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES  ${MOSEK_LIBRARIES} )
else ()
  message (STATUS "MOSEK not found!")
  set (COMISO_MOSEK_CONFIG_FILE_SETTINGS "#define COMISO_MOSEK_AVAILABLE 0" )
endif ()


312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
find_package (ARPACK)
if (ARPACK_FOUND )
  set (COMISO_ARPACK_CONFIG_FILE_SETTINGS "#define COMISO_ARPACK_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${ARPACK_INCLUDE_DIR} )
#  list( APPEND COMISO_LINK_DIRECTORIES    ${ARPACK_LIBRARY_DIR} )
  list( APPEND COMISO_LINK_LIBRARIES  ${ARPACK_LIBRARY} )
else ()
  message (STATUS "ARPACK not found!")
  set (COMISO_ARPACK_CONFIG_FILE_SETTINGS "#define COMISO_ARPACK_AVAILABLE 0" )
endif ()

find_package (CPLEX)
if (CPLEX_FOUND )
  set (COMISO_CPLEX_CONFIG_FILE_SETTINGS "#define COMISO_CPLEX_AVAILABLE 1" )
  list( APPEND COMISO_INCLUDE_DIRECTORIES ${CPLEX_INCLUDE_DIRS} )
  list( APPEND COMISO_LINK_LIBRARIES  ${CPLEX_LIBRARIES} )
  
  #enable c++ support
   add_definitions(-DIL_STD)
else ()
  message (STATUS "CPLEX not found!")
  set (COMISO_CPLEX_CONFIG_FILE_SETTINGS "#define COMISO_CPLEX_AVAILABLE 0" )
endif ()

if (NEED_LAPACK)
  FIND_PACKAGE(LAPACK)
  if (LAPACK_FOUND)
    list( APPEND COMISO_INCLUDE_DIRECTORIES ${LAPACK_INCLUDE_DIR} )
    list( APPEND COMISO_LINK_DIRECTORIES    ${LAPACK_LIBRARY_DIR} )
    list( APPEND COMISO_LINK_LIBRARIES  ${LAPACK_LIBRARIES} )
  else()
    message(STATUS "LAPACK not found!")
  endif()
endif(NEED_LAPACK)

include_directories (
  ..
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/../
  ${CMAKE_CURRENT_BINARY_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}/../
  ${COMISO_INCLUDE_DIRECTORIES}
)

# generate dllexport macros on windows
if (WIN32)
  add_definitions(-DCOMISODLL)
  add_definitions(-DBASEDLL)
  add_definitions(-D_SCL_SECURE_NO_DEPRECATE)
361
362
  # ignore "... needs to have dll-interface to be used by clients"
  add_definitions(/wd4251)
363
364
365
366
367
368
369
370
endif ()


link_directories (
  ${COMISO_LINK_DIRECTORIES}
)

# enable debug stuff
371
372
373
374
set (COMISO_ENABLE_DEBUG_OUTPUT TRUE CACHE BOOL "Enable CoMISo Debug Output")
if (COMISO_ENABLE_DEBUG_OUTPUT)
  add_definitions(-DDEB_ON)
endif ()
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396

# source code directories
set (directories 
  .
  Base/Code
  Base/Debug
  Base/Security
  Base/Utils
  Solver
  NSolver
  EigenSolver
  Config
  Utils
  QtWidgets
)

if (WIN32)
  add_definitions(
      -D_USE_MATH_DEFINES -DNOMINMAX
  )
endif ()

397
if (CMAKE_CXX_COMPILER_ID MATCHES "[cC][lL][aA][nN][gG]")
398
  # disable unused parameter warning
399
  add_definitions(-Wno-unused-parameter -Wno-deprecated-register)
400
401
endif()

402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# collect all header,source and ui files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})

if( QT4_FOUND OR QT5_FOUND )
acg_append_files (ui "*.ui" ${directories})
endif()


macro (of_list_filter _list)
  if (WIN32)
   foreach (_element ${${_list}})
     if (_element MATCHES "gnuplot_i\\.(cc|hh)$")
       list (REMOVE_ITEM ${_list} ${_element})
     endif ()
   endforeach ()
  endif ()
endmacro ()

of_list_filter  ( headers )
of_list_filter  ( sources )


# remove template cc files from source file list
acg_drop_templates (sources)

Jan Möbius's avatar
Jan Möbius committed
428
429
430
431
432
if ( QT5_FOUND )
  # genereate uic and moc targets
  acg_qt5_autouic (uic_targets ${ui})
  acg_qt5_automoc (moc_targets ${headers})
  list (APPEND COMISO_LINK_LIBRARIES ${QT_LIBRARIES})
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
endif()

acg_add_library (CoMISo SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})

if (NOT APPLE)
	target_link_libraries (CoMISo 
	  ${COMISO_LINK_LIBRARIES}
	)
else(NOT APPLE)
	target_link_libraries (CoMISo
	  ${COMISO_LINK_LIBRARIES}
	)
endif(NOT APPLE)

# display results
acg_print_configure_header (COMISO "CoMISo")

# write config file
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/Config/config.hh.in"
     "CoMISo/Config/config.hh" @ONLY IMMEDIATE)
     
     
     
#######################################################################
# Configure the examples last to be sure, that all configure files
# of the library are already there
#######################################################################

461
set (COMISO_BUILD_EXAMPLES TRUE CACHE BOOL "Build CoMISo Examples")
462

463
464
465
466
467
if (COMISO_BUILD_EXAMPLES )
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/factored_solver/CMakeLists.txt" )
	add_subdirectory (Examples/factored_solver)
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/quadratic_solver/CMakeLists.txt" )
468
	add_subdirectory (Examples/quadratic_solver)
469
470
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/test2/CMakeLists.txt" )
471
	add_subdirectory (Examples/test2)
472
473
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_quadratic_example/CMakeLists.txt" )
474
	add_subdirectory (Examples/small_quadratic_example)
475
476
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_factored_example/CMakeLists.txt" )
477
	add_subdirectory (Examples/small_factored_example)
478
479
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/super_sparse_matrix/CMakeLists.txt" )
480
	add_subdirectory (Examples/super_sparse_matrix)
481
482
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/eigen_solver/CMakeLists.txt" )
483
	add_subdirectory (Examples/eigen_solver)
484
485
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_nsolver/CMakeLists.txt" )
486
	add_subdirectory (Examples/small_nsolver)
487
488
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_eigenproblem/CMakeLists.txt" )
489
	add_subdirectory (Examples/small_eigenproblem)
490
491
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_miqp/CMakeLists.txt" )
492
	add_subdirectory (Examples/small_miqp)
493
494
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_nleast_squares/CMakeLists.txt" )
495
	add_subdirectory (Examples/small_nleast_squares)
496
497
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_sparseqr/CMakeLists.txt" )
498
	add_subdirectory (Examples/small_sparseqr)
499
500
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_quadratic_resolve_example/CMakeLists.txt" )
501
	add_subdirectory (Examples/small_quadratic_resolve_example)
502
503
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_cplex_soc/CMakeLists.txt" )
504
	add_subdirectory (Examples/small_cplex_soc)
505
506
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_adolc/CMakeLists.txt" )
507
	add_subdirectory (Examples/small_adolc)
508
509
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_dco/CMakeLists.txt" )
510
	add_subdirectory (Examples/small_dco)
511
512
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/vector1_adolc/CMakeLists.txt" )
513
	add_subdirectory (Examples/vector1_adolc)
514
515
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_linear_problem/CMakeLists.txt" )
516
	add_subdirectory (Examples/small_linear_problem)
517
518
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/crossfield3d/CMakeLists.txt" )
519
	add_subdirectory (Examples/crossfield3d)
520
521
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/crossfield3d/CMakeLists.txt" )
522
	add_subdirectory (Examples/crossfield3d_dco)
523
524
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_finite_element/CMakeLists.txt" )
525
	add_subdirectory (Examples/small_finite_element)
526
  endif()
527
528
529
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_AQP/CMakeLists.txt" )
	add_subdirectory (Examples/small_AQP)
  endif()
David Bommes's avatar
David Bommes committed
530
531
532
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/finite_element_integrability_problem/CMakeLists.txt" )
	add_subdirectory (Examples/finite_element_integrability_problem)
  endif()
David Bommes's avatar
David Bommes committed
533
534
535
536
537
538
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_mosek_native/CMakeLists.txt" )
	add_subdirectory (Examples/small_mosek_native)
  endif()
  if( EXISTS "${CMAKE_SOURCE_DIR}/Examples/small_mosek_fusion_sdp/CMakeLists.txt" )
	add_subdirectory (Examples/small_mosek_fusion_sdp)
  endif()
539
  
540
endif (COMISO_BUILD_EXAMPLES )
541

542
543
544
# Only create install target, when we are building CoMISo standalone
if(${PROJECT_NAME} MATCHES "CoMISo")

Jan Möbius's avatar
Jan Möbius committed
545
  # Install library
546
547
548
549
  install (TARGETS CoMISo 
                   RUNTIME DESTINATION lib 
                   LIBRARY DESTINATION lib
                   ARCHIVE DESTINATION lib)
Jan Möbius's avatar
Jan Möbius committed
550

551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
  # Install Header Files
  install(DIRECTORY . 
          DESTINATION include/CoMISo
          FILES_MATCHING 
          PATTERN "*.hh"
          PATTERN "*T.cc"
          PATTERN "CVS" EXCLUDE
          PATTERN ".svn" EXCLUDE
          PATTERN ".git" EXCLUDE
          PATTERN "Examples" EXCLUDE
          PATTERN "CI" EXCLUDE
          PATTERN "tmp" EXCLUDE
          PATTERN "Templates" EXCLUDE
          PATTERN "Debian*" EXCLUDE)

  # Install Config File
  install( FILES ${CMAKE_BINARY_DIR}/CoMISo/Config/config.hh
           DESTINATION include/CoMISo/Config )

endif()
571