[vcpkg baseline][ideviceinstaller] Fixing error LNK2005 when argtable2 installed before ideviceinstaller (#28459)

* [ideviceinstaller] Add support !static

* Modify port-version

* x-add-version

* Add getopt as a dependence of argtable2

* Use version

* x-add-version

* Remove space

* Add license

* Fix format error

* x-add-version

* update version

* fix argtable3

* x-add-version

* fix argtable3

* version

* fix gdcm

* format portfile.cmake

* update version

* format vcpkg.json

* x-add-version

* format portfile.cmake

* x-add-version

* Update license

* x-add-version

* Again

* Mistake

Co-authored-by: Lily Wang <494550702@qq.com>
Co-authored-by: Lily Wang <94091114+LilyWangLL@users.noreply.github.com>
This commit is contained in:
Cheney Wang 2022-12-28 13:07:26 -08:00 committed by GitHub
parent df51b93304
commit 25663f218c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 176 additions and 18 deletions

View File

@ -0,0 +1,42 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8a4bd5b..7dc50f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,7 @@ endif(COMMAND cmake_policy)
OPTION( HAVE_GETOPT_H "Have the getopt library" 0 )
IF( HAVE_GETOPT_H )
+ find_package(unofficial-getopt-win32 REQUIRED)
ADD_DEFINITIONS( -DHAVE_GETOPT_H )
ENDIF( HAVE_GETOPT_H )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 03e112c..8c58082 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,12 @@
include(GNUInstallDirs)
IF( WIN32 )
+ if(HAVE_GETOPT_H)
+ ADD_LIBRARY( argtable2 arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_str.c argtable2.c argtable2.h)
+ target_link_libraries(argtable2 PRIVATE unofficial::getopt-win32::getopt)
+ else()
ADD_LIBRARY( argtable2 arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_str.c argtable2.c argtable2.h getopt.c getopt.h getopt1.c )
+ endif()
ELSE( WIN32 )
ADD_LIBRARY( argtable2 arg_date.c arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_rex.c arg_str.c argtable2.c argtable2.h getopt.c getopt.h getopt1.c )
ENDIF( WIN32 )
diff --git a/src/argtable2.c b/src/argtable2.c
index c4d210c..1bc0a3e 100644
--- a/src/argtable2.c
+++ b/src/argtable2.c
@@ -46,7 +46,7 @@ USA.
#endif
#include "argtable2.h"
-#include "./getopt.h"
+//#include "./getopt.h"
static
void arg_register_error(struct arg_end *end, void *parent, int error, const char *argval)

View File

@ -9,18 +9,23 @@ vcpkg_from_sourceforge(
PATCHES PATCHES
0001-fix-install-dirs.patch 0001-fix-install-dirs.patch
0002-include-correct-headers.patch 0002-include-correct-headers.patch
0003-add-dependence-getopt.patch
) )
vcpkg_configure_cmake( set(HAVE_GETOPT_H "")
SOURCE_PATH ${SOURCE_PATH} if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
PREFER_NINJA set(HAVE_GETOPT_H 1)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS OPTIONS
-DCMAKE_DEBUG_POSTFIX=d -DCMAKE_DEBUG_POSTFIX=d
-DHAVE_GETOPT_H=${HAVE_GETOPT_H}
) )
vcpkg_install_cmake() vcpkg_cmake_install()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

View File

@ -1,8 +1,19 @@
{ {
"name": "argtable2", "name": "argtable2",
"version-string": "2.13", "version": "2.13",
"port-version": 9, "port-version": 10,
"description": "Argtable is an ANSI C library for parsing GNU style command line options with a minimum of fuss.", "description": "Argtable is an ANSI C library for parsing GNU style command line options with a minimum of fuss.",
"homepage": "http://argtable.sourceforge.net", "homepage": "http://argtable.sourceforge.net",
"supports": "!uwp" "license": "LGPL-2.0-only",
"supports": "!uwp",
"dependencies": [
{
"name": "getopt",
"platform": "windows & !mingw"
},
{
"name": "vcpkg-cmake",
"host": true
}
]
} }

View File

