diff options
Diffstat (limited to 'vcpkg/ports/libsbml')
| -rw-r--r-- | vcpkg/ports/libsbml/dependencies.diff | 143 | ||||
| -rw-r--r-- | vcpkg/ports/libsbml/dirent.diff | 28 | ||||
| -rw-r--r-- | vcpkg/ports/libsbml/libsbml-config.cmake | 6 | ||||
| -rw-r--r-- | vcpkg/ports/libsbml/no-docs.diff | 12 | ||||
| -rw-r--r-- | vcpkg/ports/libsbml/portfile.cmake | 84 | ||||
| -rw-r--r-- | vcpkg/ports/libsbml/test-shared.diff | 14 | ||||
| -rw-r--r-- | vcpkg/ports/libsbml/usage | 4 | ||||
| -rw-r--r-- | vcpkg/ports/libsbml/vcpkg.json | 96 |
8 files changed, 387 insertions, 0 deletions
diff --git a/vcpkg/ports/libsbml/dependencies.diff b/vcpkg/ports/libsbml/dependencies.diff new file mode 100644 index 0000000..3a23ec2 --- /dev/null +++ b/vcpkg/ports/libsbml/dependencies.diff @@ -0,0 +1,143 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b2e97c6..5f5418d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -435,8 +435,9 @@ set(LIBSBML_XML_LIBRARY_LIBS) + if(WITH_EXPAT) + + if(NOT TARGET EXPAT::EXPAT) +- find_package(EXPAT REQUIRED) + endif() ++ find_package(EXPAT NAMES expat REQUIRED) ++ set(EXPAT_LIBRARY expat::expat) + + add_definitions( -DUSE_EXPAT ) + list(APPEND SWIG_EXTRA_ARGS -DUSE_EXPAT) +@@ -457,7 +458,8 @@ endif(WITH_EXPAT) + set(USE_LIBXML OFF) + if(WITH_LIBXML) + +- find_package(LIBXML REQUIRED) ++ find_package(LIBXML NAMES LibXml2 REQUIRED) ++ set(LIBXML_LIBRARY LibXml2::LibXml2) + + add_definitions( -DUSE_LIBXML ) + list(APPEND SWIG_EXTRA_ARGS -DUSE_LIBXML) +@@ -509,7 +511,7 @@ endif() + option(WITH_BZIP2 "Enable the use of bzip2 compression." ${BZIP_INITIAL_VALUE}) + set(USE_BZ2 OFF) + if(WITH_BZIP2) +- find_package(BZ2 REQUIRED) ++ find_package(BZip2 REQUIRED) + set(USE_BZ2 ON) + add_definitions( -DUSE_BZ2 ) + list(APPEND SWIG_EXTRA_ARGS -DUSE_BZ2) +@@ -535,6 +537,9 @@ Separate multiple directories using semicolons." ) + # Locate zlib + # + ++if(WITH_ZLIB) ++ find_package(ZLIB REQUIRED) ++endif() + set(ZLIB_INITIAL_VALUE) + if (NOT LIBZ_LIBRARY) + find_library(LIBZ_LIBRARY +@@ -628,7 +633,6 @@ valid. It should contain the file zlib.h, but it does not.") + endif(WITH_ZLIB) + + # install find scripts only for used dependencies +-install(FILES ${LIBSBML_FIND_MODULES} DESTINATION share/cmake/Modules) + + ############################################################################### + # +@@ -685,7 +689,12 @@ if(WITH_CHECK) + + enable_testing() + +- find_package(CHECK REQUIRED) ++ find_package(CHECK NAMES check REQUIRED) ++ if(BUILD_SHARED_LIBS) ++ add_library(CHECK::CHECK ALIAS Check::checkShared) ++ else() ++ add_library(CHECK::CHECK ALIAS Check::check) ++ endif() + + if (UNIX) + # setup valgrind +@@ -1018,18 +1027,29 @@ install(FILES ${DOCUMENTATION_FILES} DESTINATION ${MISC_PREFIX}) + # Write libsbml.pc + # + +-set (PRIVATE_LIBS "-lstdc++ -lm") ++set(FAKE_CXX_LINKAGE "") ++foreach(lib IN LISTS CMAKE_CXX_IMPLICIT_LINK_LIBRARIES) ++ if(lib IN_LIST CMAKE_C_IMPLICIT_LINK_LIBRARIES) ++ continue() ++ elseif(EXISTS "${lib}") ++ string(APPEND FAKE_CXX_LINKAGE " ${CMAKE_LINK_LIBRARY_FILE_FLAG}${lib}") ++ else() ++ string(APPEND FAKE_CXX_LINKAGE " ${CMAKE_LINK_LIBRARY_FLAG}${lib}") ++ endif() ++endforeach() ++set (PRIVATE_LIBS "${FAKE_CXX_LINKAGE}") ++set (PRIVATE_REQUIRES "") + if (WITH_ZLIB) +-set (PRIVATE_LIBS "${LIBZ_LIBRARY} ${PRIVATE_LIBS}") ++ string(APPEND PRIVATE_REQUIRES " zlib") + endif() + if (WITH_BZIP2) +-set (PRIVATE_LIBS "${LIBBZ_LIBRARY} ${PRIVATE_LIBS}") ++ string(APPEND PRIVATE_REQUIRES " bzip2") + endif() + if (WITH_LIBXML) +-set (PRIVATE_LIBS "${LIBXML_LIBRARY} ${PRIVATE_LIBS}") ++ string(APPEND PRIVATE_REQUIRES " libxml-2.0") + endif() + if (WITH_EXPAT) +-set (PRIVATE_LIBS "${LIBEXPAT_LIBRARY} ${PRIVATE_LIBS}") ++ string(APPEND PRIVATE_REQUIRES " expat") + endif() + if (WITH_XERCES) + set (PRIVATE_LIBS "${XERCES_LIBRARY} ${PRIVATE_LIBS}") +@@ -1051,9 +1071,7 @@ if (WITH_XERCES) + file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc" "Conflicts: xerces-c = 2.6.0\n") + endif() + +-if (WITH_LIBXML) +-file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc" "Requires.private: libxml-2.0 >= 2.6.22\n") +-endif() ++file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc" "Requires.private: ${PRIVATE_REQUIRES}\n") + + if (UNIX OR MINGW) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libsbml.pc" +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 79301a6..0957d29 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -311,7 +311,7 @@ if(WITH_BZIP2) + sbml/compress/bzfstream.h + sbml/compress/bzfstream.cpp + ) +- set(LIBSBML_LIBS ${LIBSBML_LIBS} BZ2::BZ2) ++ set(LIBSBML_LIBS ${LIBSBML_LIBS} BZip2::BZip2) + + endif() + +@@ -405,7 +405,7 @@ if(WITH_EXPAT) + sbml/xml/ExpatHandler.h + sbml/xml/ExpatParser.h + ) +- set(LIBSBML_LIBS ${LIBSBML_LIBS} EXPAT::EXPAT) ++ set(LIBSBML_LIBS ${LIBSBML_LIBS} expat::expat) + + endif(WITH_EXPAT) + +@@ -423,7 +423,7 @@ if(WITH_LIBXML) + sbml/xml/LibXMLParser.h + sbml/xml/LibXMLTranscode.h + ) +- set(LIBSBML_LIBS ${LIBSBML_LIBS} LIBXML::LIBXML) ++ set(LIBSBML_LIBS ${LIBSBML_LIBS} LibXml2::LibXml2) + + endif(WITH_LIBXML) + diff --git a/vcpkg/ports/libsbml/dirent.diff b/vcpkg/ports/libsbml/dirent.diff new file mode 100644 index 0000000..538bca3 --- /dev/null +++ b/vcpkg/ports/libsbml/dirent.diff @@ -0,0 +1,28 @@ +diff --git a/src/sbml/validator/test/tps/dirent.c b/src/sbml/validator/test/tps/dirent.c +index beafc5e..48a60ca 100644 +--- a/src/sbml/validator/test/tps/dirent.c ++++ b/src/sbml/validator/test/tps/dirent.c +@@ -1,3 +1,4 @@ ++#if 0 + /* ///////////////////////////////////////////////////////////////////////////// + * File: dirent.c + * +@@ -239,3 +240,4 @@ struct dirent *readdir(DIR *dir) + } + + /* ////////////////////////////////////////////////////////////////////////// */ ++#endif +diff --git a/src/sbml/validator/test/tps/dirent.h b/src/sbml/validator/test/tps/dirent.h +index 4703aa2..8e4c29c 100644 +--- a/src/sbml/validator/test/tps/dirent.h ++++ b/src/sbml/validator/test/tps/dirent.h +@@ -46,6 +46,9 @@ + + #ifndef SYNSOFT_UNIXEM_INCL_H_DIRENT + #define SYNSOFT_UNIXEM_INCL_H_DIRENT ++#include <dirent.h> ++#endif ++#if 0 + + #ifndef _SYNSOFT_DOCUMENTATION_SKIP_SECTION + # define SYNSOFT_UNIXEM_VER_H_DIRENT_MAJOR 2 diff --git a/vcpkg/ports/libsbml/libsbml-config.cmake b/vcpkg/ports/libsbml/libsbml-config.cmake new file mode 100644 index 0000000..c0cd40a --- /dev/null +++ b/vcpkg/ports/libsbml/libsbml-config.cmake @@ -0,0 +1,6 @@ +include(CMakeFindDependencyMacro)
+find_dependency(@name@ CONFIG)
+if(NOT TARGET libsbml)
+ add_library(libsbml INTERFACE IMPORTED)
+ target_link_libraries(libsbml INTERFACE $<TARGET_NAME:@name@>)
+endif()
diff --git a/vcpkg/ports/libsbml/no-docs.diff b/vcpkg/ports/libsbml/no-docs.diff new file mode 100644 index 0000000..acac8f3 --- /dev/null +++ b/vcpkg/ports/libsbml/no-docs.diff @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8ad678a..f856774 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1012,7 +1012,6 @@ set(DOCUMENTATION_FILES + VERSION.txt + ) + +-install(FILES ${DOCUMENTATION_FILES} DESTINATION ${MISC_PREFIX}) + + ############################################################################### + # diff --git a/vcpkg/ports/libsbml/portfile.cmake b/vcpkg/ports/libsbml/portfile.cmake new file mode 100644 index 0000000..0afdd81 --- /dev/null +++ b/vcpkg/ports/libsbml/portfile.cmake @@ -0,0 +1,84 @@ +vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO sbmlteam/libsbml
+ REF "v${VERSION}"
+ SHA512 d4960b2ef12d00ae93ea883f945acf435a99763a0e2e751d94a15c7ff22fd41ff31cb16c1f37aa23257b3eb0de894201420962b008a6fe43ef0511fa2612846a
+ HEAD_REF development
+ PATCHES
+ dependencies.diff
+ dirent.diff
+ no-docs.diff
+ test-shared.diff
+)
+file(REMOVE
+ "${SOURCE_PATH}/CMakeModules/FindBZ2.cmake"
+ "${SOURCE_PATH}/CMakeModules/FindEXPAT.cmake"
+ "${SOURCE_PATH}/CMakeModules/FindLIBXML.cmake"
+ "${SOURCE_PATH}/CMakeModules/FindZLIB.cmake"
+)
+
+string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_RUNTIME)
+
+if("expat" IN_LIST FEATURES AND "libxml2" IN_LIST FEATURES)
+ message(WARNING "Feature expat conflicts with feature libxml2. Selecting libxml2.")
+ list(REMOVE_ITEM FEATURES "expat")
+endif()
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ comp ENABLE_COMP
+ fbc ENABLE_FBC
+ groups ENABLE_GROUPS
+ layout ENABLE_LAYOUT
+ multi ENABLE_MULTI
+ qual ENABLE_QUAL
+ render ENABLE_RENDER
+ bzip2 WITH_BZIP2
+ expat WITH_EXPAT
+ libxml2 WITH_LIBXML
+ zlib WITH_ZLIB
+ test WITH_CHECK
+ namespace WITH_CPP_NAMESPACE
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ -DENABLE_L3V2EXTENDEDMATH:BOOL=ON
+ -DWITH_STATIC_RUNTIME=${STATIC_RUNTIME}
+ -DWITH_SWIG=OFF
+ MAYBE_UNUSED_VARIABLES
+ WITH_STATIC_RUNTIME
+)
+
+vcpkg_cmake_install()
+vcpkg_copy_pdbs()
+vcpkg_fixup_pkgconfig()
+
+foreach(name IN ITEMS libsbml libsbml-static sbml sbml-static)
+ if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/cmake/${name}-config.cmake")
+ vcpkg_cmake_config_fixup(PACKAGE_NAME "${name}" CONFIG_PATH lib/cmake)
+ if(NOT EXISTS "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake")
+ configure_file("${CURRENT_PORT_DIR}/libsbml-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake" @ONLY)
+ endif()
+ break()
+ endif()
+endforeach()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sbml/common/extern.h" "defined LIBSBML_STATIC" "1")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/sbml/xml/XMLExtern.h" "defined(LIBLAX_STATIC)" "1")
+ if(NOT VCPKG_TARGET_IS_WINDOWS)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libsbml.pc" " -lsbml" " -lsbml-static")
+ if(NOT VCPKG_BUILD_TYPE)
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libsbml.pc" " -lsbml" " -lsbml-static")
+ endif()
+ endif()
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
diff --git a/vcpkg/ports/libsbml/test-shared.diff b/vcpkg/ports/libsbml/test-shared.diff new file mode 100644 index 0000000..71bc680 --- /dev/null +++ b/vcpkg/ports/libsbml/test-shared.diff @@ -0,0 +1,14 @@ +diff --git a/src/sbml/test/CMakeLists.txt b/src/sbml/test/CMakeLists.txt +index 7a408d7..462d58a 100644 +--- a/src/sbml/test/CMakeLists.txt ++++ b/src/sbml/test/CMakeLists.txt +@@ -49,6 +49,9 @@ if (EXTRA_INCLUDE_DIRS) + include_directories(${EXTRA_INCLUDE_DIRS}) + endif(EXTRA_INCLUDE_DIRS) + ++if(NOT TARGET ${LIBSBML_LIBRARY}-static) ++ add_library(${LIBSBML_LIBRARY}-static ALIAS ${LIBSBML_LIBRARY}) ++endif() + + add_executable(test_sbml_sbml ${TEST_FILES}) + target_link_libraries(test_sbml_sbml ${LIBSBML_LIBRARY}-static CHECK::CHECK) diff --git a/vcpkg/ports/libsbml/usage b/vcpkg/ports/libsbml/usage new file mode 100644 index 0000000..7fa95b9 --- /dev/null +++ b/vcpkg/ports/libsbml/usage @@ -0,0 +1,4 @@ +libsbml provides CMake targets:
+
+ find_package(libsbml CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE libsbml)
diff --git a/vcpkg/ports/libsbml/vcpkg.json b/vcpkg/ports/libsbml/vcpkg.json new file mode 100644 index 0000000..493bdd5 --- /dev/null +++ b/vcpkg/ports/libsbml/vcpkg.json @@ -0,0 +1,96 @@ +{ + "name": "libsbml", + "version": "5.20.4", + "description": "A library for reading / writing SBML files", + "homepage": "https://github.com/sbmlteam/libsbml", + "license": null, + "supports": "!uwp & !xbox", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "comp", + "fbc", + "groups", + "layout", + "libxml2", + "render" + ], + "features": { + "bzip2": { + "description": "bz2 compression support for libsbml", + "dependencies": [ + "bzip2" + ] + }, + "comp": { + "description": "support for Hierarchical Model Composition" + }, + "expat": { + "description": "libsbml using expat parser", + "dependencies": [ + "expat" + ] + }, + "fbc": { + "description": "support for Flux Balance Constrant Modeling" + }, + "groups": { + "description": "support for Groups" + }, + "layout": { + "description": "support for Pathway Layouts" + }, + "libxml2": { + "description": "libsbml using libxml2 parser", + "dependencies": [ + { + "name": "libxml2", + "default-features": false + } + ] + }, + "multi": { + "description": "support for Multistate Modeling" + }, + "namespace": { + "description": "Build with the WITH_CPP_NAMESPACE option set to on" + }, + "qual": { + "description": "support for Qualitative Modeling" + }, + "render": { + "description": "support for Rendering information", + "dependencies": [ + { + "name": "libsbml", + "default-features": false, + "features": [ + "layout" + ] + } + ] + }, + "test": { + "description": "Unit testing of libSBMLs implementation", + "supports": "!windows | mingw | (windows & static)", + "dependencies": [ + "check", + "dirent" + ] + }, + "zlib": { + "description": "gzip compression support for libsbml", + "dependencies": [ + "zlib" + ] + } + } +} |