From 0e360f6fd24f2165569db9a3664d7d9e889e5696 Mon Sep 17 00:00:00 2001 From: maier Date: Fri, 13 Dec 2013 23:28:32 +0000 Subject: [PATCH] CMake: Add support for the muparser library git-svn-id: https://svn.dealii.org/branches/branch_muparser@31997 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/config/CMakeLists.txt | 16 ++-- .../cmake/configure/configure_muparser.cmake | 21 ++++++ deal.II/cmake/modules/FindMUPARSER.cmake | 75 +++++++++++++++++++ deal.II/cmake/scripts/run_testsuite.cmake | 2 +- deal.II/doc/users/Config.sample | 19 +++++ deal.II/doc/users/cmake.html | 2 + deal.II/doc/users/cmakelists.html | 1 + deal.II/include/deal.II/base/config.h.in | 7 ++ 8 files changed, 134 insertions(+), 9 deletions(-) create mode 100644 deal.II/cmake/configure/configure_muparser.cmake create mode 100644 deal.II/cmake/modules/FindMUPARSER.cmake diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index e499bafbee..f78fc4e768 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -329,18 +329,18 @@ IF(DEAL_II_COMPONENT_COMPAT_FILES) COND_SET_TO_YES(DEAL_II_WITH_FUNCTIONPARSER MAKEFILE_enableparser) COND_SET_TO_YES(BUILD_SHARED_LIBS MAKEFILE_enableshared) - COND_SET_TO_YES(DEAL_II_WITH_PETSC MAKEFILE_PETSC) - COND_SET_TO_YES(DEAL_II_WITH_SLEPC MAKEFILE_SLEPC) - COND_SET_TO_YES(DEAL_II_WITH_TRILINOS MAKEFILE_TRILINOS) - COND_SET_TO_YES(DEAL_II_WITH_HDF5 MAKEFILE_HDF5) + COND_SET_TO_YES(DEAL_II_WITH_ARPACK MAKEFILE_ARPACK) COND_SET_TO_YES(DEAL_II_WITH_BLAS MAKEFILE_BLAS) - COND_SET_TO_YES(DEAL_II_WITH_MUMPS MAKEFILE_MUMPS) + COND_SET_TO_YES(DEAL_II_WITH_HDF5 MAKEFILE_HDF5) COND_SET_TO_YES(DEAL_II_WITH_LAPACK MAKEFILE_LAPACK) - COND_SET_TO_YES(DEAL_II_WITH_ARPACK MAKEFILE_ARPACK) COND_SET_TO_YES(DEAL_II_WITH_METIS MAKEFILE_METIS) - COND_SET_TO_YES(DEAL_II_WITH_UMFPACK MAKEFILE_UMFPACK) - COND_SET_TO_YES(DEAL_II_WITH_P4EST MAKEFILE_P4EST) COND_SET_TO_YES(DEAL_II_WITH_MPI MAKEFILE_MPI) + COND_SET_TO_YES(DEAL_II_WITH_MUMPS MAKEFILE_MUMPS) + COND_SET_TO_YES(DEAL_II_WITH_P4EST MAKEFILE_P4EST) + COND_SET_TO_YES(DEAL_II_WITH_PETSC MAKEFILE_PETSC) + COND_SET_TO_YES(DEAL_II_WITH_SLEPC MAKEFILE_SLEPC) + COND_SET_TO_YES(DEAL_II_WITH_TRILINOS MAKEFILE_TRILINOS) + COND_SET_TO_YES(DEAL_II_WITH_UMFPACK MAKEFILE_UMFPACK) # # For binary dir: diff --git a/deal.II/cmake/configure/configure_muparser.cmake b/deal.II/cmake/configure/configure_muparser.cmake new file mode 100644 index 0000000000..93dcbc7294 --- /dev/null +++ b/deal.II/cmake/configure/configure_muparser.cmake @@ -0,0 +1,21 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# Configuration for the MUPARSER library: +# + +CONFIGURE_FEATURE(MUPARSER) diff --git a/deal.II/cmake/modules/FindMUPARSER.cmake b/deal.II/cmake/modules/FindMUPARSER.cmake new file mode 100644 index 0000000000..cab3659727 --- /dev/null +++ b/deal.II/cmake/modules/FindMUPARSER.cmake @@ -0,0 +1,75 @@ +## --------------------------------------------------------------------- +## $Id$ +## +## Copyright (C) 2013 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE at +## the top level of the deal.II distribution. +## +## --------------------------------------------------------------------- + +# +# Try to find the MUPARSER library +# +# This module exports +# +# MUPARSER_LIBRARIES +# MUPARSER_INCLUDE_DIRS +# MUPARSER_VERSION +# MUPARSER_VERSION_MAJOR +# MUPARSER_VERSION_MINOR +# MUPARSER_VERSION_SUBMINOR +# + +INCLUDE(FindPackageHandleStandardArgs) + +SET_IF_EMPTY(MUPARSER_DIR "$ENV{MUPARSER_DIR}") + +FIND_LIBRARY(MUPARSER_LIBRARY + NAMES muparser + HINTS ${MUPARSER_DIR} + PATH_SUFFIXES lib${LIB_SUFFIX} lib64 lib + ) + +FIND_PATH(MUPARSER_INCLUDE_DIR muParserDef.h + HINTS ${MUPARSER_DIR} + PATH_SUFFIXES include + ) + +FIND_PACKAGE_HANDLE_STANDARD_ARGS(MUPARSER DEFAULT_MSG + MUPARSER_LIBRARY + MUPARSER_INCLUDE_DIR + ) + +IF(MUPARSER_FOUND) + SET(MUPARSER_LIBRARIES ${MUPARSER_LIBRARY}) + SET(MUPARSER_INCLUDE_DIRS ${MUPARSER_INCLUDE_DIR}) + + FILE(STRINGS "${MUPARSER_INCLUDE_DIR}/muParserDef.h" MUPARSER_VERSION_STRING + REGEX "#define MUP_VERSION _T" + ) + STRING(REGEX REPLACE ".*\"([0-9]+)\\.[0-9]+\\..*" "\\1" + MUPARSER_VERSION_MAJOR "${MUPARSER_VERSION_STRING}" + ) + STRING(REGEX REPLACE ".*\\.([0-9]+)\\..*" "\\1" + MUPARSER_VERSION_MINOR "${MUPARSER_VERSION_STRING}" + ) + STRING(REGEX REPLACE ".*\\.[0-9]+\\.([0-9]+)\".*" "\\1" + MUPARSER_VERSION_SUBMINOR "${MUPARSER_VERSION_STRING}" + ) + SET(MUPARSER_VERSION + "${MUPARSER_VERSION_MAJOR}.${MUPARSER_VERSION_MINOR}.${MUPARSER_VERSION_SUBMINOR}" + ) + + MARK_AS_ADVANCED(MUPARSER_DIR) +ELSE() + SET(MUPARSER_DIR "" CACHE PATH + "An optional hint to a MUPARSER installation" + ) +ENDIF() diff --git a/deal.II/cmake/scripts/run_testsuite.cmake b/deal.II/cmake/scripts/run_testsuite.cmake index ffa6253e5b..9440c6479c 100644 --- a/deal.II/cmake/scripts/run_testsuite.cmake +++ b/deal.II/cmake/scripts/run_testsuite.cmake @@ -275,7 +275,7 @@ FOREACH(_var ${_variables}) _var MATCHES "^(COMPAT_FILES|DOCUMENTATION|EXAMPLES|MESH_CONVERTER|PARAMETER_GUI)" OR _var MATCHES "^(ARPACK|BOOST|FUNCTIONPARSER|HDF5|METIS|MPI|MUMPS)_" OR _var MATCHES "^(NETCDF|P4EST|PETSC|SLEPC|THREADS|TBB|TRILINOS)_" OR - _var MATCHES "^(UMFPACK|ZLIB|LAPACK)_" OR + _var MATCHES "^(UMFPACK|ZLIB|LAPACK|MUPARSER)_" OR _var MATCHES "^(CMAKE|DEAL_II)_(C|CXX|Fortran|BUILD)_(COMPILER|FLAGS)" OR _var MATCHES "^CMAKE_BUILD_TYPE$" OR _var MATCHES "MAKEOPTS" OR diff --git a/deal.II/doc/users/Config.sample b/deal.II/doc/users/Config.sample index 26faa6c15b..b37132c370 100644 --- a/deal.II/doc/users/Config.sample +++ b/deal.II/doc/users/Config.sample @@ -376,6 +376,25 @@ # +# +# muPaser: +# +# SET(DEAL_II_WITH_MUPARSER ON CACHE BOOL +# "Build deal.II with support for muparser" +# +# Automatic detection: +# +# Specify a hint with CMAKE_PREFIX_PATH or by setting +# SET(MUPARSER_DIR "/.../..." CACHE PATH "") +# +# Manual setup: +# +# SET(MUPARSER_FOUND TRUE CACHE BOOL "") +# SET(MUPARSER_LIBRARIES "library;and;semicolon;separated;list;of;link;interface" CACHE STRING "") +# SET(MUPARSER_INCLUDE_DIRS "semicolon;separated;list;of;include;dirs" CACHE STRING "") +# + + # # Netcdf: # diff --git a/deal.II/doc/users/cmake.html b/deal.II/doc/users/cmake.html index 1f2d695a10..7d2afcbaa9 100644 --- a/deal.II/doc/users/cmake.html +++ b/deal.II/doc/users/cmake.html @@ -450,6 +450,7 @@ DEAL_II_WITH_FUNCTIONPARSER DEAL_II_WITH_LAPACK DEAL_II_WITH_METIS DEAL_II_WITH_MUMPS +DEAL_II_WITH_MUPARSER DEAL_II_WITH_MPI DEAL_II_WITH_NETCDF DEAL_II_WITH_P4EST @@ -596,6 +597,7 @@ HDF5_DIR, LAPACK_DIR (and BLAS_DIR), METIS_DIR, MUMPS_DIR (and SCALAPACK_DIR, BLACS_DIR), +MUPARSER_DIR, P4EST_DIR (and SC_DIR), PETSC_DIR and PETSC_ARCH (forming ${PETSC_DIR}/${PETSC_ARCH}), SLEPC_DIR (forming ${SLEPC_DIR}/${PETSC_ARCH}), diff --git a/deal.II/doc/users/cmakelists.html b/deal.II/doc/users/cmakelists.html index b1f13d8d7a..8997a3e3c4 100644 --- a/deal.II/doc/users/cmakelists.html +++ b/deal.II/doc/users/cmakelists.html @@ -795,6 +795,7 @@ DEAL_II_WITH_LAPACK DEAL_II_WITH_METIS DEAL_II_WITH_MPI DEAL_II_WITH_MUMPS +DEAL_II_WITH_MUPARSER DEAL_II_WITH_NETCDF DEAL_II_WITH_P4EST DEAL_II_WITH_PETSC diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 571abc27f3..375549330f 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -342,6 +342,13 @@ #endif +/************************************************* + * Configured in configure_functionparser.cmake: * + *************************************************/ + +#cmakedefine DEAL_II_WITH_MUPARSER + + /***************************************** * Configured in configure_netcdf.cmake: * *****************************************/ -- 2.39.5