Skip to content

Commit

Permalink
get HDF5 before MOAB
Browse files Browse the repository at this point in the history
  • Loading branch information
bam241 committed Dec 5, 2024
1 parent 02d3d92 commit 4673439
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 23 deletions.
47 changes: 25 additions & 22 deletions cmake/FindMOAB.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
message("")


# Find HDF5
set(ENV{PATH} "${HDF5_DIR}:$ENV{PATH}")
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
find_package(HDF5 REQUIRED)
# Remove HDF5 transitive dependencies that are system libraries
list(FILTER HDF5_LIBRARIES EXCLUDE REGEX ".*lib(pthread|dl|m).*")
set(HDF5_LIBRARIES_SHARED ${HDF5_LIBRARIES})
# CMake doesn't let you find_package(HDF5) twice so we have to do this instead
if (BUILD_STATIC_LIBS)
string(REPLACE ${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_SUFFIX}
HDF5_LIBRARIES_STATIC "${HDF5_LIBRARIES_SHARED}")
endif ()
if (NOT BUILD_SHARED_LIBS)
set(HDF5_LIBRARIES_SHARED)
endif ()
set(HDF5_LIBRARIES)

message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}")
message(STATUS "HDF5_LIBRARIES_SHARED: ${HDF5_LIBRARIES_SHARED}")
message(STATUS "HDF5_LIBRARIES_STATIC: ${HDF5_LIBRARIES_STATIC}")

include_directories(${HDF5_INCLUDE_DIRS})

# Find MOAB cmake config file
# Only used to determine the location of the HDF5 with which MOAB was built
set(MOAB_SEARCH_DIRS)
Expand All @@ -11,6 +35,7 @@ find_path(MOAB_CMAKE_CONFIG
NO_DEFAULT_PATH
)


# First check if we are forcing the download of MOAB
if (DDL_INSTALL_DEPS)
IF(DAGMC_BUILD_STATIC_LIBS)
Expand All @@ -32,28 +57,6 @@ else ()
message(FATAL_ERROR "Could not find MOAB. Set -DMOAB_DIR=<MOAB_DIR> when running cmake or use the $MOAB_DIR environment variable.")
endif ()

# Find HDF5
set(ENV{PATH} "${HDF5_DIR}:$ENV{PATH}")
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX})
find_package(HDF5 REQUIRED)
# Remove HDF5 transitive dependencies that are system libraries
list(FILTER HDF5_LIBRARIES EXCLUDE REGEX ".*lib(pthread|dl|m).*")
set(HDF5_LIBRARIES_SHARED ${HDF5_LIBRARIES})
# CMake doesn't let you find_package(HDF5) twice so we have to do this instead
if (BUILD_STATIC_LIBS)
string(REPLACE ${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_STATIC_LIBRARY_SUFFIX}
HDF5_LIBRARIES_STATIC "${HDF5_LIBRARIES_SHARED}")
endif ()
if (NOT BUILD_SHARED_LIBS)
set(HDF5_LIBRARIES_SHARED)
endif ()
set(HDF5_LIBRARIES)

message(STATUS "HDF5_INCLUDE_DIRS: ${HDF5_INCLUDE_DIRS}")
message(STATUS "HDF5_LIBRARIES_SHARED: ${HDF5_LIBRARIES_SHARED}")
message(STATUS "HDF5_LIBRARIES_STATIC: ${HDF5_LIBRARIES_STATIC}")

include_directories(${HDF5_INCLUDE_DIRS})
if(MSVC)
set(BUILD_STATIC_LIBS TRUE)
set(BUILD_SHARED_LIBS OFF)
Expand Down
2 changes: 1 addition & 1 deletion cmake/MOAB_PullAndMake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ MACRO (moab_pull_make moab_version)
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DBUILD_SHARED_LIBS:BOOL=ON
-DENABLE_HDF5:BOOL=ON
-DHDF5_ROOT:PATH=${HDF5_ROOT}
# -DHDF5_ROOT:PATH=${HDF5_ROOT}
-DENABLE_BLASLAPACK:BOOL=OFF
-DENABLE_FORTRAN:BOOL=OFF
-DCMAKE_MACOSX_RPATH:BOOL=ON
Expand Down

0 comments on commit 4673439

Please sign in to comment.