Merge remote-tracking branch 'refs/remotes/upstream/master'

This commit is contained in:
sdcb 2017-01-14 10:55:19 +08:00
commit beec44ae8d
76 changed files with 1443 additions and 419 deletions

View File

@ -1,4 +1,4 @@
Source: boost Source: boost
Version: 1.62-9 Version: 1.62-10
Description: Peer-reviewed portable C++ source libraries Description: Peer-reviewed portable C++ source libraries
Build-Depends: zlib Build-Depends: zlib

View File

@ -108,11 +108,10 @@ file(
DESTINATION ${CURRENT_PACKAGES_DIR}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include
) )
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) # Disable Boost auto-link.
file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp file(APPEND ${CURRENT_PACKAGES_DIR}/include/boost/config/user.hpp
"\n#define BOOST_ALL_DYN_LINK\n" "\n#define BOOST_ALL_NO_LIB\n"
) )
endif()
file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost RENAME copyright) file(INSTALL ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/boost RENAME copyright)
message(STATUS "Packaging headers done") message(STATUS "Packaging headers done")

View File

@ -0,0 +1,109 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed3f38a..d6480b7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1010,7 +1010,9 @@ include(CMake/OtherTests.cmake)
add_definitions(-DHAVE_CONFIG_H)
# For windows, do not allow the compiler to use default target (Vista).
-if(WIN32)
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ add_definitions(-D_WIN32_WINNT=0x0A00 -DHAVE_STRUCT_POLLFD -D_WINSOCK_DEPRECATED_NO_WARNINGS)
+elseif(WIN32)
add_definitions(-D_WIN32_WINNT=0x0501)
endif(WIN32)
diff --git a/lib/curl_gethostname.c b/lib/curl_gethostname.c
index 2591fd8..cef38ac 100644
--- a/lib/curl_gethostname.c
+++ b/lib/curl_gethostname.c
@@ -21,6 +21,7 @@
***************************************************************************/
#include "curl_setup.h"
+#include "curl/curl.h"
#include "curl_gethostname.h"
@@ -64,9 +65,10 @@ int Curl_gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) {
#ifdef DEBUGBUILD
/* Override host name when environment variable CURL_GETHOSTNAME is set */
- const char *force_hostname = getenv("CURL_GETHOSTNAME");
+ char *force_hostname = curl_getenv("CURL_GETHOSTNAME");
if(force_hostname) {
strncpy(name, force_hostname, namelen);
+ free(force_hostname);
err = 0;
}
else {
diff --git a/lib/curl_ntlm_core.c b/lib/curl_ntlm_core.c
index 812a073..02c8416 100644
--- a/lib/curl_ntlm_core.c
+++ b/lib/curl_ntlm_core.c
@@ -696,9 +696,12 @@ CURLcode Curl_ntlm_core_mk_ntlmv2_resp(unsigned char *ntlmv2hash,
/* Calculate the timestamp */
#ifdef DEBUGBUILD
- char *force_timestamp = getenv("CURL_FORCETIME");
- if(force_timestamp)
+ char *force_timestamp = curl_getenv("CURL_FORCETIME");
+ if (force_timestamp)
+ {
tw = CURL_OFF_T_C(11644473600) * 10000000;
+ free(force_timestamp);
+ }
else
#endif
tw = ((curl_off_t)time(NULL) + CURL_OFF_T_C(11644473600)) * 10000000;
diff --git a/lib/ftp.c b/lib/ftp.c
index b231731..d50779f 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3250,7 +3250,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
ssize_t nread;
int ftpcode;
CURLcode result = CURLE_OK;
- char *path;
+ char *path = NULL;
const char *path_to_use = data->state.path;
if(!ftp)
diff --git a/lib/smb.c b/lib/smb.c
index 7cb0c96..2f43d3c 100644
--- a/lib/smb.c
+++ b/lib/smb.c
@@ -32,8 +32,12 @@
#ifdef HAVE_PROCESS_H
#include <process.h>
+#if defined(CURL_WINDOWS_APP)
+#define getpid GetCurrentProcessId
+#else
#define getpid _getpid
#endif
+#endif
#include "smb.h"
#include "urldata.h"
diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c
index 56a8823..5a895ed 100644
--- a/lib/vtls/vtls.c
+++ b/lib/vtls/vtls.c
@@ -197,7 +197,7 @@ unsigned int Curl_rand(struct Curl_easy *data)
static bool seeded = FALSE;
#ifdef CURLDEBUG
- char *force_entropy = getenv("CURL_ENTROPY");
+ char *force_entropy = curl_getenv("CURL_ENTROPY");
if(force_entropy) {
if(!seeded) {
size_t elen = strlen(force_entropy);
@@ -208,6 +208,7 @@ unsigned int Curl_rand(struct Curl_easy *data)
}
else
randseed++;
+ free(force_entropy);
return randseed;
}
#endif

View File

@ -1,4 +1,4 @@
Source: curl Source: curl
Version: 7.51.0-2 Version: 7.51.0-3
Build-Depends: zlib, openssl, libssh2 Build-Depends: zlib, openssl, libssh2
Description: A library for transferring data with URLs Description: A library for transferring data with URLs

View File

@ -11,6 +11,7 @@ vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PATCHES PATCHES
${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch ${CMAKE_CURRENT_LIST_DIR}/0001_cmake.patch
${CMAKE_CURRENT_LIST_DIR}/0002_fix_uwp.patch
) )
if (VCPKG_CRT_LINKAGE STREQUAL dynamic) if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
@ -19,16 +20,34 @@ else()
SET(CURL_STATICLIB ON) SET(CURL_STATICLIB ON)
endif() endif()
vcpkg_configure_cmake( if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
SOURCE_PATH ${SOURCE_PATH} vcpkg_configure_cmake(
OPTIONS SOURCE_PATH ${SOURCE_PATH}
-DBUILD_TESTING=OFF OPTIONS
-DBUILD_CURL_EXE=OFF -DBUILD_TESTING=OFF
-DENABLE_MANUAL=OFF -DBUILD_CURL_EXE=OFF
-DCURL_STATICLIB=${CURL_STATICLIB} -DENABLE_MANUAL=OFF
OPTIONS_DEBUG -DUSE_WIN32_LDAP=OFF
-DENABLE_DEBUG=ON -DCURL_DISABLE_TELNET=ON
) -DENABLE_IPV6=OFF
-DENABLE_UNIX_SOCKETS=OFF
-DCMAKE_USE_OPENSSL=ON
-DCURL_STATICLIB=${CURL_STATICLIB}
OPTIONS_DEBUG
-DENABLE_DEBUG=ON
)
else()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DBUILD_TESTING=OFF
-DBUILD_CURL_EXE=OFF
-DENABLE_MANUAL=OFF
-DCURL_STATICLIB=${CURL_STATICLIB}
OPTIONS_DEBUG
-DENABLE_DEBUG=ON
)
endif()
vcpkg_install_cmake() vcpkg_install_cmake()

View File

@ -0,0 +1,3 @@
Source: directxmesh
Version: oct2016
Description: DirectXMesh geometry processing library

View File

@ -0,0 +1,52 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(STATUS "Warning: Dynamic building not supported yet. Building static.")
set(VCPKG_LIBRARY_LINKAGE static)
endif()
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXMesh-oct2016)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/Microsoft/DirectXMesh/archive/oct2016.tar.gz"
FILENAME "DirectXMesh-oct2016.tar.gz"
SHA512 8aaf9749766afd23709ce6c6f8d74b008fe9f96789e4d97cb387633dad34b4132ef28dfe028d13c779ea366428d53076a881c0d63c4f0c2c74d552293c8d6bf1
)
vcpkg_extract_source_archive(${ARCHIVE})
IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
SET(BUILD_ARCH "Win32")
ELSE()
SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
ENDIF()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/DirectXMesh_Desktop_2015.sln
PLATFORM ${BUILD_ARCH}
)
file(INSTALL
${SOURCE_PATH}/DirectXMesh/DirectXMesh.h
${SOURCE_PATH}/DirectXMesh/DirectXMesh.inl
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
file(INSTALL
${SOURCE_PATH}/DirectXMesh/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DirectXMesh.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL
${SOURCE_PATH}/DirectXMesh/Bin/Desktop_2015/${BUILD_ARCH}/Release/DirectXMesh.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools)
file(INSTALL
${SOURCE_PATH}/Meshconvert/Bin/Desktop_2015/${BUILD_ARCH}/Release/Meshconvert.exe
DESTINATION ${TOOL_PATH})
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/directxmesh)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/directxmesh/LICENSE ${CURRENT_PACKAGES_DIR}/share/directxmesh/copyright)

3
ports/directxtex/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: directxtex
Version: dec2016
Description: DirectXTex texture processing library

View File

@ -0,0 +1,59 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
message(STATUS "Warning: Dynamic building not supported yet. Building static.")
set(VCPKG_LIBRARY_LINKAGE static)
endif()
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/directxtex-dec2016)
vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/Microsoft/DirectXTex/archive/dec2016.tar.gz"
FILENAME "directxtex-dec2016.tar.gz"
SHA512 87797340c40a98a7b11b6eb7da17d0b93bc01ba48deed50e99ce74e0e33387cac2ec18f2f14d0148c2a79f97ca98d6b2a228dad2f16010b6dcf03c0d24a79d20
)
vcpkg_extract_source_archive(${ARCHIVE})
IF (TRIPLET_SYSTEM_ARCH MATCHES "x86")
SET(BUILD_ARCH "Win32")
ELSE()
SET(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH})
ENDIF()
vcpkg_build_msbuild(
PROJECT_PATH ${SOURCE_PATH}/DirectXTex_Desktop_2015.sln
PLATFORM ${BUILD_ARCH}
)
file(INSTALL
${SOURCE_PATH}/DirectXTex/DirectXTex.h
${SOURCE_PATH}/DirectXTex/DirectXTex.inl
DESTINATION ${CURRENT_PACKAGES_DIR}/include
)
file(INSTALL
${SOURCE_PATH}/DirectXTex/Bin/Desktop_2015/${BUILD_ARCH}/Debug/DirectXTex.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(INSTALL
${SOURCE_PATH}/DirectXTex/Bin/Desktop_2015/${BUILD_ARCH}/Release/DirectXTex.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
set(TOOL_PATH ${CURRENT_PACKAGES_DIR}/tools)
file(MAKE_DIRECTORY ${TOOL_PATH})
file(INSTALL
${SOURCE_PATH}/Texdiag/Bin/Desktop_2015/${BUILD_ARCH}/Release/texdiag.exe
DESTINATION ${TOOL_PATH})
file(INSTALL
${SOURCE_PATH}/Texconv/Bin/Desktop_2015/${BUILD_ARCH}/Release/Texconv.exe
DESTINATION ${TOOL_PATH})
file(INSTALL
${SOURCE_PATH}/Texassemble/Bin/Desktop_2015/${BUILD_ARCH}/Release/Texassemble.exe
DESTINATION ${TOOL_PATH})
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/DirectXTex)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/DirectXTex/LICENSE ${CURRENT_PACKAGES_DIR}/share/DirectXTex/copyright)

