From 71f5a6f9fe3fc9fbd0a10604d50dea4d49fc6825 Mon Sep 17 00:00:00 2001 From: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com> Date: Fri, 21 May 2021 09:50:11 +0200 Subject: [getopt-win32] fix static builds (#17942) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * vcpkg_fixup_pkgconfig for allgero5 * version stuff * Small MSbuild fixes for static builds. * version stuff * update baseline * commit vcpkg.json * version stuff * remove blocking line * version stuff * fix missing preprocessor definition * version stuff * Update ports/getopt-win32/portfile.cmake Apply CR changes Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> * version stuff Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com> --- ports/getopt-win32/CONTROL | 5 ----- ports/getopt-win32/portfile.cmake | 29 ++++++++++++++++++++++++++--- ports/getopt-win32/vcpkg.json | 8 ++++++++ 3 files changed, 34 insertions(+), 8 deletions(-) delete mode 100644 ports/getopt-win32/CONTROL create mode 100644 ports/getopt-win32/vcpkg.json (limited to 'ports') diff --git a/ports/getopt-win32/CONTROL b/ports/getopt-win32/CONTROL deleted file mode 100644 index 5de151a79..000000000 --- a/ports/getopt-win32/CONTROL +++ /dev/null @@ -1,5 +0,0 @@ -Source: getopt-win32 -Version: 0.1 -Description: An implementation of getopt. -Homepage: https://github.com/libimobiledevice-win32 -Supports: windows \ No newline at end of file diff --git a/ports/getopt-win32/portfile.cmake b/ports/getopt-win32/portfile.cmake index 780cb1c5f..2e80cf943 100644 --- a/ports/getopt-win32/portfile.cmake +++ b/ports/getopt-win32/portfile.cmake @@ -2,8 +2,6 @@ if(VCPKG_CMAKE_SYSTEM_NAME) message(FATAL_ERROR "getopt-win32 only supports building on Windows Desktop") endif() -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libimobiledevice-win32/getopt @@ -12,13 +10,38 @@ vcpkg_from_github( HEAD_REF master ) +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + list(APPEND OPTIONS "/p:ConfigurationType=StaticLibrary") +else() + list(APPEND OPTIONS "/p:ConfigurationType=DynamicLibrary") +endif() + +set(_file "${SOURCE_PATH}/getopt.vcxproj") +file(READ "${_file}" _contents) +if(VCPKG_CRT_LINKAGE STREQUAL static) + string(REPLACE "MultiThreadedDLL" "MultiThreaded" _contents "${_contents}") + string(REPLACE "MultiThreadedDebugDLL" "MultiThreadedDebug" _contents "${_contents}") +else() + string(REPLACE "MultiThreaded" "MultiThreadedDLL" _contents "${_contents}") + string(REPLACE "MultiThreadedDebug" "MultiThreadedDebugDLL" _contents "${_contents}") +endif() +file(WRITE "${_file}" "${_contents}") + + + vcpkg_install_msbuild( SOURCE_PATH ${SOURCE_PATH} PROJECT_SUBPATH getopt.vcxproj LICENSE_SUBPATH LICENSE + OPTIONS ${OPTIONS} ) # Copy header -file(COPY ${SOURCE_PATH}/getopt.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/) +file(COPY "${SOURCE_PATH}/getopt.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/") +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/getopt.h" + " #define __GETOPT_H_" " #define __GETOPT_H_\n #define STATIC_GETOPT" + ) +endif() set(VCPKG_POLICY_ALLOW_RESTRICTED_HEADERS enabled) diff --git a/ports/getopt-win32/vcpkg.json b/ports/getopt-win32/vcpkg.json new file mode 100644 index 000000000..8f68d57f2 --- /dev/null +++ b/ports/getopt-win32/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "getopt-win32", + "version-string": "0.1", + "port-version": 1, + "description": "An implementation of getopt.", + "homepage": "https://github.com/libimobiledevice-win32", + "supports": "windows" +} -- cgit v1.2.3