From e9eae568ff86faeab35a19861426331d8128003e Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sat, 14 May 2022 23:37:22 -0400 Subject: [PATCH 01/11] Don't fail silently in VersionInfo(), print useful message Having version.hpp throw an exception when built against a malformed version number (due to, eg, not having the git tag available in an automated package build from source bundle) results in _init_ failing during an otherwise apparently successful dlopen(), as well as the netgen-mesher executable crashing before hitting main(). This patch both forces an abort and prints a helpful message alerting the builder/user that something went wrong instead of handing over either a coredump or a weirdly malfunctioning library with no apparent cause. Hopefully this will avoid a repeat of automated Fedora builds shipping nonfunctional Netgen RPMs for several years! --- libsrc/core/version.hpp | 72 +++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/libsrc/core/version.hpp b/libsrc/core/version.hpp index 3048ce5b9..9e3973d90 100644 --- a/libsrc/core/version.hpp +++ b/libsrc/core/version.hpp @@ -1,9 +1,10 @@ #ifndef NETGEN_CORE_VERSION_HPP #define NETGEN_CORE_VERSION_HPP -#include +#include #include #include +#include "exception.hpp" #include "ngcore_api.hpp" @@ -18,37 +19,44 @@ namespace ngcore VersionInfo() = default; VersionInfo(std::string vstring) { - minor_ = release = patch = 0; - git_hash = ""; - if(vstring.substr(0,1) == "v") - vstring = vstring.substr(1,vstring.size()-1); - auto dot = vstring.find('.'); - mayor_ = std::stoi(vstring.substr(0,dot)); - if(dot == size_t(-1)) vstring = ""; - else vstring = vstring.substr(dot+1, vstring.size()-dot-1); - if(!vstring.empty()) - { - dot = vstring.find('.'); - minor_ = std::stoi(vstring.substr(0,dot)); - if (dot == size_t(-1)) vstring = ""; - else vstring = vstring.substr(dot+1, vstring.size()-dot-1); - if(!vstring.empty()) - { - dot = vstring.find('-'); - release = std::stoi(vstring.substr(0,dot)); - if(dot == size_t(-1)) vstring = ""; - else vstring = vstring.substr(dot+1,vstring.size()-dot-1); - if(!vstring.empty()) - { - dot = vstring.find('-'); - patch = std::stoi(vstring.substr(0,dot)); - if(dot == size_t(-1)) vstring = ""; - else vstring = vstring.substr(dot+1, vstring.size()-dot-1); - if(!vstring.empty()) - git_hash = vstring; - } - } - } + std::string save = vstring; + try { + minor_ = release = patch = 0; + git_hash = ""; + if(vstring.substr(0,1) == "v") + vstring = vstring.substr(1,vstring.size()-1); + auto dot = vstring.find('.'); + mayor_ = std::stoi(vstring.substr(0,dot)); + if(dot == size_t(-1)) vstring = ""; + else vstring = vstring.substr(dot+1, vstring.size()-dot-1); + if(!vstring.empty()) + { + dot = vstring.find('.'); + minor_ = std::stoi(vstring.substr(0,dot)); + if (dot == size_t(-1)) vstring = ""; + else vstring = vstring.substr(dot+1, vstring.size()-dot-1); + if(!vstring.empty()) + { + dot = vstring.find('-'); + release = std::stoi(vstring.substr(0,dot)); + if(dot == size_t(-1)) vstring = ""; + else vstring = vstring.substr(dot+1,vstring.size()-dot-1); + if(!vstring.empty()) + { + dot = vstring.find('-'); + patch = std::stoi(vstring.substr(0,dot)); + if(dot == size_t(-1)) vstring = ""; + else vstring = vstring.substr(dot+1, vstring.size()-dot-1); + if(!vstring.empty()) + git_hash = vstring; + } + } + } + } catch(...) { + std::cerr << "Malformed NETGEN_VERSION (" << save <<"\n"; + std::cerr << "Micompiled/mispackaged Netgen library\n"; + abort(); + } } VersionInfo(const char* cstr) : VersionInfo(std::string(cstr)) { } From b82796e58d1b63dfd57561179199cdc06c6f1b24 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sat, 14 May 2022 23:57:10 -0400 Subject: [PATCH 02/11] CMake enhancements for automated external package building Add explicit defaults where missing for clarity. Support passing in NETGEN_GIT_VERSION for use when building, eg, RPM packages using rpkg, which requires building from an untagged source bundle, that is, not directly from a git checkout. Add option to choose build against internal or external Pybind11; add cmake module to find and configure against system Pybind. re-add versioning of shared library files. Add section for GCC-specific options setting (right now, to turn off harmless warnings). Warn if pybind11_stubgen is not found. Adjust stubgen paths to work when build is not in-place in the source tree. --- CMakeLists.txt | 89 +++++--- cmake/cmake_modules/FindPythonLibsNew.cmake | 202 +++++++++++++++++ cmake/generate_version_file.cmake | 5 +- cmake/pybind11Tools.cmake | 227 ++++++++++++++++++++ libsrc/core/CMakeLists.txt | 1 + ng/CMakeLists.txt | 9 +- python/CMakeLists.txt | 22 +- 7 files changed, 510 insertions(+), 45 deletions(-) create mode 100644 cmake/cmake_modules/FindPythonLibsNew.cmake create mode 100644 cmake/pybind11Tools.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b7662035e..0a27f7937 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,32 +7,33 @@ cmake_policy(VERSION 3.13) option( USE_NATIVE_ARCH "build for native cpu architecture" ON) -option( USE_GUI "build with GUI" ON ) -option( USE_PYTHON "build with python interface" ON ) -option( USE_MPI "enable mpi parallelization" OFF ) -option( USE_MPI4PY "enable mpi4py interface" ON ) -option( USE_OCC "build with OpenCascade geometry kernel interface" OFF) -option( USE_STLGEOM "build with STL geometry support" ON) -option( USE_CSG "build with CSG kernel" ON) -option( USE_INTERFACE "build nginterface" ON) -option( USE_GEOM2D "build 2d geometry kernels" ON) -option( USE_JPEG "enable snapshots using library libjpeg" OFF ) -option( USE_MPEG "enable video recording with FFmpeg, uses libavcodec" OFF ) -option( USE_CGNS "enable CGNS file read/write support" OFF ) -option( USE_NUMA "compile with NUMA-aware code") -option( INTEL_MIC "cross compile for intel xeon phi") +option( USE_GUI "build with GUI" ON ) +option( USE_PYTHON "build with python interface" ON ) +option( USE_MPI "enable mpi parallelization" OFF ) +option( USE_MPI4PY "enable mpi4py interface" ON ) +option( USE_OCC "build with OpenCascade geometry kernel interface" OFF) +option( USE_STLGEOM "build with STL geometry support" ON) +option( USE_CSG "build with CSG kernel" ON) +option( USE_INTERFACE "build nginterface" ON) +option( USE_GEOM2D "build 2d geometry kernels" ON) +option( USE_JPEG "enable snapshots using library libjpeg" OFF ) +option( USE_MPEG "enable video recording with FFmpeg, uses libavcodec" OFF ) +option( USE_CGNS "enable CGNS file read/write support" OFF ) +option( USE_NUMA "compile with NUMA-aware code" OFF ) +option( INTEL_MIC "cross compile for intel xeon phi" OFF ) option( INSTALL_PROFILES "install environment variable settings to /etc/profile.d" OFF ) -option( USE_CCACHE "use ccache") +option( USE_CCACHE "use ccache" OFF ) option( USE_INTERNAL_TCL "Compile tcl files into the code and don't install them" ON) -option( ENABLE_UNIT_TESTS "Enable Catch unit tests") +option( USE_INTERNAL_PYBIND11 "Use internally bundled version of Pybind11" ON) +option( ENABLE_UNIT_TESTS "Enable Catch unit tests" OFF) option( ENABLE_CPP_CORE_GUIDELINES_CHECK "Enable cpp core guideline checks on ngcore" OFF) -option( USE_SPDLOG "Enable spd log logging" OFF) -option( DEBUG_LOG "Enable more debug output (may increase computation time) - only works with USE_SPDLOG=ON" OFF) -option( CHECK_RANGE "Check array range access, automatically enabled if built in debug mode" OFF) +option( USE_SPDLOG "Enable spd log logging" OFF) +option( DEBUG_LOG "Enable more debug output (may increase computation time) - only works with USE_SPDLOG=ON" OFF) +option( CHECK_RANGE "Check array range access, automatically enabled if built in debug mode" OFF) option( BUILD_STUB_FILES "Build stub files for better autocompletion" ON) -option( BUILD_FOR_CONDA "Link python libraries only to executables" OFF) +option( BUILD_FOR_CONDA "Link python libraries only to executables" OFF) -option( USE_SUPERBUILD "build dependencies automatically" ON) +option( USE_SUPERBUILD "build dependencies automatically" ON) option( TRACE_MEMORY "Enable memory tracing" OFF) set(NG_COMPILE_FLAGS "" CACHE STRING "Additional compile flags") @@ -76,19 +77,20 @@ if (USE_SUPERBUILD) # execute the superbuild (this script will be invoked again without the # USE_SUPERBUILD option this time) include (cmake/SuperBuild.cmake) - return() # stop processing this file further -else() - project(Netgen) - if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR_DEFAULT}" CACHE PATH "Install directory" FORCE) - endif() + return() # stop processing this file further endif() +# Versioning variables come in from the configuration include, need them now. set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include (${CMAKE_CURRENT_LIST_DIR}/cmake/generate_version_file.cmake) set(CPACK_PACKAGE_VERSION "${NETGEN_VERSION}") +set(PACKAGE_VERSION "${NETGEN_VERSION}") +project(Netgen VERSION "${NETGEN_VERSION_SHORT}") +if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${INSTALL_DIR_DEFAULT}" CACHE PATH "Install directory" FORCE) +endif() ####################################################################### if(USE_CCACHE) @@ -230,11 +232,20 @@ endif(WIN32) if(APPLE) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") endif(APPLE) +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + add_compile_options(-Wno-deprecated -Wno-sign-compare -Wno-unused-variable -Wno-unused-but-set-variable) + add_compile_options(-Wno-cpp -Wno-unused -Wno-parentheses) + # Uncomment below to run sanitizers + #add_compile_options(-g3 -O0 -fno-inline -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address -fno-common) + #add_link_options(-g3 -O0 -fno-inline -fno-omit-frame-pointer -fsanitize=undefined -fsanitize=address -fno-common) +endif() ####################################################################### add_library(nglib ${NGLIB_LIBRARY_TYPE}) +set_target_properties(nglib PROPERTIES VERSION "${NETGEN_LIBRARY_VERSION}") if(USE_GUI) add_library(nggui ${NGGUI_LIBRARY_TYPE}) + set_target_properties(nggui PROPERTIES VERSION "${NETGEN_LIBRARY_VERSION}") if(WIN32) set_target_properties( nggui PROPERTIES OUTPUT_NAME "libnggui") endif(WIN32) @@ -302,7 +313,13 @@ else() endif() if (USE_PYTHON) - add_subdirectory(external_dependencies/pybind11) + if (USE_INTERNAL_PYBIND11) + message(STATUS "Checking for bundled Pybind11...") + add_subdirectory(external_dependencies/pybind11) + else() + message(STATUS "Looking for external Pybind11...") + include(cmake/pybind11Tools.cmake) + endif() find_path(PYBIND_INCLUDE_DIR pybind11/pybind11.h HINTS ${PYTHON_INCLUDE_DIR}) if( PYBIND_INCLUDE_DIR ) message(STATUS "Found Pybind11: ${PYBIND_INCLUDE_DIR}") @@ -427,11 +444,23 @@ if (USE_MPEG) endif (USE_MPEG) ####################################################################### -add_custom_target(ng_generate_version_file - ${CMAKE_COMMAND} +# When not building directly from git source, version will need to be +# set explicitly--- but still get it from git! +if (NETGEN_VERSION_GIT) + add_custom_target(ng_generate_version_file + ${CMAKE_COMMAND} + -DNETGEN_VERSION_GIT=${NETGEN_VERSION_GIT} -DBDIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_LIST_DIR}/cmake/generate_version_file.cmake ) +else() + add_custom_target(ng_generate_version_file + ${CMAKE_COMMAND} + -DBDIR=${CMAKE_CURRENT_BINARY_DIR} + -P ${CMAKE_CURRENT_LIST_DIR}/cmake/generate_version_file.cmake + ) +endif() + ####################################################################### if(INSTALL_PROFILES) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/netgen.sh "#!/bin/sh\n") diff --git a/cmake/cmake_modules/FindPythonLibsNew.cmake b/cmake/cmake_modules/FindPythonLibsNew.cmake new file mode 100644 index 000000000..e660c5f3e --- /dev/null +++ b/cmake/cmake_modules/FindPythonLibsNew.cmake @@ -0,0 +1,202 @@ +# - Find python libraries +# This module finds the libraries corresponding to the Python interpreter +# FindPythonInterp provides. +# This code sets the following variables: +# +# PYTHONLIBS_FOUND - have the Python libs been found +# PYTHON_PREFIX - path to the Python installation +# PYTHON_LIBRARIES - path to the python library +# PYTHON_INCLUDE_DIRS - path to where Python.h is found +# PYTHON_MODULE_EXTENSION - lib extension, e.g. '.so' or '.pyd' +# PYTHON_MODULE_PREFIX - lib name prefix: usually an empty string +# PYTHON_SITE_PACKAGES - path to installation site-packages +# PYTHON_IS_DEBUG - whether the Python interpreter is a debug build +# +# Thanks to talljimbo for the patch adding the 'LDVERSION' config +# variable usage. + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# Copyright 2012 Continuum Analytics, Inc. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# * Neither the names of Kitware, Inc., the Insight Software Consortium, +# nor the names of their contributors may be used to endorse or promote +# products derived from this software without specific prior written +# permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +# Checking for the extension makes sure that `LibsNew` was found and not just `Libs`. +if(PYTHONLIBS_FOUND AND PYTHON_MODULE_EXTENSION) + return() +endif() + +# Use the Python interpreter to find the libs. +if(PythonLibsNew_FIND_REQUIRED) + find_package(PythonInterp ${PythonLibsNew_FIND_VERSION} REQUIRED) +else() + find_package(PythonInterp ${PythonLibsNew_FIND_VERSION}) +endif() + +if(NOT PYTHONINTERP_FOUND) + set(PYTHONLIBS_FOUND FALSE) + set(PythonLibsNew_FOUND FALSE) + return() +endif() + +# According to http://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter +# testing whether sys has the gettotalrefcount function is a reliable, cross-platform +# way to detect a CPython debug interpreter. +# +# The library suffix is from the config var LDVERSION sometimes, otherwise +# VERSION. VERSION will typically be like "2.7" on unix, and "27" on windows. +execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" + "from distutils import sysconfig as s;import sys;import struct; +print('.'.join(str(v) for v in sys.version_info)); +print(sys.prefix); +print(s.get_python_inc(plat_specific=True)); +print(s.get_python_lib(plat_specific=True)); +print(s.get_config_var('SO')); +print(hasattr(sys, 'gettotalrefcount')+0); +print(struct.calcsize('@P')); +print(s.get_config_var('LDVERSION') or s.get_config_var('VERSION')); +print(s.get_config_var('LIBDIR') or ''); +print(s.get_config_var('MULTIARCH') or ''); +" + RESULT_VARIABLE _PYTHON_SUCCESS + OUTPUT_VARIABLE _PYTHON_VALUES + ERROR_VARIABLE _PYTHON_ERROR_VALUE) + +if(NOT _PYTHON_SUCCESS MATCHES 0) + if(PythonLibsNew_FIND_REQUIRED) + message(FATAL_ERROR + "Python config failure:\n${_PYTHON_ERROR_VALUE}") + endif() + set(PYTHONLIBS_FOUND FALSE) + set(PythonLibsNew_FOUND FALSE) + return() +endif() + +# Convert the process output into a list +if(WIN32) + string(REGEX REPLACE "\\\\" "/" _PYTHON_VALUES ${_PYTHON_VALUES}) +endif() +string(REGEX REPLACE ";" "\\\\;" _PYTHON_VALUES ${_PYTHON_VALUES}) +string(REGEX REPLACE "\n" ";" _PYTHON_VALUES ${_PYTHON_VALUES}) +list(GET _PYTHON_VALUES 0 _PYTHON_VERSION_LIST) +list(GET _PYTHON_VALUES 1 PYTHON_PREFIX) +list(GET _PYTHON_VALUES 2 PYTHON_INCLUDE_DIR) +list(GET _PYTHON_VALUES 3 PYTHON_SITE_PACKAGES) +list(GET _PYTHON_VALUES 4 PYTHON_MODULE_EXTENSION) +list(GET _PYTHON_VALUES 5 PYTHON_IS_DEBUG) +list(GET _PYTHON_VALUES 6 PYTHON_SIZEOF_VOID_P) +list(GET _PYTHON_VALUES 7 PYTHON_LIBRARY_SUFFIX) +list(GET _PYTHON_VALUES 8 PYTHON_LIBDIR) +list(GET _PYTHON_VALUES 9 PYTHON_MULTIARCH) + +# Make sure the Python has the same pointer-size as the chosen compiler +# Skip if CMAKE_SIZEOF_VOID_P is not defined +if(CMAKE_SIZEOF_VOID_P AND (NOT "${PYTHON_SIZEOF_VOID_P}" STREQUAL "${CMAKE_SIZEOF_VOID_P}")) + if(PythonLibsNew_FIND_REQUIRED) + math(EXPR _PYTHON_BITS "${PYTHON_SIZEOF_VOID_P} * 8") + math(EXPR _CMAKE_BITS "${CMAKE_SIZEOF_VOID_P} * 8") + message(FATAL_ERROR + "Python config failure: Python is ${_PYTHON_BITS}-bit, " + "chosen compiler is ${_CMAKE_BITS}-bit") + endif() + set(PYTHONLIBS_FOUND FALSE) + set(PythonLibsNew_FOUND FALSE) + return() +endif() + +# The built-in FindPython didn't always give the version numbers +string(REGEX REPLACE "\\." ";" _PYTHON_VERSION_LIST ${_PYTHON_VERSION_LIST}) +list(GET _PYTHON_VERSION_LIST 0 PYTHON_VERSION_MAJOR) +list(GET _PYTHON_VERSION_LIST 1 PYTHON_VERSION_MINOR) +list(GET _PYTHON_VERSION_LIST 2 PYTHON_VERSION_PATCH) + +# Make sure all directory separators are '/' +string(REGEX REPLACE "\\\\" "/" PYTHON_PREFIX ${PYTHON_PREFIX}) +string(REGEX REPLACE "\\\\" "/" PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIR}) +string(REGEX REPLACE "\\\\" "/" PYTHON_SITE_PACKAGES ${PYTHON_SITE_PACKAGES}) + +if(CMAKE_HOST_WIN32 AND NOT (MSYS OR MINGW)) + set(PYTHON_LIBRARY + "${PYTHON_PREFIX}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") + + # when run in a venv, PYTHON_PREFIX points to it. But the libraries remain in the + # original python installation. They may be found relative to PYTHON_INCLUDE_DIR. + if(NOT EXISTS "${PYTHON_LIBRARY}") + get_filename_component(_PYTHON_ROOT ${PYTHON_INCLUDE_DIR} DIRECTORY) + set(PYTHON_LIBRARY + "${_PYTHON_ROOT}/libs/Python${PYTHON_LIBRARY_SUFFIX}.lib") + endif() + + # raise an error if the python libs are still not found. + if(NOT EXISTS "${PYTHON_LIBRARY}") + message(FATAL_ERROR "Python libraries not found") + endif() + +else() + if(PYTHON_MULTIARCH) + set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}/${PYTHON_MULTIARCH}" "${PYTHON_LIBDIR}") + else() + set(_PYTHON_LIBS_SEARCH "${PYTHON_LIBDIR}") + endif() + #message(STATUS "Searching for Python libs in ${_PYTHON_LIBS_SEARCH}") + # Probably this needs to be more involved. It would be nice if the config + # information the python interpreter itself gave us were more complete. + find_library(PYTHON_LIBRARY + NAMES "python${PYTHON_LIBRARY_SUFFIX}" + PATHS ${_PYTHON_LIBS_SEARCH} + NO_DEFAULT_PATH) + + # If all else fails, just set the name/version and let the linker figure out the path. + if(NOT PYTHON_LIBRARY) + set(PYTHON_LIBRARY python${PYTHON_LIBRARY_SUFFIX}) + endif() +endif() + +MARK_AS_ADVANCED( + PYTHON_LIBRARY + PYTHON_INCLUDE_DIR +) + +# We use PYTHON_INCLUDE_DIR, PYTHON_LIBRARY and PYTHON_DEBUG_LIBRARY for the +# cache entries because they are meant to specify the location of a single +# library. We now set the variables listed by the documentation for this +# module. +SET(PYTHON_INCLUDE_DIRS "${PYTHON_INCLUDE_DIR}") +SET(PYTHON_LIBRARIES "${PYTHON_LIBRARY}") +SET(PYTHON_DEBUG_LIBRARIES "${PYTHON_DEBUG_LIBRARY}") + +find_package_message(PYTHON + "Found PythonLibs: ${PYTHON_LIBRARY}" + "${PYTHON_EXECUTABLE}${PYTHON_VERSION}") + +set(PYTHONLIBS_FOUND TRUE) +set(PythonLibsNew_FOUND TRUE) diff --git a/cmake/generate_version_file.cmake b/cmake/generate_version_file.cmake index c4a579d13..e8f092ea2 100644 --- a/cmake/generate_version_file.cmake +++ b/cmake/generate_version_file.cmake @@ -24,8 +24,8 @@ if(status AND NOT status EQUAL 0) string(REGEX REPLACE "^netgen(.*)" "\\1" git_version_string "${git_version_string}") endif() else() - MESSAGE(WARNING "Could not determine git-version from source code - assuming 6.2.0.0") - set(git_version_string "v6.2.0.0") + MESSAGE(WARNING "Could not determine git-version from source code - assuming 6.99.2200-0-0") + set(git_version_string "v6.99.2200-0-0") endif() endif() string(STRIP ${git_version_string} git_version_string) @@ -57,6 +57,7 @@ if(NOT NETGEN_VERSION_PYTHON) set(NETGEN_VERSION_PYTHON ${NETGEN_VERSION_TWEAK}) endif() +set(NETGEN_LIBRARY_VERSION "${NETGEN_VERSION_SHORT}") set(version_file ${BDIR}/netgen_version.hpp) set(new_version_file_string "\ diff --git a/cmake/pybind11Tools.cmake b/cmake/pybind11Tools.cmake new file mode 100644 index 000000000..c7156c020 --- /dev/null +++ b/cmake/pybind11Tools.cmake @@ -0,0 +1,227 @@ +# tools/pybind11Tools.cmake -- Build system for the pybind11 modules +# +# Copyright (c) 2015 Wenzel Jakob +# +# All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +cmake_minimum_required(VERSION 2.8.12) + +# Add a CMake parameter for choosing a desired Python version +if(NOT PYBIND11_PYTHON_VERSION) + set(PYBIND11_PYTHON_VERSION "" CACHE STRING "Python version to use for compiling modules") +endif() + +set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4) +find_package(PythonLibsNew ${PYBIND11_PYTHON_VERSION} REQUIRED) + +include(CheckCXXCompilerFlag) +include(CMakeParseArguments) + +if(NOT PYBIND11_CPP_STANDARD AND NOT CMAKE_CXX_STANDARD) + if(NOT MSVC) + check_cxx_compiler_flag("-std=c++14" HAS_CPP14_FLAG) + + if (HAS_CPP14_FLAG) + set(PYBIND11_CPP_STANDARD -std=c++14) + else() + check_cxx_compiler_flag("-std=c++11" HAS_CPP11_FLAG) + if (HAS_CPP11_FLAG) + set(PYBIND11_CPP_STANDARD -std=c++11) + else() + message(FATAL_ERROR "Unsupported compiler -- pybind11 requires C++11 support!") + endif() + endif() + elseif(MSVC) + set(PYBIND11_CPP_STANDARD /std:c++14) + endif() + + set(PYBIND11_CPP_STANDARD ${PYBIND11_CPP_STANDARD} CACHE STRING + "C++ standard flag, e.g. -std=c++11, -std=c++14, /std:c++14. Defaults to C++14 mode." FORCE) +endif() + +# Checks whether the given CXX/linker flags can compile and link a cxx file. cxxflags and +# linkerflags are lists of flags to use. The result variable is a unique variable name for each set +# of flags: the compilation result will be cached base on the result variable. If the flags work, +# sets them in cxxflags_out/linkerflags_out internal cache variables (in addition to ${result}). +function(_pybind11_return_if_cxx_and_linker_flags_work result cxxflags linkerflags cxxflags_out linkerflags_out) + set(CMAKE_REQUIRED_LIBRARIES ${linkerflags}) + check_cxx_compiler_flag("${cxxflags}" ${result}) + if (${result}) + set(${cxxflags_out} "${cxxflags}" CACHE INTERNAL "" FORCE) + set(${linkerflags_out} "${linkerflags}" CACHE INTERNAL "" FORCE) + endif() +endfunction() + +# Internal: find the appropriate link time optimization flags for this compiler +function(_pybind11_add_lto_flags target_name prefer_thin_lto) + if (NOT DEFINED PYBIND11_LTO_CXX_FLAGS) + set(PYBIND11_LTO_CXX_FLAGS "" CACHE INTERNAL "") + set(PYBIND11_LTO_LINKER_FLAGS "" CACHE INTERNAL "") + + if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") + set(cxx_append "") + set(linker_append "") + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT APPLE) + # Clang Gold plugin does not support -Os; append -O3 to MinSizeRel builds to override it + set(linker_append ";$<$:-O3>") + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + set(cxx_append ";-fno-fat-lto-objects") + endif() + + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND prefer_thin_lto) + _pybind11_return_if_cxx_and_linker_flags_work(HAS_FLTO_THIN + "-flto=thin${cxx_append}" "-flto=thin${linker_append}" + PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) + endif() + + if (NOT HAS_FLTO_THIN) + _pybind11_return_if_cxx_and_linker_flags_work(HAS_FLTO + "-flto${cxx_append}" "-flto${linker_append}" + PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) + endif() + elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel") + # Intel equivalent to LTO is called IPO + _pybind11_return_if_cxx_and_linker_flags_work(HAS_INTEL_IPO + "-ipo" "-ipo" PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) + elseif(MSVC) + # cmake only interprets libraries as linker flags when they start with a - (otherwise it + # converts /LTCG to \LTCG as if it was a Windows path). Luckily MSVC supports passing flags + # with - instead of /, even if it is a bit non-standard: + _pybind11_return_if_cxx_and_linker_flags_work(HAS_MSVC_GL_LTCG + "/GL" "-LTCG" PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS) + endif() + + if (PYBIND11_LTO_CXX_FLAGS) + message(STATUS "LTO enabled") + else() + message(STATUS "LTO disabled (not supported by the compiler and/or linker)") + endif() + endif() + + # Enable LTO flags if found, except for Debug builds + if (PYBIND11_LTO_CXX_FLAGS) + target_compile_options(${target_name} PRIVATE "$<$>:${PYBIND11_LTO_CXX_FLAGS}>") + endif() + if (PYBIND11_LTO_LINKER_FLAGS) + target_link_libraries(${target_name} PRIVATE "$<$>:${PYBIND11_LTO_LINKER_FLAGS}>") + endif() +endfunction() + +# Build a Python extension module: +# pybind11_add_module( [MODULE | SHARED] [EXCLUDE_FROM_ALL] +# [NO_EXTRAS] [SYSTEM] [THIN_LTO] source1 [source2 ...]) +# +function(pybind11_add_module target_name) + set(options MODULE SHARED EXCLUDE_FROM_ALL NO_EXTRAS SYSTEM THIN_LTO) + cmake_parse_arguments(ARG "${options}" "" "" ${ARGN}) + + if(ARG_MODULE AND ARG_SHARED) + message(FATAL_ERROR "Can't be both MODULE and SHARED") + elseif(ARG_SHARED) + set(lib_type SHARED) + else() + set(lib_type MODULE) + endif() + + if(ARG_EXCLUDE_FROM_ALL) + set(exclude_from_all EXCLUDE_FROM_ALL) + endif() + + add_library(${target_name} ${lib_type} ${exclude_from_all} ${ARG_UNPARSED_ARGUMENTS}) + + if(ARG_SYSTEM) + set(inc_isystem SYSTEM) + endif() + + target_include_directories(${target_name} ${inc_isystem} + PRIVATE ${PYBIND11_INCLUDE_DIR} # from project CMakeLists.txt + PRIVATE ${pybind11_INCLUDE_DIR} # from pybind11Config + PRIVATE ${PYTHON_INCLUDE_DIRS}) + + # Python debug libraries expose slightly different objects + # https://docs.python.org/3.6/c-api/intro.html#debugging-builds + # https://stackoverflow.com/questions/39161202/how-to-work-around-missing-pymodule-create2-in-amd64-win-python35-d-lib + if(PYTHON_IS_DEBUG) + target_compile_definitions(${target_name} PRIVATE Py_DEBUG) + endif() + + # The prefix and extension are provided by FindPythonLibsNew.cmake + set_target_properties(${target_name} PROPERTIES PREFIX "${PYTHON_MODULE_PREFIX}") + set_target_properties(${target_name} PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}") + + # -fvisibility=hidden is required to allow multiple modules compiled against + # different pybind versions to work properly, and for some features (e.g. + # py::module_local). We force it on everything inside the `pybind11` + # namespace; also turning it on for a pybind module compilation here avoids + # potential warnings or issues from having mixed hidden/non-hidden types. + set_target_properties(${target_name} PROPERTIES CXX_VISIBILITY_PRESET "hidden") + set_target_properties(${target_name} PROPERTIES CUDA_VISIBILITY_PRESET "hidden") + + if(WIN32 OR CYGWIN) + # Link against the Python shared library on Windows + target_link_libraries(${target_name} PRIVATE ${PYTHON_LIBRARIES}) + elseif(APPLE) + # It's quite common to have multiple copies of the same Python version + # installed on one's system. E.g.: one copy from the OS and another copy + # that's statically linked into an application like Blender or Maya. + # If we link our plugin library against the OS Python here and import it + # into Blender or Maya later on, this will cause segfaults when multiple + # conflicting Python instances are active at the same time (even when they + # are of the same version). + + # Windows is not affected by this issue since it handles DLL imports + # differently. The solution for Linux and Mac OS is simple: we just don't + # link against the Python library. The resulting shared library will have + # missing symbols, but that's perfectly fine -- they will be resolved at + # import time. + + target_link_libraries(${target_name} PRIVATE "-undefined dynamic_lookup") + + if(ARG_SHARED) + # Suppress CMake >= 3.0 warning for shared libraries + set_target_properties(${target_name} PROPERTIES MACOSX_RPATH ON) + endif() + endif() + + # Make sure C++11/14 are enabled + if(CMAKE_VERSION VERSION_LESS 3.3) + target_compile_options(${target_name} PUBLIC ${PYBIND11_CPP_STANDARD}) + else() + target_compile_options(${target_name} PUBLIC $<$:${PYBIND11_CPP_STANDARD}>) + endif() + + if(ARG_NO_EXTRAS) + return() + endif() + + _pybind11_add_lto_flags(${target_name} ${ARG_THIN_LTO}) + + if (NOT MSVC AND NOT ${CMAKE_BUILD_TYPE} MATCHES Debug|RelWithDebInfo) + # Strip unnecessary sections of the binary on Linux/Mac OS + if(CMAKE_STRIP) + if(APPLE) + add_custom_command(TARGET ${target_name} POST_BUILD + COMMAND ${CMAKE_STRIP} -x $) + else() + add_custom_command(TARGET ${target_name} POST_BUILD + COMMAND ${CMAKE_STRIP} $) + endif() + endif() + endif() + + if(MSVC) + # /MP enables multithreaded builds (relevant when there are many files), /bigobj is + # needed for bigger binding projects due to the limit to 64k addressable sections + target_compile_options(${target_name} PRIVATE /bigobj) + if(CMAKE_VERSION VERSION_LESS 3.11) + target_compile_options(${target_name} PRIVATE $<$>:/MP>) + else() + # Only set these options for C++ files. This is important so that, for + # instance, projects that include other types of source files like CUDA + # .cu files don't get these options propagated to nvcc since that would + # cause the build to fail. + target_compile_options(${target_name} PRIVATE $<$>:$<$:/MP>>) + endif() + endif() +endfunction() diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index ee89b4f67..7c550fb99 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -13,6 +13,7 @@ add_library(ngcore ${NGCORE_LIBRARY_TYPE} utils.cpp version.cpp ) +set_target_properties(ngcore PROPERTIES VERSION "${NETGEN_LIBRARY_VERSION}") target_compile_options(ngcore PUBLIC "${NG_COMPILE_FLAGS}") diff --git a/ng/CMakeLists.txt b/ng/CMakeLists.txt index 3ad3d8be3..9320d2f30 100644 --- a/ng/CMakeLists.txt +++ b/ng/CMakeLists.txt @@ -20,6 +20,7 @@ if(USE_GUI) if(NOT BUILD_FOR_CONDA) add_executable(netgen ngappinit.cpp) + set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen-mesher) if(WIN32) target_sources(netgen PRIVATE ../windows/netgen.rc) endif(WIN32) @@ -28,7 +29,7 @@ if(USE_GUI) if(APPLE) set_target_properties(netgen PROPERTIES OUTPUT_NAME netgen) endif(APPLE) - target_link_libraries( netgen ${PYTHON_LIBRARIES} ${TCL_LIBRARY} ${TK_LIBRARY}) + target_link_libraries( netgen ${PYTHON_LIBRARIES} ${TCL_LIBRARY} ${TK_LIBRARY} ${JPEG_LIBRARIES}) endif(NOT BUILD_FOR_CONDA) install(TARGETS nggui ${NG_INSTALL_DIR}) @@ -36,6 +37,7 @@ endif(USE_GUI) if(USE_PYTHON) add_library(ngpy SHARED netgenpy.cpp) + set_target_properties(ngpy PROPERTIES VERSION "${NETGEN_LIBRARY_VERSION}") target_link_libraries( ngpy PUBLIC nglib PRIVATE "$" ) if(APPLE) set_target_properties( ngpy PROPERTIES SUFFIX ".so") @@ -44,10 +46,11 @@ if(USE_PYTHON) set_target_properties( ngpy PROPERTIES OUTPUT_NAME "libngpy") endif() set_target_properties(ngpy PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/../${NETGEN_PYTHON_RPATH}") - install(TARGETS ngpy DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX} COMPONENT netgen) + install(TARGETS ngpy DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen COMPONENT netgen) if(USE_GUI) add_library(ngguipy SHARED ngguipy.cpp) + set_target_properties(ngguipy PROPERTIES VERSION "${NETGEN_LIBRARY_VERSION}") target_link_libraries( ngguipy PUBLIC nglib nggui PRIVATE "$" $) if(APPLE) set_target_properties( ngguipy PROPERTIES SUFFIX ".so") @@ -56,7 +59,7 @@ if(USE_PYTHON) set_target_properties( ngguipy PROPERTIES OUTPUT_NAME "libngguipy") endif() set_target_properties(ngguipy PROPERTIES INSTALL_RPATH "${NG_RPATH_TOKEN}/../${NETGEN_PYTHON_RPATH}") - install(TARGETS ngguipy DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX} COMPONENT netgen) + install(TARGETS ngguipy DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen COMPONENT netgen) endif(USE_GUI) endif(USE_PYTHON) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index b4f468663..6a2fd84e4 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -14,7 +14,7 @@ install(FILES meshing.py csg.py geom2d.py stl.py gui.py NgOCC.py occ.py read_gmsh.py read_meshio.py webgui.py - DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX} + DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen COMPONENT netgen ) @@ -26,13 +26,15 @@ install(FILES # build stub files for pybind11 packages if(BUILD_STUB_FILES) -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pybind11_stubgen; print(pybind11_stubgen.__file__)" OUTPUT_VARIABLE stubgen_path RESULT_VARIABLE pybind11_stubgen) -if(pybind11_stubgen AND NOT ${pybind11_stubgen} EQUAL 0) - message(WARNING "pybind11-stubgen not found, if you want to create stub files -for better autocompletion support install it with pip.") -else() - message("-- Found pybind11-stubgen: ${stubgen_path}") - install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pybind11_stubgen --no-setup-py netgen)") - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../stubs/netgen-stubs/ DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen/ COMPONENT netgen) -endif() + message(STATUS "Building Python stub files...") + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pybind11_stubgen; print(pybind11_stubgen.__file__)" OUTPUT_VARIABLE stubgen_path RESULT_VARIABLE pybind11_stubgen) + if(pybind11_stubgen AND NOT ${pybind11_stubgen} EQUAL 0) + message(WARNING "pybind11-stubgen not found. If you want to create stub files for better autocompletion support, + install pybind11-stubgen with pip.") + else() + message("-- Found pybind11-stubgen: ${stubgen_path}") + set(env{PYTHONPATH} ".:${CMAKE_INSTALL_PREFIX}/${PYTHON_PACKAGES_INSTALL_DIR}") + install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pybind11_stubgen -o ${CMAKE_BINARY_DIR}/stubs --no-setup-py netgen)") + install(DIRECTORY ${CMAKE_BINARY_DIR}/stubs/netgen-stubs/ DESTINATION ${NG_INSTALL_DIR_PYTHON}/netgen COMPONENT netgen) + endif() endif(BUILD_STUB_FILES) From 5d0e69c7ed987f39df735b2e95ae66c9e700ab60 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:24:40 -0400 Subject: [PATCH 03/11] Alter name use of 'netgen' and 'netgen-mesher' The name of the 'netgen' executable collides with an older UNIX pcb trace routing application also named 'netgen'. Fedora, for this reason, renames this mesher package to 'netgen-mesher' and the executable, likewise, to 'netgen-mesher'. I propose the same change here. Ironically though, the current python module is already named 'netgen-mesher', which complicates loading of the module as 'netgen', often resulting in it being unfindable. For this reason, I similarly reverse the usage, renaming the python module from 'netgen-mesher' to 'netgen'. --- CMakeLists.txt | 2 +- ng/ngtesting.tcl | 4 ++-- setup.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a27f7937..35c6f6230 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ if(USE_PYTHON) file(TO_CMAKE_PATH ${PYTHON_PACKAGES_INSTALL_DIR} PYTHON_PACKAGES_INSTALL_DIR) endif(USE_PYTHON) -set(NG_INSTALL_SUFFIX netgen CACHE STRING "Suffix appended to install directories (project name)") +set(NG_INSTALL_SUFFIX netgen-mesher CACHE STRING "Suffix appended to install directories (project name)") if(APPLE) set(NG_INSTALL_DIR_BIN_DEFAULT Contents/MacOS) diff --git a/ng/ngtesting.tcl b/ng/ngtesting.tcl index 24b589834..a2c6f0ca9 100644 --- a/ng/ngtesting.tcl +++ b/ng/ngtesting.tcl @@ -64,7 +64,7 @@ proc ngtest { {t all} {f ""}} { } puts "\n ** testing in2d files in tutorials/ **" - set testdir "$::ngdir/../share/netgen" + set testdir "$::ngdir/../share/netgen-mesher" set in2dfiles { demo2d newin2d square v2in2d } foreach {tfile} $in2dfiles { if {$f != ""} { puts " * meshing file tutorials/$tfile.in2d..." } @@ -89,7 +89,7 @@ proc ngtest { {t all} {f ""}} { } puts "\n ** testing geo files in tutorials/ **" - set testdir "$::ngdir/../share/netgen" + set testdir "$::ngdir/../share/netgen-mesher" set geofiles { boxcyl cubemcyl extrusion revolution trafo circle_on_cube cubemsphere fichera sculpture twobricks cone cylinder lshape3d shaft twocubes diff --git a/setup.py b/setup.py index 0ed33a6dc..e6b48cfc3 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def _patched_parse_manifests(self): py_install_dir = get_python_lib(1,0,'').replace('\\','/') -name = "netgen-mesher" +name = "netgen" arch = None cmake_args = [ f'-DNETGEN_VERSION_GIT={git_version}', From 97d3c1ce9e49cd611f08fc02000dff1eaa73cef2 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:29:37 -0400 Subject: [PATCH 04/11] Adjust python module path in __init__, add checks to pytest Adjust path setup of the python modules in __init__ such that it's possible to run pytests from a mock root during package build/test. Also add checks to pytest/CMakelists.txt to make sure pytest abd check are present instead of failing with an inscrutible traceback if they're not installed or usable. --- python/__init__.py | 4 ++-- tests/pytest/CMakeLists.txt | 32 ++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/python/__init__.py b/python/__init__.py index ed61a3207..91d48fd6b 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -2,8 +2,8 @@ import sys from . import config -_netgen_bin_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),'..',config.NETGEN_PYTHON_RPATH_BIN)) -_netgen_lib_dir=os.path.realpath(os.path.join(os.path.dirname(__file__),'..',config.NETGEN_PYTHON_RPATH)) +_netgen_bin_dir=os.path.realpath(os.path.join(config.NG_INSTALL_DIR_PYTHON,config.NETGEN_PYTHON_RPATH_BIN)) +_netgen_lib_dir=os.path.realpath(os.path.join(config.NG_INSTALL_DIR_PYTHON,config.NETGEN_PYTHON_RPATH)) if sys.platform.startswith('win'): if sys.version >= '3.8': diff --git a/tests/pytest/CMakeLists.txt b/tests/pytest/CMakeLists.txt index 26c7d22fe..4f7e1c5bb 100644 --- a/tests/pytest/CMakeLists.txt +++ b/tests/pytest/CMakeLists.txt @@ -1,8 +1,28 @@ if(USE_PYTHON) - add_test(NAME pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - add_custom_target(pytest ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - set_tests_properties ( pytest PROPERTIES TIMEOUT 1800 ) - if(USE_MPI AND USE_MPI4PY) - add_test(NAME pytest-mpi COMMAND ${MPIEXEC_EXECUTABLE} --allow-run-as-root -np 4 ${PYTHON_EXECUTABLE} -m pytest --with-mpi test_mpi4py.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - endif(USE_MPI AND USE_MPI4PY) + if(ENABLE_UNIT_TESTS) + set(PYTHON_UNIT_TESTS TRUE) + # check for prerequisite modules + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pytest; print(pytest.__file__)" + OUTPUT_VARIABLE pytest_path RESULT_VARIABLE pytest_result) + if(NOT ${pytest_result} EQUAL 0) + message(WARNING "python module 'pytest' not found.") + set(PYTHON_UNIT_TESTS FALSE) + endif() + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import pytest_check; print(pytest_check.__file__)" + OUTPUT_VARIABLE pycheck_path RESULT_VARIABLE pycheck_result) + if(NOT ${pytest_result} EQUAL 0) + message(WARNING "python module 'pytest_check' not found.") + set(PYTHON_UNIT_TESTS FALSE) + endif() + if(PYTHON_UNIT_TESTS) + add_test(NAME pytest COMMAND ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + add_custom_target(pytest ${PYTHON_EXECUTABLE} -m pytest WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + set_tests_properties ( pytest PROPERTIES TIMEOUT 18000 ) + if(USE_MPI AND USE_MPI4PY) + add_test(NAME pytest-mpi COMMAND ${MPIEXEC_EXECUTABLE} --allow-run-as-root -np 4 ${PYTHON_EXECUTABLE} -m pytest --with-mpi test_mpi4py.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + endif(USE_MPI AND USE_MPI4PY) + else() + message(WARNING "Unable to perform unit tests on netgen python modules.") + endif() + endif() endif(USE_PYTHON) From 5ee4e43393936ab4c00feb58c48bc3a10e6bcbdb Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:33:11 -0400 Subject: [PATCH 05/11] Fix nullptr deref in archive Hardened toolchains (eg, mainline Fedora) no longer tolerate null derefs that were silently trapped/ignored in earlier versions. This eliminates a nullptr deref in archive.hpp that was failing several unit tests (and causing crashes) when trying to manipulate default-constructed archive objects. --- libsrc/core/archive.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsrc/core/archive.hpp b/libsrc/core/archive.hpp index 4271e7255..80ae99afd 100644 --- a/libsrc/core/archive.hpp +++ b/libsrc/core/archive.hpp @@ -225,7 +225,8 @@ namespace ngcore (*this) & size; if(Input()) v.resize(size); - Do(&v[0], size); + if(size > 0) // can't deref v[0] if it doesn't exist + Do(&v[0], size); return (*this); } From 6ba4a6e6c67d51b3900b1e05df1ee821107831b5 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:36:17 -0400 Subject: [PATCH 06/11] Correct deletion of non-allocated memory in ngarray A default-constructed (or just empty) ngarray will have 'ownmem' set despite not having an allocated data array. Destructor would then trigger an abort. --- libsrc/general/ngarray.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libsrc/general/ngarray.hpp b/libsrc/general/ngarray.hpp index 05639aead..1b16c46b9 100644 --- a/libsrc/general/ngarray.hpp +++ b/libsrc/general/ngarray.hpp @@ -295,8 +295,9 @@ namespace netgen /// if responsible, deletes memory ~NgArray() { - if (ownmem) - delete [] data; + if (data) + if (ownmem) + delete [] data; } /// Change logical size. If necessary, do reallocation. Keeps contents. @@ -374,8 +375,9 @@ namespace netgen /// Deallocate memory void DeleteAll () { - if (ownmem) - delete [] data; + if (data) + if (ownmem) + delete [] data; data = 0; size = allocsize = 0; } From ae87c7005c85aad90874fa9991d330a547565e91 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:39:44 -0400 Subject: [PATCH 07/11] Two nullptr deref fixes in table Don't delete memory that wasn't allocated. Similarly, we can't deref the first element of an array that was never allocated. --- libsrc/general/table.cpp | 10 ++++++---- libsrc/general/table.hpp | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libsrc/general/table.cpp b/libsrc/general/table.cpp index 732d63c39..e39d671bb 100644 --- a/libsrc/general/table.cpp +++ b/libsrc/general/table.cpp @@ -108,14 +108,16 @@ namespace netgen if (line.size == line.maxsize) { void * p = new char [(line.maxsize+5) * elsize]; - - memcpy (p, line.col, line.maxsize * elsize); - delete [] (char*)line.col; + + if (line.size > 0 && line.col != NULL) { + memcpy (p, line.col, line.maxsize * elsize); + delete [] (char*)line.col; + } line.col = p; line.maxsize += 5; } - + line.size++; } diff --git a/libsrc/general/table.hpp b/libsrc/general/table.hpp index 535d02127..44c5f9fb5 100644 --- a/libsrc/general/table.hpp +++ b/libsrc/general/table.hpp @@ -120,7 +120,8 @@ class TABLE : public BASE_TABLE /// Creates fixed maximal element size table inline TABLE (const NgFlatArray & entrysizes) - : BASE_TABLE (NgFlatArray (entrysizes.Size(), const_cast(&entrysizes[BASE])), + : BASE_TABLE (NgFlatArray (entrysizes.Size(), + entrysizes.Size() > 0 ? const_cast(&entrysizes[BASE]) : 0), sizeof(T)) { ; } From 6f5eae828d36d7be38dc2f78018ecf3b1041211e Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:41:32 -0400 Subject: [PATCH 08/11] Type corrections in rw_cgns Several occurrences of int -> cgsize_t --- libsrc/interface/rw_cgns.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc/interface/rw_cgns.cpp b/libsrc/interface/rw_cgns.cpp index ad0869a7e..a64a484b2 100644 --- a/libsrc/interface/rw_cgns.cpp +++ b/libsrc/interface/rw_cgns.cpp @@ -215,7 +215,7 @@ namespace netgen::cg if(codim==2) name += mesh.GetCD2Name(index); int ne = 0; - Array data; + Array data; if(dim==3) for(const auto el : mesh.VolumeElements()) @@ -333,7 +333,7 @@ namespace netgen::cg ZoneType_t zone_type; int fn, base, zone; int first_index_1d, first_index_2d, first_index_3d; - int nv=0, ne_1d=0, ne_2d=0, ne_3d=0; + cgsize_t nv=0, ne_1d=0, ne_2d=0, ne_3d=0; Array names_1d, names_2d, names_3d; @@ -643,7 +643,7 @@ namespace netgen int n_vertices = 0; for (auto zi : Range(1, nzones+1)) { - int size[3]; + cgsize_t size[3]; char name[100]; cg_zone_read(fn,base,zi, name, size); n_vertices += size[0]; From 2da94c3e6b578c05a23511b49d7c2715f7c1bcf7 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:43:27 -0400 Subject: [PATCH 09/11] Export additional classes to provide typeinfo visibility Add DLL_HEADER to Surface, Primitive, and STLTopology in order to make typeinfo available to link stage (otherwise, link fails with GNU ld). --- libsrc/csg/surface.hpp | 4 ++-- libsrc/stlgeom/stltopology.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc/csg/surface.hpp b/libsrc/csg/surface.hpp index f09d8c51e..7cd31b274 100644 --- a/libsrc/csg/surface.hpp +++ b/libsrc/csg/surface.hpp @@ -19,7 +19,7 @@ namespace netgen This class is used for generation of surface meshes in NETGEN */ - class Surface + class DLL_HEADER Surface { protected: /// invert normal vector @@ -236,7 +236,7 @@ namespace netgen - class Primitive + class DLL_HEADER Primitive { protected: NgArray surfaceids; diff --git a/libsrc/stlgeom/stltopology.hpp b/libsrc/stlgeom/stltopology.hpp index 101cde531..6f916bed9 100644 --- a/libsrc/stlgeom/stltopology.hpp +++ b/libsrc/stlgeom/stltopology.hpp @@ -276,7 +276,7 @@ ostream& operator<<(ostream& os, const STLTriangle& t); -class STLTopology +class DLL_HEADER STLTopology { protected: Array trias; From 6159d89386e55cd2d30fac911a7e20e49a798aef Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 00:47:44 -0400 Subject: [PATCH 10/11] Numerous changes to python bindings for clean stub generation I'm uncertain about earlier/alternate versions, but the current version of mainline pybind11_stubgen requires a number of changes in the python binding cpp files to succeed: __repr__ implementation added for some basic types Added default descriptions via py::arg_v variant syntax for those cases where a __repr__ implementation made no sense (eg, for a default sonstructor of a complex type) Moved class declarations to precede first use in arguments/returns Added trailing default arguments, so that mandatory args did not follow optional args (without resorting to kwargs trickery). --- libsrc/csg/python_csg.cpp | 2 +- libsrc/geom2d/python_geom2d.cpp | 4 +- libsrc/meshing/python_mesh.cpp | 153 +++++++++++++++---------------- libsrc/occ/python_occ.cpp | 4 +- libsrc/occ/python_occ_basic.cpp | 25 ++--- libsrc/occ/python_occ_shapes.cpp | 16 +++- 6 files changed, 105 insertions(+), 99 deletions(-) diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index 676e249a0..92592f009 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -616,7 +616,7 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails! trafo)); }), py::arg("solid1"), py::arg("solid2"), - py::arg("trafo")=Transformation<3>(Vec<3>(0,0,0)) + py::arg_v("trafo", Transformation<3>(Vec<3>(0,0,0)), "Transformation<3>(Vec<3>(0,0,0))") ) .def("NameEdge", [] (CSGeometry & self, shared_ptr s1, shared_ptr s2, string name) { diff --git a/libsrc/geom2d/python_geom2d.cpp b/libsrc/geom2d/python_geom2d.cpp index ab232f132..16ece7b1b 100644 --- a/libsrc/geom2d/python_geom2d.cpp +++ b/libsrc/geom2d/python_geom2d.cpp @@ -202,7 +202,7 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m) self.AppendSegment (spex); }, py::arg("func"), py::arg("leftdomain") = 1, py::arg("rightdomain") = py::int_(0), - py::arg("bc")=NGDummyArgument(), py::arg("maxh")=1e99, + py::arg_v("bc", NGDummyArgument(), "NGDummyArgument()"), py::arg("maxh")=1e99, "Curve is given as parametrization on the interval [0,1]") .def("SetMaterial", &SplineGeometry2d::SetMaterial) @@ -439,7 +439,7 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m) .def("Move", &Solid2d::Move) .def("Scale", static_cast(&Solid2d::Scale)) .def("Scale", static_cast)>(&Solid2d::Scale)) - .def("Rotate", &Solid2d::RotateDeg, py::arg("angle"), py::arg("center")=Point<2>{0,0}) + .def("Rotate", &Solid2d::RotateDeg, py::arg("angle"), py::arg_v("center", Point<2>{0,0}, "Point<2>{0,0}")) ; diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 5f3908326..30e5da7d9 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -167,7 +167,47 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) py::implicitly_convertible(); #endif // NG_MPI4PY - + py::class_> (m, "Vec3d") + .def(py::init()) + .def(py::init([](py::tuple v) + { + return Vec<3> { v[0].cast(), v[1].cast(), + v[2].cast() }; + })) + .def ("__str__", &ToString>) + .def(py::self==py::self) + .def(py::self+py::self) + .def(py::self-py::self) + .def(-py::self) + .def(double()*py::self) + .def(py::self*double()) + .def("Norm", &Vec<3>::Length) + .def("__getitem__", [](Vec<3>& vec, int index) { return vec[index]; }) + .def("__len__", [](Vec<3>& /*unused*/) { return 3; }) + ; + + py::implicitly_convertible>(); + + py::class_> (m, "Vec2d") + .def(py::init()) + .def(py::init( [] (std::pair xy) + { + return Vec<2>{xy.first, xy.second}; + })) + .def ("__str__", &ToString>) + .def(py::self==py::self) + .def(py::self+py::self) + .def(py::self-py::self) + .def(-py::self) + .def(double()*py::self) + .def(py::self*double()) + .def("Norm", &Vec<2>::Length) + .def("__getitem__", [](Vec<2>& vec, int index) { return vec[index]; }) + .def("__len__", [](Vec<2>& /*unused*/) { return 2; }) + ; + + py::implicitly_convertible>(); + py::class_(m, "NGDummyArgument") .def("__bool__", []( NGDummyArgument &self ) { return false; } ) ; @@ -219,47 +259,6 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) np_array.at(2)))); }); - py::class_> (m, "Vec2d") - .def(py::init()) - .def(py::init( [] (std::pair xy) - { - return Vec<2>{xy.first, xy.second}; - })) - .def ("__str__", &ToString>) - .def(py::self==py::self) - .def(py::self+py::self) - .def(py::self-py::self) - .def(-py::self) - .def(double()*py::self) - .def(py::self*double()) - .def("Norm", &Vec<2>::Length) - .def("__getitem__", [](Vec<2>& vec, int index) { return vec[index]; }) - .def("__len__", [](Vec<2>& /*unused*/) { return 2; }) - ; - - py::implicitly_convertible>(); - - py::class_> (m, "Vec3d") - .def(py::init()) - .def(py::init([](py::tuple v) - { - return Vec<3> { v[0].cast(), v[1].cast(), - v[2].cast() }; - })) - .def ("__str__", &ToString>) - .def(py::self==py::self) - .def(py::self+py::self) - .def(py::self-py::self) - .def(-py::self) - .def(double()*py::self) - .def(py::self*double()) - .def("Norm", &Vec<3>::Length) - .def("__getitem__", [](Vec<3>& vec, int index) { return vec[index]; }) - .def("__len__", [](Vec<3>& /*unused*/) { return 3; }) - ; - - py::implicitly_convertible>(); - m.def ("Vec", FunctionPointer ([] (double x, double y, double z) { return global_trafo(Vec<3>(x,y,z)); })); m.def("Vec", [](py::array_t np_array) @@ -410,7 +409,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) newel->SetIndex(index); return newel; }), - py::arg("index")=1,py::arg("vertices"), + py::arg("index")=1,py::arg_v("vertices", std::vector(), "[]"), "create volume element" ) .def("__repr__", &ToString) @@ -470,7 +469,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) throw NgException("Inconsistent number of vertices in Element2D"); return newel; }), - py::arg("index")=1,py::arg("vertices"), + py::arg("index")=1,py::arg_v("vertices", std::vector(), "[]"), "create surface element" ) .def_property("index", &Element2d::GetIndex, &Element2d::SetIndex) @@ -651,6 +650,38 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) .def("RestrictH", &NetgenGeometry::RestrictH) ; + typedef MeshingParameters MP; + auto mp = py::class_ (m, "MeshingParameters") + .def(py::init<>()) + .def(py::init([](MeshingParameters* other, py::kwargs kwargs) + { + MeshingParameters mp; + if(other) mp = *other; + CreateMPfromKwargs(mp, kwargs, false); + return mp; + }), py::arg("mp")=nullptr, meshingparameter_description.c_str()) + .def("__str__", &ToString) + .def("RestrictH", [](MP & mp, double x, double y, double z, double h) + { + mp.meshsize_points.Append ( MeshingParameters::MeshSizePoint(Point<3> (x,y,z), h)); + }, py::arg("x"), py::arg("y"), py::arg("z"), py::arg("h") + ) + .def("RestrictH", [](MP & mp, const Point<3>& p, double h) + { + mp.meshsize_points.Append ({p, h}); + }, py::arg("p"), py::arg("h")) + .def("RestrictHLine", [](MP& mp, const Point<3>& p1, const Point<3>& p2, + double maxh) + { + int steps = int(Dist(p1, p2) / maxh) + 2; + auto v = p2 - p1; + for (int i = 0; i <= steps; i++) + { + mp.meshsize_points.Append({p1 + double(i)/steps * v, maxh}); + } + }, py::arg("p1"), py::arg("p2"), py::arg("maxh")) + ; + py::class_>(m, "Mesh") // .def(py::init<>("create empty mesh")) @@ -663,7 +694,7 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) mesh -> SetGeometry (nullptr); return mesh; } ), - py::arg("dim")=3, py::arg("comm")=NgMPI_Comm{} + py::arg("dim")=3, py::arg_v("comm", NgMPI_Comm(), "NgMPI_Comm()") ) .def(NGSPickle()) .def_property_readonly("comm", [](const Mesh & amesh) -> NgMPI_Comm @@ -1449,38 +1480,6 @@ project_boundaries : Optional[str] = None .value("MESHVOLUME", MESHCONST_OPTVOLUME) ; - typedef MeshingParameters MP; - auto mp = py::class_ (m, "MeshingParameters") - .def(py::init<>()) - .def(py::init([](MeshingParameters* other, py::kwargs kwargs) - { - MeshingParameters mp; - if(other) mp = *other; - CreateMPfromKwargs(mp, kwargs, false); - return mp; - }), py::arg("mp")=nullptr, meshingparameter_description.c_str()) - .def("__str__", &ToString) - .def("RestrictH", [](MP & mp, double x, double y, double z, double h) - { - mp.meshsize_points.Append ( MeshingParameters::MeshSizePoint(Point<3> (x,y,z), h)); - }, py::arg("x"), py::arg("y"), py::arg("z"), py::arg("h") - ) - .def("RestrictH", [](MP & mp, const Point<3>& p, double h) - { - mp.meshsize_points.Append ({p, h}); - }, py::arg("p"), py::arg("h")) - .def("RestrictHLine", [](MP& mp, const Point<3>& p1, const Point<3>& p2, - double maxh) - { - int steps = int(Dist(p1, p2) / maxh) + 2; - auto v = p2 - p1; - for (int i = 0; i <= steps; i++) - { - mp.meshsize_points.Append({p1 + double(i)/steps * v, maxh}); - } - }, py::arg("p1"), py::arg("p2"), py::arg("maxh")) - ; - m.def("SetTestoutFile", FunctionPointer ([] (const string & filename) { delete testout; diff --git a/libsrc/occ/python_occ.cpp b/libsrc/occ/python_occ.cpp index e0b670310..0cc39c2e7 100644 --- a/libsrc/occ/python_occ.cpp +++ b/libsrc/occ/python_occ.cpp @@ -282,7 +282,7 @@ DLL_HEADER void ExportNgOCC(py::module &m) mesh->SendRecvMesh(); } return mesh; - }, py::arg("mp") = nullptr, py::arg("comm")=NgMPI_Comm{}, + }, py::arg("mp") = static_cast(nullptr), py::arg_v("comm", NgMPI_Comm(), "NgMPI_Comm()"), py::call_guard(), (meshingparameter_description + occparameter_description).c_str()) .def_property_readonly("shape", [](const OCCGeometry & self) { return self.GetShape(); }) @@ -356,7 +356,7 @@ DLL_HEADER void ExportNgOCC(py::module &m) cout << "IsMaterial = " << material_tool->IsMaterial(label) << endl; // cout << "IsVisMaterial = " << vismaterial_tool->IsMaterial(label) << endl; } - }, py::arg("shape")=TopoDS_Shape()); + }, py::arg_v("shape", TopoDS_Shape(), "TopoDS_Shape()")); } diff --git a/libsrc/occ/python_occ_basic.cpp b/libsrc/occ/python_occ_basic.cpp index 05fdb1ee0..87e63af51 100644 --- a/libsrc/occ/python_occ_basic.cpp +++ b/libsrc/occ/python_occ_basic.cpp @@ -21,6 +21,12 @@ using namespace netgen; DLL_HEADER void ExportNgOCCBasic(py::module &m) { + auto pyAx1 = py::class_(m, "Axis", "an OCC axis in 3d"); + auto pyAx2 = py::class_(m, "gp_Ax2"); + auto pyAx2d = py::class_(m, "gp_Ax2d", "2d OCC coordinate system"); + auto pyAx3 = py::class_(m, "Axes", "an OCC coordinate system in 3d"); + auto pyDirectionalInterval = py::class_ (m, "DirectionalInterval"); + py::class_(m, "gp_Pnt", "3d OCC point") .def(py::init([] (py::tuple pnt) { @@ -130,14 +136,12 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m) return str.str(); }) ; - - py::class_(m, "Axis", "an OCC axis in 3d") - .def(py::init([](gp_Pnt p, gp_Dir d) { + + pyAx1.def(py::init([](gp_Pnt p, gp_Dir d) { return gp_Ax1(p,d); }), py::arg("p"), py::arg("d")) ; - py::class_(m, "gp_Ax2") - .def(py::init([](gp_Pnt p, gp_Dir d) { + pyAx2.def(py::init([](gp_Pnt p, gp_Dir d) { return gp_Ax2(p,d); })) .def(py::init([](const gp_Ax3 & ax3) { @@ -145,8 +149,7 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m) })) ; - py::class_(m, "Axes", "an OCC coordinate system in 3d") - .def(py::init([](gp_Pnt p, gp_Dir N, gp_Dir Vx) { + pyAx3.def(py::init([](gp_Pnt p, gp_Dir N, gp_Dir Vx) { return gp_Ax3(p,N, Vx); }), py::arg("p")=gp_Pnt(0,0,0), py::arg("n")=gp_Vec(0,0,1), py::arg("h")=gp_Vec(1,0,0)) .def(py::init()) @@ -268,10 +271,9 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m) - py::class_(m, "gp_Ax2d", "2d OCC coordinate system") - .def(py::init([](gp_Pnt2d p, gp_Dir2d d) { + pyAx2d.def(py::init([](gp_Pnt2d p, gp_Dir2d d) { return gp_Ax2d(p,d); - }), py::arg("p")=gp_Pnt2d(0,0), py::arg("d")=gp_Dir2d(1,0)) + }), py::arg("p")=gp_Pnt2d(0,0), py::arg_v("d", gp_Dir2d(1,0), "gp_Dir2d(1,0)"), "Create an axis in a plane") ; py::class_(m, "gp_GTrsf") @@ -330,8 +332,7 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m) ; - py::class_ (m, "DirectionalInterval") - .def("__str__", [](DirectionalInterval self) + pyDirectionalInterval.def("__str__", [](DirectionalInterval self) { stringstream str; str << "(" << self.minval << ", " << self.maxval << ")"; diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index f29d4c618..bd67b0a2b 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -69,6 +69,8 @@ #include #include #include +#include +#include #include #include @@ -668,7 +670,10 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) .export_values() ; - + auto pyListOfShapes_Forward = py::class_ (m, "ListOfShapes"); + auto pyGeom2d_Curve_Forward = py::class_ (m, "Geom2d_Curve"); + py::class_,3>,size_t>>(m, "ArrayOfTriangles"); + py::class_ (m, "TopoDS_Shape") .def("__str__", [] (const TopoDS_Shape & shape) { @@ -1543,7 +1548,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) bool operator==(ListOfShapesIterator it2) const { return ptr == it2.ptr; } }; - py::class_ (m, "ListOfShapes") + pyListOfShapes_Forward .def("__iter__", [](ListOfShapes &s) { return py::make_iterator(ListOfShapesIterator(&*s.begin()), ListOfShapesIterator(&*s.end())); @@ -1715,7 +1720,8 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) { Identify(me, other, name, type, occ2ng(trafo)); }, py::arg("other"), py::arg("name"), - py::arg("type")=Identifications::PERIODIC, py::arg("trafo"), + py::arg("type")=Identifications::PERIODIC, + py::arg_v("trafo", gp_Trsf(), "gp_Trsf()"), "Identify shapes for periodic meshing") ; @@ -1731,7 +1737,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) - py::class_ (m, "Geom2d_Curve") + pyGeom2d_Curve_Forward .def("Trim", [](Handle(Geom2d_Curve) curve, double u1, double u2) -> Handle(Geom2d_Curve) { return new Geom2d_TrimmedCurve (curve, u1, u2); @@ -2434,7 +2440,7 @@ degen_tol : double }, py::arg("edges"), py::arg("tol")=1e-8, py::arg("shared")=true); py::class_> (m, "WorkPlane") - .def(py::init(), py::arg("axes")=gp_Ax3(), py::arg("pos")=gp_Ax2d()) + .def(py::init(), py::arg_v("axes", gp_Ax3(), "gp_Ax3()"), py::arg_v("pos", gp_Ax2d(), "gp_Ax2d()")) .def_property_readonly("cur_loc", &WorkPlane::CurrentLocation) .def_property_readonly("cur_dir", &WorkPlane::CurrentDirection) .def_property_readonly("start_pnt", &WorkPlane::StartPnt) From da386ea674f6b8cc32a3b370e300ccfc794b07e1 Mon Sep 17 00:00:00 2001 From: Monty Montgomery Date: Sun, 15 May 2022 01:03:52 -0400 Subject: [PATCH 11/11] Add a fedora package spec and setup Build all Netgen RPMs from cli via: rpkg local --spec package/fedora/netgen-mesher-bleed.spec from the toplevel source directory --- package/fedora/netgen-mesher-bleed.spec | 606 ++++++++++++++++++++++++ package/fedora/netgen-mesher.desktop | 10 + package/fedora/netgen-mesher.png | Bin 0 -> 3871 bytes package/fedora/rpkg.conf | 3 + package/fedora/rpkg.macros | 15 + 5 files changed, 634 insertions(+) create mode 100644 package/fedora/netgen-mesher-bleed.spec create mode 100644 package/fedora/netgen-mesher.desktop create mode 100644 package/fedora/netgen-mesher.png create mode 100644 package/fedora/rpkg.conf create mode 100644 package/fedora/rpkg.macros diff --git a/package/fedora/netgen-mesher-bleed.spec b/package/fedora/netgen-mesher-bleed.spec new file mode 100644 index 000000000..798571675 --- /dev/null +++ b/package/fedora/netgen-mesher-bleed.spec @@ -0,0 +1,606 @@ +%{!?tcl_version: %global tcl_version %(echo 'puts $tcl_version' | tclsh)} +%{!?tcl_sitearch: %global tcl_sitearch %{_libdir}/tcl%{tcl_version}} + +# Don't abort on compilation errors of the example python snippets +%global _python_bytecompile_errors_terminate_build 0 + +%if 0%{?el6} + %ifarch ppc64 + %global build_mpich 0 + %else + %global build_mpich 1 + %endif +%else + %global build_mpich 1 +%endif +%global build_openmpi 1 + +%global save_PYTHONPATH %{getenv:PYTHONPATH} +%global save_LD_PRELOAD %{getenv:LD_PRELOAD} +%global save_ASAN_OPTIONS %{getenv:ASAN_OPTIONS} +%define name netgen-mesher + +Name: %{name} +Version: {{{git_last_tag}}}.bleed^{{{git_last_tag_commits}}}.{{{git_head_short}}} +Release: 1%{?dist} +Summary: Automatic mesh generation tool +License: LGPLv2 +URL: https://github.com/montylab3d/netgen +Source0: {{{ git_repo_pack }}} + +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: tcl-devel +BuildRequires: tk-devel +BuildRequires: opencascade-devel +BuildRequires: libjpeg-turbo-devel +BuildRequires: metis-devel +BuildRequires: mesa-libGLU-devel +BuildRequires: libXmu-devel +BuildRequires: desktop-file-utils +BuildRequires: dos2unix +BuildRequires: python3-devel +BuildRequires: pybind11-devel +BuildRequires: git + +# Bundles a modified version of togl-2.1 +Provides: bundled(tcl-togl) = 2.1 + + +Requires: %{name}-common = %{version}-%{release} +Requires: %{name}-libs%{?_isa} = %{version}-%{release} + +%description +NETGEN is an automatic 3d tetrahedral mesh generator. It accepts input from +constructive solid geometry (CSG) or boundary representation (BRep) from STL +file format. The connection to a geometry kernel allows the handling of IGES +and STEP files. NETGEN contains modules for mesh optimization and hierarchical +mesh refinement. + +%package common +Summary: Common files for netgen +Requires: hicolor-icon-theme +Requires: tix +Requires: cgnslib + +BuildArch: noarch + +%description common +Common files for netgen. + +%package libs +Summary: Netgen libraries + +%description libs +Netgen libraries. + +%package devel +Summary: Development files for netgen +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: cgnslib-devel + +%description devel +Development files for netgen. + +%package devel-private +Summary: Private headers of netgen +Requires: %{name}-devel%{?_isa} = %{version}-%{release} + +%description devel-private +Private headers of netgen, needed to build certain netgen based software +packages. + +%package -n python3-%{name} +Summary: Python3 interface for netgen +%{?python_provide:%python_provide python3-netgen} +Requires: %{name}-openmpi-libs%{?_isa} = %{version}-%{release} + +%description -n python3-%{name} +Python3 interface for netgen. + +############################################################################### + +%if %{build_openmpi} +%package openmpi +Summary: Netgen compiled against openmpi +%description openmpi +Netgen compiled against openmpi. +BuildRequires: openmpi-devel +BuildRequires: python3-mpi4py-openmpi +BuildRequires: cgnslib-openmpi-devel +Requires: %{name}-common = %{version}-%{release} +Requires: %{name}-openmpi-libs%{?_isa} = %{version}-%{release} +Requires: cgnslib-openmpi + +%package openmpi-libs +Summary: Netgen libraries compiled against openmpi +%description openmpi-libs +Netgen libraries compiled against openmpi. + +%package openmpi-devel +Summary: Development files for Netgen compiled against openmpi +%description openmpi-devel +Development files for Netgen compiled against openmpi. +Requires: openmpi-devel +Requires: %{name}-openmpi%{?_isa} = %{version}-%{release} + +%package -n python3-%{name}-openmpi +Summary: Python3 interface for netgen compiled against openmpi +%{?python_provide:%python_provide python3-netgen-openmpi} +Requires: %{name}-openmpi-libs%{?_isa} = %{version}-%{release} +%description -n python3-%{name}-openmpi +Python3 interface for netgen compiled against openmpi. + +%endif + +############################################################################### + +%if %{build_mpich} +%package mpich +Summary: Netgen compiled against mpich +%description mpich +Netgen compiled against mpich. +BuildRequires: mpich-devel +BuildRequires: python3-mpi4py-mpich +BuildRequires: cgnslib-mpich-devel +Requires: %{name}-common = %{version}-%{release} +Requires: %{name}-mpich-libs%{?_isa} = %{version}-%{release} +Requires: cgnslib-mpich + +%package mpich-libs +Summary: Netgen libraries compiled against mpich +%description mpich-libs +Netgen libraries compiled against mpich. + +%package mpich-devel +Summary: Development files for Netgen compiled against mpich +%description mpich-devel +Development files for Netgen compiled against mpich. +Requires: mpich-devel +Requires: %{name}-mpich%{?_isa} = %{version}-%{release} + +%package -n python3-%{name}-mpich +Summary: Python3 interface for netgen compiled against mpich +%{?python_provide:%python_provide python3-netgen-mpich} +Requires: %{name}-openmpi-libs%{?_isa} = %{version}-%{release} +%description -n python3-%{name}-mpich +Python3 interface for netgen compiled against mpich. + +%endif + +############################################################################### + +%prep +%autosetup -p1 -n {{{git_repo_name}}} + +echo "RPM packeage build set up for %{name} version %{version}-%{release}" + +# Remove bundled pybind +rm -rf external_dependencies/pybind11 + +%build +### serial version ### +%define _vpath_builddir %{_target_platform} +%cmake \ + -DNETGEN_VERSION_GIT={{{git describe --tags --match "v[0-9]*" --long --dirty}}} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DNG_INSTALL_SUFFIX=%{name} \ + -DUSE_NATIVE_ARCH=OFF \ + -DNG_INSTALL_DIR_INCLUDE=%{_includedir}/%{name} \ + -DNG_INSTALL_DIR_LIB=%{_libdir} \ + -DNG_INSTALL_DIR_CMAKE=%{_libdir}/cmake/%{name} \ + -DNG_INSTALL_DIR_PYTHON=%{python3_sitearch} \ + -DNETGEN_PYTHON_PACKAGE_NAME="netgen" \ + -DUSE_CGNS=1 \ + -DUSE_JPEG=1 \ + -DUSE_OCC=1 \ + -DOpenGL_GL_PREFERENCE=GLVND \ + -DUSE_INTERNAL_PYBIND11=OFF \ + -DUSE_INTERNAL_TCL=ON \ + -DUSE_SUPERBUILD=OFF \ + -DENABLE_UNIT_TESTS=ON \ + -DCHECK_RANGE=ON \ + -DTRACE_MEMORY=ON \ +%cmake_build + +### openmpi version ### +%if %{build_openmpi} +%define _vpath_builddir %{_target_platform}-openmpi +%{_openmpi_load} +export CXX=mpicxx +%cmake \ + -DNETGEN_VERSION_GIT={{{git describe --tags --match "v[0-9]*" --long --dirty}}} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DNG_INSTALL_SUFFIX=%{name} \ + -DUSE_NATIVE_ARCH=OFF \ + -DNG_INSTALL_DIR_INCLUDE=%{_includedir}/openmpi/%{name} \ + -DNG_INSTALL_DIR_BIN=%{_libdir}/openmpi/bin/ \ + -DNG_INSTALL_DIR_LIB=%{_libdir}/openmpi/lib/ \ + -DNG_INSTALL_DIR_CMAKE=%{_libdir}/openmpi/lib/cmake/%{name} \ + -DNG_INSTALL_DIR_PYTHON=%{_libdir}/openmpi/python%{python3_version}/site-packages/ \ + -DNETGEN_PYTHON_PACKAGE_NAME="netgen" \ + -DUSE_CGNS=1 \ + -DUSE_JPEG=1 \ + -DUSE_OCC=1 \ + -DUSE_MPI=1 \ + -DOpenGL_GL_PREFERENCE=GLVND \ + -DUSE_INTERNAL_PYBIND11=OFF \ + -DUSE_INTERNAL_TCL=ON \ + -DUSE_SUPERBUILD=OFF \ +%cmake_build +%{_openmpi_unload} +%endif + +### mpich version ### +%if %{build_mpich} +%define _vpath_builddir %{_target_platform}-mpich +%{_mpich_load} +export CXX=mpicxx +%cmake \ + -DNETGEN_VERSION_GIT={{{git describe --tags --match "v[0-9]*" --long --dirty}}} \ + -DCMAKE_INSTALL_PREFIX=%{_prefix} \ + -DNG_INSTALL_SUFFIX=%{name} \ + -DUSE_NATIVE_ARCH=OFF \ + -DUSE_SUPERBUILD=OFF \ + -DNG_INSTALL_DIR_INCLUDE=%{_includedir}/mpich/%{name} \ + -DNG_INSTALL_DIR_BIN=%{_libdir}/mpich/bin/ \ + -DNG_INSTALL_DIR_LIB=%{_libdir}/mpich/lib/ \ + -DNG_INSTALL_DIR_CMAKE=%{_libdir}/mpich/lib/cmake/%{name} \ + -DNG_INSTALL_DIR_PYTHON=%{_libdir}/mpich/python%{python3_version}/site-packages/ \ + -DNETGEN_PYTHON_PACKAGE_NAME="netgen" \ + -DUSE_CGNS=1 \ + -DUSE_JPEG=1 \ + -DUSE_OCC=1 \ + -DUSE_MPI=1 \ + -DOpenGL_GL_PREFERENCE=GLVND \ + -DUSE_INTERNAL_PYBIND11=OFF \ + -DUSE_INTERNAL_TCL=ON \ + -DUSE_SUPERBUILD=OFF \ +%cmake_build +%{_mpich_unload} +%endif + + +%install +%define writepkgconfig() \ +install -d -m 0755 %{buildroot}/$MPI_LIB/pkgconfig; \ +cat > %{buildroot}/$MPI_LIB/pkgconfig/%{name}.pc << EOF\ +prefix=%{_prefix}\ +exec_prefix=${prefix}\ +libdir=$MPI_LIB\ +includedir=$MPI_INCLUDE/%{name}\ +\ +Name: %{name}\ +Description: %{summary}\ +Version: %{version}\ +Libs: -L\\\${libdir} -lnglib\ +Libs.private: -lngcgs -lnggeom2d -lngmesh -lngocc -lngstl\ +Cflags: -I\\\${includedir}\ +EOF\ +%{nil} + +### openmpi version ### +%if %{build_openmpi} +%define _vpath_builddir %{_target_platform}-openmpi +%{_openmpi_load} +export PYTHONPATH=.:%{buildroot}%{_libdir}/openmpi/python%{python3_version}/site-packages/ \ +%cmake_install +export PYTHONPATH=%{save_PYTHONPATH} +%writepkgconfig +%{_openmpi_unload} +%endif + +### mpich version ### +%if %{build_mpich} +%define _vpath_builddir %{_target_platform}-mpich +%{_mpich_load} +export PYTHONPATH=.:%{buildroot}%{_libdir}/mpich/python%{python3_version}/site-packages/ \ +%cmake_install +export PYTHONPATH=%{save_PYTHONPATH} +%writepkgconfig +%{_mpich_unload} +%endif + +### serial version ### +%define _vpath_builddir %{_target_platform} +export PYTHONPATH=.:%{buildroot}%{python3_sitearch} +#export LD_PRELOAD=libasan.so.6 +#export ASAN_OPTIONS=detect_odr_violation=0:detect_leaks=0 +%cmake_install +export PYTHONPATH=%{save_PYTHONPATH} +#export LD_PRELOAD=%{save_LD_PRELOAD} +#export ASAN_OPTIONS=${save_ASAN_OPTIONS} +export MPI_LIB=%{_libdir} +export MPI_INCLUDE=%{_includedir} +%writepkgconfig + +# Install icon and desktop file +install -Dpm 0644 package/fedora/%{name}.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{name}.png +desktop-file-install --dir %{buildroot}/%{_datadir}/applications/ package/fedora/%{name}.desktop + +# Delete the doc folder, the files are in %%doc below +rm -rf %{buildroot}/%{_prefix}/doc + +# Install private headers +( +cd libsrc +find \( -name *.hpp -or -name *.hxx -or -name *.h -or -name *.ixx -or -name *.jxx \) -exec install -Dpm 0644 {} %{buildroot}%{_includedir}/%{name}/private/{} \; +) + +# Install the nglib.h header +install -Dpm 0644 nglib/nglib.h %{buildroot}%{_includedir}/%{name}/nglib.h + +%files common +%doc AUTHORS doc/ng4.pdf +%license LICENSE +%{_datadir}/%{name}/ +%{_datadir}/icons/hicolor/48x48/apps/%{name}.png +%{_datadir}/applications/%{name}.desktop + +%files +%{_bindir}/* + +%files libs +%{_libdir}/*.so.* + +%files devel +%{_includedir}/%{name} +%exclude %{_includedir}/%{name}/private +%{_libdir}/*.so +%{_libdir}/*.a +%{_libdir}/pkgconfig/%{name}.pc +%{_libdir}/cmake/%{name}/* + +%files devel-private +%{_includedir}/%{name}/private + +%files -n python3-%{name} +%{python3_sitearch}/pyngcore/ +%{python3_sitearch}/netgen/ + +%if %{build_openmpi} +%files openmpi +%{_libdir}/openmpi/bin/* + +%files openmpi-libs +%{_libdir}/openmpi/lib/*.so.* + +%files openmpi-devel +%{_includedir}/openmpi*/%{name} +%{_libdir}/openmpi/lib/*.so +%{_libdir}/openmpi/lib/*.a +%{_libdir}/openmpi/lib/pkgconfig/%{name}.pc +%{_libdir}/openmpi/lib/cmake/%{name}/* + +%files -n python3-%{name}-openmpi +%{_libdir}/openmpi/python%{python3_version}/site-packages/pyngcore/ +%{_libdir}/openmpi/python%{python3_version}/site-packages/netgen/ +%endif + +%if %{build_mpich} +%files mpich +%{_libdir}/mpich/bin/* + +%files mpich-libs +%{_libdir}/mpich/lib/*.so.* + +%files mpich-devel +%{_includedir}/mpich*/%{name} +%{_libdir}/mpich/lib/*.so +%{_libdir}/mpich/lib/*.a +%{_libdir}/mpich/lib/pkgconfig/%{name}.pc +%{_libdir}/mpich/lib/cmake/%{name}/* + +%files -n python3-%{name}-mpich +%{_libdir}/mpich/python%{python3_version}/site-packages/pyngcore/ +%{_libdir}/mpich/python%{python3_version}/site-packages/netgen/ +%endif + +%check +%define _vpath_builddir %{_target_platform} +export PYTHONPATH=.:%{buildroot}%{python3_sitearch} +#export LD_PRELOAD=libasan.so.6 +#export ASAN_OPTIONS=detect_odr_violation=0:detect_leaks=0 +%ctest +export PYTHONPATH=%{save_PYTHONPATH} +#export LD_PRELOAD=%{save_LD_PRELOAD} +#export ASAN_OPTIONS=${save_ASAN_OPTIONS} + +%changelog +* Fri Apr 08 2022 Monty - 6.2.dev-master +- Build ongoing fixes from master + +* Mon Mar 14 2022 Sandro Mani - 6.2.2202-1 +- Update to 6.2.2202 + +* Sat Mar 05 2022 Sandro Mani - 6.2.2201-1 +- Update to 6.2.2201 + +* Mon Jan 24 2022 Sandro Mani - 6.2.2105-3 +- Fix packaging of python files + +* Thu Jan 20 2022 Fedora Release Engineering - 6.2.2105-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Mon Oct 04 2021 Sandro Mani - 6.2.2105-1 +- Update to 6.2.2105 + +* Fri Sep 03 2021 Sandro Mani - 6.2.2104-1 +- Update to 6.2.2104 + +* Thu Jul 22 2021 Fedora Release Engineering - 6.2.2103-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon Jun 07 2021 Python Maint - 6.2.2103-2 +- Rebuilt for Python 3.10 + +* Mon Jun 07 2021 Sandro Mani - 6.2.2103-1 +- Update to 6.2.2103 + +* Fri Jun 04 2021 Python Maint - 6.2.2102-2 +- Rebuilt for Python 3.10 + +* Wed Mar 24 2021 Sandro Mani - 6.2.2102-1 +- Update to 6.2.2102 + +* Tue Jan 26 2021 Fedora Release Engineering - 6.2.2101-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Sun Jan 24 2021 Sandro Mani - 6.2.2101-1 +- Update to 6.2.2101 + +* Thu Nov 26 2020 Richard Shaw - 6.2.2009-2 +- Rebuild for OCC 7.5.0 side-tag. + +* Thu Nov 12 2020 Sandro Mani - 6.2.2009-1 +- Update to 6.2.2009 + +* Sun Nov 08 2020 Richard Shaw - 6.2.2008-2 +- Rebuild for OpenCASCADE 7.5.0. + +* Thu Sep 17 2020 Sandro Mani - 6.2.2008-1 +- Update to 6.2.2008 + +* Tue Jul 28 2020 Fedora Release Engineering - 6.2.2007-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Thu Jul 23 2020 Sandro Mani - 6.2.2007-1 +- Update to 6.2.2007 + +* Fri Jun 19 2020 Sandro Mani - 6.2.2006-1 +- Update to 6.2.2006 + +* Sun Jun 14 2020 Sandro Mani - 6.2.2005-1 +- Update to 6.2.2005 + +* Tue May 26 2020 Miro Hrončok - 6.2.2004-2 +- Rebuilt for Python 3.9 + +* Sat Apr 18 2020 Sandro Mani - 6.2.2004-1 +- Update to 6.2.2004 + +* Mon Feb 03 2020 Sandro Mani - 6.2.1910-1 +- Update to 6.2.1910 + +* Wed Jan 29 2020 Fedora Release Engineering - 6.2.1810-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + + +* Thu Oct 03 2019 Miro Hrončok - 6.2.1810-4 +- Rebuilt for Python 3.8.0rc1 (#1748018) + +* Mon Aug 19 2019 Miro Hrončok - 6.2.1810-3 +- Rebuilt for Python 3.8 + +* Thu Jul 25 2019 Fedora Release Engineering - 6.2.1810-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Fri Jun 28 2019 Sandro Mani - 6.2.1810-1 +- Update to 6.2.1810 + +* Thu Feb 14 2019 Orion Poplawski - 6.2-0.9.git94fd571 +- Rebuild for openmpi 3.1.3 + +* Fri Feb 01 2019 Fedora Release Engineering - 6.2-0.8.git94fd571 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Fri Jul 13 2018 Fedora Release Engineering - 6.2-0.7.git94fd571 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Tue Jun 19 2018 Miro Hrončok - 6.2-0.6.git94fd571 +- Rebuilt for Python 3.7 + +* Wed May 02 2018 Sandro Mani - 6.2-0.5.git94fd571 +- Rename netgen binary at CMake level to prevent breaking cmake config module (#1573330) + +* Thu Feb 08 2018 Fedora Release Engineering - 6.2-0.4.git94fd571 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - 6.2-0.3.git94fd571 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Thu May 11 2017 Sandro Mani - 6.2.0-0.2.git94fd571 +- Install the nglib.h header + +* Thu May 11 2017 Sandro Mani - 6.2.0-0.1.git94fd571 +- Update to 6.2.0 snapshot + +* Fri Feb 10 2017 Fedora Release Engineering - 5.3.1-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Fri Oct 21 2016 Orion Poplawski - 5.3.1-12 +- Rebuild for openmpi 2.0 + +* Thu Apr 7 2016 Richard Shaw - 5.3.1-11 +- Rebuild for updated OCE. + +* Thu Feb 04 2016 Fedora Release Engineering - 5.3.1-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Tue Sep 15 2015 Orion Poplawski - 5.3.1-9 +- Rebuild for openmpi 1.10.0 + +* Sat Aug 15 2015 Zbigniew Jędrzejewski-Szmek - 5.3.1-8 +- Rebuild for MPI provides + +* Sun Jul 26 2015 Sandro Mani - 5.3.1-7 +- Rebuild for RPM MPI Requires Provides Change + +* Wed Jun 17 2015 Fedora Release Engineering - 5.3.1-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat May 02 2015 Kalev Lember - 5.3.1-5 +- Rebuilt for GCC 5 C++11 ABI change + +* Thu Mar 12 2015 Sandro Mani - 5.3.1-4 +- Rebuild (GCC5 ABI change) + +* Sat Dec 13 2014 Sandro Mani - 5.3.1-3 +- Fix library in -devel package + +* Tue Oct 07 2014 Sandro Mani - 5.3.1-2 +- Fix soname, use -release instead of -version-info + +* Mon Oct 06 2014 Sandro Mani - 5.3.1-1 +- Update to 5.3.1 + +* Mon Sep 01 2014 Sandro Mani - 5.3.0-1 +- Update to 5.3.0 + +* Sun Aug 17 2014 Fedora Release Engineering - 5.1-11 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Tue Jul 29 2014 Sandro Mani - 5.1-10 +- Rebuild (OCE) + +* Thu Jun 19 2014 Sandro Mani - 5.1-9 +- Add missing mpich-devel BR + +* Thu Jun 19 2014 Sandro Mani - 5.1-8 +- Fix escaping of pkg-config variables + +* Sat Jun 14 2014 Sandro Mani - 5.1-7 +- Rename subpackage private -> devel-private + +* Sat Jun 14 2014 Sandro Mani - 5.1-6 +- Add netgen-5.1_relative-includes.patch + +* Sat Jun 14 2014 Sandro Mani - 5.1-5 +- Add subpackage for private headers +- Add patches from salome +- Make common package noarch +- Add missing %%{?_isa} + +* Fri Jun 13 2014 Sandro Mani - 5.1-4 +- Update netgen-5.1_build.patch +- Add netgen-5.1_msc-ver.patch + +* Thu Jun 12 2014 Sandro Mani - 5.1-3 +- Fix libgnlib soname + +* Thu Jun 12 2014 Sandro Mani - 5.1-2 +- Split off libraries in libs subpackages +- Rename shared libraries to less generic names + +* Thu Jun 12 2014 Sandro Mani - 5.1-1 +- Initial package diff --git a/package/fedora/netgen-mesher.desktop b/package/fedora/netgen-mesher.desktop new file mode 100644 index 000000000..e0a234155 --- /dev/null +++ b/package/fedora/netgen-mesher.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=Netgen +GenericName=Mesh Generator +Comment=3D finite element mesh generator +Exec=netgen-mesher +Icon=netgen-mesher +Type=Application +Terminal=false +Categories=Science;Engineering; diff --git a/package/fedora/netgen-mesher.png b/package/fedora/netgen-mesher.png new file mode 100644 index 0000000000000000000000000000000000000000..9adbf7c8d2a473188f7e930bc6c6c5943285cfcf GIT binary patch literal 3871 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 hb>cVw{qg_p_;0Y2x()c