Skip to content
Snippets Groups Projects
Commit 9b0bcb9f authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Use pkg-config to find muparse

parent 6d67480b
No related branches found
No related tags found
1 merge request!52Resolve "Use pkg-config to find muparse"
Pipeline #33707 passed
...@@ -37,6 +37,7 @@ Types of changes ...@@ -37,6 +37,7 @@ Types of changes
- Installation is now divided on three components: `Runtime|Library|Development` !49 - Installation is now divided on three components: `Runtime|Library|Development` !49
- Define a recommended dune options file (`dune-copasi.opts`)[dune-copasi.opts] !49 - Define a recommended dune options file (`dune-copasi.opts`)[dune-copasi.opts] !49
- Versioned documentation !49 - Versioned documentation !49
- Dependency on `pkg-config` !52
### Changed ### Changed
- TIFF images are clamped instead of zeroed when evaluated outside its domain !47 - TIFF images are clamped instead of zeroed when evaluated outside its domain !47
- Produce versioned documentation !49 - Produce versioned documentation !49
...@@ -54,6 +55,7 @@ Types of changes ...@@ -54,6 +55,7 @@ Types of changes
- Automatic flux between compartment components with same name !30 - Automatic flux between compartment components with same name !30
- Jacobian operator is managed by the stepper instead of the model !39 - Jacobian operator is managed by the stepper instead of the model !39
- Jacobian tests are improved and extended to cover more cases !39 - Jacobian tests are improved and extended to cover more cases !39
- CMake module to find muparser, use `pkg-config` instead !52
### Fixed ### Fixed
- Finished and documented Installation procedure !49 - Finished and documented Installation procedure !49
- Wrong rounding on y pixels on TIFF file reads !47 - Wrong rounding on y pixels on TIFF file reads !47
......
...@@ -44,7 +44,8 @@ dune_project() ...@@ -44,7 +44,8 @@ dune_project()
add_subdirectory(cmake/modules) add_subdirectory(cmake/modules)
# find specific dune-copasi dependencies # find specific dune-copasi dependencies
find_package(muparser REQUIRED) find_package(PkgConfig REQUIRED)
pkg_search_module(muparser REQUIRED IMPORTED_TARGET muparser)
find_package(TIFF REQUIRED) find_package(TIFF REQUIRED)
find_package(Filesystem) find_package(Filesystem)
......
...@@ -2,6 +2,5 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") ...@@ -2,6 +2,5 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
install(FILES install(FILES
FindFilesystem.cmake FindFilesystem.cmake
Findmuparser.cmake
COMPONENT Development COMPONENT Development
DESTINATION ${DUNE_INSTALL_MODULEDIR}) DESTINATION ${DUNE_INSTALL_MODULEDIR})
\ No newline at end of file
# From https://ts-gitlab.iup.uni-heidelberg.de/dorie/dorie/blob/master/cmake/modules/Findmuparser.cmake
#
# Find the muparser library
#
# Usage:
# find_package(muparser [REQUIRED] [QUIET] )
#
# Hints may be given by the (environment) variables
# muparser_ROOT ... Path to the installation library
#
# It sets the following variables:
# muparser_FOUND ... true if muparser is found on the system
# muparser_LIBRARIES ... full path to muparser library
# muparser_INCLUDES ... muparser include directory
#
# It defines the following targets:
# muparser::muparser ... muparser library to link against
#
find_library(muparser_LIBRARY
NAMES muparser muparserd
HINTS ${muparser_ROOT} ENV muparser_ROOT
)
find_path(muparser_INCLUDE_DIR
muParserDef.h
HINTS ${muparser_ROOT} ENV muparser_ROOT
)
mark_as_advanced(muparser_INCLUDE_DIR muparser_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(muparser
DEFAULT_MSG
muparser_LIBRARY muparser_INCLUDE_DIR)
if (muparser_FOUND)
set(muparser_LIBRARIES ${muparser_LIBRARY} )
set(muparser_INCLUDES ${muparser_INCLUDE_DIR} )
# add the target
if (DUNE_USE_ONLY_STATIC_LIBS)
add_library(muparser::muparser STATIC IMPORTED)
set_target_properties(muparser::muparser
PROPERTIES IMPORTED_LOCATION ${muparser_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${muparser_INCLUDES}
INTERFACE_COMPILE_DEFINITIONS "MUPARSER_STATIC"
)
else()
add_library(muparser::muparser SHARED IMPORTED)
set_target_properties(muparser::muparser
PROPERTIES IMPORTED_LOCATION ${muparser_LIBRARIES}
IMPORTED_IMPLIB ${muparser_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${muparser_INCLUDES}
)
endif()
endif()
...@@ -55,7 +55,8 @@ if(NOT dune-copasi_FOUND) ...@@ -55,7 +55,8 @@ if(NOT dune-copasi_FOUND)
# make sure to find cmake modules for dune-copasi # make sure to find cmake modules for dune-copasi
list(APPEND CMAKE_MODULE_PATH "${dune-copasi_MODULE_PATH}") list(APPEND CMAKE_MODULE_PATH "${dune-copasi_MODULE_PATH}")
find_dependency(muparser) find_dependency(PkgConfig REQUIRED)
pkg_search_module(muparser REQUIRED IMPORTED_TARGET muparser)
find_dependency(TIFF) find_dependency(TIFF)
if(@DUNE_USE_FALLBACK_FILESYSTEM@) if(@DUNE_USE_FALLBACK_FILESYSTEM@)
find_dependency(ghc_filesystem REQUIRED) find_dependency(ghc_filesystem REQUIRED)
...@@ -67,4 +68,4 @@ if(NOT dune-copasi_FOUND) ...@@ -67,4 +68,4 @@ if(NOT dune-copasi_FOUND)
# import targets # import targets
include("${CMAKE_CURRENT_LIST_DIR}/dune-copasi-targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/dune-copasi-targets.cmake")
endif() endif()
\ No newline at end of file
...@@ -252,6 +252,7 @@ The following list of software is required to install and use `dune-copasi`: ...@@ -252,6 +252,7 @@ The following list of software is required to install and use `dune-copasi`:
| Software | Version/Branch | | Software | Version/Branch |
| ---------| -------------- | | ---------| -------------- |
| [CMake](https://cmake.org/) | >= 3.1 | | [CMake](https://cmake.org/) | >= 3.1 |
| [pkg-config](https://freedesktop.org/wiki/Software/pkg-config/) | - |
| C++ compiler | >= [C++17](https://en.wikipedia.org/wiki/List_of_compilers#C++_compilers) | | C++ compiler | >= [C++17](https://en.wikipedia.org/wiki/List_of_compilers#C++_compilers) |
| [libTIFF](http://www.libtiff.org/) | >= 3.6.1 | | [libTIFF](http://www.libtiff.org/) | >= 3.6.1 |
| [muParser](https://beltoforion.de/article.php?a=muparser) | >= 2.2.5 | | [muParser](https://beltoforion.de/article.php?a=muparser) | >= 2.2.5 |
...@@ -331,7 +332,7 @@ unix-like operating systems. e.g. ...@@ -331,7 +332,7 @@ unix-like operating systems. e.g.
```bash ```bash
apt update apt update
apt install cmake gcc g++ libtiff-dev libmuparser-dev git apt install cmake pkg-config gcc g++ libtiff-dev libmuparser-dev git
``` ```
</TabItem> </TabItem>
...@@ -339,7 +340,7 @@ apt install cmake gcc g++ libtiff-dev libmuparser-dev git ...@@ -339,7 +340,7 @@ apt install cmake gcc g++ libtiff-dev libmuparser-dev git
```bash ```bash
brew update brew update
brew install cmake gcc libtiff muparser git brew install cmake pkg-config gcc libtiff muparser git
``` ```
</TabItem> </TabItem>
......
...@@ -76,6 +76,7 @@ if [[ "$DUNE_COPASI_USE_STATIC_DEPS" =~ ^(ON|on|ON|TRUE|true|1)$ ]];then ...@@ -76,6 +76,7 @@ if [[ "$DUNE_COPASI_USE_STATIC_DEPS" =~ ^(ON|on|ON|TRUE|true|1)$ ]];then
CMAKE_FLAGS+=" -Dfmt_ROOT='"${CMAKE_INSTALL_PREFIX}"'" CMAKE_FLAGS+=" -Dfmt_ROOT='"${CMAKE_INSTALL_PREFIX}"'"
CMAKE_FLAGS+=" -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE" CMAKE_FLAGS+=" -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE"
CMAKE_FLAGS+=" -DF77=true" CMAKE_FLAGS+=" -DF77=true"
CMAKE_FLAGS+=" -DBUILD_SHARED_LIBS=OFF"
DUNE_VENDOR_FMT='OFF' DUNE_VENDOR_FMT='OFF'
export DUNE_USE_ONLY_STATIC_LIBS='ON' export DUNE_USE_ONLY_STATIC_LIBS='ON'
fi fi
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
dune_target_enable_all_packages(dune-copasi) dune_target_enable_all_packages(dune-copasi)
# add dependencies # add dependencies
target_link_libraries(dune-copasi PUBLIC ${DUNE_LIBS} TIFF::TIFF muparser::muparser) target_link_libraries(dune-copasi PUBLIC ${DUNE_LIBS} TIFF::TIFF PkgConfig::muparser)
if(NOT ${BUILD_SHARED_LIBS})
if (DUNE_COPASI_COMPILE_3D) target_compile_definitions(dune-copasi PUBLIC MUPARSER_STATIC)
endif()
if(DUNE_COPASI_COMPILE_3D)
target_compile_definitions(dune-copasi PUBLIC DUNE_COPASI_COMPILE_3D) target_compile_definitions(dune-copasi PUBLIC DUNE_COPASI_COMPILE_3D)
endif() endif()
...@@ -73,4 +75,4 @@ install(TARGETS ${AUX_DEVELOPMENT_TARGETS} ...@@ -73,4 +75,4 @@ install(TARGETS ${AUX_DEVELOPMENT_TARGETS}
COMPONENT Development COMPONENT Development
) )
include(SetupDuneCopasiCPack) include(SetupDuneCopasiCPack)
\ No newline at end of file
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