forked from Shark-ML/Shark
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
521 lines (458 loc) · 19.6 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
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
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
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
428
429
430
431
432
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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
#####################################################################
# Shark Machine Learning Library
# Top-Level CMake driver file
# Optionally included sub-probjects:
# * Test/CMakeLists.txt
# * examples/CMakeLists.txt
# * doc/CMakeLists.txt
#####################################################################
project( shark )
cmake_minimum_required( VERSION 3.1 FATAL_ERROR)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
INCLUDE (CheckFunctionExists)
cmake_policy(SET CMP0003 NEW)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
if(POLICY CMP0053)
cmake_policy(SET CMP0053 NEW)
endif()
#=========================================================
# Output directories.
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${shark_BINARY_DIR}/bin")
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
if(UNIX)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${shark_BINARY_DIR}/lib")
else()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${shark_BINARY_DIR}/bin")
endif()
endif()
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${shark_BINARY_DIR}/lib")
endif()
mark_as_advanced(
CMAKE_RUNTIME_OUTPUT_DIRECTORY
CMAKE_LIBRARY_OUTPUT_DIRECTORY
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
)
#####################################################################
# Static/Shared libraries
#####################################################################
option(BUILD_SHARED_LIBS "Compile shark into a dynamic library instead of a static one." OFF)
if(BUILD_SHARED_LIBS)
set(SHARK_USE_DYNLIB 1)
endif()
#####################################################################
# Version information
#####################################################################
option(BUILD_OFFICIAL_RELEASE "Is this an official Shark release." OFF )
mark_as_advanced( BUILD_OFFICIAL_RELEASE )
set(SHARK_VERSION_MAJOR 3)
set(SHARK_VERSION_MINOR 1)
set(SHARK_VERSION_PATCH 0)
set(SHARK_VERSION ${SHARK_VERSION_MAJOR}.${SHARK_VERSION_MINOR}.${SHARK_VERSION_PATCH})
set(SHARK_SOVERSION 0)
#####################################################################
# Adjustments for cpack and deb package generation
#####################################################################
set(CPACK_GENERATOR TGZ DEB)
set(CPACK_PACKAGE_NAME "libshark")
set(CPACK_BUNDLE_NAME "libshark")
set(CPACK_PACKAGE_VENDOR "Institut fur Neuroinformatik, Ruhr-Universitaet Bochum")
set(CPACK_PACKAGE_VERSION_MAJOR ${SHARK_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SHARK_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SHARK_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${SHARK_VERSION_MAJOR}.${SHARK_VERSION_MINOR}.${SHARK_VERSION_PATCH})
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_SOURCE_DIR}/COPYING.LESSER)
#Debian Compatible naming by default
if(CMAKE_SIZEOF_VOID_P MATCHES "8")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64)
else()
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
endif()
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libboost-all-dev (>=1.54)")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION
"SHARK is a modular C++ library for the design and optimization of adaptive systems. It provides methods for linear and nonlinear optimization, in particular evolutionary and gradient-based algorithms, kernel-based learning algorithms and neural networks, and various other machine learning techniques. SHARK serves as a toolbox to support real world applications as well as research indifferent domains of computational intelligence and machine learning. The sources are compatible with the following platforms: Windows, Solaris, MacOS X, and Linux."
)
set( CPACK_DEBIAN_PACKAGE_MAINTAINER "Christian Igel <[email protected]>" )
#####################################################################
# Adjust include, lib, example and doc paths for installation
#####################################################################
if( UNIX )
include(GNUInstallDirs)
set( SHARK_INSTALL_BIN_DIR ${CMAKE_INSTALL_BINDIR} CACHE STRING "" )
set( SHARK_INSTALL_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING "" )
set( SHARK_INSTALL_LIB_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING "" )
set( SHARK_INSTALL_CONTRIB_DIR ${CMAKE_INSTALL_DATADIR}/shark/contrib CACHE STRING "" )
set( SHARK_INSTALL_EXAMPLE_DIR ${CMAKE_INSTALL_DATADIR}/shark/examples CACHE STRING "" )
set( SHARK_INSTALL_DOC_DIR ${CMAKE_INSTALL_DATADIR}/shark/doc CACHE STRING "" )
else()
set( SHARK_INSTALL_BIN_DIR bin )
set( SHARK_INSTALL_INCLUDE_DIR include/shark/ )
set( SHARK_INSTALL_LIB_DIR lib/ )
set( SHARK_INSTALL_CONTRIB_DIR contrib/ )
set( SHARK_INSTALL_EXAMPLE_DIR examples/ )
set( SHARK_INSTALL_DOC_DIR doc )
endif()
#####################################################################
# Enable installer and package generation
#####################################################################
include( CPack )
#####################################################################
# Explicit macro setup for debug configuration
#####################################################################
# enable or disable debugging, default is Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
if (UNIX)
add_compile_options("$<$<CONFIG:DEBUG>:-Wall>")
endif()
list(APPEND COMPILE_DEFINITIONS_RELEASE NDEBUG)
message(STATUS "Will build: " ${CMAKE_BUILD_TYPE})
#####################################################################
# Boost configuration
#####################################################################
set(Boost_USE_STATIC_LIBS OFF CACHE BOOL "use static libraries from Boost")
set(Boost_USE_MULTITHREADED ON)
add_definitions(-DBOOST_PARAMETER_MAX_ARITY=15)
add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE)
# Should we link the boost test dynamically
if(NOT Boost_USE_STATIC_LIBS)
add_definitions(-DBOOST_TEST_DYN_LINK)
add_definitions(-DBOOST_ALL_DYN_LINK)
endif()
find_package(
Boost 1.48.0 REQUIRED COMPONENTS
serialization
filesystem system
)
if(NOT Boost_FOUND)
message(FATAL_ERROR "Please make sure Boost 1.48.0 is installed on your system")
endif()
if (WIN32)
# disable autolinking in boost
add_definitions( -DBOOST_ALL_NO_LIB )
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIR} )
link_directories( ${Boost_LIBRARY_DIR} )
# Set the libraries needed by Shark
list(APPEND LINK_LIBRARIES ${Boost_LIBRARIES})
message( STATUS "Using boost from " ${Boost_LIBRARY_DIR} )
#####################################################################
# OpenMP
#####################################################################
option( ENABLE_OPENMP "Enable OpenMP" ON )
if( ENABLE_OPENMP )
find_package( OpenMP QUIET )
if( OPENMP_FOUND )
message( STATUS "OpenMP found" )
set(SHARK_USE_OPENMP 1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
set(SHARK_REQUIRED_C_FLAGS "${OpenMP_C_FLAGS}")
set(SHARK_REQUIRED_CXX_FLAGS "${OpenMP_CXX_FLAGS}")
set(SHARK_REQUIRED_EXE_LINKER_FLAGS "${OpenMP_EXE_LINKER_FLAGS}")
else()
message( STATUS "OpenMP not found" )
endif()
else()
message( STATUS "Building without OpenMP as requested." )
endif()
#####################################################################
# HDF5 configuration
#####################################################################
find_package(HDF5 COMPONENTS C CXX HL QUIET)
mark_as_advanced(HDF5_DIR)
if(HDF5_FOUND)
if(HDF5_C_COMPILER_EXECUTABLE AND HDF5_CXX_COMPILER_EXECUTABLE)
message(STATUS "Checking HDF5 installation: HDF5 installation seems ok.")
include_directories( ${HDF5_INCLUDE_DIRS} )
list(APPEND LINK_LIBRARIES ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
else()
message(STATUS "Checking HDF5 installation:HDF5 package might be broken.")
if(NOT( HDF5_C_COMPILER_EXECUTABLE))
message(STATUS " C Compiler Extension not found.")
endif()
if(NOT( HDF5_CXX_COMPILER_EXECUTABLE))
message(STATUS " CXX Compiler Extension not found.")
endif()
message(STATUS "Disabling HDF5.")
unset( HDF5_FOUND )
endif()
else()
message(STATUS "HDF5 not found, skip")
endif()
#####################################################################
# BLAS configuration
#####################################################################
option( ENABLE_SIMD "Use experimental SIMD feature in linear algebra" OFF )
if( ENABLE_SIMD )
set( SHARK_USE_SIMD 1)
endif()
option( ENABLE_CBLAS "Use Installed Linear Algebra Library" ON )
if( ENABLE_CBLAS )
set(CBLAS_VENDOR FALSE)
if( APPLE )
set(CBLAS_VENDOR "Accelerate")
set(CBLAS_INCLUDES "")
set(CBLAS_LIBRARIES "-framework Accelerate" )
else()
#todo: do a propper vendor check
find_library(OPENBLAS_LIBRARY openblas
HINTS ${CBLAS_ROOT}/lib /opt/local/lib /usr/lib/openblas-base
)
find_library(CBLAS_LIBRARY cblas
HINTS ${ATLAS_ROOT}/lib ${CBLAS_ROOT}/lib /opt/local/lib /usr/lib64/atlas/ /usr/lib/libblas
)
find_library(CLAPACK_LIBRARY lapack
HINTS ${ATLAS_ROOT}/lib ${CBLAS_ROOT}/lib /opt/local/lib /usr/lib64/atlas/ /usr/lib/lapack
)
find_library(ATLAS_LIBRARY atlas
HINTS ${ATLAS_ROOT}/lib ${CBLAS_ROOT}/lib /opt/local/lib /usr/lib64/atlas/ /usr/lib/atlas-base
)
mark_as_advanced(
OPENBLAS_LIBRARY
CBLAS_LIBRARY
CLAPACK_LIBRARY
ATLAS_LIBRARY
)
#find the cblas.h include path
if(CBLAS_LIBRARY )
get_filename_component(CBLAS_LIB_PATH ${CBLAS_LIBRARY} PATH )
elseif( OPENBLAS_LIBRARY)
get_filename_component(CBLAS_LIB_PATH ${OPENBLAS_LIBRARY} PATH )
endif()
if(CBLAS_LIB_PATH)
find_file(CBLAS_INCLUDES cblas.h
PATHS ${CBLAS_LIB_PATH} ${CBLAS_LIB_PATH}/../include
)
get_filename_component(CBLAS_INCLUDES ${CBLAS_INCLUDES} PATH )
endif()
if(ATLAS_LIBRARY)
get_filename_component(ATLAS_LIBRARY_PATH ${ATLAS_LIBRARY} PATH )
find_file(CLAPACK_INCLUDES clapack.h
PATHS
${ATLAS_LIBRARY_PATH}
${ATLAS_LIBRARY_PATH}/../include
${ATLAS_LIBRARY_PATH}/../include/atlas
${ATLAS_LIBRARY_PATH}/../../include/atlas
)
get_filename_component(CLAPACK_INCLUDES ${CLAPACK_INCLUDES} PATH )
set(CBLAS_INCLUDES ${CBLAS_INCLUDES} ${CLAPACK_INCLUDES})
endif()
if( OPENBLAS_LIBRARY AND CBLAS_INCLUDES)
set(CBLAS_VENDOR "OpenBLAS")
set(CBLAS_LIBRARIES ${OPENBLAS_LIBRARY})
elseif( CBLAS_LIBRARY AND CLAPACK_LIBRARY AND ATLAS_LIBRARY AND CBLAS_INCLUDES)
set(CBLAS_VENDOR "ATLAS")
set(CBLAS_LIBRARIES ${CLAPACK_LIBRARY} ${CBLAS_LIBRARY} ${ATLAS_LIBRARY})
elseif( CBLAS_LIBRARY AND CBLAS_INCLUDES)
#check that we can compile a basic program with the libraries we have found
#vendor versions might come with additional libraries which would be bad.
try_compile(CBLAS_COMPILE
"${PROJECT_BINARY_DIR}/cBlasCheck"
"${CMAKE_SOURCE_DIR}/cBlasCheck.cpp"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${CBLAS_INCLUDES}"
LINK_LIBRARIES ${CBLAS_LIBRARY}
)
if(CBLAS_COMPILE)
set(CBLAS_VENDOR "GENERIC")
set(CBLAS_LIBRARIES ${CBLAS_LIBRARY})
else()
message(WARNING "Unknown CBLAS. Can not use it")
endif()
endif()
endif()
if(CBLAS_VENDOR)
message(STATUS "CBLAS FOUND: " ${CBLAS_VENDOR} " with include directory " ${CBLAS_INCLUDES} )
set(SHARK_USE_CBLAS 1)
list(APPEND EXTRA_INCLUDE_DIRECTORIES ${CBLAS_INCLUDES} )
list(APPEND LINK_LIBRARIES ${CBLAS_LIBRARIES})
include_directories ( ${CBLAS_INCLUDES} )
else()
message(STATUS "No usable CBLAS Library found. No fast linear Algebra used.")
endif()
#Special setup for ATLAS
if( CBLAS_VENDOR MATCHES "ATLAS" )
set( SHARK_USE_ATLAS_LAPACK 1) # ATLAS always contains some LAPACK methods that we can use
#check for full lapack
set(CMAKE_REQUIRE_QUIET 1)
set(CMAKE_REQUIRED_LIBRARIES ${CBLAS_LIBRARIES})
check_function_exists(dsyev_ ATLAS_FULL_LAPACK)
if( ATLAS_FULL_LAPACK )
set( SHARK_USE_LAPACK 1)
message(STATUS "Detected ATLAS with full LAPACK package. Using it!")
endif()
endif()
endif()
#####################################################################
# clBLAS configuration
#####################################################################
option( ENABLE_CLBLAS "Use GPU backend (currently only as BLAS backend for testing. unused by shark" OFF )
if( ENABLE_CLBLAS )
if(${Boost_MINOR_VERSION} LESS 61)
message(FATAL_ERROR "Boost below 1.61 does not include Boost.Compute.")
endif()
find_package( clBLAS REQUIRED)
if(NOT clBLAS_FOUND)
message(FATAL_ERROR "clBLAS could not be found.")
endif()
include_directories(SYSTEM ${Boost_INCLUDE_DIR} ${CLBLAS_INCLUDE_DIRS} ${CLBLAS_INCLUDE_DIRS}/clBLAS/ )
# Set the libraries needed by Shark
list(APPEND LINK_LIBRARIES ${Boost_LIBRARIES} ${CLBLAS_LIBRARIES})
set(SHARK_USE_CLBLAS 1)
endif()
#####################################################################
# Static Code Analysis
#####################################################################
option(USE_CPPCHECK "Use CPPCheck Static Code Analysis" OFF)
mark_as_advanced(USE_CPPCHECK)
if(USE_CPPCHECK)
find_program(CPP_CHECK cppcheck)
mark_as_advanced(CPP_CHECK)
if(CPP_CHECK)
message(STATUS "cppcheck available for static code analysis." )
add_custom_target(code_analysis
${CPP_CHECK} --enable=all --xml --force -I${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR} 2> StaticAnalysis.xml)
endif()
endif()
#####################################################################
# GCov Code Analysis
#####################################################################
option(USE_GCOV_CHECK "GCov Coverage Check" OFF)
if(USE_GCOV_CHECK)
find_program(GCOV_CHECK gcov)
if(CMAKE_BUILD_TYPE MATCHES "Release")
message( FATAL_ERROR
"\nYou specified a Release Build."
"This does not make sense, if Coverage is enabled."
"Please change Build type to Debug or turn off Coverage."
)
endif()
message(STATUS "GCov available for static code analysis. Configuring for Code Check." )
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
set(CFLAGS "${CFLAGS} -g -O0 -Wall -W --coverage")
set(LDFLAGS "${LDFLAGS} --coverage")
endif()
#####################################################################
# Adjust compiler flags and settings for MSVC
#####################################################################
if( MSVC )
#4250: inherit via dominance
add_definitions(/wd4250)
#4251: needs to have dll-interface
add_definitions(/wd4251)
#4275: non-dll interface used as base for dll-interface class
add_definitions(/wd4275)
#4308: Negative integral constant
add_definitions(/wd4800)
add_definitions(/wd4308)
string( REPLACE "/O2" "/Od" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING "compiler-flags" FORCE )
add_definitions(-D_USE_MATH_DEFINES)
add_definitions(-DNOMINMAX)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1)
endif()
#####################################################################
# General Path settings
#####################################################################
include_directories( ${shark_SOURCE_DIR}/include )
include_directories( ${shark_BINARY_DIR}/include )
add_subdirectory( include )
add_subdirectory( src )
#####################################################################
# Include Examples
#####################################################################
option( BUILD_EXAMPLES "Build example programs." ON )
add_subdirectory( examples )
#####################################################################
# Include Unit Tests
#####################################################################
# Enable Testing
include(CTest)
if(BUILD_TESTING)
enable_testing()
add_subdirectory( Test )
endif()
#####################################################################
# Include Documentation
#####################################################################
option(BUILD_DOCUMENTATION "Build documentation." OFF)
if(BUILD_DOCUMENTATION)
add_subdirectory(doc)
endif()
###################################################################
# CPACK PACKAGING
###################################################################
set(INSTALL_CMAKE_DIR lib/cmake/Shark/)
# Add all targets to the build-tree export set
export(TARGETS shark SharkVersion FILE "${shark_BINARY_DIR}/SharkTargets.cmake")
# Create the SharkConfig.cmake and SharkConfigVersion files
set(SHARK_USE_FILE "${PROJECT_SOURCE_DIR}/UseShark.cmake")
set(SHARK_TARGETS_FILE "${PROJECT_BINARY_DIR}/SharkTargets.cmake")
set(SHARK_LIBRARIES ${LINK_LIBRARIES} shark)
set(SHARK_LIBRARY_DIRS "${PROJECT_BINARY_DIR}/lib")
set(SHARK_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include" "${Boost_INCLUDE_DIR}" ${EXTRA_INCLUDE_DIRECTORIES})
# Configure the files to be exported
configure_file(SharkConfig.cmake.in "${PROJECT_BINARY_DIR}/SharkConfig.cmake")
configure_file(SharkConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/SharkConfigVersion.cmake")
# Configure the SharkConfig.cmake for the install tree
set(SHARK_CONFIG_CODE "
# Compute the installation prefix from this SharkConfig.cmake file location.
get_filename_component(SHARK_INSTALL_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)")
# Construct the proper number of get_filename_component(... PATH)
# calls to compute the installation prefix.
string(REGEX REPLACE "/" ";" _count "${INSTALL_CMAKE_DIR}")
foreach(p ${_count})
set(SHARK_CONFIG_CODE "${SHARK_CONFIG_CODE}
get_filename_component(SHARK_INSTALL_PREFIX \"\${SHARK_INSTALL_PREFIX}\" DIRECTORY)")
endforeach()
set(SHARK_CONFIG_CODE "${SHARK_CONFIG_CODE}")
set(SHARK_USE_FILE "\${SHARK_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}UseShark.cmake")
set(SHARK_TARGETS_FILE "\${SHARK_INSTALL_PREFIX}/${INSTALL_CMAKE_DIR}SharkTargets.cmake")
set(SHARK_LIBRARIES ${LINK_LIBRARIES} shark)
set(SHARK_LIBRARY_DIRS "\${SHARK_INSTALL_PREFIX}/lib")
set(SHARK_INCLUDE_DIRS "\${SHARK_INSTALL_PREFIX}/${SHARK_INSTALL_INCLUDE_DIR}" "${Boost_INCLUDE_DIR}" ${EXTRA_INCLUDE_DIRECTORIES})
configure_file(SharkConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/SharkConfig.cmake")
# Install the SharkConfig.cmake and SharkConfigVersion.cmake
install(FILES
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/SharkConfig.cmake"
"${PROJECT_BINARY_DIR}/SharkConfigVersion.cmake"
"${PROJECT_SOURCE_DIR}/UseShark.cmake"
DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev
)
# Install the export set for use with the install-tree
install(EXPORT SharkTargets DESTINATION "${INSTALL_CMAKE_DIR}" COMPONENT dev)
#####################################################################
# Configure the Shark.h file
#####################################################################
configure_file (
"${CMAKE_SOURCE_DIR}/include/shark/Core/Shark.h.in"
"${CMAKE_BINARY_DIR}/include/shark/Core/Shark.h"
)
install(FILES
"${CMAKE_BINARY_DIR}/include/shark/Core/Shark.h"
DESTINATION "${SHARK_INSTALL_INCLUDE_DIR}/shark/Core/" COMPONENT deV
)
###################################################################
# UNINSTALL #
###################################################################
# refer to
# http://www.cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
# for details
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)