diff options
author | 2022-12-13 08:18:29 +0100 | |
---|---|---|
committer | 2022-12-30 11:49:09 +0100 | |
commit | 17bb597408259e7752da517e31ef4c502c015045 (patch) | |
tree | 452211dec0f5ed1163c35be1b6bd24f65f6e00b0 /media-gfx | |
parent | media-gfx/netgen: drop 6.2.2105 (diff) | |
download | sci-17bb597408259e7752da517e31ef4c502c015045.tar.gz sci-17bb597408259e7752da517e31ef4c502c015045.tar.bz2 sci-17bb597408259e7752da517e31ef4c502c015045.zip |
media-gfx/netgen: enable logging and tests
- enable logging, using dev-libs/spdlog
- enable tests, disable some tests which do not work
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
Closes: https://github.com/gentoo/sci/pull/1186
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'media-gfx')
6 files changed, 144 insertions, 12 deletions
diff --git a/media-gfx/netgen/files/netgen-6.2.2204-disable-failing-tests.patch b/media-gfx/netgen/files/netgen-6.2.2204-disable-failing-tests.patch new file mode 100644 index 000000000..a11df8e3d --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-disable-failing-tests.patch @@ -0,0 +1,19 @@ +From 21bfc56e76a448170dc4bb305c97b8f957b6e75d Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Wed, 14 Dec 2022 07:12:04 +0100 +Subject: [PATCH] disable failing tests + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/tests/catch/CMakeLists.txt ++++ b/tests/catch/CMakeLists.txt +@@ -34,7 +34,6 @@ add_unit_test(archive archive.cpp) + target_link_libraries(test_archive netgen_python) + add_unit_test(array array.cpp) + add_unit_test(ranges ranges.cpp) +-add_unit_test(symboltable symboltable.cpp) + add_unit_test(utils utils.cpp) + add_unit_test(version version.cpp) + +-- +2.38.1 + diff --git a/media-gfx/netgen/files/netgen-6.2.2204-disable-python-tests.patch b/media-gfx/netgen/files/netgen-6.2.2204-disable-python-tests.patch new file mode 100644 index 000000000..7a6def418 --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-disable-python-tests.patch @@ -0,0 +1,17 @@ +From 2c402f3b552ce18483119de1d3a91fd457c9c170 Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Wed, 14 Dec 2022 08:50:07 +0100 +Subject: [PATCH] disable python tests + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -1,5 +1,4 @@ + add_subdirectory(catch) +-add_subdirectory(pytest) + + # this code goes here, because tests is the last add_subdirectory (otherwise it gets executed too early) + if(APPLE AND BUILD_FOR_CONDA) +-- +2.38.1 + diff --git a/media-gfx/netgen/files/netgen-6.2.2204-use-system-catch.patch b/media-gfx/netgen/files/netgen-6.2.2204-use-system-catch.patch new file mode 100644 index 000000000..1c08e49e7 --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-use-system-catch.patch @@ -0,0 +1,40 @@ +From 6eaa13cc02ccd5f1bfa448fbcff3a1d9af8ba90a Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Wed, 14 Dec 2022 07:04:29 +0100 +Subject: [PATCH] use system catch + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -474,7 +474,7 @@ enable_testing() + include(CTest) + + if(ENABLE_UNIT_TESTS) +- include(${CMAKE_CURRENT_LIST_DIR}/cmake/external_projects/catch.cmake) ++ find_package(Catch2 REQUIRED) + endif(ENABLE_UNIT_TESTS) + + +--- a/tests/catch/CMakeLists.txt ++++ b/tests/catch/CMakeLists.txt +@@ -3,11 +3,15 @@ if(ENABLE_UNIT_TESTS) + add_custom_target(unit_tests) + + # Build catch_main test object +-include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR}) ++if(TARGET Catch2::Catch2) ++ get_target_property(CATCH_INCLUDE_DIR Catch2::Catch2 INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${CATCH_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../../libsrc/include ${SPDLOG_INCLUDE_DIR}) ++else() ++ message(SEND_ERROR "Catch header files couldn't be found.") ++endif() + add_library(catch_main STATIC main.cpp) + set_target_properties(catch_main PROPERTIES CXX_STANDARD 17) + add_dependencies(unit_tests catch_main) +-add_dependencies(catch_main project_catch) + + # ensure the test targets are built before testing + add_test(NAME unit_tests_built COMMAND ${CMAKE_COMMAND} --build . --target unit_tests --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. ) +-- +2.38.1 + diff --git a/media-gfx/netgen/files/netgen-6.2.2204-use-system-spdlog.patch b/media-gfx/netgen/files/netgen-6.2.2204-use-system-spdlog.patch new file mode 100644 index 000000000..cbd45ca07 --- /dev/null +++ b/media-gfx/netgen/files/netgen-6.2.2204-use-system-spdlog.patch @@ -0,0 +1,40 @@ +From e20e1e2e2109f1ce6580587f63ad000ac6bdd877 Mon Sep 17 00:00:00 2001 +From: Bernd Waibel <waebbl-gentoo@posteo.net> +Date: Tue, 13 Dec 2022 08:14:12 +0100 +Subject: [PATCH] use system spdlog + +Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net> +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -481,8 +481,13 @@ endif(ENABLE_UNIT_TESTS) + ####################################################################### + + if(USE_SPDLOG) +- include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/external_projects/spdlog.cmake) +- include_directories(${SPDLOG_INCLUDE_DIR}) ++ find_package(spdlog REQUIRED CONFIG) ++ if(TARGET spdlog::spdlog) ++ get_target_property(SPDLOG_INCLUDE_DIR spdlog::spdlog INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${SPDLOG_INCLUDE_DIR}) ++ else() ++ message(SEND_ERROR "You enabled USE_SPDLOG, but the spdlog package could not be found.") ++ endif() + endif(USE_SPDLOG) + + if(ENABLE_CPP_CORE_GUIDELINES_CHECK) +--- a/libsrc/core/CMakeLists.txt ++++ b/libsrc/core/CMakeLists.txt +@@ -50,10 +50,6 @@ endif(TRACE_MEMORY) + + if(USE_SPDLOG) + include_directories(${SPDLOG_INCLUDE_DIR}) +- install(DIRECTORY ${SPDLOG_INCLUDE_DIR} +- DESTINATION ${NG_INSTALL_DIR_INCLUDE} +- ) +- add_dependencies(ngcore project_spdlog) + target_compile_definitions(ngcore PUBLIC NETGEN_USE_SPDLOG) + if(DEBUG_LOG) + target_compile_definitions(ngcore PUBLIC NETGEN_LOG_DEBUG) +-- +2.38.1 + diff --git a/media-gfx/netgen/metadata.xml b/media-gfx/netgen/metadata.xml index cb94caeca..f19c0cf6e 100644 --- a/media-gfx/netgen/metadata.xml +++ b/media-gfx/netgen/metadata.xml @@ -6,7 +6,8 @@ <name>Gentoo Mathematics Project</name> </maintainer> <use> - <flag name="opencascade"> Enable OpenCASCADE support</flag> + <flag name="logging">Enable logging through <pkg>dev-libs/spdlog</pkg></flag> + <flag name="opencascade">Enable OpenCASCADE support</flag> </use> <upstream> <remote-id type="github">NGSolve/netgen</remote-id> diff --git a/media-gfx/netgen/netgen-6.2.2204.ebuild b/media-gfx/netgen/netgen-6.2.2204.ebuild index 06a2bf53f..492170dbf 100644 --- a/media-gfx/netgen/netgen-6.2.2204.ebuild +++ b/media-gfx/netgen/netgen-6.2.2204.ebuild @@ -14,7 +14,9 @@ SLOT="0" LICENSE="LGPL-2.1" KEYWORDS="~amd64 ~x86" -IUSE="ffmpeg jpeg mpi opencascade python gui" +IUSE="ffmpeg gui jpeg logging mpi opencascade python test" +RESTRICT="!test? ( test )" + REQUIRED_USE=" ${PYTHON_REQUIRED_USE} ffmpeg? ( gui ) @@ -35,6 +37,7 @@ DEPEND=" x11-libs/libxcb:= ) jpeg? ( media-libs/libjpeg-turbo:0= ) + logging? ( dev-libs/spdlog:= ) mpi? ( sci-libs/metis virtual/mpi @@ -55,13 +58,21 @@ RDEPEND="${DEPEND}" BDEPEND=" sys-apps/lsb-release virtual/pkgconfig + test? ( + <dev-cpp/catch-3:0 + python? ( $(python_gen_cond_dep 'dev-python/pytest[${PYTHON_USEDEP}]') ) + ) " PATCHES=( - "${FILESDIR}/${P}-use-external-pybind11.patch" - "${FILESDIR}/${P}-find-Tk-include-directories.patch" - "${FILESDIR}/${P}-find-libjpeg-turbo-library.patch" - "${FILESDIR}/${P}-link-against-ffmpeg.patch" + "${FILESDIR}/${PN}-6.2.2204-use-external-pybind11.patch" + "${FILESDIR}/${PN}-6.2.2204-find-Tk-include-directories.patch" + "${FILESDIR}/${PN}-6.2.2204-find-libjpeg-turbo-library.patch" + "${FILESDIR}/${PN}-6.2.2204-link-against-ffmpeg.patch" + "${FILESDIR}/${PN}-6.2.2204-use-system-spdlog.patch" + "${FILESDIR}/${PN}-6.2.2204-use-system-catch.patch" + "${FILESDIR}/${PN}-6.2.2204-disable-failing-tests.patch" + "${FILESDIR}/${PN}-6.2.2204-disable-python-tests.patch" ) pkg_setup() { @@ -81,6 +92,7 @@ src_configure() { # currently not working in a sandbox, expects netgen to be installed # see https://github.com/NGSolve/netgen/issues/132 -DBUILD_STUB_FILES=OFF + -DENABLE_UNIT_TESTS=$(usex test) -DINSTALL_PROFILES=OFF -DNG_INSTALL_DIR_CMAKE="$(get_libdir)/cmake/${PN}" -DNG_INSTALL_DIR_INCLUDE="include/${PN}" @@ -88,15 +100,16 @@ src_configure() { -DUSE_CCACHE=OFF # doesn't build with this version -DUSE_CGNS=OFF - -DUSE_GUI="$(usex gui)" + -DUSE_GUI=$(usex gui) -DUSE_INTERNAL_TCL=OFF - -DUSE_JPEG="$(usex jpeg)" - -DUSE_MPEG="$(usex ffmpeg)" + -DUSE_JPEG=$(usex jpeg) + -DUSE_MPEG=$(usex ffmpeg) # respect users -march= choice -DUSE_NATIVE_ARCH=OFF - -DUSE_MPI="$(usex mpi)" - -DUSE_OCC="$(usex opencascade)" - -DUSE_PYTHON="$(usex python)" + -DUSE_MPI=$(usex mpi) + -DUSE_OCC=$(usex opencascade) + -DUSE_PYTHON=$(usex python) + -DUSE_SPDLOG=$(usex logging) -DUSE_SUPERBUILD=OFF ) # no need to set this, if we only build the library @@ -134,4 +147,6 @@ src_install() { mv "${ED}"/usr/share/${PN}/doc/ng4.pdf "${ED}"/usr/share/doc/${PF} || die dosym -r /usr/share/doc/${PF}/ng4.pdf /usr/share/${PN}/doc/ng4.pdf + + use python || rm -r "${ED}${NETGENDIR}"/py_tutorials || die } |