Skip to content

Commit

Permalink
Update muparser
Browse files Browse the repository at this point in the history
Replaced muparser folder with muparser version 2.3.4.
  • Loading branch information
rquey committed Dec 21, 2023
1 parent b28462c commit 075c24f
Show file tree
Hide file tree
Showing 42 changed files with 11,424 additions and 12,621 deletions.
2 changes: 1 addition & 1 deletion VERSIONS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
New in 4.7.1-16 (07 Dec 2023):
New in 4.7.1-17 (21 Dec 2023):
- module -T: fixed weibull distribution, made minor fixes.
- module -M: fixed meshing of -transform cut(cylinder) tessellations,
fixed msh4 format.
Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import sphinx_rtd_theme

project = u'Neper'
version = u'4.7.1-16'
release = u'4.7.1-16'
version = u'4.7.1-17'
release = u'4.7.1-17'
author = u'Romain Quey'
copyright = u'Romain Quey'
language = 'en'
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()

set(NEPER_VERSION \"4.7.1-16\")
set(NEPER_VERSION \"4.7.1-17\")
project(neper)

if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.1)
Expand Down
11 changes: 11 additions & 0 deletions src/contrib/muparser/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: c++
sudo: false
compiler:
- clang
- gcc
script:
# LD_LIBRARY_PATH workaround to find clang's libomp: https://github.com/travis-ci/travis-ci/issues/8613
- if [[ ${CC} = clang ]]; then export LD_LIBRARY_PATH=/usr/local/clang/lib${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH; fi
- cmake -DCMAKE_C_FLAGS="-Wall" -DCMAKE_CXX_FLAGS="-Wall" -DCMAKE_INSTALL_PREFIX=~/.local/ .
- make install -j2
- ctest --output-on-failure
122 changes: 94 additions & 28 deletions src/contrib/muparser/Changes.txt → src/contrib/muparser/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,26 +1,92 @@
#######################################################################
# #
# #
# __________ #
# _____ __ __\______ \_____ _______ ______ ____ _______ #
# / \ | | \| ___/\__ \ \_ __ \/ ___/_/ __ \\_ __ \ #
# | Y Y \| | /| | / __ \_| | \/\___ \ \ ___/ | | \/ #
# |__|_| /|____/ |____| (____ /|__| /____ > \___ >|__| #
# \/ \/ \/ \/ #
# Fast math parser Library #
# #
# Copyright (C) 2015 Ingo Berg #
# #
# Web: muparser.beltoforion.de #
# e-mail: [email protected] #
# #
# #
#######################################################################


_____ __ _____________ _______ ______ ___________
/ \| | \____ \__ \\_ __ \/ ___// __ \_ __ \
| Y Y \ | / |_> > __ \| | \/\___ \\ ___/| | \/
|__|_| /____/| __(____ /__| /____ >\___ >__|
\/ |__| \/ \/ \/
Copyright (C) 2004 - 2022 Ingo Berg

=======================================================================
https://beltoforion.de/en/muparser
=======================================================================

History:
--------

Rev 2.3.4: 06.11.2022
---------------------
Build System Changes (CMake):
* cmake is using OpenMP target and setting _UNICODE preprocessor definition
Compiler Warnings:
* fix for issue #117 (sprintf deprecation warning)

Rev 2.3.3: 22.01.2022
---------------------
Build System Changes (CMake):
* Added a new option "-DENABLE_WIDE_CHAR" to CMake for building muparser with wide character support

Compiler Warnings fixed/disabled (Visual Studio):
* Disabled compiler warning 26812 (Prefer 'enum class' over 'enum')
I consider this a bogus warning. Use of plain old enums has not been deprecated and only MSVC is complaining.
* Disabled compiler warning 4251 (... needs to have dll-interface to be used by clients of class ...)
When the build system was changed to CMake Linux and Windows builds were unified. Each dynamic library contains the
class interface as well as the C-interface. Before the linux shared library was using the class interface and the
windows dll was using the C-interface.

Only the C-Interface is safe to use when you intent to bring an executable to another linux distribution or windows version!
This is up to the client software. I cannot change this because on linux the shared library was always using the class
interface. Usually this is not a problem since distributions compile all applications from scratch.

If you use the class interface you can not take for granted that your software will run with a muparser
version compiled for another operating system or linux distribution! You must either use the C-Interface if you
want this or use a static library build of muparser!

Security Fixes: (The issues were present in all prior stable releases)
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24167
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24355

Bugfixes:
* fixed a couple of issues for building the C-Interface (muParserDLL.cpp/.h) with wide character support.

Rev 2.3.2: 17.06.2020
---------------------
API-Change Revertion (to 2.3.0):
* removed final keyword from Parser class (added in 2.3.0) as this was breaking existing Applications

Changes:
* made Parser class final
* using OpenMP is now the default settings for cmake based builds
* added optimization for trivial expressions. (Expressions whose RPN only has a single entry)
* introduced a maximum length for expressions (5000 Character)
* introduced a maximum length for identifiers (100 Characters)
* removed the MUP_MATH_EXCEPTION macro and related functionality. (C++ exceptions for divide by zero or sqrt of a negative number are no longer supported)
* removed ParserStack.h (replaced with std::stack)
* removed macros for defining E and PI (replaced with a static constants)
* source code is now aimed at C++17
* the MUP_ASSERT macro is no longer removed in release builds for better protection against segmentation faults

Security Fixes: (The issues were present in all prior stable releases)
* Prevented multiple access violations for malformed expressions with if then else and functions taking multiple arguments like "sum(0?1,2,3,4:5)"
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23330
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22922
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22938
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23330
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=23410
* Added additional runtime checks for release builds to prevent segmentation faults for invalid expressions

Bugfixes:
* Fixed an issue where the bulk mode could hang on GCC/CLANG builds due to OpenMP chunksize dropping below 1.

Rev 2.3.0 - 2.3.1:
------------------
Short lived releases or prereleases that were replaced by 2.3.2 almost instantly due to API breaking changes. Version 2.3.2 is the successor to version 2.2.6

Rev 2.2.6: 04.10.2018
---------------------
Changes:
* Build system is now based on cmake
* several compiler warnings fixed

Rev 2.2.5: 27.04.2015
---------------------
Changes:
Expand Down Expand Up @@ -104,7 +170,7 @@ Rev 2.1.0: 19.11.2011
* Function atan2 added

Bugfixes:
* Issue 3438380: Changed behavior of tellg with GCC >4.6 led to failures
* Issue 3438380: Changed behaviour of tellg with GCC >4.6 led to failures
in value detection callbacks.
* Issue 3438715: only "double" is a valid MUP_BASETYPE
MUP_BASETYPE can now be any of:
Expand Down Expand Up @@ -180,15 +246,15 @@ Rev 1.34: 04.09.2010
New features:
* The associativity of binary operators can now be changed. The pow operator
is now right associative. (This is what Mathematica is using)
* Seperator can now be used outside of functions. This allows compound
* Separator can now be used outside of functions. This allows compound
expressions like:
"a=10,b=20,c=a*b" The last "argument" will be taken as the return value

Bugfixes:
* The copy constructor did not copy binary operator definitions. Those were lost
in the copied parser instance.
* Mixing special characters and alphabetic characters in binary operator names
led to inconsistent parsing behavior when parsing expressions like "a ++ b"
led to inconsistent parsing behaviour when parsing expressions like "a ++ b"
and "a++b" when "++" is defined as a binary operator. Binary operators must
now consist entirely of special characters or of alphabetic ones.
(original bug report: https://sourceforge.net/projects/muparser/forums/forum/462843/topic/3696881/index/page/1)
Expand Down Expand Up @@ -226,7 +292,7 @@ Rev 1.32: 29.01.2010



Rev 1.31cp: 15.01.2010 (Maintainance release for CodeProject)
Rev 1.31cp: 15.01.2010 (Maintenance release for CodeProject)
----------------------

Changes:
Expand Down Expand Up @@ -359,7 +425,7 @@ Changes:

Project Changes:
* Borland project files removed
(The code should still compile with BCB but I cant provide you with project files)
(The code should still compile with BCB but I can't provide you with project files)

Internal Changes:
* unnecessary template files have been removed:
Expand All @@ -377,11 +443,11 @@ user defined binary operators. Consequently the built in operators can now be
turned off, thus you can deactivate them and write complete customized parser
subclasses that only contain the functionality you want. Another new feature is
the introduction of callback functions taking string arguments, implicit
generation of variables and the Assignement operator.
generation of variables and the Assignment operator.

Functionality
* New built in operator: xor; Logical xor.
* New built in operator: Assignement operator; Defining variables in terms of
* New built in operator: Assignment operator; Defining variables in terms of
other variables/constants
* New feature: Strings as arguments for callback functions
* New feature: User defined binary operators
Expand All @@ -407,7 +473,7 @@ generation of variables and the Assignement operator.

Internal changes
* new class muParserTokenReader.h encapsulates the token identification
and token assignement.
and token assignment.
* Internal handling of function callbacks unified as a result the performance
of the bytecode evaluation increased.

Expand Down Expand Up @@ -453,7 +519,7 @@ Rev 1.09 : November 20, 2004
* Internal structure changed; changing base datatype at compile time is now possible.
* Bug fix: Postfix operator parsing could fail in certain cases; This has been fixed now.
* Internal change: Removed most dependencies from the C-string libraries.
* Internal change: Bytecode is now stored in a seperate class: ParserByteCode.h.
* Internal change: Bytecode is now stored in a separate class: ParserByteCode.h.
* Internal change: GetUsedVar() does no longer require that variables are defined at time of call.
* Internal change: Error treatment changed. ParserException is no longer derived from
std::runtime_error; Internal treatment of Error messages changed.
Expand Down
152 changes: 139 additions & 13 deletions src/contrib/muparser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,146 @@
# This file is part of the Neper software package.
# Copyright(C) 2003-2022, Romain Quey.
# See the COPYING file in the top-level directory.
# CMake based on work from @xantares
cmake_minimum_required (VERSION 3.1.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

cmake_minimum_required(VERSION 3.0)
project(muparser CXX)
# By default, build in Release mode. Must appear before project() command
if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
endif ()

file(GLOB headers "include/*.h")
file(GLOB sources "src/*.cpp")
project(muParserProject)

# disabling all compilation warnings
add_definitions(-w)
# Bump versions on release
set(MUPARSER_VERSION_MAJOR 2)
set(MUPARSER_VERSION_MINOR 3)
set(MUPARSER_VERSION_PATCH 4)
set(MUPARSER_VERSION ${MUPARSER_VERSION_MAJOR}.${MUPARSER_VERSION_MINOR}.${MUPARSER_VERSION_PATCH})

set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
# Build options
option(ENABLE_SAMPLES "Build the samples" OFF)
option(ENABLE_OPENMP "Enable OpenMP for multithreading" ON)
option(ENABLE_WIDE_CHAR "Enable wide character support" OFF)

add_library(muparser ${sources})
if(ENABLE_OPENMP)
find_package(OpenMP REQUIRED)
endif()

target_link_libraries(muparser ${EXTRA_LIBS})
# Credit: https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake/3818084
if(MSVC)
# Force to always compile with W4
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# Update if necessary
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
endif()

include_directories(include)
FILE(GLOB_RECURSE MUPARSER_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") #all .cpp
add_library(muparser ${MUPARSER_SOURCES})

# Use the headers in the build-tree or the installed ones
target_include_directories(muparser PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

# This compiles the "DLL" interface (C API)
target_compile_definitions(muparser PRIVATE MUPARSER_DLL)

target_compile_definitions(muparser PUBLIC MUPARSER_STATIC)
add_definitions( -DMUPARSER_STATIC )

if (CMAKE_BUILD_TYPE STREQUAL Debug)
target_compile_definitions(muparser PRIVATE _DEBUG)
endif ()

if(ENABLE_OPENMP)
target_compile_definitions(muparser PRIVATE MUP_USE_OPENMP)
target_link_libraries(muparser PRIVATE OpenMP::OpenMP_CXX)
endif()

if(ENABLE_WIDE_CHAR)
target_compile_definitions(muparser PUBLIC _UNICODE)
endif()

set_target_properties(muparser PROPERTIES
VERSION ${MUPARSER_VERSION}
SOVERSION ${MUPARSER_VERSION_MAJOR}
)

if(ENABLE_SAMPLES)
add_executable(example1 samples/example1/example1.cpp)
target_link_libraries(example1 muparser)

add_executable(example2 samples/example2/example2.c)
target_link_libraries(example2 muparser)
endif()

# The GNUInstallDirs defines ${CMAKE_INSTALL_DATAROOTDIR}
# See https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include (GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/muparser)

install(TARGETS muparser
EXPORT muparser-export
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Development
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT RuntimeLibraries
)

FILE(GLOB_RECURSE MUPARSER_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") #all .h
install(FILES
${MUPARSER_HEADERS}
DESTINATION include
COMPONENT Development
)

# Export the target under the build-tree (no need to install)
export(EXPORT muparser-export
FILE "${CMAKE_BINARY_DIR}/muparser-targets.cmake"
NAMESPACE muparser::
)
add_library(muparser::muparser ALIAS muparser)

# Export the installed target (typically for packaging)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/muparserConfigVersion.cmake"
VERSION ${MUPARSER_VERSION}
COMPATIBILITY AnyNewerVersion
)
configure_file(muparserConfig.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/muparserConfig.cmake"
COPYONLY
)
install(EXPORT muparser-export
FILE muparser-targets.cmake
NAMESPACE muparser::
DESTINATION ${INSTALL_CONFIGDIR}
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/muparserConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/muparserConfigVersion.cmake
DESTINATION ${INSTALL_CONFIGDIR}
COMPONENT Development
)

# Define variables for the pkg-config file
set(PACKAGE_NAME muparser)
if(ENABLE_WIDE_CHAR)
set(PKG_CONFIG_FLAGS "-D_UNICODE")
endif(ENABLE_WIDE_CHAR)
configure_file(
muparser.pc.in
${CMAKE_BINARY_DIR}/muparser.pc
@ONLY
)
install(
FILES ${CMAKE_BINARY_DIR}/muparser.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)

include(CTest)
Loading

0 comments on commit 075c24f

Please sign in to comment.