mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 03:10:57 +08:00
[xlsxio] Export official targets (#25575)
* [xlsxio] Export unofficial targets * version * Add license * version * Use official changes instead * version * Apply suggestions * version
This commit is contained in:
parent
0920ffe742
commit
3beaa7d849
138
ports/xlsxio/export-targets.patch
Normal file
138
ports/xlsxio/export-targets.patch
Normal file
@ -0,0 +1,138 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 05c7ee5..28a0206 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -87,7 +87,8 @@ INCLUDE_DIRECTORIES(${ANYZIP_INCLUDE_DIRS})
|
||||
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIRS})
|
||||
|
||||
# build definitions
|
||||
-SET(ALLTARGETS)
|
||||
+SET(ALLTARGETS_LIB)
|
||||
+SET(ALLTARGETS_EXE)
|
||||
SET(LINKTYPES)
|
||||
IF(BUILD_STATIC)
|
||||
LIST(APPEND LINKTYPES "STATIC")
|
||||
@@ -106,7 +107,7 @@ FOREACH(LINKTYPE ${LINKTYPES})
|
||||
ENDIF()
|
||||
TARGET_INCLUDE_DIRECTORIES(xlsxio_read_${LINKTYPE} PRIVATE lib)
|
||||
TARGET_LINK_LIBRARIES(xlsxio_read_${LINKTYPE} ${ANYZIP_LIBRARIES} ${EXPAT_LIBRARIES})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} xlsxio_read_${LINKTYPE})
|
||||
+ SET(ALLTARGETS_LIB ${ALLTARGETS_LIB} xlsxio_read_${LINKTYPE})
|
||||
|
||||
ADD_LIBRARY(xlsxio_write_${LINKTYPE} ${LINKTYPE} lib/xlsxio_write.c)
|
||||
SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES COMPILE_DEFINITIONS "BUILD_XLSXIO;${ANYZIP_DEF};BUILD_XLSXIO_${LINKTYPE}")
|
||||
@@ -115,7 +116,7 @@ FOREACH(LINKTYPE ${LINKTYPES})
|
||||
SET_TARGET_PROPERTIES(xlsxio_write_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_write.def")
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(xlsxio_write_${LINKTYPE} ${ANYZIP_LIBRARIES} ${THREADLIB})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} xlsxio_write_${LINKTYPE})
|
||||
+ SET(ALLTARGETS_LIB ${ALLTARGETS_LIB} xlsxio_write_${LINKTYPE})
|
||||
|
||||
IF(WITH_WIDE)
|
||||
ADD_LIBRARY(xlsxio_readw_${LINKTYPE} ${LINKTYPE} lib/xlsxio_read.c lib/xlsxio_read_sharedstrings.c)
|
||||
@@ -127,7 +128,7 @@ FOREACH(LINKTYPE ${LINKTYPES})
|
||||
ENDIF()
|
||||
TARGET_INCLUDE_DIRECTORIES(xlsxio_readw_${LINKTYPE} PRIVATE lib)
|
||||
TARGET_LINK_LIBRARIES(xlsxio_readw_${LINKTYPE} ${ANYZIP_LIBRARIES} ${EXPATW_LIBRARIES})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} xlsxio_readw_${LINKTYPE})
|
||||
+ SET(ALLTARGETS_LIB ${ALLTARGETS_LIB} xlsxio_readw_${LINKTYPE})
|
||||
|
||||
#ADD_LIBRARY(xlsxio_writew_${LINKTYPE} ${LINKTYPE} lib/xlsxio_write.c)
|
||||
#SET_TARGET_PROPERTIES(xlsxio_writew_${LINKTYPE} PROPERTIES DEFINE_SYMBOL "BUILD_XLSXIO_DLL")
|
||||
@@ -137,7 +138,7 @@ FOREACH(LINKTYPE ${LINKTYPES})
|
||||
# SET_TARGET_PROPERTIES(xlsxio_writew_${LINKTYPE} PROPERTIES LINK_FLAGS "-Wl,--output-def=libxlsxio_writew.def")
|
||||
#ENDIF()
|
||||
#TARGET_LINK_LIBRARIES(xlsxio_writew_${LINKTYPE} ${ANYZIP_LIBRARIES} ${THREADLIB})
|
||||
- #SET(ALLTARGETS ${ALLTARGETS} xlsxio_writew_${LINKTYPE})
|
||||
+ #SET(ALLTARGETS_LIB ${ALLTARGETS_LIB} xlsxio_writew_${LINKTYPE})
|
||||
ENDIF()
|
||||
|
||||
SET(EXELINKTYPE ${LINKTYPE})
|
||||
@@ -148,35 +149,35 @@ ENDFOREACH()
|
||||
IF(BUILD_TOOLS)
|
||||
ADD_EXECUTABLE(xlsxio_xlsx2csv src/xlsxio_xlsx2csv.c)
|
||||
TARGET_LINK_LIBRARIES(xlsxio_xlsx2csv xlsxio_read_${EXELINKTYPE})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} xlsxio_xlsx2csv)
|
||||
+ SET(ALLTARGETS_EXE ${ALLTARGETS_EXE} xlsxio_xlsx2csv)
|
||||
|
||||
ADD_EXECUTABLE(xlsxio_csv2xlsx src/xlsxio_csv2xlsx.c)
|
||||
TARGET_LINK_LIBRARIES(xlsxio_csv2xlsx xlsxio_write_${EXELINKTYPE})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} xlsxio_csv2xlsx)
|
||||
+ SET(ALLTARGETS_EXE ${ALLTARGETS_EXE} xlsxio_csv2xlsx)
|
||||
ENDIF()
|
||||
|
||||
IF(BUILD_EXAMPLES)
|
||||
ADD_EXECUTABLE(example_xlsxio_write_getversion examples/example_xlsxio_write_getversion.c)
|
||||
TARGET_LINK_LIBRARIES(example_xlsxio_write_getversion xlsxio_write_${EXELINKTYPE})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} example_xlsxio_write_getversion)
|
||||
+ SET(ALLTARGETS_EXE ${ALLTARGETS_EXE} example_xlsxio_write_getversion)
|
||||
|
||||
ADD_EXECUTABLE(example_xlsxio_write examples/example_xlsxio_write.c)
|
||||
TARGET_LINK_LIBRARIES(example_xlsxio_write xlsxio_write_${EXELINKTYPE})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} example_xlsxio_write)
|
||||
+ SET(ALLTARGETS_EXE ${ALLTARGETS_EXE} example_xlsxio_write)
|
||||
|
||||
ADD_EXECUTABLE(example_xlsxio_read examples/example_xlsxio_read.c)
|
||||
TARGET_LINK_LIBRARIES(example_xlsxio_read xlsxio_read_${EXELINKTYPE})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} example_xlsxio_read)
|
||||
+ SET(ALLTARGETS_EXE ${ALLTARGETS_EXE} example_xlsxio_read)
|
||||
|
||||
ADD_EXECUTABLE(example_xlsxio_read_advanced examples/example_xlsxio_read_advanced.c)
|
||||
TARGET_LINK_LIBRARIES(example_xlsxio_read_advanced xlsxio_read_${EXELINKTYPE})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} example_xlsxio_read_advanced)
|
||||
+ SET(ALLTARGETS_EXE ${ALLTARGETS_EXE} example_xlsxio_read_advanced)
|
||||
|
||||
IF(WITH_WIDE)
|
||||
ADD_EXECUTABLE(example_xlsxio_readw examples/example_xlsxio_read.c)
|
||||
SET_TARGET_PROPERTIES(example_xlsxio_readw PROPERTIES COMPILE_DEFINITIONS "XML_UNICODE")
|
||||
TARGET_LINK_LIBRARIES(example_xlsxio_readw xlsxio_readw_${EXELINKTYPE})
|
||||
- SET(ALLTARGETS ${ALLTARGETS} example_xlsxio_readw)
|
||||
+ SET(ALLTARGETS_EXE ${ALLTARGETS_EXE} example_xlsxio_readw)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
@@ -200,7 +201,43 @@ IF(BUILD_DOCUMENTATION)
|
||||
ENDIF()
|
||||
|
||||
# installation specifications
|
||||
-INSTALL(TARGETS ${ALLTARGETS}
|
||||
+INSTALL(TARGETS ${ALLTARGETS_LIB}
|
||||
+ EXPORT xlsxioTargets
|
||||
+ ARCHIVE DESTINATION lib
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ RUNTIME DESTINATION bin
|
||||
+)
|
||||
+INSTALL(EXPORT xlsxioTargets
|
||||
+ NAMESPACE xlsxio::
|
||||
+ DESTINATION cmake
|
||||
+)
|
||||
+FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/xlsxio-config.cmake.in"
|
||||
+[[INCLUDE(CMakeFindDependencyMacro)
|
||||
+IF (@WITH_LIBZIP@)
|
||||
+ FIND_DEPENDENCY(LibZip)
|
||||
+ELSE()
|
||||
+ FIND_DEPENDENCY(minizip CONFIG)
|
||||
+ENDIF()
|
||||
+IF (@EXPAT_DIR@)
|
||||
+ FIND_PATH(EXPAT_INCLUDE_DIR NAMES expat.h NO_DEFAULT_PATH PATHS ${EXPAT_DIR}/include ${EXPAT_DIR})
|
||||
+ FIND_LIBRARY(EXPAT_LIBRARIES NAMES expat libexpat NO_DEFAULT_PATH PATHS ${EXPAT_DIR}/lib ${EXPAT_DIR})
|
||||
+ELSE()
|
||||
+ FIND_DEPENDENCY(EXPAT)
|
||||
+ENDIF()
|
||||
+
|
||||
+IF(@WITH_WIDE@)
|
||||
+ IF(@EXPAT_DIR@)
|
||||
+ FIND_LIBRARY(EXPATW_LIBRARIES NAMES expatw libexpatw NO_DEFAULT_PATH PATHS ${EXPAT_DIR}/lib ${EXPAT_DIR})
|
||||
+ ELSE()
|
||||
+ FIND_LIBRARY(EXPATW_LIBRARIES NAMES expatw)
|
||||
+ ENDIF()
|
||||
+ENDIF()
|
||||
+INCLUDE("${CMAKE_CURRENT_LIST_DIR}/xlsxioTargets.cmake")
|
||||
+]])
|
||||
+CONFIGURE_FILE("${CMAKE_CURRENT_BINARY_DIR}/xlsxio-config.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/xlsxio-config.cmake" @ONLY)
|
||||
+INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/xlsxio-config.cmake" DESTINATION cmake)
|
||||
+
|
||||
+INSTALL(TARGETS ${ALLTARGETS_EXE}
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
@ -4,10 +4,12 @@ vcpkg_from_github(
|
||||
REF e3acace39e5fb153f5ce3500a4952c2bf93175bd
|
||||
SHA512 8148b89c43cf45653c583d51fb8050714d3cd0a76ab9a05d46604f3671a06487e4fc58d3f6f9f2a9f9b57a9f9fe1863ef07017c74197f151390576c5aac360ea
|
||||
HEAD_REF master
|
||||
PATCHES fix-dependencies.patch
|
||||
PATCHES
|
||||
fix-dependencies.patch
|
||||
export-targets.patch # https://github.com/brechtsanders/xlsxio/pull/105
|
||||
)
|
||||
|
||||
file(REMOVE ${SOURCE_PATH}/CMake/FindMinizip.cmake)
|
||||
file(REMOVE "${SOURCE_PATH}/CMake/FindMinizip.cmake")
|
||||
|
||||
vcpkg_check_features(
|
||||
OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
@ -15,17 +17,11 @@ vcpkg_check_features(
|
||||
libzip WITH_LIBZIP
|
||||
)
|
||||
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
set(BUILD_STATIC ON)
|
||||
set(BUILD_SHARED OFF)
|
||||
else()
|
||||
set(BUILD_SHARED ON)
|
||||
set(BUILD_STATIC OFF)
|
||||
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
|
||||
${FEATURE_OPTIONS}
|
||||
-DBUILD_SHARED=${BUILD_SHARED}
|
||||
@ -37,10 +33,12 @@ vcpkg_configure_cmake(
|
||||
-DBUILD_TOOLS=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_cmake_install()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
vcpkg_cmake_config_fixup(CONFIG_PATH cmake)
|
||||
vcpkg_fixup_pkgconfig()
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
||||
|
@ -1,8 +1,10 @@
|
||||
{
|
||||
"name": "xlsxio",
|
||||
"version-date": "2021-03-24",
|
||||
"port-version": 1,
|
||||
"description": "Cross-platform C library for reading values from and writing values to .xlsx files",
|
||||
"homepage": "https://github.com/brechtsanders/xlsxio",
|
||||
"license": "MIT",
|
||||
"dependencies": [
|
||||
"expat",
|
||||
{
|
||||
@ -10,6 +12,14 @@
|
||||
"features": [
|
||||
"bzip2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake",
|
||||
"host": true
|
||||
},
|
||||
{
|
||||
"name": "vcpkg-cmake-config",
|
||||
"host": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -7690,7 +7690,7 @@
|
||||
},
|
||||
"xlsxio": {
|
||||
"baseline": "2021-03-24",
|
||||
"port-version": 0
|
||||
"port-version": 1
|
||||
},
|
||||
"xmlsec": {
|
||||
"baseline": "1.2.34",
|
||||
|
@ -1,5 +1,10 @@
|
||||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "6b4eb1ccf9e863a9291e03521af9ff4d62f5eb3d",
|
||||
"version-date": "2021-03-24",
|
||||
"port-version": 1
|
||||
},
|
||||
{
|
||||
"git-tree": "363ef11ba53c472f8ec8186c455f964b49088d7f",
|
||||
"version-date": "2021-03-24",
|
||||
|
Loading…
x
Reference in New Issue
Block a user