View File

@ -1,3 +1,3 @@
Source: directxtk Source: directxtk
Version: oct2016-1 Version: dec2016
Description: A collection of helper classes for writing DirectX 11.x code in C++. Description: A collection of helper classes for writing DirectX 11.x code in C++.

View File

@ -4,11 +4,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
endif() endif()
include(vcpkg_common_functions) include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK-oct2016) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK-dec2016)
vcpkg_download_distfile(ARCHIVE vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/Microsoft/DirectXTK/archive/oct2016.tar.gz" URLS "https://github.com/Microsoft/DirectXTK/archive/dec2016.tar.gz"
FILENAME "oct2016.tar.gz" FILENAME "DirectXTK-dec2016.tar.gz"
SHA512 b44ee28518ca65d38a3c915881ef79533b48b07d3738b616f1935d7c00a26d5e48b2292cde6acc34e933f85ba2a6362c585c60b2bbc704745d43cef53769a112 SHA512 efb8a98d0872bf1835b274ba88615e88c4a58ab753c5ebef5a407c54d5f9a2197d1521f14651c60ea16c047918db6f54bf2ac58a6eb7330490b9bae619e8dad3
) )
vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_extract_source_archive(${ARCHIVE})

View File

@ -1,3 +1,3 @@
Source: directxtk12 Source: directxtk12
Version: oct2016 Version: dec2016
Description: A collection of helper classes for writing DirectX 12 code in C++. Description: A collection of helper classes for writing DirectX 12 code in C++.

View File

@ -4,11 +4,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
endif() endif()
include(vcpkg_common_functions) include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK12-oct2016) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/DirectXTK12-dec2016)
vcpkg_download_distfile(ARCHIVE vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/Microsoft/DirectXTK12/archive/oct2016.tar.gz" URLS "https://github.com/Microsoft/DirectXTK12/archive/dec2016.tar.gz"
FILENAME "DirectXTK12-oct2016.tar.gz" FILENAME "DirectXTK12-dec2016.tar.gz"
SHA512 f33af80dc018c1fda117eeef66bd08046b48572806d879651187cbed9d5ceb402b1798ecc0e1089b54ddb879e5355b45f2b67e3be99fbe270c5216a945a9924b SHA512 7c98fbf1d7ef96807a38d396a87dacdc60fdcd7e461210d246cc424789c4c5c5fb1390db958c1bd1f77da8af756a9eae36813e5da6bbb0ea1432ff4004f1d010
) )
vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_extract_source_archive(${ARCHIVE})

View File

@ -0,0 +1,63 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 744b2d5..d114b9b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -312,6 +312,9 @@ else ()
set(BASE_SRCS ${BASE_SRCS} src/base/ftdebug.c)
endif ()
+if(MSVC)
+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
+endif()
if (BUILD_FRAMEWORK)
set(BASE_SRCS
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 4666d48..382a915 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -845,6 +845,9 @@ FT_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
/*************************************************************************/
/* */
@@ -1777,6 +1780,10 @@ FT_BEGIN_HEADER
} FT_GlyphSlotRec;
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#undef generic
+#endif
+
/*************************************************************************/
/*************************************************************************/
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index fa05347..ae2754b 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -457,6 +457,9 @@
return error;
}
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
/* documentation is in ftobjs.h */
@@ -971,6 +974,9 @@
FT_FREE( face );
}
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#undef generic
+#endif
static void
Destroy_Driver( FT_Driver driver )

View File

@ -1,4 +1,4 @@
Source: freetype Source: freetype
Version: 2.6.3-3 Version: 2.6.3-4
Build-Depends: zlib, bzip2, libpng Build-Depends: zlib, bzip2, libpng
Description: A library to render fonts. Description: A library to render fonts.

View File

