~ubuntu-branches/ubuntu/natty/dolfin/natty

« back to all changes in this revision

Viewing changes to cmake/modules/FindArmadillo.cmake

  • Committer: Bazaar Package Importer
  • Author(s): Johannes Ring
  • Date: 2011-02-24 10:34:44 UTC
  • mfrom: (1.1.7 upstream) (14.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110224103444-n3fwnmh32lfoske0
Tags: 0.9.10-1
* New upstream release. This release fixes bug "FTBFS: error:
  'SCOTCH_Dgraph' was not declared in this scope" (closes: #612602).
* debian/control:
  - Add libslepc3.1-dev and libboost-thread-dev to Build-Depends and
    Depends field in binary package libdolfin0-dev.
  - Bump build dependency on python-ufc to >= 2.0.0.
  - Remove Build-Depends-Indep field as upstream no longer ships the
    user manual.
  - Remove old fields Conflicts, Provides, and Replaces from
    libdolfin0-dev, libdolfin0, libdolfin0-dbg, and python-dolfin.
* Remove all patches as they are now incorporated upstream.
* Add dolfin-plot and dolfin-version to debian/dolfin-bin.install.
* Remove .doc-base file since the user manual is removed by upstream.
* Remove targets clean and install/dolfin-doc from debian/rules since
  they are no longer needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
find_path(ARMADILLO_INCLUDE_DIRS
20
20
  NAMES armadillo
21
 
  PATHS ${ARMADILLO_DIR}/include $ENV{ARMADILLO_DIR}/include
 
21
  HINTS ${ARMADILLO_DIR}/include $ENV{ARMADILLO_DIR}/include
22
22
  DOC "Directory where the Armadillo header file is located"
23
23
  )
24
24
mark_as_advanced(ARMADILLO_INCLUDE_DIRS)
25
25
 
26
26
find_library(ARMADILLO_LIBRARIES
27
27
  NAMES armadillo
28
 
  PATHS ${ARMADILLO_DIR}/lib $ENV{ARMADILLO_DIR}/lib
 
28
  HINTS ${ARMADILLO_DIR}/lib $ENV{ARMADILLO_DIR}/lib
29
29
  DOC "The Armadillo library"
30
30
  )
31
31
mark_as_advanced(ARMADILLO_LIBRARIES)
50
50
  include(CheckCXXSourceRuns)
51
51
 
52
52
  # Armadillo needs the location of the Boost header files
53
 
  if (NOT Boost_INCLUDE_DIR)
 
53
  if (NOT Boost_FOUND)
54
54
    set(BOOST_ROOT $ENV{BOOST_DIR})
55
 
    set(Boost_ADDITIONAL_VERSIONS 1.43 1.43.0)
 
55
    set(Boost_ADDITIONAL_VERSIONS 1.43 1.43.0 1.44 1.44.0 1.45 1.45.0)
56
56
    find_package(Boost REQUIRED)
57
57
  endif()
58
58
 
59
59
  # These are needed for the try_run and check_cxx_source_runs commands below
60
 
  set(CMAKE_REQUIRED_INCLUDES ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIR})
 
60
  set(CMAKE_REQUIRED_INCLUDES ${ARMADILLO_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
61
61
  set(CMAKE_REQUIRED_LIBRARIES ${ARMADILLO_LIBRARIES})
62
62
  if (ARMADILLO_LINK_FLAGS)
63
63
    set(CMAKE_REQUIRED_LIBRARIES ${ARMADILLO_LINK_FLAGS} ${CMAKE_REQUIRED_LIBRARIES})
83
83
    ARMADILLO_CONFIG_TEST_VERSION_COMPILED
84
84
    ${CMAKE_CURRENT_BINARY_DIR}
85
85
    ${ARMADILLO_CONFIG_TEST_VERSION_CPP}
 
86
    CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
86
87
    RUN_OUTPUT_VARIABLE OUTPUT
87
88
    )
88
89
 
90
91
    set(ARMADILLO_VERSION ${OUTPUT} CACHE TYPE STRING)
91
92
  endif()
92
93
 
 
94
  if (${ARMADILLO_VERSION} VERSION_GREATER "0.9.10")
 
95
    set(armadillo_test_str "
 
96
#include <armadillo>
 
97
int main()
 
98
{
 
99
 arma::mat A = arma::randu(4, 4);
 
100
 arma::vec b = arma::randu(4);
 
101
 arma::vec x = arma::solve(A, b);
 
102
 return 0;
 
103
}
 
104
")
 
105
  else()
 
106
    set(armadillo_test_str "
 
107
#include <armadillo>
 
108
int main()
 
109
{
 
110
 arma::mat A = arma::rand(4, 4);
 
111
 arma::vec b = arma::rand(4);
 
112
 arma::vec x = arma::solve(A, b);
 
113
 return 0;
 
114
}
 
115
")
 
116
  endif()
 
117
 
93
118
  # Check that C++ program runs
94
 
  check_cxx_source_compiles("
95
 
#include <armadillo>
96
 
int main()
97
 
{
98
 
 arma::mat A = arma::rand(4, 4);
99
 
 arma::vec b = arma::rand(4);
100
 
 arma::vec x = arma::solve(A, b);
101
 
 return 0;
102
 
}
103
 
"
104
 
    ARMADILLO_TEST_RUNS)
 
119
  check_cxx_source_runs("${armadillo_test_str}" ARMADILLO_TEST_RUNS)
105
120
 
106
 
  # If program runs, trying adding LAPACK library and test again
 
121
  # If program does not run, try adding LAPACK library and test again
107
122
  if(NOT ARMADILLO_TEST_RUNS)
108
 
    find_package(LAPACK)
 
123
    if (NOT LAPACK_FOUND)
 
124
      find_package(LAPACK)
 
125
    endif()
109
126
    if (LAPACK_LIBRARIES)
110
127
      set(CMAKE_REQUIRED_LIBRARIES ${ARMADILLO_LIBRARIES} ${LAPACK_LIBRARIES})
111
 
      check_cxx_source_runs("
112
 
#include <armadillo>
113
 
int main()
114
 
{
115
 
 arma::mat A = arma::rand(4, 4);
116
 
 arma::vec b = arma::rand(4);
117
 
 arma::vec x = arma::solve(A, b);
118
 
 return 0;
119
 
}
120
 
"
121
 
      ARMADILLO_LAPACK_TEST_RUNS)
 
128
      check_cxx_source_runs("${armadillo_test_str}" ARMADILLO_LAPACK_TEST_RUNS)
122
129
 
123
130
      # Add LAPACK libary if required
124
131
      if (ARMADILLO_LAPACK_TEST_RUNS)
138
145
include(FindPackageHandleStandardArgs)
139
146
find_package_handle_standard_args(Armadillo
140
147
  "Armadillo could not be found. Be sure to set ARMADILLO_DIR."
141
 
  ARMADILLO_TEST_RUNS)
 
148
  ARMADILLO_LIBRARIES ARMADILLO_INCLUDE_DIRS ARMADILLO_TEST_RUNS)