@ -0,0 +1,16 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2e0b519..6b455dd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -79,6 +79,11 @@ endif()
add_library(${ARGTABLE3_PROJECT_NAME}::argtable3 ALIAS argtable3)
target_include_directories(argtable3 PRIVATE ${PROJECT_SOURCE_DIR}/src)
+if(NOT ARGTABLE3_REPLACE_GETOPT)
+ find_package(unofficial-getopt-win32 REQUIRED)
+ target_link_libraries(argtable3 PRIVATE unofficial::getopt-win32::getopt)
+endif()
+
set_target_properties(argtable3 PROPERTIES
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
SOVERSION ${PROJECT_VERSION_MAJOR}

View File

@ -4,14 +4,21 @@ vcpkg_from_github(
REF 7704006f3cbb556e11da80a5b97469075a32892e # 3.2.1 + minor patches including ARGTABLE3_ENABLE_EXAMPLES support REF 7704006f3cbb556e11da80a5b97469075a32892e # 3.2.1 + minor patches including ARGTABLE3_ENABLE_EXAMPLES support
SHA512 c51aa0a33a247c3801e36ca5d9523acefa31f21a34c1e86965a39290c1b437785e4d7e0ae80a65d811803b8fcbbc3a96ba3d6aefaea9bda15abc0f38bd1f45cc SHA512 c51aa0a33a247c3801e36ca5d9523acefa31f21a34c1e86965a39290c1b437785e4d7e0ae80a65d811803b8fcbbc3a96ba3d6aefaea9bda15abc0f38bd1f45cc
HEAD_REF master HEAD_REF master
PATCHES Fix-dependence-getopt.patch
) )
set(ARGTABLE3_REPLACE_GETOPT ON)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(ARGTABLE3_REPLACE_GETOPT OFF)
endif()
vcpkg_cmake_configure( vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}" SOURCE_PATH "${SOURCE_PATH}"
OPTIONS OPTIONS
-DARGTABLE3_ENABLE_CONAN=OFF -DARGTABLE3_ENABLE_CONAN=OFF
-DARGTABLE3_ENABLE_TESTS=OFF -DARGTABLE3_ENABLE_TESTS=OFF
-DARGTABLE3_ENABLE_EXAMPLES=OFF -DARGTABLE3_ENABLE_EXAMPLES=OFF
-DARGTABLE3_REPLACE_GETOPT=${ARGTABLE3_REPLACE_GETOPT}
) )
vcpkg_cmake_install() vcpkg_cmake_install()

View File