@ -11,6 +11,7 @@ vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Support-Windows-DLLs-via-CMAKE_WINDOWS_EXPORT_ALL_SY.patch PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Support-Windows-DLLs-via-CMAKE_WINDOWS_EXPORT_ALL_SY.patch
${CMAKE_CURRENT_LIST_DIR}/0002-Add-CONFIG_INSTALL_PATH-option.patch ${CMAKE_CURRENT_LIST_DIR}/0002-Add-CONFIG_INSTALL_PATH-option.patch
${CMAKE_CURRENT_LIST_DIR}/0003-Fix-UWP.patch
) )
vcpkg_configure_cmake( vcpkg_configure_cmake(

View File

@ -1,3 +1,3 @@
Source: glew Source: glew
Version: 2.0.0 Version: 2.0.0-1
Description: The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. Description: The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.

View File

@ -57,17 +57,15 @@ message(STATUS "Installing")
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
file(INSTALL file(INSTALL
${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.dll ${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.dll
${SOURCE_PATH}/bin/Debug/${BUILD_ARCH}/glew32d.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
) )
file(INSTALL file(INSTALL
${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.dll ${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.dll
${SOURCE_PATH}/bin/Release/${BUILD_ARCH}/glew32.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin DESTINATION ${CURRENT_PACKAGES_DIR}/bin
) )
file(INSTALL file(INSTALL
${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32d.lib ${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32d.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME glew32.lib
) )
file(INSTALL file(INSTALL
${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib ${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32.lib
@ -76,13 +74,11 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
else() else()
file(INSTALL file(INSTALL
${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32sd.lib ${SOURCE_PATH}/lib/Debug/${BUILD_ARCH}/glew32sd.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib RENAME glew32.lib
RENAME glew32d.lib
) )
file(INSTALL file(INSTALL
${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32s.lib ${SOURCE_PATH}/lib/Release/${BUILD_ARCH}/glew32s.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib RENAME glew32.lib
RENAME glew32.lib
) )
endif() endif()

View File

@ -5,13 +5,17 @@ if (BUILD_SHARED_LIBS)
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif() endif()
if(CMAKE_BUILD_TYPE MATCHES "Release")
add_definitions(-DHTTP_PARSER_STRICT=0)
endif()
add_library(http_parser http_parser.c http_parser.h) add_library(http_parser http_parser.c http_parser.h)
install(TARGETS http_parser install(TARGETS http_parser
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin"
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
) )
if (NOT SKIP_INSTALL_HEADERS) if (NOT SKIP_INSTALL_HEADERS)
install(FILES http_parser.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include") install(FILES http_parser.h DESTINATION "${CMAKE_INSTALL_PREFIX}/include")
endif() endif()

View File

@ -1,3 +1,3 @@
Source: http-parser Source: http-parser
Version: 2.7.1 Version: 2.7.1-1
Description: HTTP Parser. Description: HTTP Parser.

View File

@ -0,0 +1,48 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6401acf..64de3e9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -349,7 +349,7 @@ target_include_directories(libssh2 PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
# Check for the OS.
# Daniel's note: this should not be necessary and we need to work to
# get this removed.
-if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows" OR ${CMAKE_SYSTEM_NAME} STREQUAL "WindowsStore")
target_compile_definitions(libssh2 PRIVATE LIBSSH2_WIN32)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
target_compile_definitions(libssh2 PRIVATE LIBSSH2_DARWIN)
diff --git a/src/agent.c b/src/agent.c
index c2ba422..f1799f8 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -51,6 +51,10 @@
#include "userauth.h"
#include "session.h"
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define IS_UWP 1
+#endif /* #if defined(WINAPI_FAMILY) */
+
/* Requests from client to agent for protocol 1 key operations */
#define SSH_AGENTC_REQUEST_RSA_IDENTITIES 1
#define SSH_AGENTC_RSA_CHALLENGE 3
@@ -254,7 +258,7 @@ struct agent_ops agent_ops_unix = {
};
#endif /* PF_UNIX */
-#ifdef WIN32
+#if defined(WIN32) && !defined(IS_UWP)
/* Code to talk to Pageant was taken from PuTTY.
*
* Portions copyright Robert de Bath, Joris van Rantwijk, Delian
@@ -362,8 +366,8 @@ static struct {
const char *name;
struct agent_ops *ops;
} supported_backends[] = {
-#ifdef WIN32
- {"Pageant", &agent_ops_pageant},
+#if defined(WIN32) && !defined(IS_UWP)
+ {"Pageant", &agent_ops_pageant},
#endif /* WIN32 */
#ifdef PF_UNIX
{"Unix", &agent_ops_unix},

View File

@ -1,4 +1,4 @@
Source: libssh2 Source: libssh2
Version: 1.8.0 Version: 1.8.0-1
Build-Depends: zlib, openssl Build-Depends: zlib, openssl
Description: The SSH library Description: The SSH library

View File

@ -7,6 +7,10 @@ vcpkg_download_distfile(ARCHIVE_FILE
) )
vcpkg_extract_source_archive(${ARCHIVE_FILE}) vcpkg_extract_source_archive(${ARCHIVE_FILE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-UWP.patch
)
vcpkg_configure_cmake( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
OPTIONS OPTIONS

View File

@ -0,0 +1,91 @@
diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c
index dd3e95a..eb1690a 100644
--- a/lib/lws-plat-win.c
+++ b/lib/lws-plat-win.c
@@ -155,7 +155,7 @@ lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
{
struct lws_context_per_thread *pt = &context->pt[tsi];
WSANETWORKEVENTS networkevents;
- struct lws_pollfd *pfd;
+ struct lws_pollfd *pfd = NULL;
struct lws *wsi;
unsigned int i;
DWORD ev;
@@ -493,6 +493,7 @@ lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
return ok ? dst : NULL;
}
+#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
static lws_filefd_type
_lws_plat_file_open(struct lws *wsi, const char *filename,
unsigned long *filelen, int flags)
@@ -516,6 +517,35 @@ _lws_plat_file_open(struct lws *wsi, const char *filename,
return ret;
}
+#else
+static lws_filefd_type
+_lws_plat_file_open(struct lws *wsi, const char *filename,
+ unsigned long *filelen, int flags)
+{
+ HANDLE ret;
+ WCHAR buf[MAX_PATH];
+
+ (void)wsi;
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
+ if ((flags & 7) == _O_RDONLY) {
+ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL);
+ }
+ else {
+ lwsl_err("%s: open for write not implemented\n", __func__);
+ *filelen = 0;
+ return LWS_INVALID_FILE;
+ }
+
+ if (ret != LWS_INVALID_FILE)
+ {
+ struct stat info;
+ int result = stat(filename, &info);
+ *filelen = result != 0 ? -1 : (long)(info.st_size);
+ }
+
+ return ret;
+}
+#endif
static int
_lws_plat_file_close(struct lws *wsi, lws_filefd_type fd)
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
index 23f8f4d..bc32aef 100644
--- a/lib/private-libwebsockets.h
+++ b/lib/private-libwebsockets.h
@@ -48,12 +48,25 @@
#endif
#if defined(WIN32) || defined(_WIN32)
+
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+ #ifndef WINVER
+ #define WINVER 0x0602
+ #define _WIN32_WINNT WINVER
+ #endif
+
+ #define getenv(x) NULL
+ #define _WINSOCK_DEPRECATED_NO_WARNINGS
+#else
+
#if (WINVER < 0x0501)
-#undef WINVER
-#undef _WIN32_WINNT
-#define WINVER 0x0501
-#define _WIN32_WINNT WINVER
+ #undef WINVER
+ #undef _WIN32_WINNT
+ #define WINVER 0x0501
+ #define _WIN32_WINNT WINVER
+ #endif
#endif
+
#define LWS_NO_DAEMONIZE
#define LWS_ERRNO WSAGetLastError()
#define LWS_EAGAIN WSAEWOULDBLOCK

View File

@ -1,4 +1,4 @@
Source: libwebsockets Source: libwebsockets
Version: 2.0.0 Version: 2.0.0-1
Build-Depends: zlib, openssl Build-Depends: zlib, openssl
Description: Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources, and provide fast throughput in both directions as client or server. Description: Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources, and provide fast throughput in both directions as client or server.

View File

@ -11,6 +11,12 @@ vcpkg_download_distfile(ARCHIVE
) )
vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/0001-Fix-UWP.patch
)
vcpkg_configure_cmake( vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
OPTIONS OPTIONS

3
ports/metis/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: metis
Version: 5.1.0
Description: Serial Graph Partitioning and Fill-reducing Matrix Ordering

View File

@ -0,0 +1,8 @@
--- a/CMakeLists.txt Wed Dec 21 18:24:22 2016
+++ b/CMakeLists.txt Wed Dec 21 18:24:26 2016
@@ -20,4 +20,4 @@
# Recursively look for CMakeLists.txt in subdirs.
add_subdirectory("include")
add_subdirectory("libmetis")
-add_subdirectory("programs")
+# add_subdirectory("programs")

View File

@ -0,0 +1,15 @@
--- a/CMakeLists.txt Sat Mar 30 17:24:45 2013
+++ b/CMakeLists.txt Wed Dec 21 18:23:43 2016
@@ -4,11 +4,7 @@
set(GKLIB_PATH "GKlib" CACHE PATH "path to GKlib")
set(SHARED FALSE CACHE BOOL "build a shared library")
-if(MSVC)
- set(METIS_INSTALL FALSE)
-else()
- set(METIS_INSTALL TRUE)
-endif()
+set(METIS_INSTALL TRUE)
# Configure libmetis library.
if(SHARED)

View File

@ -0,0 +1,11 @@
--- a/GKlib/gk_arch.h Wed Dec 21 18:34:18 2016
+++ b/GKlib/gk_arch.h Wed Dec 21 18:30:49 2016
@@ -58,7 +58,7 @@
#define PTRDIFF_MAX INT64_MAX
#endif
-#ifdef __MSC__
+#if defined(__MSC__) && (_MSC_VER < 1900)
/* MSC does not have rint() function */
#define rint(x) ((int)((x)+0.5))

View File

@ -0,0 +1,11 @@
--- a/libmetis/metislib.h Sat Mar 30 17:24:45 2013
+++ b/libmetis/metislib.h Wed Dec 21 18:30:59 2016
@@ -31,7 +31,7 @@
#include <proto.h>
-#if defined(COMPILER_MSC)
+#if defined(COMPILER_MSC) && (_MSC_VER < 1900)
#if defined(rint)
#undef rint
#endif

View File

@ -0,0 +1,10 @@
--- a/libmetis/CMakeLists.txt Sat Mar 30 17:24:45 2013
+++ b/libmetis/CMakeLists.txt Wed Dec 21 17:41:37 2016
@@ -11,6 +11,6 @@
if(METIS_INSTALL)
install(TARGETS metis
LIBRARY DESTINATION lib
- RUNTIME DESTINATION lib
+ RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib)
endif()

View File

@ -0,0 +1,47 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/metis-5.1.0)
vcpkg_download_distfile(ARCHIVE
URLS "http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz"
FILENAME "metis-5.1.0.tar.gz"
SHA512 deea47749d13bd06fbeaf98a53c6c0b61603ddc17a43dae81d72c8015576f6495fd83c11b0ef68d024879ed5415c14ebdbd87ce49c181bdac680573bea8bdb25
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/enable-install.patch
${CMAKE_CURRENT_LIST_DIR}/disable-programs.patch
${CMAKE_CURRENT_LIST_DIR}/fix-runtime-install-destination.patch
${CMAKE_CURRENT_LIST_DIR}/fix-metis-vs14-math.patch
${CMAKE_CURRENT_LIST_DIR}/fix-gklib-vs14-math.patch
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(OPTIONS -DSHARED=ON -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON)
else()
set(OPTIONS -DSHARED=OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
${OPTIONS}
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/metis)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/metis/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/metis/copyright)

View File

@ -1,3 +1,3 @@
Source: openssl Source: openssl
Version: 1.0.2j-1 Version: 1.0.2j-2
Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library. Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.

View File

@ -3,7 +3,7 @@ call:set_%1
exit /b exit /b
:set_universal10.0Win32 :set_universal10.0Win32
call:setVar _VS14VC VisualStudio14VC call:setVar _VS14VC VisualStudio14VC
call "%_VS14VC%vcvarsall" x86 call "%_VS14VC%vcvarsall" x86 store
set _VCPlatform=x86 set _VCPlatform=x86
set _VCLibPlat= set _VCLibPlat=
call:setEnv call:setEnv
@ -11,7 +11,7 @@ exit /b
:set_universal10.0x64 :set_universal10.0x64
call:setVar _VS14VC VisualStudio14VC call:setVar _VS14VC VisualStudio14VC
call "%_VS14VC%vcvarsall" x64 call "%_VS14VC%vcvarsall" x64 store
set _VCPlatform=x64 set _VCPlatform=x64
set _VCLibPlat=amd64 set _VCLibPlat=amd64
call:setEnv call:setEnv
@ -19,7 +19,7 @@ exit /b
:set_universal10.0arm :set_universal10.0arm
call:setVar _VS14VC VisualStudio14VC call:setVar _VS14VC VisualStudio14VC
call "%_VS14VC%vcvarsall" x86_arm call "%_VS14VC%vcvarsall" x86_arm store
set _VCPlatform=ARM set _VCPlatform=ARM
set _VCLibPlat=ARM set _VCLibPlat=ARM
call:setEnv call:setEnv
@ -27,7 +27,7 @@ exit /b
:set_universal10.0arm64 :set_universal10.0arm64
call:setVar _VS14VC VisualStudio14VC call:setVar _VS14VC VisualStudio14VC
call "%_VS14VC%vcvarsall" x86_arm64 call "%_VS14VC%vcvarsall" x86_arm64 store
set _VCPlatform=ARM64 set _VCPlatform=ARM64
set _VCLibPlat=ARM64 set _VCLibPlat=ARM64
call:setEnv call:setEnv

View File

@ -0,0 +1,109 @@
cmake_minimum_required(VERSION 2.6)
project(SDL2_image)
### configuration ###
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
# enable all file formats which are supported natively
set(SUPPORTED_FORMATS BMP GIF LBM PCX PNM TGA XPM XCF XV)
# enable all file formats which are supported through external dependencies
# first try to load them statically (lib file in vcpkg installation)
# if this fails try to make them a dynamic dependency (dll will be loaded at runtime) if possible. vcpkg cannot resolve these dependencies!
# else do not support this file format at all
set(DEPENDENCIES PNG JPEG TIFF WEBP)
# patch library names for preprocessor flags
set(JPEG_FLAG JPG)
set(TIFF_FLAG TIF)
# names of potentially dynamically loaded libraries
set(JPEG_DYNAMIC \"libjpeg-9.dll\")
set(PNG_DYNAMIC \"libpng16-16.dll\")
set(TIFF_DYNAMIC \"libtiff-5.dll\")
set(WEBP_DYNAMIC \"libwebp-4.dll\")
### implementation ###
add_library(SDL2_image
IMG.c
IMG_bmp.c
IMG_gif.c
IMG_jpg.c
IMG_lbm.c
IMG_pcx.c
IMG_png.c
IMG_pnm.c
IMG_tga.c
IMG_tif.c
IMG_webp.c
IMG_xcf.c
IMG_xpm.c
IMG_xv.c
IMG_xxx.c
)
foreach(FORMAT ${SUPPORTED_FORMATS})
add_definitions(-DLOAD_${FORMAT})
endforeach(FORMAT)
# SDL
find_path(SDL_INCLUDE_DIR SDL2/SDL.h)
find_library(SDL_LIBRARY SDL2)
include_directories(${SDL_INCLUDE_DIR})
include_directories(${SDL_INCLUDE_DIR}/SDL2)
include_directories(${CMAKE_SOURCE_DIR})
target_link_libraries(SDL2_image ${SDL_LIBRARY})
# external dependencies
foreach(DEPENDENCY ${DEPENDENCIES})
find_package(${DEPENDENCY})
if(NOT DEFINED ${DEPENDENCY}_FLAG)
set(${DEPENDENCY}_FLAG ${DEPENDENCY})
endif()
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG})
if(${DEPENDENCY}_FOUND)
message(STATUS " --> linking statically.")
target_link_libraries(SDL2_image ${${DEPENDENCY}_LIBRARIES})
elseif(DEFINED ${DEPENDENCY}_DYNAMIC)
message(STATUS " --> linking dynamically.")
add_definitions(-DLOAD_${${DEPENDENCY}_FLAG}_DYNAMIC=${${DEPENDENCY}_DYNAMIC})
set(RUNTIME_DEPENDENCIES ON)
else()
message(STATUS " --> skipping.")
endif()
endforeach(DEPENDENCY)
if(DEFINED RUNTIME_DEPENDENCIES)
include_directories(VisualC/external/include)
endif()
install(TARGETS SDL2_image
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)
install(FILES SDL_image.h DESTINATION include/SDL2 CONFIGURATIONS Release)
message(STATUS "Link-time dependencies:")
message(STATUS " " ${SDL_LIBRARY})
foreach(DEPENDENCY ${DEPENDENCIES})
if(${DEPENDENCY}_FOUND)
message(STATUS " " ${DEPENDENCY})
endif()
endforeach(DEPENDENCY)
if(DEFINED RUNTIME_DEPENDENCIES)
message(STATUS "Run-time dependencies:")
foreach(DEPENDENCY ${DEPENDENCIES})
if(NOT ${DEPENDENCY}_FOUND AND DEFINED ${DEPENDENCY}_DYNAMIC)
message(STATUS " " ${${DEPENDENCY}_DYNAMIC})
endif()
endforeach(DEPENDENCY)
endif()

5
ports/sdl2-image/CONTROL Normal file
View File

@ -0,0 +1,5 @@
Source: sdl2-image
Version: 2.0.1
Build-Depends: sdl2, libpng, libjpeg-turbo, tiff, libwebp
Description: SDL_image is an image file loading library. It loads images as SDL surfaces and textures, and supports the following formats: BMP, GIF, JPEG, LBM, PCX, PNG, PNM, TGA, TIFF, WEBP, XCF, XPM, XV

View File

@ -0,0 +1,24 @@
# - Find WEBP
# Find the WEBP library
# This module defines
# WEBP_INCLUDE_DIRS, where to find webp/decode.h
# WEBP_LIBRARIES, the libraries needed to use WEBP
#
find_path(WEBP_INCLUDE_DIRS
NAMES webp/decode.h
)
mark_as_advanced(WEBP_INCLUDE_DIRS)
find_library(
WEBP_LIBRARIES
NAMES webp
)
find_library(WEBP_LIBRARY_RELEASE NAMES webp PATH_SUFFIXES lib)
find_library(WEBP_LIBRARY_DEBUG NAMES webpd PATH_SUFFIXES lib)
include(SelectLibraryConfigurations)
select_library_configurations(WEBP)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(WEBP DEFAULT_MSG WEBP_INCLUDE_DIRS WEBP_LIBRARIES)

View File

@ -0,0 +1,25 @@
diff --git "a/SDL_image.h" "b/SDL_image.h"
index f654483..1bd4f62 100644
--- "a/SDL_image.h"
+++ "b/SDL_image.h"
@@ -24,9 +24,9 @@
#ifndef _SDL_IMAGE_H
#define _SDL_IMAGE_H
-#include "SDL.h"
-#include "SDL_version.h"
-#include "begin_code.h"
+#include <SDL2/SDL.h>
+#include <SDL2/SDL_version.h>
+#include <SDL2/begin_code.h>
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@@ -140,6 +140,6 @@ extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst,
#ifdef __cplusplus
}
#endif
-#include "close_code.h"
+#include <SDL2/close_code.h>
#endif /* _SDL_IMAGE_H */

View File

@ -0,0 +1,39 @@
# Common Ambient Variables:
# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg>
# TARGET_TRIPLET is the current triplet (x86-windows, etc)
# PORT is the current port name (zlib, etc)
# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT}
# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET}
#
include(vcpkg_common_functions)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/SDL2_image-2.0.1)
vcpkg_download_distfile(ARCHIVE
URLS "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-2.0.1.zip"
FILENAME "SDL2_image-2.0.1.zip"
SHA512 37d12f4fae71c586bec73262bddb9207ab2f9a2ca6001d2cbfde646e268a950ba5cd4cff53d75e2da8959ae6da6e9cadc6eca88fa7bd9aa2758395d64c84a307
)
vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/correct-sdl-headers-dir.patch)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindWEBP.cmake DESTINATION ${SOURCE_PATH}/cmake)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
# OPTIONS
# OPTIONS_RELEASE -DOPTIMIZE=1
# OPTIONS_DEBUG -DDEBUGGABLE=1
)
vcpkg_install_cmake()
# Handle copyright
file(COPY ${SOURCE_PATH}/COPYING.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/sdl2-image)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/sdl2-image/COPYING.txt ${CURRENT_PACKAGES_DIR}/share/sdl2-image/copyright)
vcpkg_copy_pdbs()

3
ports/szip/CONTROL Normal file
View File

@ -0,0 +1,3 @@
Source: szip
Version: 2.1
Description: Szip compression software, providing lossless compression of scientific data

View File

@ -0,0 +1,39 @@
--- a/src/CMakeLists.txt Mon Aug 03 17:10:33 2015
+++ b/src/CMakeLists.txt Fri Jan 13 09:38:07 2017
@@ -22,20 +22,22 @@
${SZIP_SRC_SOURCE_DIR}/szlib.h
)
-add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS})
-#set_target_properties (${SZIP_LIB_TARGET}
-# PROPERTIES
-# LINK_FLAGS "-version-info 2:0:0"
-#)
-TARGET_C_PROPERTIES (${SZIP_LIB_TARGET} STATIC " " " ")
-target_link_libraries (${SZIP_LIB_TARGET} ${LINK_LIBS})
-set_target_properties(${SZIP_LIB_TARGET} PROPERTIES
- PUBLIC_HEADER "${SZIP_PUBLIC_HEADERS}"
- INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
-)
-set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET})
-SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC)
-set (install_targets ${SZIP_LIB_TARGET})
+if (NOT BUILD_SHARED_LIBS)
+ add_library (${SZIP_LIB_TARGET} STATIC ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS})
+ #set_target_properties (${SZIP_LIB_TARGET}
+ # PROPERTIES
+ # LINK_FLAGS "-version-info 2:0:0"
+ #)
+ TARGET_C_PROPERTIES (${SZIP_LIB_TARGET} STATIC " " " ")
+ target_link_libraries (${SZIP_LIB_TARGET} ${LINK_LIBS})
+ set_target_properties(${SZIP_LIB_TARGET} PROPERTIES
+ PUBLIC_HEADER "${SZIP_PUBLIC_HEADERS}"
+ INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
+ )
+ set_global_variable (SZIP_LIBRARIES_TO_EXPORT ${SZIP_LIB_TARGET})
+ SZIP_SET_LIB_OPTIONS (${SZIP_LIB_TARGET} ${SZIP_LIB_NAME} STATIC)
+ set (install_targets ${SZIP_LIB_TARGET})
+endif()
if (BUILD_SHARED_LIBS)
add_library (${SZIP_LIBSH_TARGET} SHARED ${SZIP_SRCS} ${SZIP_PUBLIC_HEADERS})

48
ports/szip/portfile.cmake Normal file
View File

@ -0,0 +1,48 @@
include(vcpkg_common_functions)
# set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/szip-2.1)
# vcpkg_download_distfile(ARCHIVE
# URLS "https://support.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz"
# FILENAME "szip-2.1.tar.gz"
# SHA512 ea91b877bb061fe6c96988a3c4b705e101a6950e34e9be53d6a57455c6a625be0afa60f4a3cfdd09649205b9f8586cc25ea60fe07a8131579acf3826b35fb749
# )
# vcpkg_extract_source_archive(${ARCHIVE})
# NOTE: We use Szip from the HDF5 cmake package dir, because it includes a lot of fixes for the CMake build files
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CMake-hdf5-1.10.0-patch1)
vcpkg_download_distfile(ARCHIVE
URLS "http://hdf4.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.0-patch1/src/CMake-hdf5-1.10.0-patch1.zip"
FILENAME "CMake-hdf5-1.10.0-patch1.zip"
SHA512 ec2edb43438661323be5998ecf64c4dd537ddc7451e31f89390260d16883e60a1ccc1bf745bcb809af22f2bf7157d50331a33910b8ebf5c59cd50693dfb2ef8f
)
vcpkg_extract_source_archive(${ARCHIVE})
set(ARCHIVE ${SOURCE_PATH}/SZip.tar.gz)
vcpkg_extract_source_archive(${ARCHIVE})
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/Szip)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/disable-static-lib-in-shared-build.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=1
-DSZIP_INSTALL_DATA_DIR=share/szip/data
-DSZIP_INSTALL_CMAKE_DIR=share/szip
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(RENAME ${CURRENT_PACKAGES_DIR}/share/szip/data/COPYING ${CURRENT_PACKAGES_DIR}/share/szip/copyright)
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/szip/szip-targets-debug.cmake SZIP_TARGETS_DEBUG_MODULE)
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SZIP_TARGETS_DEBUG_MODULE "${SZIP_TARGETS_DEBUG_MODULE}")
file(WRITE ${CURRENT_PACKAGES_DIR}/share/szip/szip-targets-debug.cmake "${SZIP_TARGETS_DEBUG_MODULE}")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

