mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-19 08:43:33 +08:00
[fmilib] Export targets for usage (#28002)
* [fmilib] Export targets for usage * Use "version" instead of "version-string" * Add unofficial as namespace
This commit is contained in:
parent
37eb76785b
commit
90e8f9da45
25
ports/fmilib/0003-export-targets.patch
Normal file
25
ports/fmilib/0003-export-targets.patch
Normal file
@ -0,0 +1,25 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f3c11f1..2461ecb 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -299,10 +299,18 @@ 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
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
- RUNTIME DESTINATION lib
|
||||
+ RUNTIME DESTINATION bin
|
||||
+)
|
||||
+
|
||||
+install(EXPORT unofficial-fmilib-config
|
||||
+ FILE unofficial-fmilib-config.cmake
|
||||
+ NAMESPACE unofficial::fmilib::
|
||||
+ DESTINATION share/unofficial-fmilib
|
||||
)
|
||||
install(FILES
|
||||
"${FMILIBRARYHOME}/FMILIB_Readme.txt"
|
@ -1,17 +1,20 @@
|
||||
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
|
||||
|
||||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "https://jmodelica.org/fmil/FMILibrary-2.0.3-src.zip"
|
||||
FILENAME "FMILibrary-2.0.3-src.zip"
|
||||
URLS "https://jmodelica.org/fmil/FMILibrary-${VERSION}-src.zip"
|
||||
FILENAME "FMILibrary-${VERSION}-src.zip"
|
||||
SHA512 86e4b5019d8f2a76b01141411845d977fb3949617604de0b34351f23647e3e8b378477de184e1c4f2f59297bc4c7de3155e0edba9099b8924594a36b37b04cc8
|
||||
)
|
||||
|
||||
vcpkg_extract_source_archive_ex(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
ARCHIVE ${ARCHIVE}
|
||||
vcpkg_extract_source_archive(
|
||||
SOURCE_PATH
|
||||
ARCHIVE "${ARCHIVE}"
|
||||
PATCHES
|
||||
0001-remove-install-prefix.patch
|
||||
0002-include-sys-stat.h-for-mkdir.patch
|
||||
0003-export-targets.patch
|
||||
)
|
||||
|
||||
# Note that if you have configured and built both static and shared library on Windows
|
||||
@ -41,27 +44,24 @@ else()
|
||||
SET(FMILIB_BUILD_FOR_SHARED_LIBS ON)
|
||||
endif()
|
||||
|
||||
# Only build the requested library
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
SET(FMILIB_BUILD_STATIC_LIB ON)
|
||||
SET(FMILIB_BUILD_SHARED_LIB OFF)
|
||||
else()
|
||||
SET(FMILIB_BUILD_STATIC_LIB OFF)
|
||||
SET(FMILIB_BUILD_SHARED_LIB ON)
|
||||
endif()
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
|
||||
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS
|
||||
-DFMILIB_BUILD_TESTS=OFF
|
||||
-DFMILIB_BUILD_STATIC_LIB=${FMILIB_BUILD_STATIC_LIB}
|
||||
-DFMILIB_BUILD_SHARED_LIB=${FMILIB_BUILD_SHARED_LIB}
|
||||
-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}
|
||||
MAYBE_UNUSED_VARIABLES
|
||||
FMILIB_BUILDING_LIBRARY
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-fmilib)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")
|
||||
|
@ -1,7 +1,18 @@
|
||||
{
|
||||
"name": "fmilib",
|
||||
"version-string": "2.0.3",
|
||||
"port-version": 4,
|
||||
"version": "2.0.3",
|
||||
"port-version": 5,
|
||||
"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/"
|
||||
"homepage": "https://www.fmi-standard.org/",
|
||||
"license": null,
|
||||
"dependencies": [
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -2378,7 +2378,7 @@
|
||||
},
|
||||
"fmilib": {
|
||||
"baseline": "2.0.3",
|
||||
"port-version": 4
|
||||
"port-version": 5
|
||||
},
|
||||
"fmt": {
|
||||
"baseline": "9.1.0",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "c30d1f2f0827e03141bda90fe3ae2b462f93c116",
|
||||
"version": "2.0.3",
|
||||
"port-version": 5
|
||||
},
|
||||
{
|
||||
"git-tree": "9bf58761098e936528140d847911dab3613f5983",
|
||||
"version-string": "2.0.3",
|
||||
|
Loading…
Reference in New Issue
Block a user