@ -1,11 +1,15 @@
{ {
"name": "argtable3", "name": "argtable3",
"version": "3.2.1", "version": "3.2.1",
"port-version": 2, "port-version": 3,
"description": "A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options", "description": "A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options",
"homepage": "https://www.argtable.org/", "homepage": "https://www.argtable.org/",
"license": "BSD-2-Clause-FreeBSD", "license": "BSD-2-Clause-NetBSD AND TCL",
"dependencies": [ "dependencies": [
{
"name": "getopt",
"platform": "windows & !mingw"
},
{ {
"name": "vcpkg-cmake", "name": "vcpkg-cmake",
"host": true "host": true

View File

@ -0,0 +1,39 @@
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 4cdc999..c6ede41 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -69,6 +69,7 @@ if(NOT GDCM_USE_SYSTEM_ZLIB)
endif()
# Do getopt
+if(NOT USE_VCPKG_GETOPT)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/getopt)
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/getopt/COPYING)
if(WIN32 AND NOT CYGWIN AND NOT MINGW)
@@ -79,6 +80,7 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/getopt)
add_subdirectory(getopt)
endif()
endif()
+endif()
# you could be running mingw32 on linux in which case you do NOT want the gdcmuuid lib
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/gdcmuuid/COPYING)
diff --git a/Utilities/VTK/Applications/CMakeLists.txt b/Utilities/VTK/Applications/CMakeLists.txt
index c7f1ad9..20883a2 100644
--- a/Utilities/VTK/Applications/CMakeLists.txt
+++ b/Utilities/VTK/Applications/CMakeLists.txt
@@ -45,7 +45,13 @@ foreach(app ${GDCM_VTK_APPS})
target_link_libraries(${app} ${VTK_LIBRARIES} vtkIOXML)
endif()
if(WIN32 AND NOT CYGWIN)
- target_link_libraries(${app} gdcmgetopt)
+ if(USE_VCPKG_GETOPT)
+ find_package(unofficial-getopt-win32 REQUIRED)
+ target_link_libraries(${app} PRIVATE unofficial::getopt-win32::getopt)
+ else()
+ target_link_libraries(${app} gdcmgetopt)
+ endif()
+else()
endif()
if(NOT GDCM_INSTALL_NO_RUNTIME)
install(TARGETS ${app}

View File

@ -10,6 +10,7 @@ vcpkg_from_github(
use-openjpeg-config.patch use-openjpeg-config.patch
fix-share-path.patch fix-share-path.patch
Fix-Cmake_DIR.patch Fix-Cmake_DIR.patch
fix-dependence-getopt.patch
) )
file(REMOVE "${SOURCE_PATH}/CMake/FindOpenJPEG.cmake") file(REMOVE "${SOURCE_PATH}/CMake/FindOpenJPEG.cmake")
@ -20,6 +21,11 @@ else()
set(VCPKG_BUILD_SHARED_LIBS OFF) set(VCPKG_BUILD_SHARED_LIBS OFF)
endif() endif()
set(USE_VCPKG_GETOPT OFF)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
set(USE_VCPKG_GETOPT ON)
endif()
vcpkg_cmake_configure( vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}" SOURCE_PATH "${SOURCE_PATH}"
OPTIONS OPTIONS
@ -30,6 +36,7 @@ vcpkg_cmake_configure(
-DGDCM_USE_SYSTEM_ZLIB=ON -DGDCM_USE_SYSTEM_ZLIB=ON
-DGDCM_USE_SYSTEM_OPENJPEG=ON -DGDCM_USE_SYSTEM_OPENJPEG=ON
-DGDCM_BUILD_TESTING=OFF -DGDCM_BUILD_TESTING=OFF
-DUSE_VCPKG_GETOPT=${USE_VCPKG_GETOPT}
) )
vcpkg_cmake_install() vcpkg_cmake_install()
@ -59,4 +66,4 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif() endif()
file(INSTALL "${SOURCE_PATH}/Copyright.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/Copyright.txt")

View File

@ -1,12 +1,17 @@
{ {
"name": "gdcm", "name": "gdcm",
"version": "3.0.12", "version": "3.0.12",
"port-version": 1,
"description": "Grassroots DICOM library", "description": "Grassroots DICOM library",
"homepage": "https://github.com/malaterre/GDCM", "homepage": "https://github.com/malaterre/GDCM",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"supports": "!uwp & !(windows & arm)", "supports": "!uwp & !(windows & arm)",
"dependencies": [ "dependencies": [
"expat", "expat",
{
"name": "getopt",
"platform": "windows & !mingw"
},
"openjpeg", "openjpeg",
{ {
"name": "vcpkg-cmake", "name": "vcpkg-cmake",

View File

@ -10,6 +10,8 @@ endif()
add_library(getopt getopt.c) add_library(getopt getopt.c)
TARGET_INCLUDE_DIRECTORIES(getopt INTERFACE $<INSTALL_INTERFACE:include>)
install( install(
TARGETS getopt TARGETS getopt
EXPORT unofficial-getopt-win32 EXPORT unofficial-getopt-win32

View File

@ -1,7 +1,7 @@
{ {
"name": "getopt-win32", "name": "getopt-win32",
"version": "0.1", "version": "0.1",
"port-version": 6, "port-version": 7,
"description": "An implementation of getopt.", "description": "An implementation of getopt.",
"homepage": "https://github.com/libimobiledevice-win32/getopt", "homepage": "https://github.com/libimobiledevice-win32/getopt",
"license": "LGPL-3.0-only", "license": "LGPL-3.0-only",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "931507f46135a9267c3d15ed5064235aac6154f4",
"version": "2.13",
"port-version": 10
},
{ {
"git-tree": "406503ece7b3ab95af28c6871a6de7263731f829", "git-tree": "406503ece7b3ab95af28c6871a6de7263731f829",
"version-string": "2.13", "version-string": "2.13",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "b84ef22a845ccccda6197d1865ddd1d8df9098c1",
"version": "3.2.1",
"port-version": 3
},
{ {
"git-tree": "fe3b1c9a876237412e7ba925a3b41f62e7fc1d99", "git-tree": "fe3b1c9a876237412e7ba925a3b41f62e7fc1d99",
"version": "3.2.1", "version": "3.2.1",

View File

@ -170,11 +170,11 @@
}, },
"argtable2": { "argtable2": {
"baseline": "2.13", "baseline": "2.13",
"port-version": 9 "port-version": 10
}, },
"argtable3": { "argtable3": {
"baseline": "3.2.1", "baseline": "3.2.1",
"port-version": 2 "port-version": 3
}, },
"argumentum": { "argumentum": {
"baseline": "0.3.1", "baseline": "0.3.1",
@ -2566,7 +2566,7 @@
}, },
"gdcm": { "gdcm": {
"baseline": "3.0.12", "baseline": "3.0.12",
"port-version": 0 "port-version": 1
}, },
"gdcm2": { "gdcm2": {
"baseline": "deprecated", "baseline": "deprecated",
@ -2610,7 +2610,7 @@
}, },
"getopt-win32": { "getopt-win32": {
"baseline": "0.1", "baseline": "0.1",
"port-version": 6 "port-version": 7
}, },
"gettext": { "gettext": {
"baseline": "0.21", "baseline": "0.21",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "cb3870f85a108727ba53c35d59633f9d6fdb4c4e",
"version": "3.0.12",
"port-version": 1
},
{ {
"git-tree": "d88a2229a173f1d38ae7beeb24d8169957968e74", "git-tree": "d88a2229a173f1d38ae7beeb24d8169957968e74",
"version": "3.0.12", "version": "3.0.12",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "28d4331693c8c94a354365fff55df5f5762b7be6",
"version": "0.1",
"port-version": 7
},
{ {
"git-tree": "e2e91ce0684f0a2daa95adc45c9c32e61ae40a7e", "git-tree": "e2e91ce0684f0a2daa95adc45c9c32e61ae40a7e",
"version": "0.1", "version": "0.1",