annotate armadillo-2.4.4/CMakeLists.txt @ 8:ccfdf972c04b

Compiled and built using -mmacosx-version-min=10.5
author maxzanoni76 <max.zanoni@eecs.qmul.ac.uk>
date Fri, 13 Apr 2012 00:54:18 +0100
parents 8b6102e2a9b0
children
rev   line source
max@0 1
max@0 2 # Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
max@0 3 # Copyright (C) 2008-2011 Conrad Sanderson
max@0 4 # Copyright (C) 2011 Clement Creusot
max@0 5 #
max@0 6 # This file is part of the Armadillo C++ library.
max@0 7 # It is provided without any warranty of fitness
max@0 8 # for any purpose. You can redistribute this file
max@0 9 # and/or modify it under the terms of the GNU
max@0 10 # Lesser General Public License (LGPL) as published
max@0 11 # by the Free Software Foundation, either version 3
max@0 12 # of the License or (at your option) any later version.
max@0 13 # (see http://www.opensource.org/licenses for more info)
max@0 14
max@0 15 cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
max@0 16
max@0 17 set(ARMA_MAJOR 2)
max@0 18 set(ARMA_MINOR 4)
max@0 19 set(ARMA_PATCH 4)
max@0 20
max@0 21 message(STATUS "Configuring Armadillo ${ARMA_MAJOR}.${ARMA_MINOR}.${ARMA_PATCH}")
max@0 22
max@0 23 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/build_aux/cmake/Modules/")
max@0 24
max@0 25 include(CheckIncludeFileCXX)
max@0 26 include(CheckLibraryExists)
max@0 27 include(FindBoost)
max@0 28 include(ARMA_CheckProto)
max@0 29 include(ARMA_CheckMathProto)
max@0 30
max@0 31 project(armadillo CXX)
max@0 32
max@0 33 #CMAKE_REQUIRED_FLAGS = string of compile command line flags
max@0 34 #CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
max@0 35 #CMAKE_REQUIRED_LIBRARIES = list of libraries to link
max@0 36
max@0 37
max@0 38 set(ARMA_USE_LAPACK false)
max@0 39 set(ARMA_USE_BLAS false)
max@0 40 set(ARMA_USE_ATLAS false)
max@0 41 set(ARMA_USE_BOOST false)
max@0 42 set(ARMA_USE_WRAPPER true )
max@0 43
max@0 44
max@0 45 if(WIN32)
max@0 46 message(STATUS "")
max@0 47 message(STATUS "WARNING:")
max@0 48 message(STATUS "Automatic installation is currently not available for this platform.")
max@0 49 message(STATUS "Please use the manual installation, as described in the README.txt file.")
max@0 50 message(STATUS "You can also use the 'include' folder directly, but you may want to edit")
max@0 51 message(STATUS "'include/armadillo_bits/config.hpp' if you have LAPACK installed.")
max@0 52 message(STATUS "")
max@0 53 endif()
max@0 54
max@0 55
max@0 56
max@0 57 #
max@0 58 # Find LAPACK and BLAS libraries, or their optimised versions
max@0 59 #
max@0 60
max@0 61 if(APPLE)
max@0 62 set(ARMA_OS macos)
max@0 63
max@0 64 set(ARMA_USE_LAPACK true)
max@0 65 set(ARMA_USE_BLAS true)
max@0 66
max@0 67 # Under MacOS, the current version of ARMA_FindCLAPACK can get confused between
max@0 68 # two incompatible versions of "clapack.h" (one provided by the system and one
max@0 69 # provided by ATLAS). As such, use of ATLAS under MacOS is disabled for now.
max@0 70
max@0 71 else()
max@0 72 set(ARMA_OS unix)
max@0 73
max@0 74 include(ARMA_FindMKL)
max@0 75 include(ARMA_FindACMLMP)
max@0 76 include(ARMA_FindACML)
max@0 77
max@0 78 message(STATUS "MKL_FOUND = ${MKL_FOUND}")
max@0 79 message(STATUS "ACMLMP_FOUND = ${ACMLMP_FOUND}")
max@0 80 message(STATUS "ACML_FOUND = ${ACML_FOUND}")
max@0 81
max@0 82 if(MKL_FOUND OR ACMLMP_FOUND OR ACML_FOUND)
max@0 83
max@0 84 set(ARMA_USE_BLAS true)
max@0 85 set(ARMA_USE_LAPACK true)
max@0 86
max@0 87 message(STATUS "*** If the MKL or ACML libraries are installed in a non-standard location,")
max@0 88 message(STATUS "*** make sure the run-time linker can find them.")
max@0 89 message(STATUS "*** On Linux systems this can be done by editing /etc/ld.so.conf")
max@0 90 message(STATUS "*** or modifying the LD_LIBRARY_PATH environment variable.")
max@0 91 message(STATUS "*** On systems with SELinux enabled (e.g. Fedora, RHEL),")
max@0 92 message(STATUS "*** you may need to change the SELinux type of all MKL/ACML libraries")
max@0 93 message(STATUS "*** to fix permission problems that may occur during run-time.")
max@0 94 message(STATUS "*** See README.txt for more information")
max@0 95
max@0 96 else()
max@0 97
max@0 98 include(ARMA_FindLAPACK)
max@0 99 include(ARMA_FindBLAS)
max@0 100 include(ARMA_FindCLAPACK)
max@0 101 include(ARMA_FindCBLAS)
max@0 102
max@0 103 message(STATUS "LAPACK_FOUND = ${LAPACK_FOUND}")
max@0 104 message(STATUS "BLAS_FOUND = ${BLAS_FOUND}")
max@0 105 message(STATUS "CLAPACK_FOUND = ${CLAPACK_FOUND}")
max@0 106 message(STATUS "CBLAS_FOUND = ${CBLAS_FOUND}")
max@0 107
max@0 108 if(LAPACK_FOUND)
max@0 109 set(ARMA_USE_LAPACK true)
max@0 110 endif()
max@0 111
max@0 112 if(BLAS_FOUND)
max@0 113 set(ARMA_USE_BLAS true)
max@0 114 endif()
max@0 115
max@0 116 if(CLAPACK_FOUND AND CBLAS_FOUND)
max@0 117 message(STATUS "CLAPACK_INCLUDE_DIR = ${CLAPACK_INCLUDE_DIR}")
max@0 118 message(STATUS "CBLAS_INCLUDE_DIR = ${CBLAS_INCLUDE_DIR}")
max@0 119 if(${CLAPACK_INCLUDE_DIR} STREQUAL ${CBLAS_INCLUDE_DIR})
max@0 120 set(ARMA_USE_ATLAS true)
max@0 121 set(ARMA_ATLAS_INCLUDE_DIR ${CLAPACK_INCLUDE_DIR})
max@0 122 endif()
max@0 123 endif()
max@0 124
max@0 125 endif()
max@0 126
max@0 127 endif()
max@0 128
max@0 129
max@0 130 if(MKL_FOUND OR ACMLMP_FOUND OR ACML_FOUND)
max@0 131
max@0 132 if(MKL_FOUND)
max@0 133 set(ARMA_LIBS ${ARMA_LIBS} ${MKL_LIBRARIES})
max@0 134
max@0 135 if(ACMLMP_FOUND OR ACML_FOUND)
max@0 136 message(STATUS "*** Intel MKL as well as AMD ACML libraries were found.")
max@0 137 message(STATUS "*** Using only the MKL library to avoid linking conflicts.")
max@0 138 message(STATUS "*** If you wish to use ACML instead, please link manually with")
max@0 139 message(STATUS "*** acml or acml_mp instead of the armadillo run-time component.")
max@0 140 message(STATUS "*** Alternatively, remove MKL from your system and rerun")
max@0 141 message(STATUS "*** Armadillo's configuration using ./configure")
max@0 142 endif()
max@0 143
max@0 144 else()
max@0 145
max@0 146 if(ACMLMP_FOUND)
max@0 147 set(ARMA_LIBS ${ARMA_LIBS} ${ACMLMP_LIBRARIES})
max@0 148
max@0 149 message(STATUS "*** Both single-core and multi-core ACML libraries were found.")
max@0 150 message(STATUS "*** Using only the multi-core library to avoid linking conflicts.")
max@0 151 else()
max@0 152 if(ACML_FOUND)
max@0 153 set(ARMA_LIBS ${ARMA_LIBS} ${ACML_LIBRARIES})
max@0 154 endif()
max@0 155 endif()
max@0 156
max@0 157 endif()
max@0 158
max@0 159 else()
max@0 160
max@0 161 if(ARMA_USE_BLAS STREQUAL true)
max@0 162 set(ARMA_LIBS ${ARMA_LIBS} ${BLAS_LIBRARIES})
max@0 163 endif()
max@0 164
max@0 165 if(ARMA_USE_LAPACK STREQUAL true)
max@0 166 set(ARMA_LIBS ${ARMA_LIBS} ${LAPACK_LIBRARIES})
max@0 167 endif()
max@0 168
max@0 169 if(ARMA_USE_ATLAS STREQUAL true)
max@0 170 set(ARMA_LIBS ${ARMA_LIBS} ${CBLAS_LIBRARIES})
max@0 171 set(ARMA_LIBS ${ARMA_LIBS} ${CLAPACK_LIBRARIES})
max@0 172 endif()
max@0 173
max@0 174 endif()
max@0 175
max@0 176
max@0 177 if(APPLE)
max@0 178 set(ARMA_LIBS ${ARMA_LIBS} "-framework Accelerate") # or "-framework accelerate" ?
max@0 179 message(STATUS "MacOS X detected. Added '-framework Accelerate' to compiler flags")
max@0 180 endif()
max@0 181
max@0 182 message(STATUS "*** ")
max@0 183 message(STATUS "*** The Armadillo run-time library component will be an alias for the following libraries:")
max@0 184 message(STATUS "*** ARMA_LIBS = ${ARMA_LIBS}")
max@0 185 message(STATUS "*** ")
max@0 186
max@0 187 find_package(Boost)
max@0 188
max@0 189 if(Boost_FOUND)
max@0 190
max@0 191 message(STATUS "Boost_MAJOR_VERSION = ${Boost_MAJOR_VERSION}")
max@0 192 message(STATUS "Boost_MINOR_VERSION = ${Boost_MINOR_VERSION}")
max@0 193
max@0 194 if(Boost_MAJOR_VERSION GREATER 0)
max@0 195 if(Boost_MINOR_VERSION GREATER 33)
max@0 196 set(ARMA_USE_BOOST true)
max@0 197 message(STATUS "Boost_INCLUDE_DIR = ${Boost_INCLUDE_DIR}")
max@0 198 endif()
max@0 199 endif()
max@0 200
max@0 201 endif()
max@0 202
max@0 203 if(ARMA_USE_BOOST STREQUAL false)
max@0 204 message(STATUS "Boost libraries either not found or their version is too low (version 1.34 or later is good).")
max@0 205 message(STATUS "( It's possible that CMake didn't find the particular version of Boost you may have. )")
max@0 206 message(STATUS "( If that's the case, please edit include/armadillo_bits/config.hpp manually. )")
max@0 207 endif()
max@0 208
max@0 209
max@0 210 # If Boost libraries were found, explicitly check if Boost's date_time library is also present.
max@0 211 # This is due to the non-standard packaging of Boost libraries on Debian and Ubuntu systems,
max@0 212 # where certain individual Boost libraries are packaged separately.
max@0 213
max@0 214 if(ARMA_USE_BOOST STREQUAL true)
max@0 215 set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${Boost_INCLUDE_DIR})
max@0 216 CHECK_INCLUDE_FILE_CXX("boost/date_time/posix_time/posix_time.hpp" ARMA_USE_BOOST_DATE)
max@0 217 endif()
max@0 218
max@0 219 ARMA_CHECK_MATH_PROTO("isfinite" "std" "cmath" ARMA_HAVE_STD_ISFINITE)
max@0 220 ARMA_CHECK_MATH_PROTO("isinf" "std" "cmath" ARMA_HAVE_STD_ISINF)
max@0 221 ARMA_CHECK_MATH_PROTO("isnan" "std" "cmath" ARMA_HAVE_STD_ISNAN)
max@0 222 ARMA_CHECK_MATH_PROTO("log1p" "" "cmath" ARMA_HAVE_LOG1P)
max@0 223
max@0 224 ARMA_CHECK_PROTO("snprintf" "std" "cstdio" ARMA_HAVE_STD_SNPRINTF)
max@0 225 ARMA_CHECK_PROTO("gettimeofday" "" "sys/time.h" ARMA_HAVE_GETTIMEOFDAY)
max@0 226
max@0 227
max@0 228 message(STATUS "Generating 'include/armadillo_bits/config.hpp'")
max@0 229 configure_file(include/armadillo_bits/config.hpp.cmake include/armadillo_bits/config.hpp)
max@0 230
max@0 231 message(STATUS "Generating 'examples/Makefile'")
max@0 232 configure_file(examples/Makefile.cmake examples/Makefile)
max@0 233
max@0 234
max@0 235 if(ARMA_USE_BOOST STREQUAL true)
max@0 236 include_directories(include ${Boost_INCLUDE_DIR})
max@0 237 else()
max@0 238 include_directories(include)
max@0 239 endif()
max@0 240
max@0 241
max@0 242 ## For any library that is not in a default location,
max@0 243 ## embed its path into the Armadillo runtime library.
max@0 244 ## Examples of default locations are "/lib", "/usr/lib",
max@0 245 ## or as specified in "/etc/ld.so.conf".
max@0 246 ##
max@0 247 ## Path embedding is not recommended unless you know
max@0 248 ## what you're doing. It might be better to add the
max@0 249 ## path to the "/etc/ld.so.conf" file and then run "ldconfig".
max@0 250 ##
max@0 251 #set(CMAKE_SKIP_BUILD_RPATH FALSE)
max@0 252 #set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
max@0 253 #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
max@0 254
max@0 255
max@0 256 add_library( armadillo SHARED src/wrap_libs )
max@0 257 target_link_libraries( armadillo ${ARMA_LIBS} )
max@0 258
max@0 259 set_target_properties(armadillo PROPERTIES VERSION ${ARMA_MAJOR}.${ARMA_MINOR}.${ARMA_PATCH} SOVERSION 2)
max@0 260
max@0 261
max@0 262
max@0 263 ################################################################################
max@0 264 # INSTALL CONFIGURATION
max@0 265
max@0 266
max@0 267 # As Red Hat Enterprise Linux (and related systems such as Fedora)
max@0 268 # does not search /usr/local/lib by default, we need to place the
max@0 269 # library in either /usr/lib or /usr/lib64
max@0 270
max@0 271 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
max@0 272 set(CMAKE_INSTALL_PREFIX "/usr")
max@0 273 endif()
max@0 274
max@0 275 # Allow for the "lib" directory to be specified on the command line
max@0 276 if(NOT INSTALL_LIB_DIR)
max@0 277 set(INSTALL_LIB_DIR "lib")
max@0 278 if(UNIX AND NOT APPLE) # I don't know how Mac OS handles 64 bit systems
max@0 279 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
max@0 280 message(STATUS "Detected 64 bit system")
max@0 281 if(IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib64")
max@0 282 unset(INSTALL_LIB_DIR)
max@0 283 set(INSTALL_LIB_DIR "lib64")
max@0 284 endif()
max@0 285 endif()
max@0 286 endif()
max@0 287 endif()
max@0 288
max@0 289 # Allow for the "include" directory to be specified on the command line
max@0 290
max@0 291 if(NOT INSTALL_INCLUDE_DIR)
max@0 292 set(INSTALL_INCLUDE_DIR "include")
max@0 293 endif()
max@0 294
max@0 295 # We use data dir to store files shared with other programs
max@0 296 # like the ArmadilloConfig.cmake file.
max@0 297 if(NOT INSTALL_DATA_DIR)
max@0 298 set(INSTALL_DATA_DIR "share")
max@0 299 endif()
max@0 300
max@0 301 # Make relative paths absolute so we can write them in Config.cmake files
max@0 302 foreach(p LIB INCLUDE DATA)
max@0 303 set(var INSTALL_${p}_DIR)
max@0 304 if(NOT IS_ABSOLUTE "${${var}}")
max@0 305 set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
max@0 306 endif()
max@0 307 endforeach()
max@0 308
max@0 309 message(STATUS "CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX}")
max@0 310 message(STATUS "INSTALL_LIB_DIR = ${INSTALL_LIB_DIR}" )
max@0 311 message(STATUS "INSTALL_INCLUDE_DIR = ${INSTALL_INCLUDE_DIR}" )
max@0 312 message(STATUS "INSTALL_DATA_DIR = ${INSTALL_DATA_DIR}" )
max@0 313
max@0 314
max@0 315 # Note that the trailing / character in "include/" is critical
max@0 316
max@0 317 install(DIRECTORY include/ DESTINATION ${INSTALL_INCLUDE_DIR}
max@0 318 PATTERN ".svn" EXCLUDE
max@0 319 PATTERN "*.cmake" EXCLUDE
max@0 320 PATTERN "*~" EXCLUDE
max@0 321 PATTERN "*orig" EXCLUDE
max@0 322 )
max@0 323
max@0 324 install(TARGETS armadillo
max@0 325 DESTINATION ${INSTALL_LIB_DIR}
max@0 326 EXPORT ArmadilloLibraryDepends)
max@0 327
max@0 328 # Export the package for use from the build-tree
max@0 329 # (this registers the build-tree with a global CMake-registry)
max@0 330 if(CMAKE_VERSION VERSION_GREATER "2.7")
max@0 331 export(PACKAGE armadillo)
max@0 332 endif()
max@0 333
max@0 334 ## LOCAL FILES
max@0 335 # Create ArmadilloConfig.cmake file for the use from the build tree
max@0 336 set(ARMADILLO_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}" "${PROJECT_BINARY_DIR}")
max@0 337 set(ARMADILLO_LIB_DIR "${PROJECT_BINARY_DIR}")
max@0 338 set(ARMADILLO_CMAKE_DIR "${PROJECT_BINARY_DIR}")
max@0 339
max@0 340
max@0 341 message(STATUS "Generating '${PROJECT_BINARY_DIR}/ArmadilloConfig.cmake'")
max@0 342 # copy/change config and configVersion file (modify only the @xyz@ variables)
max@0 343 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfig.cmake.in
max@0 344 "${PROJECT_BINARY_DIR}/ArmadilloConfig.cmake" @ONLY)
max@0 345
max@0 346 message(STATUS "Generating '${PROJECT_BINARY_DIR}/ArmadilloConfigVersion.cmake'")
max@0 347 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfigVersion.cmake.in
max@0 348 "${PROJECT_BINARY_DIR}/ArmadilloConfigVersion.cmake" @ONLY)
max@0 349
max@0 350
max@0 351 # Install the export set for use with the install-tree
max@0 352 install(EXPORT ArmadilloLibraryDepends DESTINATION
max@0 353 "${INSTALL_DATA_DIR}/Armadillo/CMake"
max@0 354 COMPONENT dev)
max@0 355
max@0 356
max@0 357 ## GLOBAL INSTALL FILES
max@0 358 # Create ArmadilloConfig.cmake file for the use from the install tree
max@0 359 # and install it
max@0 360 set(ARMADILLO_INCLUDE_DIRS "${INSTALL_INCLUDE_DIR}")
max@0 361 set(ARMADILLO_LIB_DIR "${INSTALL_LIB_DIR}")
max@0 362 set(ARMADILLO_CMAKE_DIR "${INSTALL_DATA_DIR}/Armadillo/CMake")
max@0 363
max@0 364
max@0 365 message(STATUS "Generating '${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake'")
max@0 366 # copy/change config and configVersion file (modify only the @xyz@ variables)
max@0 367 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfig.cmake.in
max@0 368 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake" @ONLY)
max@0 369
max@0 370 message(STATUS "Generating '${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake'")
max@0 371 configure_file(build_aux/cmake/InstallFiles/ArmadilloConfigVersion.cmake.in
max@0 372 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake" @ONLY)
max@0 373
max@0 374 # Install files to be found by cmake users with find_package()
max@0 375 install(FILES
max@0 376 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfig.cmake"
max@0 377 "${PROJECT_BINARY_DIR}/InstallFiles/ArmadilloConfigVersion.cmake"
max@0 378 DESTINATION "${ARMADILLO_CMAKE_DIR}" COMPONENT dev)