View File

@ -1,4 +1,4 @@
Source: tiff Source: tiff
Version: 4.0.6-1 Version: 4.0.6-2
Build-Depends: zlib Build-Depends: zlib
Description: A library that supports the manipulation of TIFF image files Description: A library that supports the manipulation of TIFF image files

25
ports/tiff/fix-uwp.patch Normal file
View File

@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 439e26a..05416d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -187,6 +187,7 @@ endforeach(flag ${test_flags})
if(MSVC)
set(CMAKE_DEBUG_POSTFIX "d")
+ add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
endif()
option(ld-version-script "Enable linker version script" ON)
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index a0dc68b..3c4e101 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -3690,7 +3690,7 @@ TIFFReadDirectory(TIFF* tif)
case TIFFTAG_SMAXSAMPLEVALUE:
{
- double *data;
+ double *data = NULL;
enum TIFFReadDirEntryErr err;
uint32 saved_flags;
int m;

View File

@ -10,6 +10,7 @@ vcpkg_extract_source_archive(${ARCHIVE})
vcpkg_apply_patches( vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH} SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-component-options.patch PATCHES ${CMAKE_CURRENT_LIST_DIR}/add-component-options.patch
${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch
) )
vcpkg_configure_cmake( vcpkg_configure_cmake(

View File

@ -7,6 +7,9 @@ function resolve($targetBinary) {
$a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" }) $a = $(dumpbin /DEPENDENTS $targetBinary | ? { $_ -match "^ [^ ].*\.dll" } | % { $_ -replace "^ ","" })
$a | % { $a | % {
if ([string]::IsNullOrEmpty($_)) {
continue
}
if (Test-Path "$installedDir\$_") { if (Test-Path "$installedDir\$_") {
if (Test-Path "$targetBinaryDir\$_") { if (Test-Path "$targetBinaryDir\$_") {
Write-Verbose "$_ is already present" Write-Verbose "$_ is already present"

View File

@ -1,7 +1,16 @@
function(vcpkg_build_cmake) function(vcpkg_build_cmake)
cmake_parse_arguments(_bc "MSVC_64_TOOLSET" "" "" ${ARGN})
set(MSVC_EXTRA_ARGS)
# Specifies the architecture of the toolset, NOT the architecture of the produced binary
if (_bc_MSVC_64_TOOLSET)
list(APPEND MSVC_EXTRA_ARGS "/p:PreferredToolArchitecture=x64")
endif()
message(STATUS "Build ${TARGET_TRIPLET}-rel") message(STATUS "Build ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process( vcpkg_execute_required_process(
COMMAND ${CMAKE_COMMAND} --build . --config Release -- /p:VCPkgLocalAppDataDisabled=true /m COMMAND ${CMAKE_COMMAND} --build . --config Release -- /p:VCPkgLocalAppDataDisabled=true /m ${MSVC_EXTRA_ARGS}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME build-${TARGET_TRIPLET}-rel LOGNAME build-${TARGET_TRIPLET}-rel
) )
@ -9,7 +18,7 @@ function(vcpkg_build_cmake)
message(STATUS "Build ${TARGET_TRIPLET}-dbg") message(STATUS "Build ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process( vcpkg_execute_required_process(
COMMAND ${CMAKE_COMMAND} --build . --config Debug -- /p:VCPkgLocalAppDataDisabled=true /m COMMAND ${CMAKE_COMMAND} --build . --config Debug -- /p:VCPkgLocalAppDataDisabled=true /m ${MSVC_EXTRA_ARGS}
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME build-${TARGET_TRIPLET}-dbg LOGNAME build-${TARGET_TRIPLET}-dbg
) )

View File

@ -57,6 +57,12 @@ function(vcpkg_find_acquire_program VAR)
set(URL "http://download.qt.io/official_releases/jom/jom_1_1_1.zip") set(URL "http://download.qt.io/official_releases/jom/jom_1_1_1.zip")
set(ARCHIVE "jom_1_1_1.zip") set(ARCHIVE "jom_1_1_1.zip")
set(HASH 23a26dc7e29979bec5dcd3bfcabf76397b93ace64f5d46f2254d6420158bac5eff1c1a8454e3427e7a2fe2c233c5f2cffc87b376772399e12e40b51be2c065f4) set(HASH 23a26dc7e29979bec5dcd3bfcabf76397b93ace64f5d46f2254d6420158bac5eff1c1a8454e3427e7a2fe2c233c5f2cffc87b376772399e12e40b51be2c065f4)
elseif(VAR MATCHES "7Z")
set(PROGNAME 7z)
set(PATHS "C:/Program Files/7-Zip" ${DOWNLOADS}/tools/7z/Files/7-Zip)
set(URL "http://7-zip.org/a/7z1604.msi")
set(ARCHIVE "7z1604.msi")
set(HASH 556f95f7566fe23704d136239e4cf5e2a26f939ab43b44145c91b70d031a088d553e5c21301f1242a2295dcde3143b356211f0108c68e65eef8572407618326d)
else() else()
message(FATAL "unknown tool ${VAR} -- unable to acquire.") message(FATAL "unknown tool ${VAR} -- unable to acquire.")
endif() endif()
@ -71,10 +77,21 @@ function(vcpkg_find_acquire_program VAR)
if(DEFINED NOEXTRACT) if(DEFINED NOEXTRACT)
file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}) file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME})
else() else()
execute_process( get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT)
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE} string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION)
WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME} if(${ARCHIVE_EXTENSION} STREQUAL ".msi")
) file(TO_NATIVE_PATH "${DOWNLOADS}/${ARCHIVE}" ARCHIVE_NATIVE_PATH)
file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}" DESTINATION_NATIVE_PATH)
execute_process(
COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH}
WORKING_DIRECTORY ${DOWNLOADS}
)
else()
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE}
WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}
)
endif()
endif() endif()
find_program(${VAR} ${PROGNAME} PATHS ${PATHS}) find_program(${VAR} ${PROGNAME} PATHS ${PATHS})

