~corrado-maurini/dolfin/tao

« back to all changes in this revision

Viewing changes to cmake/modules/FindSCOTCH.cmake

  • Committer: corrado maurini
  • Date: 2012-12-18 12:16:08 UTC
  • mfrom: (6685.78.207 trunk)
  • Revision ID: corrado.maurini@upmc.fr-20121218121608-nk82ly9jgsld9u84
updating with trunk, fix uint in TAO solver and hacking the check for tao FindTAO.cmake

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
  DOC "Directory where the SCOTCH-PT header is located"
54
54
  )
55
55
 
 
56
# Check for scotch
 
57
find_library(SCOTCH_LIBRARY
 
58
  NAMES scotch
 
59
  HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib
 
60
  DOC "The SCOTCH library"
 
61
  )
 
62
 
 
63
# Check for scotcherr
 
64
find_library(SCOTCHERR_LIBRARY
 
65
  NAMES scotcherr
 
66
  HINTS ${SCOTCH_DIR}/lib $ENV{SCOTCH_DIR}/lib
 
67
  DOC "The SCOTCH-ERROR library"
 
68
  )
 
69
 
56
70
# Check for ptscotch
57
71
find_library(PTSCOTCH_LIBRARY
58
72
  NAMES ptscotch
79
93
    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
80
94
                   "location of ptscotch.h: ${SCOTCH_INCLUDE_DIRS}/ptscotch.h")
81
95
    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
 
96
                   "location of libscotch: ${SCOTCH_LIBRARY}")
 
97
    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
82
98
                   "location of libptscotch: ${PTSCOTCH_LIBRARY}")
83
99
    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
84
100
                   "location of libptscotcherr: ${PTSCOTCHERR_LIBRARY}")
87
103
  # Set flags for building test program
88
104
  set(CMAKE_REQUIRED_INCLUDES ${SCOTCH_INCLUDE_DIRS})
89
105
  set(CMAKE_REQUIRED_LIBRARIES ${SCOTCH_LIBRARIES})
 
106
  #set(CMAKE_REQUIRED_LIBRARIES ${SCOTCH_LIBRARY} ${SCOTCHERR_LIBRARY})
90
107
 
91
108
  # Add MPI variables if MPI has been found
92
109
  if (MPI_CXX_FOUND)
99
116
    "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/scotch_config_test_version.cpp")
100
117
  file(WRITE ${SCOTCH_CONFIG_TEST_VERSION_CPP} "
101
118
#define MPICH_IGNORE_CXX_SEEK 1
 
119
#include <stdint.h>
102
120
#include <stdio.h>
103
121
#include <mpi.h>
104
 
#include <ptscotch.h>
 
122
#include <scotch.h>
105
123
#include <iostream>
106
124
 
107
125
int main() {
124
142
    RUN_OUTPUT_VARIABLE OUTPUT
125
143
    )
126
144
 
 
145
  # Set version number
127
146
  if (SCOTCH_CONFIG_TEST_VERSION_EXITCODE EQUAL 0)
128
147
    set(SCOTCH_VERSION ${OUTPUT} CACHE TYPE STRING)
 
148
    message(STATUS "Found SCOTCH (version ${SCOTCH_VERSION})")
 
149
  endif()
 
150
 
 
151
  # For SCOTCH version > 6, need to add libraries scotch and ptscotch
 
152
  if (NOT ${SCOTCH_VERSION} VERSION_LESS "6")
 
153
    set(SCOTCH_LIBRARIES ${PTSCOTCH_LIBRARY} ${SCOTCH_LIBRARY} ${PTSCOTCHERR_LIBRARY})
 
154
    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${SCOTCH_LIBRARY})
129
155
  endif()
130
156
 
131
157
  # PT-SCOTCH was first introduced in SCOTCH version 5.0
136
162
      "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/scotch_test_lib.cpp")
