Skip to content
Snippets Groups Projects
Commit 6ffbc6bb authored by Cédric Traizet's avatar Cédric Traizet
Browse files

Merge branch '2071-update-mu-parser' into 'develop'

Update MuParser in Superbuild

Closes #2083 and #2071

See merge request orfeotoolbox/otb!731
parents f3c553c9 fd724045
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,15 @@ find_path( MUPARSER_INCLUDE_DIR muParser.h
if(EXISTS "${MUPARSER_INCLUDE_DIR}/muParserDef.h")
file(READ "${MUPARSER_INCLUDE_DIR}/muParserDef.h" _muParserDef_h_CONTENTS)
string(REGEX REPLACE ".*# *define MUP_VERSION *_T\\(\"([0-9.]+)\"\\).*" "\\1" MUPARSER_VERSION "${_muParserDef_h_CONTENTS}")
# Try to find the version for muparser < 2.3
string(REGEX REPLACE ".*# *define MUP_VERSION *_T\\(\"([0-9.]+)\"\\).*" "\\1"
MUPARSER_VERSION_OLD_STYLE "${_muParserDef_h_CONTENTS}")
# Try to find the version for muparser >= 2.3
string(REGEX REPLACE ".*static *const *string_type *ParserVersion *= *string_type\\(_T\\(\"([0-9.]+)\"\\)\\);.*"
"\\1" MUPARSER_VERSION "${MUPARSER_VERSION_OLD_STYLE}")
if(MUPARSER_VERSION MATCHES "^[0-9]+\$")
set(MUPARSER_VERSION "${MUPARSER_VERSION}.0.0")
endif()
......
......@@ -333,7 +333,7 @@ macro(check_compiler_platform_flags)
set(OTB_CXX_DISABLE_OPTIMIZATION_FLAG "-O0")
endif()
if(DEFINED OTB_CXX_DISABLE_OPTIMIZATION_FLAG)
CHECK_CXX_SOURCE_COMPILES(${OTB_CXX_DISABLE_OPTIMIZATION_FLAG} CXX_HAS_DISABLE_OPTIMIZATION_FLAG)
CHECK_CXX_COMPILER_FLAG(${OTB_CXX_DISABLE_OPTIMIZATION_FLAG} CXX_HAS_DISABLE_OPTIMIZATION_FLAG)
endif()
endmacro()#End the platform check function
......
......@@ -24,21 +24,29 @@ SETUP_SUPERBUILD(MUPARSER)
ExternalProject_Add(MUPARSER
PREFIX MUPARSER
URL "https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz"
URL_MD5 02dae671aa5ad955fdcbcd3fee313fb7
URL "https://github.com/beltoforion/muparser/archive/v2.3.2.tar.gz"
URL_MD5 cbc1b284e03abc7081b3c30997959893
BINARY_DIR ${MUPARSER_SB_BUILD_DIR}
INSTALL_DIR ${SB_INSTALL_PREFIX}
DOWNLOAD_DIR ${DOWNLOAD_LOCATION}
CMAKE_CACHE_ARGS ${SB_CMAKE_CACHE_ARGS}
CMAKE_CACHE_ARGS
${SB_CMAKE_CACHE_ARGS}
-DCMAKE_INSTALL_LIBDIR:PATH=lib
-DENABLE_OPENMP:BOOL=FALSE
-DENABLE_SAMPLES:BOOL=FALSE
CMAKE_COMMAND ${SB_CMAKE_COMMAND}
DEPENDS ${MUPARSER_DEPENDENCIES}
PATCH_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/patches/MUPARSER/CMakeLists.txt
${MUPARSER_SB_SRC}
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
)
SUPERBUILD_UPDATE_CMAKE_VARIABLES(MUPARSER FALSE)
SUPERBUILD_PATCH_SOURCE(MUPARSER)
set(_SB_MUPARSER_INCLUDE_DIR ${SB_INSTALL_PREFIX}/include)
if(WIN32)
set(_SB_MUPARSER_LIBRARY ${SB_INSTALL_PREFIX}/lib/muparser.lib)
elseif(UNIX)
set(_SB_MUPARSER_LIBRARY ${SB_INSTALL_PREFIX}/lib/libmuparser${CMAKE_SHARED_LIBRARY_SUFFIX})
endif()
#
# Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
#
# This file is part of Orfeo Toolbox
#
# https://www.orfeo-toolbox.org/
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
cmake_minimum_required(VERSION 2.8.3)
project(muparser)
option(BUILD_SHARED_LIBS "Building shared libs. Default is ON" ON)
if(MSVC AND BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif()
file(GLOB MUPARSER_SRCS "src/*.cpp" )
list(REMOVE_ITEM MUPARSER_SRCS "${CMAKE_SOURCE_DIR}/src/muParserComplex.cpp")
include_directories("${CMAKE_SOURCE_DIR}/include")
add_library(muparser ${MUPARSER_SRCS})
#if(OTB_LIBRARY_PROPERTIES)
# set_target_properties(muparser PROPERTIES ${OTB_LIBRARY_PROPERTIES})
#endif()
install(TARGETS muparser
RUNTIME DESTINATION bin COMPONENT RuntimeLibraries
LIBRARY DESTINATION lib COMPONENT RuntimeLibraries
ARCHIVE DESTINATION lib COMPONENT Development)
file(GLOB MUPARSER_HEADERS "${CMAKE_SOURCE_DIR}/include/*.h")
list(REMOVE_ITEM MUPARSER_HEADERS "${CMAKE_SOURCE_DIR}/include/muParserComplex.h")
install(FILES ${MUPARSER_HEADERS}
DESTINATION include
COMPONENT Development)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment