зеркало из https://github.com/microsoft/vcpkg.git
[fmilib] Cleanup, de-vendor libs, fix linux (#29834)
* [fmilib] change to the github and update to fix bug of libexpat * add license * Cleanup and devendor expat, minizip, zlib * Merge target objects, not archives * Update "supports" and ci baseline * zlib is a transitive dependency * Fix config --------- Co-authored-by: FrankXie <v-frankxie@microsoft.com> Co-authored-by: Javier Matos Denizac <javier.matosd@gmail.com> Co-authored-by: Monica <v-liumonica@microsoft.com>
This commit is contained in:
Родитель
5da7b20588
Коммит
2256cc983d
|
@ -1,48 +0,0 @@
|
|||
From 04bb359c724308e30268840c64932ea1d05b9077 Mon Sep 17 00:00:00 2001
|
||||
From: Nicole Mazzuca <mazzucan@outlook.com>
|
||||
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)
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
From 080876bf3735efeedaab0b211d2be7b3c3524d97 Mon Sep 17 00:00:00 2001
|
||||
From: Nicole Mazzuca <mazzucan@outlook.com>
|
||||
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 <unistd.h>
|
||||
# include <utime.h>
|
||||
+# include <sys/stat.h>
|
||||
#endif
|
||||
|
|
@ -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")
|
||||
|
|
@ -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 "$<TARGET_OBJECTS:${lib}>")
|
||||
+ 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)
|
|
@ -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")
|
||||
|
|
|
@ -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_INTERFACE:include>)
|
||||
+
|
||||
+install(TARGETS ${FMILIB_TARGETS} EXPORT unofficial-fmilib-config
|
||||
+target_include_directories(${FMILIB_TARGETS} INTERFACE $<INSTALL_INTERFACE:include>)
|
||||
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
|
||||
)
|
|
@ -0,0 +1,4 @@
|
|||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(expat CONFIG)
|
||||
find_dependency(minizip CONFIG)
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/unofficial-fmilib-targets.cmake")
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -2502,7 +2502,7 @@
|
|||
},
|
||||
"fmilib": {
|
||||
"baseline": "2.4.1",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"fmt": {
|
||||
"baseline": "9.1.0",
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "aa8b7d569a23fd953d1e4de558a034a6d9f95e33",
|
||||
"version": "2.4.1",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "34b7f7cc468b8eecb267b5fd750cb1e602d36248",
|
||||
"version": "2.4.1",
|
||||
|
|
Загрузка…
Ссылка в новой задаче