diff --git a/.gitmodules b/.gitmodules index 6673c74f9a2765b1d2f6d5b6259fcf58a3feb784..458b19e2ccecda398606717523b912bfbf41b334 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,3 @@ [submodule "ThirdParty/ogs6py"] path = ThirdParty/ogs6py url = https://github.com/joergbuchwald/ogs6py.git -[submodule "ThirdParty/xdmf"] - path = ThirdParty/xdmf - url = https://gitlab.opengeosys.org/ogs/xdmflib.git diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index 03584ee1771077d31fa5a809d2bb5aceb1cb949f..ac50211fe38d29b7d54c20510c18717c25f8112a 100644 --- a/ThirdParty/CMakeLists.txt +++ b/ThirdParty/CMakeLists.txt @@ -9,42 +9,6 @@ if(OGS_BUILD_SWMM) list(APPEND DISABLE_WARNINGS_TARGETS SWMM SwmmInterface) endif() -if(OGS_USE_XDMF) - find_package(ZLIB REQUIRED) # ZLIB is a HDF5 dependency - set(XDMF_LIBNAME OgsXdmf CACHE INTERNAL "") - add_subdirectory(xdmf) - target_include_directories(${XDMF_LIBNAME} PUBLIC - ${PROJECT_SOURCE_DIR}/ThirdParty/xdmf - ${PROJECT_BINARY_DIR}/ThirdParty/xdmf - ) - if(OGS_USE_CONAN AND UNIX AND APPLE) - find_package(Iconv REQUIRED) - endif() - - if(MSVC AND OGS_USE_CONAN) - # Hack: Conan HDF5 not found on Windows - target_link_libraries(${XDMF_LIBNAME} ${CONAN_LIBS}) - else() - target_link_libraries(${XDMF_LIBNAME} Boost::boost ${Iconv_LIBRARIES} ZLIB::ZLIB) - endif() - target_include_directories(${XDMF_LIBNAME}Core PUBLIC - ${PROJECT_SOURCE_DIR}/ThirdParty/xdmf/core - ${PROJECT_BINARY_DIR}/ThirdParty/xdmf/core - ) - find_package(LibXml2 REQUIRED) # LibXml2 is a XdmfCore dependency - target_link_libraries(${XDMF_LIBNAME}Core PUBLIC LibXml2::LibXml2) - - set_target_properties(${XDMF_LIBNAME} ${XDMF_LIBNAME}Core PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR} - LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} - ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} - ) - if(BUILD_SHARED_LIBS) - install(TARGETS ${XDMF_LIBNAME} ${XDMF_LIBNAME}Core LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - list(APPEND DISABLE_WARNINGS_TARGETS ${XDMF_LIBNAME} ${XDMF_LIBNAME}Core) -endif() - foreach(TARGET ${DISABLE_WARNINGS_TARGETS}) target_compile_options(${TARGET} PRIVATE $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:-w> diff --git a/ThirdParty/xdmf b/ThirdParty/xdmf deleted file mode 160000 index 3a226178c07e7cb1edaf572afb6c7938fff6b6ce..0000000000000000000000000000000000000000 --- a/ThirdParty/xdmf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3a226178c07e7cb1edaf572afb6c7938fff6b6ce diff --git a/scripts/cmake/Dependencies.cmake b/scripts/cmake/Dependencies.cmake index 2a494f5bd4bdc656e5c3fe741afacf512a648657..aeedbc60e46a150595273847b3a11160ed18809d 100644 --- a/scripts/cmake/Dependencies.cmake +++ b/scripts/cmake/Dependencies.cmake @@ -124,6 +124,50 @@ if(OGS_USE_MFRONT) endif() endif() +if(OGS_USE_XDMF) + find_package(ZLIB REQUIRED) # ZLIB is a HDF5 dependency + + CPMAddPackage( + NAME xdmf + VERSION 3.0.0 + GIT_REPOSITORY https://gitlab.opengeosys.org/ogs/xdmflib.git + GIT_TAG 8d5ae1e1cbf506b8ca2160745fc914e25690c8a4 + OPTIONS "XDMF_LIBNAME OgsXdmf" + ) + if(xdmf_ADDED) + target_include_directories(OgsXdmf PUBLIC + ${PROJECT_SOURCE_DIR}/ThirdParty/xdmf + ${PROJECT_BINARY_DIR}/ThirdParty/xdmf + ) + if(OGS_USE_CONAN AND UNIX AND APPLE) + find_package(Iconv REQUIRED) + endif() + + if(MSVC AND OGS_USE_CONAN) + # Hack: Conan HDF5 not found on Windows + target_link_libraries(OgsXdmf ${CONAN_LIBS}) + else() + target_link_libraries(OgsXdmf Boost::boost ${Iconv_LIBRARIES} ZLIB::ZLIB) + endif() + target_include_directories(OgsXdmfCore PUBLIC + ${PROJECT_SOURCE_DIR}/ThirdParty/xdmf/core + ${PROJECT_BINARY_DIR}/ThirdParty/xdmf/core + ) + find_package(LibXml2 REQUIRED) # LibXml2 is a XdmfCore dependency + target_link_libraries(OgsXdmfCore PUBLIC LibXml2::LibXml2) + + set_target_properties(OgsXdmf OgsXdmfCore PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR} + LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} + ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} + ) + if(BUILD_SHARED_LIBS) + install(TARGETS OgsXdmf OgsXdmfCore LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + list(APPEND DISABLE_WARNINGS_TARGETS OgsXdmf OgsXdmfCore) + endif() +endif() + # Disable warnings foreach(TARGET ${DISABLE_WARNINGS_TARGETS}) target_compile_options(${TARGET} PRIVATE diff --git a/scripts/cmake/SubmoduleSetup.cmake b/scripts/cmake/SubmoduleSetup.cmake index ae47b74e90dd36393c3d58c09451074674ec1bd5..584efe7299b54f0b15c1b8861782cb27e1b4305e 100644 --- a/scripts/cmake/SubmoduleSetup.cmake +++ b/scripts/cmake/SubmoduleSetup.cmake @@ -3,9 +3,6 @@ if(NOT IS_GIT_REPO) endif() # This file initializes the required submodules -if(OGS_USE_XDMF) - list(APPEND REQUIRED_SUBMODULES ThirdParty/xdmf) -endif() if(OGS_BUILD_SWMM) list(APPEND REQUIRED_SUBMODULES ThirdParty/SwmmInterface) endif()