View File

@ -3,46 +3,113 @@
#include "vcpkg_cmd_arguments.h" #include "vcpkg_cmd_arguments.h"
#include "vcpkg_paths.h" #include "vcpkg_paths.h"
namespace vcpkg namespace vcpkg::Commands
{ {
extern const char*const INTEGRATE_COMMAND_HELPSTRING;
void print_usage();
void print_example(const std::string& command_and_arguments);
std::string create_example_string(const std::string& command_and_arguments);
void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void internal_test_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void help_topic_valid_triplet(const vcpkg_paths& paths);
void version_command(const vcpkg_cmd_arguments& args);
void contact_command(const vcpkg_cmd_arguments& args);
void hash_command(const vcpkg_cmd_arguments& args);
using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet); using command_type_a = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths); using command_type_b = void(*)(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
using command_type_c = void(*)(const vcpkg_cmd_arguments& args); using command_type_c = void(*)(const vcpkg_cmd_arguments& args);
namespace Build
{
void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir);
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
}
namespace BuildExternal
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
}
namespace Install
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
}
namespace Remove
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet);
}
namespace Update
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Create
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Edit
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Search
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace List
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Import
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Owns
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Cache
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Integrate
{
extern const char*const INTEGRATE_COMMAND_HELPSTRING;
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace PortsDiff
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
}
namespace Help
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths);
void help_topic_valid_triplet(const vcpkg_paths& paths);
void print_usage();
void print_example(const std::string& command_and_arguments);
std::string create_example_string(const std::string& command_and_arguments);
}
namespace Version
{
void perform_and_exit(const vcpkg_cmd_arguments& args);
}
namespace Contact
{
void perform_and_exit(const vcpkg_cmd_arguments& args);
}
namespace Hash
{
void perform_and_exit(const vcpkg_cmd_arguments& args);
}
template <class T> template <class T>
struct package_name_and_function struct package_name_and_function
{ {
@ -55,7 +122,7 @@ namespace vcpkg
const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c(); const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c();
template <typename T> template <typename T>
T find_command(const std::string& command_name, const std::vector<package_name_and_function<T>> available_commands) T find(const std::string& command_name, const std::vector<package_name_and_function<T>> available_commands)
{ {
for (const package_name_and_function<T>& cmd : available_commands) for (const package_name_and_function<T>& cmd : available_commands)
{ {

View File

@ -0,0 +1,44 @@
#include "vcpkg_Commands.h"
namespace vcpkg::Commands
{
const std::vector<package_name_and_function<command_type_a>>& get_available_commands_type_a()
{
static std::vector<package_name_and_function<command_type_a>> t = {
{"install", &Install::perform_and_exit},
{"remove", &Remove::perform_and_exit},
{"build", &Build::perform_and_exit},
{"build_external", &BuildExternal::perform_and_exit}
};
return t;
}
const std::vector<package_name_and_function<command_type_b>>& get_available_commands_type_b()
{
static std::vector<package_name_and_function<command_type_b>> t = {
{"/?", &Help::perform_and_exit},
{"help", &Help::perform_and_exit},
{"search", &Search::perform_and_exit},
{"list", &List::perform_and_exit},
{"integrate", &Integrate::perform_and_exit},
{"owns", &Owns::perform_and_exit},
{"update", &Update::perform_and_exit},
{"edit", &Edit::perform_and_exit},
{"create", &Create::perform_and_exit},
{"import", &Import::perform_and_exit},
{"cache", &Cache::perform_and_exit},
{"portsdiff", &PortsDiff::perform_and_exit}
};
return t;
}
const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c()
{
static std::vector<package_name_and_function<command_type_c>> t = {
{"version", &Version::perform_and_exit},
{"contact", &Contact::perform_and_exit},
{"hash", &Hash::perform_and_exit},
};
return t;
}
}

View File

@ -0,0 +1,128 @@
#include "vcpkg_Commands.h"
#include "StatusParagraphs.h"
#include "vcpkg.h"
#include "vcpkg_Input.h"
#include "post_build_lint.h"
#include "vcpkg_Dependencies.h"
#include "vcpkg_System.h"
#include "vcpkg_Environment.h"
#include "metrics.h"
#include "vcpkg_info.h"
#include <fstream>
namespace vcpkg::Commands::Build
{
using Dependencies::package_spec_with_install_plan;
using Dependencies::install_plan_type;
static const std::string OPTION_CHECKS_ONLY = "--checks-only";
static void create_binary_control_file(const vcpkg_paths& paths, const SourceParagraph& source_paragraph, const triplet& target_triplet)
{
const BinaryParagraph bpgh = BinaryParagraph(source_paragraph, target_triplet);
const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL";
std::ofstream(binary_control_file) << bpgh;
}
void build_package(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir)
{
Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_internal()");
const triplet& target_triplet = spec.target_triplet();
const fs::path ports_cmake_script_path = paths.ports_cmake;
const std::wstring command = Strings::wformat(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")",
Strings::utf8_to_utf16(target_triplet.architecture()),
Strings::utf8_to_utf16(source_paragraph.name),
Strings::utf8_to_utf16(target_triplet.canonical_name()),
port_dir.generic_wstring(),
ports_cmake_script_path.generic_wstring());
System::Stopwatch2 timer;
timer.start();
int return_code = System::cmd_execute(command);
timer.stop();
TrackMetric("buildtimeus-" + to_string(spec), timer.microseconds());
if (return_code != 0)
{
System::println(System::color::error, "Error: building package %s failed", to_string(spec));
System::println("Please ensure sure you're using the latest portfiles with `vcpkg update`, then\n"
"submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n"
" Package: %s\n"
" Vcpkg version: %s\n"
"\n"
"Additionally, attach any relevant sections from the log files above."
, to_string(spec), Info::version());
TrackProperty("error", "build failed");
TrackProperty("build_error", to_string(spec));
exit(EXIT_FAILURE);
}
PostBuildLint::perform_all_checks(spec, paths);
create_binary_control_file(paths, source_paragraph, target_triplet);
// const fs::path port_buildtrees_dir = paths.buildtrees / spec.name;
// delete_directory(port_buildtrees_dir);
}
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
{
static const std::string example = Commands::Help::create_example_string("build zlib:x64-windows");
// Installing multiple packages leads to unintuitive behavior if one of them depends on another.
// Allowing only 1 package for now.
args.check_exact_arg_count(1, example);
StatusParagraphs status_db = database_load_check(paths);
const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
Input::check_triplet(spec.target_triplet(), paths);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY});
if (options.find(OPTION_CHECKS_ONLY) != options.end())
{
PostBuildLint::perform_all_checks(spec, paths);
exit(EXIT_SUCCESS);
}
// Explicitly load and use the portfile's build dependencies when resolving the build command (instead of a cached package's dependencies).
const expected<SourceParagraph> maybe_spgh = try_load_port(paths, spec.name());
Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message());
const SourceParagraph& spgh = *maybe_spgh.get();
const std::vector<std::string> first_level_deps = filter_dependencies(spgh.depends, spec.target_triplet());
std::vector<package_spec> first_level_deps_specs;
for (const std::string& dep : first_level_deps)
{
first_level_deps_specs.push_back(package_spec::from_name_and_triplet(dep, spec.target_triplet()).get_or_throw());
}
std::vector<package_spec_with_install_plan> unmet_dependencies = Dependencies::create_install_plan(paths, first_level_deps_specs, status_db);
unmet_dependencies.erase(
std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [](const package_spec_with_install_plan& p)
{
return p.plan.type == install_plan_type::ALREADY_INSTALLED;
}),
unmet_dependencies.end());
if (!unmet_dependencies.empty())
{
System::println(System::color::error, "The build command requires all dependencies to be already installed.");
System::println("The following dependencies are missing:");
System::println("");
for (const package_spec_with_install_plan& p : unmet_dependencies)
{
System::println(" %s", to_string(p.spec));
}
System::println("");
exit(EXIT_FAILURE);
}
Environment::ensure_utilities_on_path(paths);
build_package(spgh, spec, paths, paths.port_dir(spec));
exit(EXIT_SUCCESS);
}
}

View File

@ -0,0 +1,32 @@
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_Environment.h"
#include "vcpkg_Input.h"
#include "vcpkg.h"
namespace vcpkg::Commands::BuildExternal
{
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
{
static const std::string example = Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
args.check_exact_arg_count(2, example);
expected<package_spec> maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet);
if (auto spec = maybe_current_spec.get())
{
Input::check_triplet(spec->target_triplet(), paths);
Environment::ensure_utilities_on_path(paths);
const fs::path port_dir = args.command_arguments.at(1);
const expected<SourceParagraph> maybe_spgh = try_load_port(port_dir);
if (auto spgh = maybe_spgh.get())
{
Commands::Build::build_package(*spgh, *spec, paths, port_dir);
exit(EXIT_SUCCESS);
}
}
System::println(System::color::error, "Error: %s: %s", maybe_current_spec.error_code().message(), args.command_arguments[0]);
Commands::Help::print_example(Strings::format("%s zlib:x64-windows", args.command));
exit(EXIT_FAILURE);
}
}

View File

@ -4,7 +4,7 @@
#include "Paragraphs.h" #include "Paragraphs.h"
#include "BinaryParagraph.h" #include "BinaryParagraph.h"
namespace vcpkg namespace vcpkg::Commands::Cache
{ {
static std::vector<BinaryParagraph> read_all_binary_paragraphs(const vcpkg_paths& paths) static std::vector<BinaryParagraph> read_all_binary_paragraphs(const vcpkg_paths& paths)
{ {
@ -34,10 +34,10 @@ namespace vcpkg
return output; return output;
} }
void cache_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = Strings::format( static const std::string example = Strings::format(
"The argument should be a substring to search for, or no argument to display all cached libraries.\n%s", create_example_string("cache png")); "The argument should be a substring to search for, or no argument to display all cached libraries.\n%s", Commands::Help::create_example_string("cache png"));
args.check_max_arg_count(1, example); args.check_max_arg_count(1, example);
const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths); const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths);

View File

@ -0,0 +1,13 @@
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_info.h"
namespace vcpkg::Commands::Contact
{
void perform_and_exit(const vcpkg_cmd_arguments& args)
{
args.check_exact_arg_count(0);
System::println("Send an email to %s with any feedback.", Info::email());
exit(EXIT_SUCCESS);
}
}

View File

@ -4,11 +4,11 @@
#include "vcpkg_Files.h" #include "vcpkg_Files.h"
#include "vcpkg_Input.h" #include "vcpkg_Input.h"
namespace vcpkg namespace vcpkg::Commands::Create
{ {
void create_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###"); static const std::string example = Commands::Help::create_example_string(R"###(create zlib2 http://zlib.net/zlib128.zip "zlib128-2.zip")###");
args.check_max_arg_count(3, example); args.check_max_arg_count(3, example);
args.check_min_arg_count(2, example); args.check_min_arg_count(2, example);

View File

@ -2,15 +2,16 @@
#include "vcpkg_System.h" #include "vcpkg_System.h"
#include "vcpkg_Input.h" #include "vcpkg_Input.h"
namespace vcpkg namespace vcpkg::Commands::Edit
{ {
void edit_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = create_example_string("edit zlib"); static const std::string example = Commands::Help::create_example_string("edit zlib");
args.check_exact_arg_count(1, example); args.check_exact_arg_count(1, example);
const std::string port_name = args.command_arguments.at(0); const std::string port_name = args.command_arguments.at(0);
const fs::path portpath = paths.ports / port_name; const fs::path portpath = paths.ports / port_name;
Checks::check_exit(fs::is_directory(portpath), "Could not find port named %s", port_name);
// Find editor // Find editor
std::wstring env_EDITOR = System::wdupenv_str(L"EDITOR"); std::wstring env_EDITOR = System::wdupenv_str(L"EDITOR");
@ -27,7 +28,7 @@ namespace vcpkg
} }
} }
std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" "%s")", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native()); std::wstring cmdLine = Strings::wformat(LR"("%s" "%s" "%s" -n)", env_EDITOR, portpath.native(), (portpath / "portfile.cmake").native());
exit(System::cmd_execute(cmdLine)); exit(System::cmd_execute(cmdLine));
} }
} }

