-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
134 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
MACRO (find_set_HDF5) | ||
# 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}) | ||
|
||
ENDMACRO (find_set_HDF5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,99 @@ | ||
# this Macro sets up the download and build of MOAB using ExternalProject | ||
# few tweak are done in src/dagmc/CMakeLists.txt and src/PyNE/CMakelists.txt | ||
# This Macro sets up the download and build of MOAB using ExternalProject | ||
# few tweak are done in src/dagmc/CMakeLists.txt and src/PyNE/CMakeists.txt | ||
# to make sure that MOAB is built before DAGMC. | ||
MACRO (moab_pull_make moab_version) | ||
message(STATUS "MOAB will be downloaded and built") | ||
include(ExternalProject) | ||
message("HDF5_ROOT: ${HDF5_ROOT}") | ||
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}/lib") | ||
message("MOAB_LIBRARY_DIRS: ${MOAB_LIBRARY_DIRS}") | ||
message("CMAKE_SHARED_LIBRARY_SUFFIX: ${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
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} | ||
-DCMAKE_INSTALL_RPATH=${HDF5_ROOT}/lib:${MOAB_INSTALL_PREFIX}/lib | ||
-DENABLE_BLASLAPACK:BOOL=OFF | ||
-DENABLE_FORTRAN:BOOL=OFF | ||
-DENABLE_PYMOAB:BOOL=OFF | ||
DOWNLOAD_EXTRACT_TIMESTAMP true | ||
BUILD_BYPRODUCTS "${MOAB_LIBRARY_DIRS}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" | ||
INSTALL_DIR "${MOAB_INSTALL_PREFIX}" | ||
) | ||
# 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_LIBRARY_DIRS}/libMOAB${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
add_dependencies(MOAB MOAB_ep) | ||
install(TARGETS MOAB LIBRARY DESTINATION ${MOAB_LIBRARY_DIRS} | ||
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR}) | ||
include_directories(${MOAB_INCLUDE_DIRS}) | ||
link_directories(${MOAB_LIBRARY_DIRS}) | ||
find_package(Eigen3 REQUIRED NO_MODULE) | ||
include_directories(${EIGEN3_INCLUDE_DIRS}) | ||
MESSAGE(STATUS "MOAB will be downloaded and built") | ||
|
||
# Ensure STATIC LIBS Build | ||
IF(DAGMC_BUILD_STATIC_LIBS) | ||
MESSAGE(FATAL_ERROR "PULL_INSTALL_MOAB is ONLY compatible with shared libraries.") | ||
endIF() | ||
|
||
# Ensure MOAB_VERSION | ||
IF(NOT MOAB_VERSION) | ||
SET(MOAB_VERSION "5.5.1") | ||
endIF() | ||
|
||
# Ensure we have the right variables to build MOAB | ||
moab_autobuild_check_deps() | ||
|
||
|
||
INCLUDE(ExternalProject) | ||
MESSAGE("HDF5_ROOT: ${HDF5_ROOT}") | ||
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}/lib") | ||
MESSAGE("MOAB_LIBRARY_DIRS: ${MOAB_LIBRARY_DIRS}") | ||
MESSAGE("CMAKE_SHARED_LIBRARY_SUFFIX: ${CMAKE_SHARED_LIBRARY_SUFFIX}") | ||
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} | ||
-DCMAKE_INSTALL_RPATH=${HDF5_ROOT}/lib:${MOAB_INSTALL_PREFIX}/lib | ||
-DENABLE_BLASLAPACK:BOOL=OFF | ||
-DENABLE_FORTRAN:BOOL=OFF | ||
-DENABLE_PYMOAB:BOOL=OFF | ||
${OPTION_FLAG} | ||
DOWNLOAD_EXTRACT_TIMESTAMP true | ||
BUILD_BYPRODUCTS "${MOAB_LIBRARY_DIRS}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*" | ||
INSTALL_DIR "${MOAB_INSTALL_PREFIX}" | ||
) | ||
# 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_LIBRARY_DIRS}/libMOAB${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
ADD_DEPENDENCIES(MOAB MOAB_ep) | ||
INSTALL(TARGETS MOAB LIBRARY DESTINATION ${MOAB_LIBRARY_DIRS} | ||
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDE_DIR}) | ||
INCLUDE_DIRECTORIES(${MOAB_INCLUDE_DIRS}) | ||
LINK_DIRECTORIES(${MOAB_LIBRARY_DIRS}) | ||
FIND_PACKAGE(Eigen3 REQUIRED NO_MODULE) | ||
INCLUDE_DIRECTORIES(${EIGEN3_INCLUDE_DIRS}) | ||
|
||
# Find HDF5 | ||
INCLUDE(HDF5_macro) | ||
find_SET_HDF5() | ||
|
||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX}) | ||
FIND_LIBRARY(MOAB_LIBRARIES_SHARED | ||
NAMES MOAB | ||
HINTS ${MOAB_LIBRARY_DIRS} | ||
NO_DEFAULT_PATH | ||
) | ||
LIST(APPEND MOAB_LIBRARIES_SHARED) | ||
MESSAGE(STATUS "MOAB_INCLUDE_DIRS: ${MOAB_INCLUDE_DIRS}") | ||
MESSAGE(STATUS "MOAB_LIBRARY_DIRS: ${MOAB_LIBRARY_DIRS}") | ||
MESSAGE(STATUS "MOAB_LIBRARIES_SHARED: ${MOAB_LIBRARIES_SHARED}") | ||
|
||
INCLUDE_DIRECTORIES(${MOAB_INCLUDE_DIRS}) | ||
IF (MOAB_INCLUDE_DIRS AND (MOAB_LIBRARIES_SHARED)) | ||
MESSAGE(STATUS "MOAB Will be installed.") | ||
ELSE () | ||
MESSAGE(FATAL_ERROR "Could not set MOAB for installation and compilation.") | ||
ENDIF () | ||
|
||
ENDMACRO(moab_pull_make) | ||
|
||
|
||
MACRO (moab_autobuild_check_deps) | ||
# First check IF we are forcing the download of MOAB | ||
IF (PULL_INSTALL_MOAB) | ||
IF (NOT DEFINED HDF5_ROOT or not DEFINED ${HDF5_ROOT}) | ||
MESSAGE(FATAL_ERROR "HDF5_ROOT is required to build MOAB") | ||
ENDIF() | ||
|
||
IF (DEFINED ${EIGEN3_DIR}) | ||
OPTION_FLAG = "-DEIGEN3_DIR=${EIGEN3_DIR}" | ||
ENDIF() | ||
|
||
ENDIF () | ||
|
||
ENDMACRO (moab_autobuild_check_deps) |