Skip to content

Commit

Permalink
reformating
Browse files Browse the repository at this point in the history
  • Loading branch information
bam241 committed Dec 5, 2024
1 parent 172da40 commit 473711e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 46 deletions.
53 changes: 7 additions & 46 deletions cmake/FindMOAB.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,10 @@ if (MOAB_CMAKE_CONFIG)
message(STATUS "MOAB_CMAKE_CONFIG: ${MOAB_CMAKE_CONFIG}")
include(${MOAB_CMAKE_CONFIG})
elseif (DDL_INSTALL_DEPS)
include(ExternalProject)
# Configure MOAB
if(NOT MOAB_VERSION)
set(MOAB_VERSION "5.5.1")
endif()
message(STATUS "MOAB version ${MOAB_VERSION} will be downloaded and built")

set(CMAKE_INSTALL_LIBDIR "lib")
SET(MOAB_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/moab")
set(MOAB_ROOT "${CMAKE_BINARY_DIR}/moab")
set(MOAB_INCLUDE_DIRS "${MOAB_INSTALL_PREFIX}/include")
set(MOAB_LIBRARY_DIRS "${MOAB_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
set(MOAB_LIBRARIES_SHARED "")
ExternalProject_Add(MOAB_ep
PREFIX ${MOAB_ROOT}
GIT_REPOSITORY https://bitbucket.org/fathomteam/moab.git
GIT_TAG ${MOAB_VERSION}
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DBUILD_SHARED_LIBS:BOOL=ON
-DENABLE_HDF5:BOOL=ON
-DHDF5_ROOT:PATH=${HDF5_ROOT}
-DEIGEN3_DIR:PATH=${EIGEN3_INCLUDE_DIRS}
-DENABLE_BLASLAPACK:BOOL=OFF
-DENABLE_FORTRAN:BOOL=OFF
-DCMAKE_MACOSX_RPATH:BOOL=ON
DOWNLOAD_EXTRACT_TIMESTAMP true
BUILD_BYPRODUCTS "${MOAB_LIBRARY_DIRS}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*"
# Set devel space as install prefix
INSTALL_DIR "${MOAB_INSTALL_PREFIX}"
)
add_library(MOAB INTERFACE)
# list(APPEND CMAKE_MODULE_PATH ${MOAB_LIBRARY_DIRS}/cmake)
message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}")
message(STATUS "MOAB_LIBRARY_DIRS=${MOAB_LIBRARY_DIRS}")
message(STATUS "MOAB_LIBRARY_DIRS=${MOAB_LIBRARY_DIRS}")
target_include_directories(MOAB SYSTEM INTERFACE ${MOAB_INCLUDE_DIRS})
target_link_libraries(MOAB INTERFACE ${MOAB_INSTALL_PREFIX}/lib64/libMOAB.so)
add_dependencies(MOAB MOAB_ep)
install(TARGETS MOAB LIBRARY DESTINATION ${MOAB_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR})

include_directories(${MOAB_INCLUDE_DIRS})
link_directories(${MOAB_LIBRARY_DIRS})
include_directories(${EIGEN3_INCLUDE_DIRS})
IF(NOT MOAB_VERSION)
SET(MOAB_VERSION "5.5.1")
ENDIF()
include(MOAB_PullAndMake)
else ()
message(FATAL_ERROR "Could not find MOAB. Set -DMOAB_DIR=<MOAB_DIR> when running cmake or use the $MOAB_DIR environment variable.")
endif ()
Expand Down Expand Up @@ -120,8 +79,10 @@ message(STATUS "MOAB_LIBRARIES_STATIC: ${MOAB_LIBRARIES_STATIC}")
if (MOAB_INCLUDE_DIRS AND (MOAB_LIBRARIES_SHARED OR NOT BUILD_SHARED_LIBS) AND
(MOAB_LIBRARIES_STATIC OR NOT BUILD_STATIC_LIBS))
message(STATUS "Found MOAB")
elseif(DDL_INSTALL_DEPS)
message(STATUS "MOAB not found, will be downloaded and built at make time")
else()
# message(FATAL_ERROR "Could not find MOAB")
message(FATAL_ERROR "Could not find MOAB")
endif ()

include_directories(${MOAB_INCLUDE_DIRS})
39 changes: 39 additions & 0 deletions cmake/MOAB_PullAndMake.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
MACRO (PULL_AND_MAKE_MOAB moab_version)
MESSAGE(STATUS "MOAB WILL BE DOWNLOADED AND BUILT")
INCLUDE(include(ExternalProject))

SET(CMAKE_INSTALL_LIBDIR "LIB")
SET(MOAB_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/MOAB")
SET(MOAB_ROOT "${CMAKE_BINARY_DIR}/MOAB")
SET(MOAB_INCLUDE_DIRS "${MOAB_INSTALL_PREFIX}/INCLUDE")
SET(MOAB_LIBRARY_DIRS "${MOAB_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
SET(MOAB_LIBRARIES_SHARED "")
ExternalProject_Add(MOAB_EP
PREFIX ${MOAB_ROOT}
GIT_REPOSITORY HTTPS://BITBUCKET.ORG/FATHOMTEAM/MOAB.GIT
GIT_TAG ${moab_version}
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DBUILD_SHARED_LIBS:BOOL=ON
-DENABLE_HDF5:BOOL=ON
-DHDF5_ROOT:PATH=${HDF5_ROOT}
-DEIGEN3_DIR:PATH=${EIGEN3_INCLUDE_DIRS}
-DENABLE_BLASLAPACK:BOOL=OFF
-DENABLE_FORTRAN:BOOL=OFF
-DCMAKE_MACOSX_RPATH:BOOL=ON
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
BUILD_BYPRODUCTS "${MOAB_LIBRARY_DIRS}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*"
)

# Setup a interface library for MOAB based on ExternalProoject MOAB_EP
ADD_LIBRARY(MOAB INTERFACE)
TARGET_INCLUDE_DIRECTORIES(MOAB SYSTEM INTERFACE ${MOAB_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(MOAB INTERFACE ${MOAB_INSTALL_PREFIX}/LIB64/LIBMOAB.SO)
ADD_DEPENDENCIES(MOAB MOAB_EP)
INSTALL(TARGETS MOAB LIBRARY DESTINATION ${MOAB_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR})

INCLUDE_DIRECTORIES(${MOAB_INCLUDE_DIRS})
LINK_DIRECTORIES(${MOAB_LIBRARY_DIRS})
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS})
ENDMACRO(PULL_AND_MAKE_MOAB)

0 comments on commit 473711e

Please sign in to comment.