|
76 | 76 | endif()
|
77 | 77 |
|
78 | 78 | ################################ CMAKE OPTIONS ##################################
|
| 79 | +option(WITH_NSDF "Enable NSDF support. Requires hdf5" OFF ) |
| 80 | + |
79 | 81 | option(DEBUG "Build with debug support" OFF)
|
80 | 82 | option(GPROF "Build for profiling using gprof" OFF)
|
81 | 83 | option(ENABLE_UNIT_TESTS "Enable unit tests (DEBUG should also be ON)" OFF)
|
@@ -187,68 +189,71 @@ if(WITH_BOOST_ODE)
|
187 | 189 | add_definitions(-DUSE_BOOST_ODE -UUSE_GSL)
|
188 | 190 | endif()
|
189 | 191 |
|
190 |
| - |
191 |
| -find_package(HDF5 COMPONENTS CXX HL) |
192 |
| -if(NOT HDF5_FOUND) |
193 |
| - message( |
194 |
| - "==================================================================\n" |
195 |
| - " HDF5 not found. Disabling support. Required for nsdf. \n\n" |
196 |
| - " If you need hdf5 support, please install hdf5-dev or hdf5-devel\n" |
197 |
| - " package or equivalent.\n\n" |
198 |
| - " $ sudo apt-get install libhdf5-dev \n" |
199 |
| - " $ sudo yum install libhdf5-devel \n" |
200 |
| - " $ brew install hdf5 \n\n" |
201 |
| - " Otherwise, continue with 'make' and 'make install' \n" |
202 |
| - " If you install hdf5 to non-standard path, export environment \n" |
203 |
| - " variable HDF5_ROOT to the location. Rerun cmake \n" |
204 |
| - "================================================================ \n" |
205 |
| - ) |
206 |
| -endif(NOT HDF5_FOUND) |
207 |
| - |
208 |
| -if(HDF5_FOUND) |
209 |
| - include_directories( ${HDF5_INCLUDE_DIRS} ) |
210 |
| - add_definitions( -DUSE_HDF5 ) |
211 |
| - if(HDF5_USE_STATIC_LIBRARIES) |
212 |
| - message(STATUS "Finding static HDF5 libraries in $ENV{HDF5_ROOT}") |
213 |
| - find_library(HDF5_CXX_LIBRARIES NAMES libhdf5.a |
214 |
| - PATHS $ENV{HDF5_ROOT}/lib $ENV{HDF5_ROOT}/lib64 |
| 192 | +# NSDF5 support. Disabled by default. |
| 193 | +if(WITH_NSDF) |
| 194 | + find_package(HDF5 COMPONENTS CXX HL) |
| 195 | + if(NOT HDF5_FOUND) |
| 196 | + message( |
| 197 | + "==================================================================\n" |
| 198 | + " HDF5 not found. Disabling NSDF support.\n\n" |
| 199 | + " If you need NSDF support, please install hdf5-dev or hdf5-devel\n" |
| 200 | + " package or equivalent.\n\n" |
| 201 | + " $ sudo apt-get install libhdf5-dev \n" |
| 202 | + " $ sudo yum install libhdf5-devel \n" |
| 203 | + " $ brew install hdf5 \n\n" |
| 204 | + " Otherwise, continue with 'make' and 'make install' \n" |
| 205 | + " If you install hdf5 to non-standard path, export environment \n" |
| 206 | + " variable HDF5_ROOT to the location. Rerun cmake \n" |
| 207 | + "================================================================ \n" |
215 | 208 | )
|
216 |
| - find_library(HDF5_HL_LIBRARIES NAMES libhdf5_hl.a |
217 |
| - PATHS $ENV{HDF5_ROOT}/lib $ENV{HDF5_ROOT}/lib64 |
218 |
| - ) |
219 |
| - set(HDF5_LIBRARIES ${HDF5_CXX_LIBRARIES} ${HDF5_HL_LIBRARIES}) |
| 209 | + endif(NOT HDF5_FOUND) |
| 210 | + |
| 211 | + if(HDF5_FOUND) |
| 212 | + include_directories( ${HDF5_INCLUDE_DIRS} ) |
| 213 | + add_definitions( -DUSE_HDF5 -DENABLE_NSDF ) |
| 214 | + if(HDF5_USE_STATIC_LIBRARIES) |
| 215 | + message(STATUS "Finding static HDF5 libraries in $ENV{HDF5_ROOT}") |
| 216 | + find_library(HDF5_CXX_LIBRARIES NAMES libhdf5.a |
| 217 | + PATHS $ENV{HDF5_ROOT}/lib $ENV{HDF5_ROOT}/lib64 |
| 218 | + ) |
| 219 | + find_library(HDF5_HL_LIBRARIES NAMES libhdf5_hl.a |
| 220 | + PATHS $ENV{HDF5_ROOT}/lib $ENV{HDF5_ROOT}/lib64 |
| 221 | + ) |
| 222 | + set(HDF5_LIBRARIES ${HDF5_CXX_LIBRARIES} ${HDF5_HL_LIBRARIES}) |
| 223 | + endif() |
| 224 | + |
| 225 | + |
| 226 | + # Make sure, HDF5_HL_LIBRARIES are set. The COMPONENTS in find_package may |
| 227 | + # or may not work. See BhallaLab/moose-core#163. |
| 228 | + if(NOT HDF5_HL_LIBRARIES) |
| 229 | + set(HDF5_HL_LIBRARIES ${HDF5_HL_LIBRARIES}) |
| 230 | + endif(NOT HDF5_HL_LIBRARIES) |
| 231 | + list(APPEND HDF5_LIBRARIES ${HDF5_HL_LIBRARIES}) |
| 232 | + |
| 233 | + # message(STATUS "MOOSE will use following HDF5 ${HDF5_LIBRARIES}" ) |
| 234 | + foreach(HDF5_LIB ${HDF5_LIBRARIES}) |
| 235 | + if(HDF5_LIB) |
| 236 | + get_filename_component( HDF5_LIB_EXT ${HDF5_LIB} EXT ) |
| 237 | + if(HDF5_LIB_EXT) |
| 238 | + if(${HDF5_LIB_EXT} STREQUAL ".a") |
| 239 | + list(APPEND STATIC_LIBRARIES ${HDF5_LIB} ) |
| 240 | + else( ) |
| 241 | + list(APPEND SYSTEM_SHARED_LIBS ${HDF5_LIB} ) |
| 242 | + endif( ) |
| 243 | + endif() |
| 244 | + endif( ) |
| 245 | + endforeach( ) |
| 246 | + else( HDF5_FOUND ) |
| 247 | + message(STATUS "HDF5 is not found" ) |
| 248 | + endif( HDF5_FOUND ) |
| 249 | + # This is a fix for new HDF5 package on Debian/Ubuntu which installs hdf5 |
| 250 | + # headers in non-standard path. issue #80. |
| 251 | + if(HDF5_LIBRARY_DIRS) |
| 252 | + set_target_properties( libmoose PROPERTIES LINK_FLAGS "-L${HDF5_LIBRARY_DIRS}" ) |
220 | 253 | endif()
|
221 |
| - |
222 |
| - |
223 |
| - # Make sure, HDF5_HL_LIBRARIES are set. The COMPONENTS in find_package may |
224 |
| - # or may not work. See BhallaLab/moose-core#163. |
225 |
| - if(NOT HDF5_HL_LIBRARIES) |
226 |
| - set(HDF5_HL_LIBRARIES ${HDF5_HL_LIBRARIES}) |
227 |
| - endif(NOT HDF5_HL_LIBRARIES) |
228 |
| - list(APPEND HDF5_LIBRARIES ${HDF5_HL_LIBRARIES}) |
229 |
| - |
230 |
| - # message(STATUS "MOOSE will use following HDF5 ${HDF5_LIBRARIES}" ) |
231 |
| - foreach(HDF5_LIB ${HDF5_LIBRARIES}) |
232 |
| - if(HDF5_LIB) |
233 |
| - get_filename_component( HDF5_LIB_EXT ${HDF5_LIB} EXT ) |
234 |
| - if(HDF5_LIB_EXT) |
235 |
| - if(${HDF5_LIB_EXT} STREQUAL ".a") |
236 |
| - list(APPEND STATIC_LIBRARIES ${HDF5_LIB} ) |
237 |
| - else( ) |
238 |
| - list(APPEND SYSTEM_SHARED_LIBS ${HDF5_LIB} ) |
239 |
| - endif( ) |
240 |
| - endif() |
241 |
| - endif( ) |
242 |
| - endforeach( ) |
243 |
| -else( HDF5_FOUND ) |
244 |
| - message(STATUS "HDF5 is not found" ) |
245 |
| -endif( HDF5_FOUND ) |
246 |
| - |
247 |
| -# This is a fix for new HDF5 package on Debian/Ubuntu which installs hdf5 |
248 |
| -# headers in non-standard path. issue #80. |
249 |
| -if(HDF5_LIBRARY_DIRS) |
250 |
| - set_target_properties( libmoose PROPERTIES LINK_FLAGS "-L${HDF5_LIBRARY_DIRS}" ) |
251 |
| -endif() |
| 254 | +else(WITH_NSDF) |
| 255 | + message(STATUS "NSDF support is disabled" ) |
| 256 | +endif(WITH_NSDF) |
252 | 257 |
|
253 | 258 | # Openmpi
|
254 | 259 | if(WITH_MPI)
|
@@ -432,7 +437,7 @@ message(STATUS "binary distribution file ${PYMOOSE_BDIST_FILE}")
|
432 | 437 | add_custom_target(bdist ALL DEPENDS ${PYMOOSE_BDIST_FILE} )
|
433 | 438 |
|
434 | 439 | # Any command using setup.cmake.py must run in the same directory. Use option
|
435 |
| -# `--relative` to prefix is aways fixed. |
| 440 | +# `--relative` to prefix is aways fixed. |
436 | 441 | add_custom_command( OUTPUT ${PYMOOSE_BDIST_FILE}
|
437 | 442 | COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist_dumb -p ${_platform}
|
438 | 443 | -d ${PYMOOSE_BDIST_DIR} --relative
|
@@ -464,7 +469,7 @@ add_dependencies( copy_pymoose _moose )
|
464 | 469 | install(TARGETS moose.bin DESTINATION bin CONFIGURATIONS Debug)
|
465 | 470 | install(TARGETS libmoose DESTINATION lib CONFIGURATIONS Debug)
|
466 | 471 |
|
467 |
| -# install pymoose bdist. |
| 472 | +# install pymoose bdist. |
468 | 473 | install(DIRECTORY ${PYMOOSE_BDIST_INSTALL_DIR}/
|
469 | 474 | DESTINATION ${CMAKE_INSTALL_PREFIX}
|
470 | 475 | CONFIGURATIONS Release Debug
|
|
0 commit comments