View File

@ -1,7 +1,7 @@
#include "vcpkg_Commands.h" #include "vcpkg_Commands.h"
#include "vcpkg_System.h" #include "vcpkg_System.h"
namespace vcpkg namespace vcpkg::Commands::Hash
{ {
static void do_file_hash(fs::path const& path, std::wstring const& hashType) static void do_file_hash(fs::path const& path, std::wstring const& hashType)
{ {
@ -23,10 +23,10 @@ namespace vcpkg
System::println(hash); System::println(hash);
} }
void hash_command(const vcpkg_cmd_arguments& args) void perform_and_exit(const vcpkg_cmd_arguments& args)
{ {
static const std::string example = Strings::format( static const std::string example = Strings::format(
"The argument should be a file path\n%s", create_example_string("hash boost_1_62_0.tar.bz2")); "The argument should be a file path\n%s", Commands::Help::create_example_string("hash boost_1_62_0.tar.bz2"));
args.check_min_arg_count(1, example); args.check_min_arg_count(1, example);
args.check_max_arg_count(2, example); args.check_max_arg_count(2, example);

View File

@ -1,20 +1,69 @@
#include "vcpkg_Commands.h" #include "vcpkg_Commands.h"
#include "vcpkg_System.h" #include "vcpkg_System.h"
#include "vcpkg_info.h"
namespace vcpkg namespace vcpkg::Commands::Help
{ {
void version_command(const vcpkg_cmd_arguments& args) void help_topic_valid_triplet(const vcpkg_paths& paths)
{ {
args.check_exact_arg_count(0); System::println("Available architecture triplets:");
System::println("Vcpkg package management program version %s\n" auto it = fs::directory_iterator(paths.triplets);
"\n" for (; it != fs::directory_iterator(); ++it)
"See LICENSE.txt for license information.", Info::version() {
); System::println(" %s", it->path().stem().filename().string());
exit(EXIT_SUCCESS); }
} }
void help_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void print_usage()
{
System::println(
"Commands:\n"
" vcpkg search [pat] Search for packages available to be built\n"
" vcpkg install <pkg> Install a package\n"
" vcpkg remove <pkg> Uninstall a package. \n"
" vcpkg remove --purge <pkg> Uninstall and delete a package. \n"
" vcpkg list List installed packages\n"
" vcpkg update Display list of packages for updating\n"
" vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n"
"\n"
"%s" // Integration help
"\n"
" vcpkg edit <pkg> Open up a port for editing (uses %%EDITOR%%, default 'code')\n"
" vcpkg import <pkg> Import a pre-built library\n"
" vcpkg create <pkg> <url>\n"
" [archivename] Create a new package\n"
" vcpkg owns <pat> Search for files in installed packages\n"
" vcpkg cache List cached compiled packages\n"
" vcpkg version Display version information\n"
" vcpkg contact Display contact information to send feedback\n"
"\n"
//"internal commands:\n"
//" --check-build-deps <controlfile>\n"
//" --create-binary-control <controlfile>\n"
//"\n"
"Options:\n"
" --triplet <t> Specify the target architecture triplet.\n"
" (default: %%VCPKG_DEFAULT_TRIPLET%%, see 'vcpkg help triplet')\n"
"\n"
" --vcpkg-root <path> Specify the vcpkg root directory\n"
" (default: %%VCPKG_ROOT%%)\n"
"\n"
"For more help (including examples) see the accompanying README.md."
, Integrate::INTEGRATE_COMMAND_HELPSTRING);
}
std::string create_example_string(const std::string& command_and_arguments)
{
std::string cs = Strings::format("Example:\n"
" vcpkg %s", command_and_arguments);
return cs;
}
void print_example(const std::string& command_and_arguments)
{
System::println(create_example_string(command_and_arguments));
}
void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
args.check_max_arg_count(1); args.check_max_arg_count(1);
if (args.command_arguments.empty()) if (args.command_arguments.empty())
@ -35,21 +84,4 @@ namespace vcpkg
} }
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
void contact_command(const vcpkg_cmd_arguments& args)
{
args.check_exact_arg_count(0);
System::println("Send an email to %s with any feedback.", Info::email());
exit(EXIT_SUCCESS);
}
void help_topic_valid_triplet(const vcpkg_paths& paths)
{
System::println("Available architecture triplets:");
auto it = fs::directory_iterator(paths.triplets);
for (; it != fs::directory_iterator(); ++it)
{
System::println(" %s", it->path().stem().filename().string());
}
}
} }

View File

@ -0,0 +1,7 @@
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
namespace vcpkg::Commands::Helpers
{
}

View File

@ -4,7 +4,7 @@
#include "vcpkg_Files.h" #include "vcpkg_Files.h"
#include <fstream> #include <fstream>
namespace vcpkg namespace vcpkg::Commands::Import
{ {
struct Binaries struct Binaries
{ {
@ -75,9 +75,9 @@ namespace vcpkg
std::ofstream(control_file_path) << control_file_data; std::ofstream(control_file_path) << control_file_data;
} }
void import_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"); static const std::string example = Commands::Help::create_example_string(R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)");
args.check_exact_arg_count(3, example); args.check_exact_arg_count(3, example);
const fs::path control_file_path(args.command_arguments[0]); const fs::path control_file_path(args.command_arguments[0]);

View File

@ -1,72 +1,17 @@
#include "vcpkg_Commands.h" #include "vcpkg_Commands.h"
#include "vcpkg.h" #include "vcpkg.h"
#include <fstream>
#include "vcpkg_Environment.h" #include "vcpkg_Environment.h"
#include "metrics.h" #include "metrics.h"
#include "vcpkg_Files.h" #include "vcpkg_Files.h"
#include "post_build_lint.h"
#include "vcpkg_System.h" #include "vcpkg_System.h"
#include "vcpkg_Dependencies.h" #include "vcpkg_Dependencies.h"
#include "vcpkg_Input.h" #include "vcpkg_Input.h"
#include "vcpkg_Maps.h"
#include "vcpkg_info.h"
namespace vcpkg namespace vcpkg::Commands::Install
{ {
using Dependencies::package_spec_with_install_plan; using Dependencies::package_spec_with_install_plan;
using Dependencies::install_plan_type; using Dependencies::install_plan_type;
static const std::string OPTION_CHECKS_ONLY = "--checks-only";
static void create_binary_control_file(const vcpkg_paths& paths, const SourceParagraph& source_paragraph, const triplet& target_triplet)
{
const BinaryParagraph bpgh = BinaryParagraph(source_paragraph, target_triplet);
const fs::path binary_control_file = paths.packages / bpgh.dir() / "CONTROL";
std::ofstream(binary_control_file) << bpgh;
}
static void build_internal(const SourceParagraph& source_paragraph, const package_spec& spec, const vcpkg_paths& paths, const fs::path& port_dir)
{
Checks::check_exit(spec.name() == source_paragraph.name, "inconsistent arguments to build_internal()");
const triplet& target_triplet = spec.target_triplet();
const fs::path ports_cmake_script_path = paths.ports_cmake;
const std::wstring command = Strings::wformat(LR"("%%VS140COMNTOOLS%%..\..\VC\vcvarsall.bat" %s && cmake -DCMD=BUILD -DPORT=%s -DTARGET_TRIPLET=%s "-DCURRENT_PORT_DIR=%s/." -P "%s")",
Strings::utf8_to_utf16(target_triplet.architecture()),
Strings::utf8_to_utf16(source_paragraph.name),
Strings::utf8_to_utf16(target_triplet.canonical_name()),
port_dir.generic_wstring(),
ports_cmake_script_path.generic_wstring());
System::Stopwatch2 timer;
timer.start();
int return_code = System::cmd_execute(command);
timer.stop();
TrackMetric("buildtimeus-" + to_string(spec), timer.microseconds());
if (return_code != 0)
{
System::println(System::color::error, "Error: building package %s failed", to_string(spec));
System::println("Please ensure sure you're using the latest portfiles with `vcpkg update`, then\n"
"submit an issue at https://github.com/Microsoft/vcpkg/issues including:\n"
" Package: %s\n"
" Vcpkg version: %s\n"
"\n"
"Additionally, attach any relevant sections from the log files above."
, to_string(spec), Info::version());
TrackProperty("error", "build failed");
TrackProperty("build_error", to_string(spec));
exit(EXIT_FAILURE);
}
PostBuildLint::perform_all_checks(spec, paths);
create_binary_control_file(paths, source_paragraph, target_triplet);
// const fs::path port_buildtrees_dir = paths.buildtrees / spec.name;
// delete_directory(port_buildtrees_dir);
}
static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryParagraph& bpgh) static void install_and_write_listfile(const vcpkg_paths& paths, const BinaryParagraph& bpgh)
{ {
std::vector<std::string> output; std::vector<std::string> output;
@ -238,9 +183,9 @@ namespace vcpkg
status_db.insert(std::make_unique<StatusParagraph>(spgh)); status_db.insert(std::make_unique<StatusParagraph>(spgh));
} }
void install_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
{ {
static const std::string example = create_example_string("install zlib zlib:x64-windows curl boost"); static const std::string example = Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost");
args.check_min_arg_count(1, example); args.check_min_arg_count(1, example);
StatusParagraphs status_db = database_load_check(paths); StatusParagraphs status_db = database_load_check(paths);
@ -271,7 +216,7 @@ namespace vcpkg
} }
else if (action.plan.type == install_plan_type::BUILD_AND_INSTALL) else if (action.plan.type == install_plan_type::BUILD_AND_INSTALL)
{ {
build_internal(*action.plan.spgh, action.spec, paths, paths.port_dir(action.spec)); Commands::Build::build_package(*action.plan.spgh, action.spec, paths, paths.port_dir(action.spec));
const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw(); const BinaryParagraph bpgh = try_load_cached_package(paths, action.spec).get_or_throw();
install_package(paths, bpgh, status_db); install_package(paths, bpgh, status_db);
System::println(System::color::success, "Package %s is installed", action.spec); System::println(System::color::success, "Package %s is installed", action.spec);
@ -293,88 +238,4 @@ namespace vcpkg
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
void build_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
{
static const std::string example = create_example_string("build zlib:x64-windows");
// Installing multiple packages leads to unintuitive behavior if one of them depends on another.
// Allowing only 1 package for now.
args.check_exact_arg_count(1, example);
StatusParagraphs status_db = database_load_check(paths);
const package_spec spec = Input::check_and_get_package_spec(args.command_arguments.at(0), default_target_triplet, example);
Input::check_triplet(spec.target_triplet(), paths);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY});
if (options.find(OPTION_CHECKS_ONLY) != options.end())
{
PostBuildLint::perform_all_checks(spec, paths);
exit(EXIT_SUCCESS);
}
// Explicitly load and use the portfile's build dependencies when resolving the build command (instead of a cached package's dependencies).
const expected<SourceParagraph> maybe_spgh = try_load_port(paths, spec.name());
Checks::check_exit(!maybe_spgh.error_code(), "Could not find package named %s: %s", spec, maybe_spgh.error_code().message());
const SourceParagraph& spgh = *maybe_spgh.get();
const std::vector<std::string> first_level_deps = filter_dependencies(spgh.depends, spec.target_triplet());
std::vector<package_spec> first_level_deps_specs;
for (const std::string& dep : first_level_deps)
{
first_level_deps_specs.push_back(package_spec::from_name_and_triplet(dep, spec.target_triplet()).get_or_throw());
}
std::vector<package_spec_with_install_plan> unmet_dependencies = Dependencies::create_install_plan(paths, first_level_deps_specs, status_db);
unmet_dependencies.erase(
std::remove_if(unmet_dependencies.begin(), unmet_dependencies.end(), [](const package_spec_with_install_plan& p)
{
return p.plan.type == install_plan_type::ALREADY_INSTALLED;
}),
unmet_dependencies.end());
if (!unmet_dependencies.empty())
{
System::println(System::color::error, "The build command requires all dependencies to be already installed.");
System::println("The following dependencies are missing:");
System::println("");
for (const package_spec_with_install_plan& p : unmet_dependencies)
{
System::println(" %s", to_string(p.spec));
}
System::println("");
exit(EXIT_FAILURE);
}
Environment::ensure_utilities_on_path(paths);
build_internal(spgh, spec, paths, paths.port_dir(spec));
exit(EXIT_SUCCESS);
}
void build_external_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
{
static const std::string example = create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)");
args.check_exact_arg_count(2, example);
expected<package_spec> maybe_current_spec = package_spec::from_string(args.command_arguments[0], default_target_triplet);
if (auto spec = maybe_current_spec.get())
{
Input::check_triplet(spec->target_triplet(), paths);
Environment::ensure_utilities_on_path(paths);
const fs::path port_dir = args.command_arguments.at(1);
const expected<SourceParagraph> maybe_spgh = try_load_port(port_dir);
if (auto spgh = maybe_spgh.get())
{
build_internal(*spgh, *spec, paths, port_dir);
exit(EXIT_SUCCESS);
}
}
System::println(System::color::error, "Error: %s: %s", maybe_current_spec.error_code().message(), args.command_arguments[0]);
print_example(Strings::format("%s zlib:x64-windows", args.command));
exit(EXIT_FAILURE);
}
} }

View File

@ -10,7 +10,7 @@
#include "vcpkg_System.h" #include "vcpkg_System.h"
#include "vcpkg_Files.h" #include "vcpkg_Files.h"
namespace vcpkg namespace vcpkg::Commands::Integrate
{ {
static const std::array<fs::path, 2> old_system_target_files = { static const std::array<fs::path, 2> old_system_target_files = {
"C:/Program Files (x86)/MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets", "C:/Program Files (x86)/MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets",
@ -293,7 +293,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console
" vcpkg integrate remove Remove user-wide integration\n" " vcpkg integrate remove Remove user-wide integration\n"
" vcpkg integrate project Generate a referencing nuget package for individual VS project use\n"; " vcpkg integrate project Generate a referencing nuget package for individual VS project use\n";
void integrate_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = Strings::format("Commands:\n" static const std::string example = Strings::format("Commands:\n"
"%s", INTEGRATE_COMMAND_HELPSTRING); "%s", INTEGRATE_COMMAND_HELPSTRING);

View File

@ -3,7 +3,7 @@
#include "vcpkg_System.h" #include "vcpkg_System.h"
#include "vcpkglib_helpers.h" #include "vcpkglib_helpers.h"
namespace vcpkg namespace vcpkg::Commands::List
{ {
static void do_print(const StatusParagraph& pgh) static void do_print(const StatusParagraph& pgh)
{ {
@ -13,10 +13,10 @@ namespace vcpkg
details::shorten_description(pgh.package.description)); details::shorten_description(pgh.package.description));
} }
void list_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = Strings::format( static const std::string example = Strings::format(
"The argument should be a substring to search for, or no argument to display all installed libraries.\n%s", create_example_string("list png")); "The argument should be a substring to search for, or no argument to display all installed libraries.\n%s", Commands::Help::create_example_string("list png"));
args.check_max_arg_count(1, example); args.check_max_arg_count(1, example);
const StatusParagraphs status_paragraphs = database_load_check(paths); const StatusParagraphs status_paragraphs = database_load_check(paths);

View File

@ -1,103 +0,0 @@
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
namespace vcpkg
{
void print_usage()
{
System::println(
"Commands:\n"
" vcpkg search [pat] Search for packages available to be built\n"
" vcpkg install <pkg> Install a package\n"
" vcpkg remove <pkg> Uninstall a package. \n"
" vcpkg remove --purge <pkg> Uninstall and delete a package. \n"
" vcpkg list List installed packages\n"
" vcpkg update Display list of packages for updating\n"
" vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n"
"\n"
"%s" // Integration help
"\n"
" vcpkg edit <pkg> Open up a port for editing (uses %%EDITOR%%, default 'code')\n"
" vcpkg import <pkg> Import a pre-built library\n"
" vcpkg create <pkg> <url>\n"
" [archivename] Create a new package\n"
" vcpkg owns <pat> Search for files in installed packages\n"
" vcpkg cache List cached compiled packages\n"
" vcpkg version Display version information\n"
" vcpkg contact Display contact information to send feedback\n"
"\n"
//"internal commands:\n"
//" --check-build-deps <controlfile>\n"
//" --create-binary-control <controlfile>\n"
//"\n"
"Options:\n"
" --triplet <t> Specify the target architecture triplet.\n"
" (default: %%VCPKG_DEFAULT_TRIPLET%%, see 'vcpkg help triplet')\n"
"\n"
" --vcpkg-root <path> Specify the vcpkg root directory\n"
" (default: %%VCPKG_ROOT%%)\n"
"\n"
"For more help (including examples) see the accompanying README.md."
, INTEGRATE_COMMAND_HELPSTRING);
}
std::string create_example_string(const std::string& command_and_arguments)
{
std::string cs = Strings::format("Example:\n"
" vcpkg %s", command_and_arguments);
return cs;
}
void print_example(const std::string& command_and_arguments)
{
System::println(create_example_string(command_and_arguments));
}
void internal_test_command(const vcpkg_cmd_arguments& /*args*/, const vcpkg_paths& /*paths*/)
{
// auto data = FormatEventData("test");
// Track(data);
exit(EXIT_SUCCESS);
}
const std::vector<package_name_and_function<command_type_a>>& get_available_commands_type_a()
{
static std::vector<package_name_and_function<command_type_a>> t = {
{"install", install_command},
{"remove", remove_command},
{"build", build_command},
{"build_external", build_external_command}
};
return t;
}
const std::vector<package_name_and_function<command_type_b>>& get_available_commands_type_b()
{
static std::vector<package_name_and_function<command_type_b>> t = {
{"/?", help_command},
{"help", help_command},
{"search", search_command},
{"list", list_command},
{"integrate", integrate_command},
{"owns", owns_command},
{"update", update_command},
{"edit", edit_command},
{"create", create_command},
{"import", import_command},
{"cache", cache_command},
{"internal_test", internal_test_command},
{"portsdiff", portsdiff_command}
};
return t;
}
const std::vector<package_name_and_function<command_type_c>>& get_available_commands_type_c()
{
static std::vector<package_name_and_function<command_type_c>> t = {
{"version", &version_command},
{"contact", &contact_command},
{"hash", &hash_command},
};
return t;
}
}

View File

@ -2,7 +2,7 @@
#include "vcpkg_System.h" #include "vcpkg_System.h"
#include "vcpkg.h" #include "vcpkg.h"
namespace vcpkg namespace vcpkg::Commands::Owns
{ {
static void search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db) static void search_file(const vcpkg_paths& paths, const std::string& file_substr, const StatusParagraphs& status_db)
{ {
@ -21,9 +21,9 @@ namespace vcpkg
} }
} }
void owns_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = Strings::format("The argument should be a pattern to search for. %s", create_example_string("owns zlib.dll")); static const std::string example = Strings::format("The argument should be a pattern to search for. %s", Commands::Help::create_example_string("owns zlib.dll"));
args.check_exact_arg_count(1, example); args.check_exact_arg_count(1, example);
StatusParagraphs status_db = database_load_check(paths); StatusParagraphs status_db = database_load_check(paths);

View File

@ -10,7 +10,7 @@
#include "SourceParagraph.h" #include "SourceParagraph.h"
#include "vcpkg_Environment.h" #include "vcpkg_Environment.h"
namespace vcpkg namespace vcpkg::Commands::PortsDiff
{ {
static void do_print_name_and_version(const std::vector<std::string>& ports_to_print, const std::map<std::string, std::string>& names_and_versions) static void do_print_name_and_version(const std::vector<std::string>& ports_to_print, const std::map<std::string, std::string>& names_and_versions)
{ {
@ -97,9 +97,9 @@ namespace vcpkg
Checks::check_exit(output.output == VALID_COMMIT_OUTPUT, "Invalid commit id %s", Strings::utf16_to_utf8(git_commit_id)); Checks::check_exit(output.output == VALID_COMMIT_OUTPUT, "Invalid commit id %s", Strings::utf16_to_utf8(git_commit_id));
} }
void portsdiff_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", create_example_string("portsdiff mybranchname")); static const std::string example = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", Commands::Help::create_example_string("portsdiff mybranchname"));
args.check_min_arg_count(1, example); args.check_min_arg_count(1, example);
args.check_max_arg_count(2, example); args.check_max_arg_count(2, example);

View File

@ -4,7 +4,7 @@
#include "vcpkg_Input.h" #include "vcpkg_Input.h"
#include <fstream> #include <fstream>
namespace vcpkg namespace vcpkg::Commands::Remove
{ {
static const std::string OPTION_PURGE = "--purge"; static const std::string OPTION_PURGE = "--purge";
@ -166,9 +166,9 @@ namespace vcpkg
System::println(System::color::success, "Package %s was successfully removed", pkg.package.displayname()); System::println(System::color::success, "Package %s was successfully removed", pkg.package.displayname());
} }
void remove_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths, const triplet& default_target_triplet)
{ {
static const std::string example = create_example_string("remove zlib zlib:x64-windows curl boost"); static const std::string example = Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost");
args.check_min_arg_count(1, example); args.check_min_arg_count(1, example);
const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_PURGE}); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_PURGE});

View File

@ -4,7 +4,7 @@
#include "vcpkglib_helpers.h" #include "vcpkglib_helpers.h"
#include "SourceParagraph.h" #include "SourceParagraph.h"
namespace vcpkg namespace vcpkg::Commands::Search
{ {
static std::vector<SourceParagraph> read_all_source_paragraphs(const vcpkg_paths& paths) static std::vector<SourceParagraph> read_all_source_paragraphs(const vcpkg_paths& paths)
{ {
@ -40,9 +40,10 @@ namespace vcpkg
details::shorten_description(source_paragraph.description)); details::shorten_description(source_paragraph.description));
} }
void search_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
static const std::string example = Strings::format("The argument should be a substring to search for, or no argument to display all libraries.\n%s", create_example_string("search png")); static const std::string example = Strings::format("The argument should be a substring to search for, or no argument to display all libraries.\n%s",
Commands::Help::create_example_string("search png"));
args.check_max_arg_count(1, example); args.check_max_arg_count(1, example);
const std::vector<SourceParagraph> source_paragraphs = read_all_source_paragraphs(paths); const std::vector<SourceParagraph> source_paragraphs = read_all_source_paragraphs(paths);

View File

@ -5,9 +5,9 @@
#include "Paragraphs.h" #include "Paragraphs.h"
#include "vcpkg_info.h" #include "vcpkg_info.h"
namespace vcpkg namespace vcpkg::Commands::Update
{ {
void update_command(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths) void perform_and_exit(const vcpkg_cmd_arguments& args, const vcpkg_paths& paths)
{ {
args.check_exact_arg_count(0); args.check_exact_arg_count(0);
System::println("Using local portfile versions. To update the local portfiles, use `git pull`."); System::println("Using local portfile versions. To update the local portfiles, use `git pull`.");

View File

@ -0,0 +1,16 @@
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_info.h"
namespace vcpkg::Commands::Version
{
void perform_and_exit(const vcpkg_cmd_arguments& args)
{
args.check_exact_arg_count(0);
System::println("Vcpkg package management program version %s\n"
"\n"
"See LICENSE.txt for license information.", Info::version()
);
exit(EXIT_SUCCESS);
}
}

View File

@ -21,7 +21,7 @@ bool g_debugging = false;
void invalid_command(const std::string& cmd) void invalid_command(const std::string& cmd)
{ {
System::println(System::color::error, "invalid command: %s", cmd); System::println(System::color::error, "invalid command: %s", cmd);
print_usage(); Commands::Help::print_usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -30,11 +30,11 @@ static void inner(const vcpkg_cmd_arguments& args)
TrackProperty("command", args.command); TrackProperty("command", args.command);
if (args.command.empty()) if (args.command.empty())
{ {
print_usage(); Commands::Help::print_usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (auto command_function = find_command(args.command, get_available_commands_type_c())) if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c()))
{ {
return command_function(args); return command_function(args);
} }
@ -66,7 +66,7 @@ static void inner(const vcpkg_cmd_arguments& args)
int exit_code = _wchdir(paths.root.c_str()); int exit_code = _wchdir(paths.root.c_str());
Checks::check_exit(exit_code == 0, "Changing the working dir failed"); Checks::check_exit(exit_code == 0, "Changing the working dir failed");
if (auto command_function = find_command(args.command, get_available_commands_type_b())) if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_b()))
{ {
return command_function(args, paths); return command_function(args, paths);
} }
@ -91,7 +91,7 @@ static void inner(const vcpkg_cmd_arguments& args)
Input::check_triplet(default_target_triplet, paths); Input::check_triplet(default_target_triplet, paths);
if (auto command_function = find_command(args.command, get_available_commands_type_a())) if (auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a()))
{ {
return command_function(args, paths, default_target_triplet); return command_function(args, paths, default_target_triplet);
} }

View File

@ -37,7 +37,7 @@ namespace vcpkg::Input
{ {
System::println(System::color::error, "Error: invalid triplet: %s", t.canonical_name()); System::println(System::color::error, "Error: invalid triplet: %s", t.canonical_name());
TrackProperty("error", "invalid triplet: " + t.canonical_name()); TrackProperty("error", "invalid triplet: " + t.canonical_name());
help_topic_valid_triplet(paths); Commands::Help::help_topic_valid_triplet(paths);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
} }

View File

@ -18,7 +18,7 @@ namespace vcpkg
{ {
System::println(System::color::error, "Error: expected value after %s", option_name); System::println(System::color::error, "Error: expected value after %s", option_name);
TrackProperty("error", "error option name"); TrackProperty("error", "error option name");
print_usage(); Commands::Help::print_usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -26,7 +26,7 @@ namespace vcpkg
{ {
System::println(System::color::error, "Error: %s specified multiple times", option_name); System::println(System::color::error, "Error: %s specified multiple times", option_name);
TrackProperty("error", "error option specified multiple times"); TrackProperty("error", "error option specified multiple times");
print_usage(); Commands::Help::print_usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -42,7 +42,7 @@ namespace vcpkg
{ {
System::println(System::color::error, "Error: conflicting values specified for --%s", option_name); System::println(System::color::error, "Error: conflicting values specified for --%s", option_name);
TrackProperty("error", "error conflicting switches"); TrackProperty("error", "error conflicting switches");
print_usage(); Commands::Help::print_usage();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
option_field = new_setting; option_field = new_setting;

View File

@ -130,7 +130,11 @@
<ItemGroup> <ItemGroup>
<ClCompile Include="..\MachineType.cpp" /> <ClCompile Include="..\MachineType.cpp" />
<ClCompile Include="..\src\coff_file_reader.cpp" /> <ClCompile Include="..\src\coff_file_reader.cpp" />
<ClCompile Include="..\src\commands_available_commands.cpp" />
<ClCompile Include="..\src\commands_build.cpp" />
<ClCompile Include="..\src\commands_build_external.cpp" />
<ClCompile Include="..\src\commands_cache.cpp" /> <ClCompile Include="..\src\commands_cache.cpp" />
<ClCompile Include="..\src\commands_contact.cpp" />
<ClCompile Include="..\src\commands_create.cpp" /> <ClCompile Include="..\src\commands_create.cpp" />
<ClCompile Include="..\src\commands_edit.cpp" /> <ClCompile Include="..\src\commands_edit.cpp" />
<ClCompile Include="..\src\commands_hash.cpp" /> <ClCompile Include="..\src\commands_hash.cpp" />
@ -141,12 +145,12 @@
<ClCompile Include="..\src\commands_remove.cpp" /> <ClCompile Include="..\src\commands_remove.cpp" />
<ClCompile Include="..\src\commands_search.cpp" /> <ClCompile Include="..\src\commands_search.cpp" />
<ClCompile Include="..\src\commands_update.cpp" /> <ClCompile Include="..\src\commands_update.cpp" />
<ClCompile Include="..\src\commands_version.cpp" />
<ClCompile Include="..\src\vcpkg_cmd_arguments.cpp" /> <ClCompile Include="..\src\vcpkg_cmd_arguments.cpp" />
<ClCompile Include="..\src\commands_other.cpp" />
<ClCompile Include="..\src\vcpkg_Dependencies.cpp" /> <ClCompile Include="..\src\vcpkg_Dependencies.cpp" />
<ClCompile Include="..\src\vcpkg_Environment.cpp" /> <ClCompile Include="..\src\vcpkg_Environment.cpp" />
<ClCompile Include="..\src\commands_installation.cpp" /> <ClCompile Include="..\src\commands_install.cpp" />
<ClCompile Include="..\src\commands_integration.cpp" /> <ClCompile Include="..\src\commands_integrate.cpp" />
<ClCompile Include="..\src\main.cpp" /> <ClCompile Include="..\src\main.cpp" />
<ClCompile Include="..\src\commands_help.cpp" /> <ClCompile Include="..\src\commands_help.cpp" />
<ClCompile Include="..\src\post_build_lint.cpp" /> <ClCompile Include="..\src\post_build_lint.cpp" />

View File

@ -18,18 +18,9 @@
<ClCompile Include="..\src\main.cpp"> <ClCompile Include="..\src\main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\commands_other.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_help.cpp"> <ClCompile Include="..\src\commands_help.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\commands_integration.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_installation.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\post_build_lint.cpp"> <ClCompile Include="..\src\post_build_lint.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
@ -84,6 +75,27 @@
<ClCompile Include="..\src\commands_portsdiff.cpp"> <ClCompile Include="..\src\commands_portsdiff.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\src\commands_build_external.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_build.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_install.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_integrate.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_available_commands.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_version.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\commands_contact.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\include\post_build_lint.h"> <ClInclude Include="..\include\post_build_lint.h">