137
163
    file(WRITE ${SCOTCH_TEST_LIB_CPP} "
138
164
#define MPICH_IGNORE_CXX_SEEK 1
139
 
#include <sys/types.h>
 
165
#include <stdint.h>
140
166
#include <stdio.h>
141
167
#include <mpi.h>
142
168
#include <ptscotch.h>
189
215
    else()
190
216
      message(STATUS "Performing test SCOTCH_TEST_RUNS - Failed")
191
217
      if (SCOTCH_DEBUG)
192
 
        # Output some variables
193
 
        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
 
218
        # Output some variables
 
219
        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
194
220
                       "SCOTCH_TEST_LIB_COMPILED = ${SCOTCH_TEST_LIB_COMPILED}")
195
221
        message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
196
222
                       "SCOTCH_TEST_LIB_COMPILE_OUTPUT = ${SCOTCH_TEST_LIB_COMPILE_OUTPUT}")
204
230
    # If program does not run, try adding zlib library and test again
205
231
    if(NOT SCOTCH_TEST_RUNS)
206
232
      if (NOT ZLIB_FOUND)
207
 
        find_package(ZLIB)
 
233
        find_package(ZLIB)
208
234
      endif()
209
235
 
210
236
      if (ZLIB_INCLUDE_DIRS AND ZLIB_LIBRARIES)
211
 
        set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZLIB_INCLUDE_DIRS})
212
 
        set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZLIB_LIBRARIES})
 
237
        set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZLIB_INCLUDE_DIRS})
 
238
        set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZLIB_LIBRARIES})
213
239
 
214
 
        message(STATUS "Performing test SCOTCH_ZLIB_TEST_RUNS")
215
 
        try_run(
216
 
          SCOTCH_ZLIB_TEST_LIB_EXITCODE
217
 
          SCOTCH_ZLIB_TEST_LIB_COMPILED
218
 
          ${CMAKE_CURRENT_BINARY_DIR}
219
 
          ${SCOTCH_TEST_LIB_CPP}
220
 
          CMAKE_FLAGS
221
 
            "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
222
 
            "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
223
 
          COMPILE_OUTPUT_VARIABLE SCOTCH_ZLIB_TEST_LIB_COMPILE_OUTPUT
224
 
          RUN_OUTPUT_VARIABLE SCOTCH_ZLIB_TEST_LIB_OUTPUT
225
 
          )
 
240
        message(STATUS "Performing test SCOTCH_ZLIB_TEST_RUNS")
 
241
        try_run(
 
242
          SCOTCH_ZLIB_TEST_LIB_EXITCODE
 
243
          SCOTCH_ZLIB_TEST_LIB_COMPILED
 
244
          ${CMAKE_CURRENT_BINARY_DIR}
 
245
          ${SCOTCH_TEST_LIB_CPP}
 
246
          CMAKE_FLAGS
 
247
                  "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
 
248
                  "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}"
 
249
          COMPILE_OUTPUT_VARIABLE SCOTCH_ZLIB_TEST_LIB_COMPILE_OUTPUT
 
250
          RUN_OUTPUT_VARIABLE SCOTCH_ZLIB_TEST_LIB_OUTPUT
 
251
          )
226
252
 
227
253
        # Add zlib flags if required and set test run to 'true'
228
254
        if (SCOTCH_ZLIB_TEST_LIB_COMPILED AND SCOTCH_ZLIB_TEST_LIB_EXITCODE EQUAL 0)
232
258
          set(SCOTCH_TEST_RUNS TRUE)
233
259
        else()
234
260
          message(STATUS "Performing test SCOTCH_ZLIB_TEST_RUNS - Failed")
235
 
          if (SCOTCH_DEBUG)
 
261
          if (SCOTCH_DEBUG)
236
262
            message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
237
263
                           "SCOTCH_ZLIB_TEST_LIB_COMPILED = ${SCOTCH_ZLIB_TEST_LIB_COMPILED}")
238
264
            message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "