From 2eabf6a4a6efb63f552a68c067c2f5f14cbf0d22 Mon Sep 17 00:00:00 2001 From: Baptiste Mouginot Date: Thu, 5 Dec 2024 18:16:12 +0100 Subject: [PATCH] adding test, and reshaping some things, adding comments --- .github/workflows/linux_build_test.yml | 5 +++++ cmake/FindMOAB.cmake | 25 +++++++++++++++++-------- cmake/MOAB_PullAndMake.cmake | 4 +++- src/dagmc/CMakeLists.txt | 1 + src/pyne/CMakeLists.txt | 1 + 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux_build_test.yml b/.github/workflows/linux_build_test.yml index 2aaf9ec29..c7557e01f 100644 --- a/.github/workflows/linux_build_test.yml +++ b/.github/workflows/linux_build_test.yml @@ -50,6 +50,10 @@ jobs: 5.4.1, 5.5.1, ] + ddl_deps : [ + off, + on, + ] geant4_version : [ 10.7.4, 11.1.2 @@ -88,6 +92,7 @@ jobs: cmake ../ \ -DMOAB_DIR=${moab_install_dir} \ -DBUILD_GEANT4=$([ "${{ matrix.geant4_version }}" != "off" ] && echo "ON" || echo "OFF") \ + -DDDL_INSTALL_DEPS$([ "${{ matrix.ddl_deps }}" != "off" ] && echo "ON" || echo "OFF") \ -DGEANT4_DIR=${geant4_install_dir} \ -DBUILD_CI_TESTS=ON \ -DBUILD_MW_REG_TESTS=OFF \ diff --git a/cmake/FindMOAB.cmake b/cmake/FindMOAB.cmake index c6f60091e..337f12756 100644 --- a/cmake/FindMOAB.cmake +++ b/cmake/FindMOAB.cmake @@ -10,17 +10,24 @@ find_path(MOAB_CMAKE_CONFIG PATHS ${MOAB_SEARCH_DIRS} NO_DEFAULT_PATH ) -if (MOAB_CMAKE_CONFIG) - set(MOAB_CMAKE_CONFIG ${MOAB_CMAKE_CONFIG}/MOABConfig.cmake) - message(STATUS "MOAB_CMAKE_CONFIG: ${MOAB_CMAKE_CONFIG}") - include(${MOAB_CMAKE_CONFIG}) -elseif (DDL_INSTALL_DEPS) + +# First check if we are forcing the download of MOAB +if (DDL_INSTALL_DEPS) + IF(NOT DAGMC_BUILD_SHARED_LIBS OR DAGMC_BUILD_STATIC_LIBS) + message(FATAL_ERROR "DDL_INSTALL_DEPS is ONLY compatible with shared libraries.") + ENDIF() IF(NOT MOAB_VERSION) SET(MOAB_VERSION "5.5.1") ENDIF() include(MOAB_PullAndMake) moab_pull_make(${MOAB_VERSION}) +# Back to normal behavior +elseif (MOAB_CMAKE_CONFIG) + set(MOAB_CMAKE_CONFIG ${MOAB_CMAKE_CONFIG}/MOABConfig.cmake) + message(STATUS "MOAB_CMAKE_CONFIG: ${MOAB_CMAKE_CONFIG}") + include(${MOAB_CMAKE_CONFIG}) + else () message(FATAL_ERROR "Could not find MOAB. Set -DMOAB_DIR= when running cmake or use the $MOAB_DIR environment variable.") endif () @@ -78,11 +85,13 @@ message(STATUS "MOAB_LIBRARY_DIRS: ${MOAB_LIBRARY_DIRS}") message(STATUS "MOAB_LIBRARIES_SHARED: ${MOAB_LIBRARIES_SHARED}") message(STATUS "MOAB_LIBRARIES_STATIC: ${MOAB_LIBRARIES_STATIC}") -if (MOAB_INCLUDE_DIRS AND (MOAB_LIBRARIES_SHARED OR NOT BUILD_SHARED_LIBS) AND + + +if(DDL_INSTALL_DEPS) + message(STATUS "MOAB will be downloaded and built at make time") +elseif (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") endif () diff --git a/cmake/MOAB_PullAndMake.cmake b/cmake/MOAB_PullAndMake.cmake index 29329c7f4..fb888bada 100644 --- a/cmake/MOAB_PullAndMake.cmake +++ b/cmake/MOAB_PullAndMake.cmake @@ -1,3 +1,6 @@ +# 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 +# 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) @@ -17,7 +20,6 @@ MACRO (moab_pull_make moab_version) -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 diff --git a/src/dagmc/CMakeLists.txt b/src/dagmc/CMakeLists.txt index 4bc24b286..af6cf93de 100644 --- a/src/dagmc/CMakeLists.txt +++ b/src/dagmc/CMakeLists.txt @@ -14,6 +14,7 @@ include_directories(${CMAKE_BINARY_DIR}/src/dagmc) dagmc_install_library(dagmc) +# Required to ensure that MOAB is built before DAGMC and to properly link against MOAB if(DDL_INSTALL_DEPS) add_dependencies(dagmc-shared MOAB) target_link_libraries(dagmc-shared PUBLIC ${MOAB_INSTALL_PREFIX}/lib64/libMOAB.so) diff --git a/src/pyne/CMakeLists.txt b/src/pyne/CMakeLists.txt index 500e28b69..15e5a9a47 100644 --- a/src/pyne/CMakeLists.txt +++ b/src/pyne/CMakeLists.txt @@ -34,6 +34,7 @@ if(NOT (${HDF5_VERSION} VERSION_LESS 1.12.0)) endif() dagmc_install_library(pyne_dagmc) +# Required to ensure that MOAB is built before pyne_dagmc if(DDL_INSTALL_DEPS) add_dependencies(pyne_dagmc-shared MOAB) endif()