Skip to content

Commit

Permalink
[getopt-win32] fix static builds (#17942)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Neumann-A and JackBoosY authored May 21, 2021
1 parent 094e58f commit 71f5a6f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
5 changes: 0 additions & 5 deletions ports/getopt-win32/CONTROL

This file was deleted.

29 changes: 26 additions & 3 deletions ports/getopt-win32/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>" "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>" _contents "${_contents}")
string(REPLACE "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>" "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>" _contents "${_contents}")
else()
string(REPLACE "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>" "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>" _contents "${_contents}")
string(REPLACE "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>" "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>" _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)
8 changes: 8 additions & 0 deletions ports/getopt-win32/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 0 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ getopt-win32:arm-uwp=fail
getopt-win32:x64-linux=fail
getopt-win32:x64-osx=fail
getopt-win32:x64-uwp=fail
getopt-win32:x64-windows-static=fail
gflags:arm-uwp=fail
gflags:x64-uwp=fail

Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2226,7 +2226,7 @@
},
"getopt-win32": {
"baseline": "0.1",
"port-version": 0
"port-version": 1
},
"gettext": {
"baseline": "0.21",
Expand Down
5 changes: 5 additions & 0 deletions versions/g-/getopt-win32.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d4b235f13a89dbec23f09caa05c7b71c176cfab8",
"version-string": "0.1",
"port-version": 1
},
{
"git-tree": "f54e92c884b42be2395cb2c5929785cb2db8ad9b",
"version-string": "0.1",
Expand Down

0 comments on commit 71f5a6f

Please sign in to comment.