diff --git a/CHANGELOG.md b/CHANGELOG.md index 7003432af8c0ae641730c9081b313ba81b3f2bdd..cf7d581d0d5af6fd25525bec2c91da771bf5e20b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Types of changes - Installation is now divided on three components: `Runtime|Library|Development` !49 - Define a recommended dune options file (`dune-copasi.opts`)[dune-copasi.opts] !49 - Versioned documentation !49 +- Dependency on `pkg-config` !52 ### Changed - TIFF images are clamped instead of zeroed when evaluated outside its domain !47 - Produce versioned documentation !49 @@ -54,6 +55,7 @@ Types of changes - Automatic flux between compartment components with same name !30 - Jacobian operator is managed by the stepper instead of the model !39 - Jacobian tests are improved and extended to cover more cases !39 +- CMake module to find muparser, use `pkg-config` instead !52 ### Fixed - Finished and documented Installation procedure !49 - Wrong rounding on y pixels on TIFF file reads !47 diff --git a/CMakeLists.txt b/CMakeLists.txt index da180989a335da1a481ed2b6f79d2be53064eab4..d25ac1fd444a71909ef568348a3d3a88713565f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,8 @@ dune_project() add_subdirectory(cmake/modules) # 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(Filesystem) diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 55de99bd8f7eb84d4e76558d0cb1e6c4048d76e6..548905f5824f9d3538fa20ccada2e0991d8afca8 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -2,6 +2,5 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}") install(FILES FindFilesystem.cmake - Findmuparser.cmake COMPONENT Development - DESTINATION ${DUNE_INSTALL_MODULEDIR}) \ No newline at end of file + DESTINATION ${DUNE_INSTALL_MODULEDIR}) diff --git a/cmake/modules/Findmuparser.cmake b/cmake/modules/Findmuparser.cmake deleted file mode 100644 index a7625a0a29f24fad9cff3f62a00388d3cf4559b7..0000000000000000000000000000000000000000 --- a/cmake/modules/Findmuparser.cmake +++ /dev/null @@ -1,57 +0,0 @@ -# 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() diff --git a/cmake/pkg/dune-copasi-config.cmake.in b/cmake/pkg/dune-copasi-config.cmake.in index 9f8921487512a17e2840db8357f9fd6a8fe30f3c..e6729dec514b2332958ba2849f6b23ac26067cff 100644 --- a/cmake/pkg/dune-copasi-config.cmake.in +++ b/cmake/pkg/dune-copasi-config.cmake.in @@ -55,7 +55,8 @@ if(NOT dune-copasi_FOUND) # make sure to find cmake modules for dune-copasi 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) if(@DUNE_USE_FALLBACK_FILESYSTEM@) find_dependency(ghc_filesystem REQUIRED) @@ -67,4 +68,4 @@ if(NOT dune-copasi_FOUND) # import targets include("${CMAKE_CURRENT_LIST_DIR}/dune-copasi-targets.cmake") -endif() \ No newline at end of file +endif() diff --git a/doc/docusaurus/docs/install_use.md b/doc/docusaurus/docs/install_use.md index 1d23ddc9d0dd0d0eafb0c3dbeb8b6bdb863fa6ca..80c7d7b64949e7e6132a4784090c5b556567fd1a 100644 --- a/doc/docusaurus/docs/install_use.md +++ b/doc/docusaurus/docs/install_use.md @@ -252,6 +252,7 @@ The following list of software is required to install and use `dune-copasi`: | Software | Version/Branch | | ---------| -------------- | | [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) | | [libTIFF](http://www.libtiff.org/) | >= 3.6.1 | | [muParser](https://beltoforion.de/article.php?a=muparser) | >= 2.2.5 | @@ -331,7 +332,7 @@ unix-like operating systems. e.g. ```bash 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> @@ -339,7 +340,7 @@ apt install cmake gcc g++ libtiff-dev libmuparser-dev git ```bash brew update -brew install cmake gcc libtiff muparser git +brew install cmake pkg-config gcc libtiff muparser git ``` </TabItem> diff --git a/dune-copasi.opts b/dune-copasi.opts index 41a90a6634836657f84c6b2d655c4e601d65db4e..315eec220000965131930499d757a7150dd6b1c4 100755 --- a/dune-copasi.opts +++ b/dune-copasi.opts @@ -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+=" -DCMAKE_DISABLE_FIND_PACKAGE_QuadMath=TRUE" CMAKE_FLAGS+=" -DF77=true" + CMAKE_FLAGS+=" -DBUILD_SHARED_LIBS=OFF" DUNE_VENDOR_FMT='OFF' export DUNE_USE_ONLY_STATIC_LIBS='ON' fi diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index db233abf6a77588af09329cc76b704fedbaa4c50..4b7c56264ecd2eabc6f923e932cf36d6f065d34b 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -2,9 +2,11 @@ dune_target_enable_all_packages(dune-copasi) # add dependencies -target_link_libraries(dune-copasi PUBLIC ${DUNE_LIBS} TIFF::TIFF muparser::muparser) - -if (DUNE_COPASI_COMPILE_3D) +target_link_libraries(dune-copasi PUBLIC ${DUNE_LIBS} TIFF::TIFF PkgConfig::muparser) +if(NOT ${BUILD_SHARED_LIBS}) + target_compile_definitions(dune-copasi PUBLIC MUPARSER_STATIC) +endif() +if(DUNE_COPASI_COMPILE_3D) target_compile_definitions(dune-copasi PUBLIC DUNE_COPASI_COMPILE_3D) endif() @@ -73,4 +75,4 @@ install(TARGETS ${AUX_DEVELOPMENT_TARGETS} COMPONENT Development ) -include(SetupDuneCopasiCPack) \ No newline at end of file +include(SetupDuneCopasiCPack)