diff --git a/ports/fmilib/0001-remove-install-prefix.patch b/ports/fmilib/0001-remove-install-prefix.patch deleted file mode 100644 index 42ba75701e..0000000000 --- a/ports/fmilib/0001-remove-install-prefix.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 04bb359c724308e30268840c64932ea1d05b9077 Mon Sep 17 00:00:00 2001 -From: Nicole Mazzuca -Date: Wed, 23 Sep 2020 10:00:23 -0700 -Subject: [PATCH 1/2] remove install prefix - ---- - CMakeLists.txt | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f7372bf..f3c11f1 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -26,7 +26,6 @@ set(FMILIBRARYHOME ${FMILibrary_SOURCE_DIR}) - set(FMILIBRARYBUILD ${FMILibrary_BINARY_DIR}) - - # User configuration options and parameters --SET(FMILIB_INSTALL_PREFIX ${FMILibrary_BINARY_DIR}/../install CACHE PATH "Prefix prepended to install directories") - set(FMILIB_THIRDPARTYLIBS ${FMILibrary_SOURCE_DIR}/ThirdParty CACHE PATH "Path to the ThirdParty library dir" ) - set(FMILIB_FMI_STANDARD_HEADERS ${FMILIB_THIRDPARTYLIBS}/FMI/default CACHE PATH "Path to the FMI standard headers dir" ) - -@@ -84,7 +83,6 @@ IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE ${FMILIB_DEFAULT_BUILD_TYPE}) - ENDIF(NOT CMAKE_BUILD_TYPE) - --SET(CMAKE_INSTALL_PREFIX ${FMILIB_INSTALL_PREFIX} CACHE INTERNAL "Prefix prepended to install directories" FORCE) - - # debug_message is used to trace the build script - function(debug_message) -@@ -350,7 +348,6 @@ endfunction() - - if(FMILIB_GENERATE_DOXYGEN_DOC) - -- file(MAKE_DIRECTORY "${FMILIB_INSTALL_PREFIX}/doc") - - set(DOXYFILE_IN ${FMILIBRARYHOME}/Config.cmake/fmilib_doxydoc.conf CACHE INTERNAL "Doxygen config file") - set(DOXYFILE_IMAGE_DIR "${FMILIBRARYHOME}/images" CACHE INTERNAL "Doxygen images" FORCE) -@@ -372,7 +369,6 @@ if(FMILIB_GENERATE_DOXYGEN_DOC) - set(DOXYFILE_SOURCE_DIR "${FMILIBRARYBUILD}/doc" CACHE INTERNAL "Doxygen default source dir" FORCE) - set(DOXYFILE_EXTRA_SOURCES "${DOXYFILE_EXTRA_SOURCES} \"${FMILIBRARYHOME}/Test\"") - -- set(DOXYFILE_OUTPUT_DIR "${FMILIB_INSTALL_PREFIX}/doc") - - set(DOXYFILE_STRIP_FROM_PATH "${FMILIBRARYHOME}") - --- -2.24.3 (Apple Git-128) - diff --git a/ports/fmilib/0002-include-sys-stat.h-for-mkdir.patch b/ports/fmilib/0002-include-sys-stat.h-for-mkdir.patch deleted file mode 100644 index a39617e474..0000000000 --- a/ports/fmilib/0002-include-sys-stat.h-for-mkdir.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 080876bf3735efeedaab0b211d2be7b3c3524d97 Mon Sep 17 00:00:00 2001 -From: Nicole Mazzuca -Date: Wed, 23 Sep 2020 10:03:30 -0700 -Subject: [PATCH 2/2] include sys/stat.h for mkdir - ---- - ThirdParty/Minizip/minizip/miniunz.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/ThirdParty/Minizip/minizip/miniunz.c b/ThirdParty/Minizip/minizip/miniunz.c -index 2264705..e0167d5 100644 ---- a/ThirdParty/Minizip/minizip/miniunz.c -+++ b/ThirdParty/Minizip/minizip/miniunz.c -@@ -53,5 +53,6 @@ - #else - # include - # include -+# include - #endif - diff --git a/ports/fmilib/devendor-sublibs.diff b/ports/fmilib/devendor-sublibs.diff new file mode 100644 index 0000000000..02c39dbdab --- /dev/null +++ b/ports/fmilib/devendor-sublibs.diff @@ -0,0 +1,50 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b01aba5..583e15b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -230,7 +230,7 @@ configure_file ( + "${FMILibrary_BINARY_DIR}/fmilib_config.h" + ) + +-set(FMILIB_SHARED_SUBLIBS ${FMIXML_LIBRARIES} ${FMIZIP_LIBRARIES} ${FMICAPI_LIBRARIES} expat minizip zlib c99snprintf) ++set(FMILIB_SHARED_SUBLIBS ${FMIXML_LIBRARIES} ${FMIZIP_LIBRARIES} ${FMICAPI_LIBRARIES} c99snprintf) + set(FMILIB_SUBLIBS ${FMIIMPORT_LIBRARIES} ${JMUTIL_LIBRARIES} ${FMILIB_SHARED_SUBLIBS}) + set(FMILIB_SHARED_SRC ${FMIIMPORTSOURCE} ${JMUTILSOURCE} ${FMIIMPORTHEADERS}) + +diff --git a/Config.cmake/fmixml.cmake b/Config.cmake/fmixml.cmake +index ddd3c1f..3bafac3 100644 +--- a/Config.cmake/fmixml.cmake ++++ b/Config.cmake/fmixml.cmake +@@ -137,6 +137,7 @@ set(FMIXMLSOURCE + src/FMI2/fmi2_xml_variable.c + ) + ++if(0) + include(ExternalProject) + + # The *_POSTFIX variables are set because it makes it easier to determine the name of +@@ -211,7 +212,10 @@ if(FMILIB_INSTALL_SUBLIBS) + DESTINATION lib) + endif() + ++endif(0) + set(EXPAT_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/ExpatEx/install/include) ++find_package(expat CONFIG REQUIRED) ++add_library(expat ALIAS expat::expat) + + include_directories("${EXPAT_INCLUDE_DIRS}" "${FMILIB_THIRDPARTYLIBS}/FMI/" "${FMIXMLGENDIR}/FMI1" "${FMIXMLGENDIR}/FMI2") + +diff --git a/Config.cmake/fmizip.cmake b/Config.cmake/fmizip.cmake +index 091fc4d..c53555f 100644 +--- a/Config.cmake/fmizip.cmake ++++ b/Config.cmake/fmizip.cmake +@@ -20,7 +20,8 @@ if(NOT FMIZIPDIR) + + set(FMIZIP_LIBRARIES fmizip) + +- add_subdirectory(Config.cmake/Minizip) ++ find_package(minizip CONFIG REQUIRED) ++ add_library(minizip ALIAS minizip::minizip) + + include_directories("${FMIZIPDIR}/include" "${FMILIB_THIRDPARTYLIBS}/Minizip/minizip" "${FMILIB_THIRDPARTYLIBS}/FMI" "${FMILIB_THIRDPARTYLIBS}/Zlib/zlib-1.2.6" "${FMILibrary_BINARY_DIR}/zlib") + diff --git a/ports/fmilib/fix-mergestaticlibs.diff b/ports/fmilib/fix-mergestaticlibs.diff new file mode 100644 index 0000000000..05fbcc432e --- /dev/null +++ b/ports/fmilib/fix-mergestaticlibs.diff @@ -0,0 +1,20 @@ +diff --git a/Config.cmake/mergestaticlibs.cmake b/Config.cmake/mergestaticlibs.cmake +index 858a026..67eccb7 100644 +--- a/Config.cmake/mergestaticlibs.cmake ++++ b/Config.cmake/mergestaticlibs.cmake +@@ -21,6 +21,15 @@ function(merge_static_libs outlib ) + file(WRITE ${dummyfile} "const char * dummy = \"${dummyfile}\";") + + add_library(${outlib} STATIC ${dummyfile}) ++ foreach(lib IN LISTS libs) ++ target_sources(${outlib} PRIVATE "$") ++ get_target_property(link_libs ${lib} INTERFACE_LINK_LIBRARIES) ++ if(link_libs) ++ list(REMOVE_ITEM link_libs ${libs}) ++ target_link_libraries(${outlib} ${link_libs}) ++ endif() ++ endforeach() ++ return() + + if("${CMAKE_CFG_INTDIR}" STREQUAL ".") + set(multiconfig FALSE) diff --git a/ports/fmilib/portfile.cmake b/ports/fmilib/portfile.cmake index 0689feedeb..374c43f3d9 100644 --- a/ports/fmilib/portfile.cmake +++ b/ports/fmilib/portfile.cmake @@ -7,56 +7,47 @@ vcpkg_from_github( SHA512 65c2dc11116737e4e2ee91a4ec58d2cf24003774fd6d9b8b1d6521f046be9e8f8a963ebedb50a161ad264927062f41ce757c84563cfe628d47614910e8730349 HEAD_REF master PATCHES - 0001-remove-install-prefix.patch - 0002-include-sys-stat.h-for-mkdir.patch - 0003-export-targets.patch + devendor-sublibs.diff + fix-mergestaticlibs.diff + unofficial-export.diff ) -# Note that if you have configured and built both static and shared library on Windows -# but want to link with the static library compile time define "FMILIB_BUILDING_LIBRARY" must be set. -if ((NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") AND VCPKG_LIBRARY_LINKAGE STREQUAL static) - SET(FMILIB_BUILDING_LIBRARY ON) -else() - SET(FMILIB_BUILDING_LIBRARY OFF) -endif() - -# Use static run-time libraries (/MT or /MTd code generation flags) -# This is only used when generating Microsoft Visual Studio solutions. If the options is on then the library will -# be built against static runtime, otherwise - dynamic runtime (/MD or /MDd). Make sure the client code is using -# matching runtime -if ((NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") AND VCPKG_CRT_LINKAGE STREQUAL static) - SET(FMILIB_BUILD_WITH_STATIC_RTLIB ON) -else() - SET(FMILIB_BUILD_WITH_STATIC_RTLIB OFF) -endif() - -# On LINUX position independent code (-fPIC) must be used on all files to be linked into a shared library (.so file). -# On other systems this is not needed (either is default or relocation is done). Set this option to OFF if you -# are building an application on Linux and use static library only -if ((VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Darwin") AND VCPKG_LIBRARY_LINKAGE STREQUAL static) - SET(FMILIB_BUILD_FOR_SHARED_LIBS OFF) -else() - SET(FMILIB_BUILD_FOR_SHARED_LIBS ON) -endif() +file(REMOVE RECURSE + "${SOURCE_PATH}/ThirdParty/Expat" + "${SOURCE_PATH}/ThirdParty/Minizip" + "${SOURCE_PATH}/ThirdParty/Zlib" +) +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" FMILIB_BUILD_WITH_STATIC_RTLIB) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS + -Wno-dev -DFMILIB_BUILD_TESTS=OFF -DFMILIB_BUILD_STATIC_LIB=${BUILD_STATIC} -DFMILIB_BUILD_SHARED_LIB=${BUILD_SHARED} - -DFMILIB_BUILDING_LIBRARY=${FMILIB_BUILDING_LIBRARY} -DFMILIB_BUILD_WITH_STATIC_RTLIB=${FMILIB_BUILD_WITH_STATIC_RTLIB} + -DFMILIB_GENERATE_DOXYGEN_DOC=OFF + OPTIONS_DEBUG + "-DFMILIB_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}/debug" + OPTIONS_RELEASE + "-DFMILIB_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR}" MAYBE_UNUSED_VARIABLES - FMILIB_BUILDING_LIBRARY + FMILIB_BUILD_WITH_STATIC_RTLIB ) vcpkg_cmake_install() vcpkg_copy_pdbs() +file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/unofficial-fmilib-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-fmilib") vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-fmilib) -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE + "${CURRENT_PACKAGES_DIR}/debug/include" + "${CURRENT_PACKAGES_DIR}/debug/doc" + "${CURRENT_PACKAGES_DIR}/doc" +) + vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md") diff --git a/ports/fmilib/0003-export-targets.patch b/ports/fmilib/unofficial-export.diff similarity index 59% rename from ports/fmilib/0003-export-targets.patch rename to ports/fmilib/unofficial-export.diff index 30c6286611..f621e18da9 100644 --- a/ports/fmilib/0003-export-targets.patch +++ b/ports/fmilib/unofficial-export.diff @@ -1,23 +1,21 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index f3c11f1..2461ecb 100644 +index 583e15b..0319e3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -299,10 +299,18 @@ endif() +@@ -300,10 +300,17 @@ endif() file(COPY "${FMILIBRARYHOME}/Config.cmake/fmilib.h" DESTINATION "${FMILibrary_BINARY_DIR}") --install(TARGETS ${FMILIB_TARGETS} -+TARGET_INCLUDE_DIRECTORIES(${FMILIB_TARGETS} INTERFACE $) -+ -+install(TARGETS ${FMILIB_TARGETS} EXPORT unofficial-fmilib-config ++target_include_directories(${FMILIB_TARGETS} INTERFACE $) + install(TARGETS ${FMILIB_TARGETS} ++ EXPORT unofficial-fmilib-targets ARCHIVE DESTINATION lib LIBRARY DESTINATION lib - RUNTIME DESTINATION lib + RUNTIME DESTINATION bin +) -+ -+install(EXPORT unofficial-fmilib-config -+ FILE unofficial-fmilib-config.cmake ++install(EXPORT unofficial-fmilib-targets ++ FILE unofficial-fmilib-targets.cmake + NAMESPACE unofficial::fmilib:: + DESTINATION share/unofficial-fmilib ) diff --git a/ports/fmilib/unofficial-fmilib-config.cmake b/ports/fmilib/unofficial-fmilib-config.cmake new file mode 100644 index 0000000000..154b57aec9 --- /dev/null +++ b/ports/fmilib/unofficial-fmilib-config.cmake @@ -0,0 +1,4 @@ +include(CMakeFindDependencyMacro) +find_dependency(expat CONFIG) +find_dependency(minizip CONFIG) +include("${CMAKE_CURRENT_LIST_DIR}/unofficial-fmilib-targets.cmake") diff --git a/ports/fmilib/vcpkg.json b/ports/fmilib/vcpkg.json index 4c2c5535f1..d2dac18800 100644 --- a/ports/fmilib/vcpkg.json +++ b/ports/fmilib/vcpkg.json @@ -1,10 +1,14 @@ { "name": "fmilib", "version": "2.4.1", + "port-version": 1, "description": "FMI library is intended as a foundation for applications interfacing FMUs (Functional Mockup Units) that follow FMI Standard. This version of the library supports FMI 1.0 and FMI2.0.", "homepage": "https://www.fmi-standard.org/", "license": "BSD-3-Clause", + "supports": "!uwp", "dependencies": [ + "expat", + "minizip", { "name": "vcpkg-cmake", "host": true diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 64040e6ceb..99cde087ee 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -231,10 +231,6 @@ fluidlite:x64-windows=skip fluidlite:x86-windows=skip fmi4cpp:arm-uwp=fail fmi4cpp:x64-uwp=fail -fmilib:arm64-windows=fail -fmilib:arm-uwp=fail -fmilib:x64-linux=fail -fmilib:x64-uwp=fail fontconfig:x64-uwp=fail fontconfig:arm-uwp=fail foonathan-memory:arm64-windows=fail diff --git a/versions/baseline.json b/versions/baseline.json index c38f326b20..4149c350b2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -2502,7 +2502,7 @@ }, "fmilib": { "baseline": "2.4.1", - "port-version": 0 + "port-version": 1 }, "fmt": { "baseline": "9.1.0", diff --git a/versions/f-/fmilib.json b/versions/f-/fmilib.json index 63cead2f5c..756e21d91a 100644 --- a/versions/f-/fmilib.json +++ b/versions/f-/fmilib.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "aa8b7d569a23fd953d1e4de558a034a6d9f95e33", + "version": "2.4.1", + "port-version": 1 + }, { "git-tree": "34b7f7cc468b8eecb267b5fd750cb1e602d36248", "version": "2.4.1",