diff options
36 files changed, 377 insertions, 300 deletions
diff --git a/.gitattributes b/.gitattributes index 9812ceb1f..a83b236d4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,4 @@ *.patch text eol=lf +*.vcxproj text eol=crlf +*.vcxproj.filters text eol=crlf +*.sln text eol=crlf
\ No newline at end of file diff --git a/ports/brotli/CONTROL b/ports/brotli/CONTROL new file mode 100644 index 000000000..75a2973a0 --- /dev/null +++ b/ports/brotli/CONTROL @@ -0,0 +1,3 @@ +Source: brotli
+Version: 0.6.0
+Description: a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd order context modeling.
diff --git a/ports/brotli/portfile.cmake b/ports/brotli/portfile.cmake new file mode 100644 index 000000000..36e489bc4 --- /dev/null +++ b/ports/brotli/portfile.cmake @@ -0,0 +1,51 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO google/brotli + REF v0.6.0 + SHA512 36caa277790efeb5bff0fdc090cdcf00fd9995c4e81a60ed31d36af2e13848ec1afe5d84e6926eebbee013525191e9404e112cb7fbede16097221c5bc3dfb5d5 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_build_cmake() + +file(GLOB DLLS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/Release/*.dll" +) +file(GLOB LIBS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Release/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/*/Release/*.lib" +) +file(GLOB DEBUG_DLLS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/*.dll" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/Debug/*.dll" +) +file(GLOB DEBUG_LIBS + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Debug/*.lib" + "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/*/Debug/*.lib" +) +file(GLOB HEADERS "${SOURCE_PATH}/c/include/brotli/*.h" "${SOURCE_PATH}/include/brotli/*.h") +if(DLLS) + file(INSTALL ${DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/bin) +endif() +file(INSTALL ${LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/lib) +if(DEBUG_DLLS) + file(INSTALL ${DEBUG_DLLS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() +file(INSTALL ${DEBUG_LIBS} DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) +file(INSTALL ${HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include/brotli) + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/brotli RENAME copyright) + +vcpkg_copy_pdbs() diff --git a/ports/freetype/0002-Add-CONFIG_INSTALL_PATH-option.patch b/ports/freetype/0002-Add-CONFIG_INSTALL_PATH-option.patch index 33b0b920f..eeecbc1f7 100644 --- a/ports/freetype/0002-Add-CONFIG_INSTALL_PATH-option.patch +++ b/ports/freetype/0002-Add-CONFIG_INSTALL_PATH-option.patch @@ -1,29 +1,17 @@ -From 59ebd2985f081229edc3c487367a1e5d5ac8db9a Mon Sep 17 00:00:00 2001 -From: Robert Schumacher <roschuma@microsoft.com> -Date: Mon, 10 Oct 2016 23:00:38 -0700 -Subject: [PATCH] Add CONFIG_INSTALL_PATH option - ---- - CMakeLists.txt | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - diff --git a/CMakeLists.txt b/CMakeLists.txt -index 774737d..5de689c 100644 +index 6bb2558..a894ada 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -401,8 +401,11 @@ install(TARGETS freetype - ARCHIVE DESTINATION lib - FRAMEWORK DESTINATION Library/Frameworks - ) +@@ -419,8 +419,11 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL) + ARCHIVE DESTINATION lib + FRAMEWORK DESTINATION Library/Frameworks + ) + -+set(CONFIG_INSTALL_PATH "lib/cmake/freetype" CACHE STRING "location to install cmake config files") ++ set(CONFIG_INSTALL_PATH "lib/cmake/freetype" CACHE STRING "location to install cmake config files") + - install(EXPORT freetype-targets -- DESTINATION lib/cmake/freetype -+ DESTINATION ${CONFIG_INSTALL_PATH} - FILE freetype-config.cmake - ) - --- -2.9.2.windows.1 - + install(EXPORT freetype-targets +- DESTINATION lib/cmake/freetype ++ DESTINATION ${CONFIG_INSTALL_PATH} + FILE freetype-config.cmake + ) + endif () diff --git a/ports/freetype/CONTROL b/ports/freetype/CONTROL index 3afd18c9d..541f8b024 100644 --- a/ports/freetype/CONTROL +++ b/ports/freetype/CONTROL @@ -1,4 +1,4 @@ Source: freetype -Version: 2.6.3-5 +Version: 2.8 Build-Depends: zlib, bzip2, libpng Description: A library to render fonts.
\ No newline at end of file diff --git a/ports/freetype/portfile.cmake b/ports/freetype/portfile.cmake index b5c20a610..8bce2577e 100644 --- a/ports/freetype/portfile.cmake +++ b/ports/freetype/portfile.cmake @@ -1,9 +1,10 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freetype-2.6.3) +set(FT_VERSION 2.8) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/freetype-${FT_VERSION}) vcpkg_download_distfile(ARCHIVE - URLS "http://download.savannah.gnu.org/releases/freetype/freetype-2.6.3.tar.bz2" - FILENAME "freetype-2.6.3.tar.bz2" - SHA512 e1f9018835fc88beeb4479537b59f866c52393ae18d24a1e0710a464cf948ab02b35c2c6043bc20c1db3a04871ee4eb0bb1d210550c0ea2780c8b1aea98fbf0d + URLS "http://download.savannah.gnu.org/releases/freetype/freetype-${FT_VERSION}.tar.bz2" + FILENAME "freetype-${FT_VERSION}.tar.bz2" + SHA512 3842c34bf6100a8c9b78258146b2ff35e9bb4c993937d3ef09982c1e2552dfd15f8849ddd8a1e84edf08b5a5fb918b68cf7b1584545c5900e22a00bfa1c89ff5 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -16,6 +17,7 @@ vcpkg_apply_patches( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DCONFIG_INSTALL_PATH=share/freetype -DWITH_ZLIB=ON diff --git a/ports/gli/CONTROL b/ports/gli/CONTROL index 8d89bc2d1..b8edac798 100644 --- a/ports/gli/CONTROL +++ b/ports/gli/CONTROL @@ -1,3 +1,4 @@ Source: gli -Version: 0.8.2 +Version: 0.8.2-1 +Build-Depends: glm Description: OpenGL Image (GLI) https://gli.g-truc.net diff --git a/ports/gli/portfile.cmake b/ports/gli/portfile.cmake index c0854909f..305233619 100644 --- a/ports/gli/portfile.cmake +++ b/ports/gli/portfile.cmake @@ -1,20 +1,19 @@ #header-only library include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/gli-0.8.2.0) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/g-truc/gli/archive/0.8.2.0.tar.gz" - FILENAME "0.8.2.0.tar.gz" + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO g-truc/gli + REF 0.8.2.0 SHA512 c254a4e1497d0add985e4a882c552db99c512cc0e9cc72145d51a6e7deada817d624d9818099a47136a8a3ef1223a26a34e355e3c713166f0bb062e506059834 + HEAD_REF master ) -vcpkg_extract_source_archive(${ARCHIVE}) - -# Remove glm/CMakeLists.txt -file(REMOVE ${SOURCE_PATH}/glm/CMakeLists.txt) # Put the license file where vcpkg expects it -file(COPY ${SOURCE_PATH}/external/glm/copying.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/gli/) -file(RENAME ${CURRENT_PACKAGES_DIR}/share/gli/copying.txt ${CURRENT_PACKAGES_DIR}/share/gli/copyright) +# manual.md contains the "licenses" section for the project +file(COPY ${SOURCE_PATH}/manual.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/gli/) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/gli/manual.md ${CURRENT_PACKAGES_DIR}/share/gli/copyright) # Copy the glm header files -file(GLOB HEADER_FILES ${SOURCE_PATH}/gli/*) +file(GLOB HEADER_FILES "${SOURCE_PATH}/gli/*.hpp" "${SOURCE_PATH}/gli/core") file(COPY ${HEADER_FILES} DESTINATION ${CURRENT_PACKAGES_DIR}/include/gli) diff --git a/ports/openssl/portfile.cmake b/ports/openssl/portfile.cmake index b325432b0..3b13c4660 100644 --- a/ports/openssl/portfile.cmake +++ b/ports/openssl/portfile.cmake @@ -4,7 +4,7 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") endif() include(vcpkg_common_functions) -set(OPENSSL_VERSION 1.0.2k) +set(OPENSSL_VERSION 1.0.2l) set(MASTER_COPY_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-${OPENSSL_VERSION}) vcpkg_find_acquire_program(PERL) find_program(NMAKE nmake) @@ -13,9 +13,9 @@ get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) set(ENV{PATH} "${PERL_EXE_PATH};$ENV{PATH}") vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE - URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" + URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" "https://www.openssl.org/source/old/1.0.2/openssl-${OPENSSL_VERSION}.tar.gz" FILENAME "openssl-${OPENSSL_VERSION}.tar.gz" - SHA512 0d314b42352f4b1df2c40ca1094abc7e9ad684c5c35ea997efdd58204c70f22a1abcb17291820f0fff3769620a4e06906034203d31eb1a4d540df3e0db294016 + SHA512 047d964508ad6025c79caabd8965efd2416dc026a56183d0ef4de7a0a6769ce8e0b4608a3f8393d326f6d03b26a2b067e6e0c750f35b20be190e595e8290c0e3 ) vcpkg_extract_source_archive(${OPENSSL_SOURCE_ARCHIVE}) diff --git a/ports/plibsys/CONTROL b/ports/plibsys/CONTROL new file mode 100644 index 000000000..5f099fc51 --- /dev/null +++ b/ports/plibsys/CONTROL @@ -0,0 +1,3 @@ +Source: plibsys
+Version: 0.0.3
+Description: Highly portable C system library: threads and synchronization, sockets, IPC, data structures and more.
diff --git a/ports/plibsys/portfile.cmake b/ports/plibsys/portfile.cmake new file mode 100644 index 000000000..b70fe771d --- /dev/null +++ b/ports/plibsys/portfile.cmake @@ -0,0 +1,69 @@ +include(vcpkg_common_functions)
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO saprykin/plibsys
+ REF 0.0.3
+ SHA512 e2393fecb3e5feae81a4d60cd03e2ca17bc58453efaa5598beacdc5acedbc7c90374f9f851301fee08ace8dace843a2dff8c1c449cd457302363c98dd24e0415
+ HEAD_REF master
+)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ SET(PLIBSYS_STATIC OFF)
+else()
+ SET(PLIBSYS_STATIC ON)
+endif()
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DPLIBSYS_TESTS=OFF
+ -DPLIBSYS_COVERAGE=OFF
+ -DPLIBSYS_BUILD_STATIC=${PLIBSYS_STATIC}
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/plibsys RENAME copyright)
+
+if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ set(PLIBSYS_FILENAME plibsys)
+
+ # Put shared libraries into the proper directory
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/plibsys.dll ${CURRENT_PACKAGES_DIR}/bin/plibsys.dll)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.dll ${CURRENT_PACKAGES_DIR}/debug/bin/plibsys.dll)
+else()
+ set(PLIBSYS_FILENAME plibsysstatic)
+
+ # For static build remove dynamic libraries
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/plibsys.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/plibsys.dll)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.lib)
+ file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.dll)
+endif()
+
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tmp)
+
+# Save library files
+file(RENAME ${CURRENT_PACKAGES_DIR}/lib/${PLIBSYS_FILENAME}.lib ${CURRENT_PACKAGES_DIR}/tmp/plibsys.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/${PLIBSYS_FILENAME}.lib ${CURRENT_PACKAGES_DIR}/tmp/plibsys_debug.lib)
+
+# Remove unused shared libraries
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib)
+file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+# Re-install library files
+file(RENAME ${CURRENT_PACKAGES_DIR}/tmp/plibsys.lib ${CURRENT_PACKAGES_DIR}/lib/plibsys.lib)
+file(RENAME ${CURRENT_PACKAGES_DIR}/tmp/plibsys_debug.lib ${CURRENT_PACKAGES_DIR}/debug/lib/plibsys.lib)
+
+# Remove duplicate library files (already installed)
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/tmp)
+
+vcpkg_copy_pdbs()
diff --git a/ports/sciter/CONTROL b/ports/sciter/CONTROL index 62cc3309d..d6f84d4da 100644 --- a/ports/sciter/CONTROL +++ b/ports/sciter/CONTROL @@ -1,4 +1,4 @@ Source: sciter -Version: 4.0.0.9-2 +Version: 4.0.1.0 Description: Sciter is an embeddable HTML/CSS/scripting engine. Maintainer: andrew.fedoniouk@gmail.com, ehysta@gmail.com diff --git a/ports/sciter/portfile.cmake b/ports/sciter/portfile.cmake index 5c7c7c5c6..7d5016f1c 100644 --- a/ports/sciter/portfile.cmake +++ b/ports/sciter/portfile.cmake @@ -12,9 +12,9 @@ include(vcpkg_common_functions) # header-only library set(VCPKG_POLICY_DLLS_WITHOUT_LIBS enabled) -set(SCITER_VERSION 4.0.0.9) -set(SCITER_REVISION 43565156c373f9635cc491551b870a948d4d6f37) -set(SCITER_SHA 6c50822c46784a8b2114973dffa8ec4041c69f84303507fdcde425dbac8d698dd6241a209cdc0ae0663751ed0f78d92f7b0c26794417f374978bfb3e33bf004c) +set(SCITER_VERSION 4.0.1.0) +set(SCITER_REVISION 67d2939a0510886c036c7c41267603463cbf96e0) +set(SCITER_SHA adf77354cc8624892ac1daaf03cba56cf8c3f2d7f77426977011af2a3070f685f51fd594dfb58a7fc7421f3d8c418ba47afb6ceb00170c8623eefcedfe1dca82) if(VCPKG_TARGET_ARCHITECTURE STREQUAL x64) set(SCITER_ARCH 64) diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index f1d9bde16..d833f02b9 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -1,3 +1,3 @@ Source: sqlite3
-Version: 3.18.0-1
+Version: 3.19.1-1
Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
\ No newline at end of file diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index 1b906fba5..768cd83a6 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -1,7 +1,7 @@ include(vcpkg_common_functions)
-set(SQLITE_VERSION 3180000)
-set(SQLITE_HASH d390c1d83afc27ec184ea6ab392477647cc80eb97ca177797cd494409c5646435c7a84502cc74ded1b654af13e65d2eef444bb0255a127e59d2cf40d5d0c1192)
+set(SQLITE_VERSION 3190100)
+set(SQLITE_HASH 14064707d9ca029131ec92863026748e184ad4d6ca9d25e941fc254d9ad24f1451fc5fae6516603a420925aab1736e3fb92085f03d8dc47ec913839e158652c4)
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/sqlite-amalgamation-${SQLITE_VERSION})
vcpkg_download_distfile(ARCHIVE
diff --git a/ports/tbb/CONTROL b/ports/tbb/CONTROL index b82b70555..9dc9198f8 100644 --- a/ports/tbb/CONTROL +++ b/ports/tbb/CONTROL @@ -1,3 +1,3 @@ Source: tbb -Version: 20160916 +Version: 2017_U6 Description: Intel's Threading Building Blocks. diff --git a/ports/tbb/portfile.cmake b/ports/tbb/portfile.cmake index fc761f113..a733be711 100644 --- a/ports/tbb/portfile.cmake +++ b/ports/tbb/portfile.cmake @@ -1,24 +1,26 @@ -# 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 static) message(STATUS "Warning: Static building not supported yet. Building dynamic.") set(VCPKG_LIBRARY_LINKAGE dynamic) endif() +if (VCPKG_CRT_LINKAGE STREQUAL static OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore) + message(FATAL_ERROR "Build settings not supported") +endif() + include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO 01org/tbb + REF 2017_U6 + SHA512 76b49fd085d8407b68b0f17e6eebfbcb7d2e6f9116bb5f6a00c6b4d59a55b16f9de79a2b9c9c3ece497b01810c33df21d0657893fd886db8bed639091ba97060 + HEAD_REF tbb_2017) + +if(TRIPLET_SYSTEM_ARCH STREQUAL x86) + set(BUILD_ARCH Win32) +else() + set(BUILD_ARCH ${TRIPLET_SYSTEM_ARCH}) +endif() -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/tbb2017_20160916oss) -vcpkg_download_distfile(ARCHIVE - URLS "https://www.threadingbuildingblocks.org/sites/default/files/software_releases/windows/tbb2017_20160916oss_win_1.zip" - FILENAME "tbb2017_20160916oss_win_1.zip" - SHA512 14bbc54aa0c4506bab6e6fdb7e9e562cbc88881cb683a8bd690e3101177e55433f25a2143e7af1ed52edacb44dc92fab354e1f2101bc13b33b3ea137def8bdd1 -) -vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_build_msbuild(PROJECT_PATH ${SOURCE_PATH}/build/vs2012/makefile.sln PLATFORM ${BUILD_ARCH}) # Installation message(STATUS "Installing") @@ -27,54 +29,33 @@ file(COPY ${SOURCE_PATH}/include/serial DESTINATION ${CURRENT_PACKAGES_DIR}/include) -if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") - set(BIN_PATH ${SOURCE_PATH}/bin/intel64/vc14) - set(LIB_PATH ${SOURCE_PATH}/lib/intel64/vc14) -elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") - set(BIN_PATH ${SOURCE_PATH}/bin/ia32/vc14) - set(LIB_PATH ${SOURCE_PATH}/lib/ia32/vc14) -else() - message(FATAL_ERROR "Unsupported architecture") -endif() +set(DEBUG_OUTPUT_PATH ${SOURCE_PATH}/build/vs2012/${BUILD_ARCH}/Debug) +set(RELEASE_OUTPUT_PATH ${SOURCE_PATH}/build/vs2012/${BUILD_ARCH}/Release) file(COPY - ${LIB_PATH}/tbb.lib - ${LIB_PATH}/tbb_preview.lib - ${LIB_PATH}/tbbmalloc.lib - ${LIB_PATH}/tbbmalloc_proxy.lib - ${LIB_PATH}/tbbproxy.lib - ${LIB_PATH}/tbbproxy.pdb + ${RELEASE_OUTPUT_PATH}/tbb.lib + ${RELEASE_OUTPUT_PATH}/tbbmalloc.lib + ${RELEASE_OUTPUT_PATH}/tbbmalloc_proxy.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib) file(COPY - ${LIB_PATH}/tbb_debug.lib - ${LIB_PATH}/tbb_preview_debug.lib - ${LIB_PATH}/tbbmalloc_debug.lib - ${LIB_PATH}/tbbmalloc_proxy_debug.lib - ${LIB_PATH}/tbbproxy_debug.lib - ${LIB_PATH}/tbbproxy_debug.pdb + ${DEBUG_OUTPUT_PATH}/tbb_debug.lib + ${DEBUG_OUTPUT_PATH}/tbbmalloc_debug.lib + ${DEBUG_OUTPUT_PATH}/tbbmalloc_proxy_debug.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) file(COPY - ${BIN_PATH}/tbb.dll - ${BIN_PATH}/tbb_preview.dll - ${BIN_PATH}/tbbmalloc.dll - ${BIN_PATH}/tbbmalloc_proxy.dll - ${BIN_PATH}/tbb.pdb - ${BIN_PATH}/tbb_preview.pdb - ${BIN_PATH}/tbbmalloc.pdb - ${BIN_PATH}/tbbmalloc_proxy.pdb + ${RELEASE_OUTPUT_PATH}/tbb.dll + ${RELEASE_OUTPUT_PATH}/tbbmalloc.dll + ${RELEASE_OUTPUT_PATH}/tbbmalloc_proxy.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin) file(COPY - ${BIN_PATH}/tbb_debug.dll - ${BIN_PATH}/tbb_preview_debug.dll - ${BIN_PATH}/tbbmalloc_debug.dll - ${BIN_PATH}/tbbmalloc_proxy_debug.dll - ${BIN_PATH}/tbb_debug.pdb - ${BIN_PATH}/tbb_preview_debug.pdb - ${BIN_PATH}/tbbmalloc_debug.pdb - ${BIN_PATH}/tbbmalloc_proxy_debug.pdb + ${DEBUG_OUTPUT_PATH}/tbb_debug.dll + ${DEBUG_OUTPUT_PATH}/tbbmalloc_debug.dll + ${DEBUG_OUTPUT_PATH}/tbbmalloc_proxy_debug.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) +vcpkg_copy_pdbs() + message(STATUS "Installing done") # Handle copyright diff --git a/ports/uwebsockets/CONTROL b/ports/uwebsockets/CONTROL index 39441586b..6371c8ad0 100644 --- a/ports/uwebsockets/CONTROL +++ b/ports/uwebsockets/CONTROL @@ -1,4 +1,4 @@ Source: uwebsockets -Version: 0.14.2 +Version: 0.14.3 Build-Depends: libuv, openssl, zlib, boost Description: Highly scalable cross-platform WebSocket & HTTP library for C++11 and Node.js diff --git a/ports/uwebsockets/portfile.cmake b/ports/uwebsockets/portfile.cmake index 1de6762d4..85c64c743 100644 --- a/ports/uwebsockets/portfile.cmake +++ b/ports/uwebsockets/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions) -set(VERSION 0.14.2) +set(VERSION 0.14.3) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/uwebsockets-${VERSION}) vcpkg_download_distfile(ARCHIVE URLS "https://github.com/uWebSockets/uWebSockets/archive/v${VERSION}.zip" FILENAME "uwebsockets-v${VERSION}.zip" - SHA512 b6389a00a310d77ec55273c1b9499679b13f5e430c31fbc5dd5847780455115d95d5a439cd82dddc537d85c4afb5db4cacefb6db5b3f9681ff142d6ab9ef5024 + SHA512 a64a6ee91d411f4285deb10b9b7620b4c4a2ff0f8137864380968349f7786c406ba44644b6ca589ee41c1e5adfa1ee1cf3697e54ecf5d459ab8bf69a3a4def7e ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 98144bffa..b6144d581 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -9,7 +9,9 @@ $downloadPromptOverride_NO_OVERRIDE= 0 $downloadPromptOverride_DO_NOT_PROMPT = 1 $downloadPromptOverride_ALWAYS_PROMPT = 2 -Import-Module BitsTransfer -Verbose:$false +if ($PSVersionTable.PSEdition -ne "Core") { + Import-Module BitsTransfer -Verbose:$false +} Write-Verbose "Fetching dependency: $Dependency" @@ -80,7 +82,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) New-Item -ItemType directory -Path $downloadDir | Out-Null } - if ($Dependency -ne "git") # git fails with BITS + if (($PSVersionTable.PSEdition -ne "Core") -and ($Dependency -ne "git")) # git fails with BITS { try { $WC = New-Object System.Net.WebClient @@ -195,10 +197,17 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) performDownload $Dependency $url $downloadsDir $downloadPath $downloadVersion $requiredVersion #calculating the hash - $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA256") - $fileAsByteArray = [io.File]::ReadAllBytes($downloadPath) - $hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray) - $downloadedFileHash = -Join ($hashByteArray | ForEach {"{0:x2}" -f $_}) + if ($PSVersionTable.PSEdition -ne "Core") + { + $hashAlgorithm = [Security.Cryptography.HashAlgorithm]::Create("SHA256") + $fileAsByteArray = [io.File]::ReadAllBytes($downloadPath) + $hashByteArray = $hashAlgorithm.ComputeHash($fileAsByteArray) + $downloadedFileHash = -Join ($hashByteArray | ForEach {"{0:x2}" -f $_}) + } + else + { + $downloadedFileHash = (Get-FileHash -Path $downloadPath -Algorithm SHA256).Hash + } if ($expectedDownloadedFileHash -ne $downloadedFileHash) { diff --git a/scripts/internalCI.ps1 b/scripts/internalCI.ps1 index 151b664b8..66744976d 100644 --- a/scripts/internalCI.ps1 +++ b/scripts/internalCI.ps1 @@ -15,7 +15,7 @@ if (-not $?) { throw $? } ./vcpkg.exe install azure-storage-cpp cpprestsdk:x64-windows-static cpprestsdk:x86-uwp if (-not $?) { throw $? } -./vcpkg.exe install bond chakracore cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows +./vcpkg.exe install bond chakracore cryptopp zlib expat sdl2 curl sqlite3 libuv protobuf:x64-windows sfml opencv:x64-windows uwebsockets uwebsockets:x64-windows-static if (-not $?) { throw $? } ./vcpkg.exe install opencv:x86-uwp boost:x86-uwp diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/BinaryParagraph.h index 90ca8fe9a..1c2edf790 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/BinaryParagraph.h @@ -6,6 +6,9 @@ namespace vcpkg { + /// <summary> + /// Built package metadata + /// </summary> struct BinaryParagraph { BinaryParagraph(); diff --git a/toolsrc/include/MachineType.h b/toolsrc/include/MachineType.h index 2318c092b..6f61bbd53 100644 --- a/toolsrc/include/MachineType.h +++ b/toolsrc/include/MachineType.h @@ -32,5 +32,5 @@ namespace vcpkg WCEMIPSV2 = 0x169, // MIPS little-endian WCE v2 }; - MachineType getMachineType(const uint16_t value); + MachineType to_machine_type(const uint16_t value); } diff --git a/toolsrc/include/PostBuildLint_BuildPolicies.h b/toolsrc/include/PostBuildLint_BuildPolicies.h deleted file mode 100644 index 95e01d71c..000000000 --- a/toolsrc/include/PostBuildLint_BuildPolicies.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once -#include "CStringView.h" -#include <array> -#include <string> - -namespace vcpkg::PostBuildLint -{ - struct BuildPolicies final - { - enum class BackingEnum - { - NULLVALUE = 0, - EMPTY_PACKAGE, - DLLS_WITHOUT_LIBS, - ONLY_RELEASE_CRT, - EMPTY_INCLUDE_FOLDER, - ALLOW_OBSOLETE_MSVCRT - }; - - static BuildPolicies parse(const std::string& s); - - constexpr BuildPolicies() : backing_enum(BackingEnum::NULLVALUE) {} - constexpr explicit BuildPolicies(BackingEnum backing_enum) : backing_enum(backing_enum) {} - constexpr operator BackingEnum() const { return backing_enum; } - - const std::string& to_string() const; - const std::string& cmake_variable() const; - - private: - BackingEnum backing_enum; - }; - - namespace BuildPoliciesC - { - static constexpr CStringView ENUM_NAME = "vcpkg::PostBuildLint::BuildPolicies"; - - static constexpr BuildPolicies NULLVALUE(BuildPolicies::BackingEnum::NULLVALUE); - static constexpr BuildPolicies EMPTY_PACKAGE(BuildPolicies::BackingEnum::EMPTY_PACKAGE); - static constexpr BuildPolicies DLLS_WITHOUT_LIBS(BuildPolicies::BackingEnum::DLLS_WITHOUT_LIBS); - static constexpr BuildPolicies ONLY_RELEASE_CRT(BuildPolicies::BackingEnum::ONLY_RELEASE_CRT); - static constexpr BuildPolicies EMPTY_INCLUDE_FOLDER(BuildPolicies::BackingEnum::EMPTY_INCLUDE_FOLDER); - static constexpr BuildPolicies ALLOW_OBSOLETE_MSVCRT(BuildPolicies::BackingEnum::ALLOW_OBSOLETE_MSVCRT); - - static constexpr std::array<BuildPolicies, 5> VALUES = { - EMPTY_PACKAGE, DLLS_WITHOUT_LIBS, ONLY_RELEASE_CRT, EMPTY_INCLUDE_FOLDER, ALLOW_OBSOLETE_MSVCRT}; - } -} diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/SourceParagraph.h index 8d51b45d4..19f558170 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/SourceParagraph.h @@ -15,6 +15,9 @@ namespace vcpkg const std::string& to_string(const Dependency& dep); + /// <summary> + /// Port metadata (CONTROL file) + /// </summary> struct SourceParagraph { SourceParagraph(); diff --git a/toolsrc/include/StatusParagraph.h b/toolsrc/include/StatusParagraph.h index ad913d11b..2d1815dc0 100644 --- a/toolsrc/include/StatusParagraph.h +++ b/toolsrc/include/StatusParagraph.h @@ -23,6 +23,9 @@ namespace vcpkg PURGE }; + /// <summary> + /// Installed package metadata + /// </summary> struct StatusParagraph { StatusParagraph(); diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 2eee658c8..c58c30ea3 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -31,6 +31,7 @@ #include <sys/timeb.h> #include <system_error> #include <time.h> +#include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg_Build.h index 4deb81900..e0a5ae1ce 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg_Build.h @@ -1,12 +1,13 @@ #pragma once +#include "CStringView.h" #include "PackageSpec.h" -#include "PostBuildLint_BuildPolicies.h" #include "PostBuildLint_LinkageType.h" #include "StatusParagraphs.h" #include "VcpkgPaths.h" #include "vcpkg_Files.h" #include "vcpkg_optional.h" + #include <map> #include <unordered_map> #include <vector> @@ -32,8 +33,14 @@ namespace vcpkg::Build std::string create_error_message(const BuildResult build_result, const PackageSpec& spec); std::string create_user_troubleshooting_message(const PackageSpec& spec); + /// <summary> + /// Settings from the triplet file which impact the build environment and post-build checks + /// </summary> struct PreBuildInfo { + /// <summary> + /// Runs the triplet file in a "capture" mode to create a PreBuildInfo + /// </summary> static PreBuildInfo from_triplet_file(const VcpkgPaths& paths, const Triplet& triplet); std::string target_architecture; @@ -69,16 +76,46 @@ namespace vcpkg::Build const BuildPackageConfig& config, const StatusParagraphs& status_db); - struct BuildInfo + enum class BuildPolicy + { + EMPTY_PACKAGE, + DLLS_WITHOUT_LIBS, + ONLY_RELEASE_CRT, + EMPTY_INCLUDE_FOLDER, + ALLOW_OBSOLETE_MSVCRT, + // Must be last + COUNT, + }; + + Optional<BuildPolicy> to_build_policy(const std::string& str); + + const std::string& to_string(BuildPolicy policy); + CStringView to_cmake_variable(BuildPolicy policy); + + struct BuildPolicies { - static BuildInfo create(std::unordered_map<std::string, std::string> pgh); + BuildPolicies() {} + BuildPolicies(std::map<BuildPolicy, bool>&& map) : m_policies(std::move(map)) {} + inline bool is_enabled(BuildPolicy policy) const + { + auto it = m_policies.find(policy); + if (it != m_policies.cend()) return it->second; + return false; + } + + private: + std::map<BuildPolicy, bool> m_policies; + }; + + struct BuildInfo + { PostBuildLint::LinkageType crt_linkage; PostBuildLint::LinkageType library_linkage; Optional<std::string> version; - std::map<PostBuildLint::BuildPolicies, bool> policies; + BuildPolicies policies; }; BuildInfo read_build_info(const Files::Filesystem& fs, const fs::path& filepath); diff --git a/toolsrc/src/MachineType.cpp b/toolsrc/src/MachineType.cpp index f288855e6..2f44ce21a 100644 --- a/toolsrc/src/MachineType.cpp +++ b/toolsrc/src/MachineType.cpp @@ -5,7 +5,7 @@ namespace vcpkg { - MachineType getMachineType(const uint16_t value) + MachineType to_machine_type(const uint16_t value) { MachineType t = static_cast<MachineType>(value); switch (t) diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/PostBuildLint.cpp index 4491f3f2e..bcad27032 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/PostBuildLint.cpp @@ -12,6 +12,7 @@ using vcpkg::Build::PreBuildInfo; using vcpkg::Build::BuildInfo; +using vcpkg::Build::BuildPolicy; namespace vcpkg::PostBuildLint { @@ -37,16 +38,7 @@ namespace vcpkg::PostBuildLint } }; - template<class T> - static bool contains_and_enabled(const std::map<T, bool> map, const T& key) - { - auto it = map.find(key); - if (it != map.cend()) return it->second; - - return false; - } - - const std::vector<OutdatedDynamicCrt>& get_outdated_dynamic_crts(const std::map<BuildPolicies, bool>& policies) + const std::vector<OutdatedDynamicCrt>& get_outdated_dynamic_crts(const Build::BuildPolicies& policies) { static const std::vector<OutdatedDynamicCrt> v_no_msvcrt = { {"msvcp100.dll", R"(msvcp100\.dll)"}, @@ -73,7 +65,7 @@ namespace vcpkg::PostBuildLint return ret; }(); - if (contains_and_enabled(policies, BuildPoliciesC::ALLOW_OBSOLETE_MSVCRT)) + if (policies.is_enabled(BuildPolicy::ALLOW_OBSOLETE_MSVCRT)) { return v_no_msvcrt; } @@ -82,10 +74,10 @@ namespace vcpkg::PostBuildLint } static LintStatus check_for_files_in_include_directory(const Files::Filesystem& fs, - const std::map<BuildPolicies, bool>& policies, + const Build::BuildPolicies& policies, const fs::path& package_dir) { - if (contains_and_enabled(policies, BuildPoliciesC::EMPTY_INCLUDE_FOLDER)) + if (policies.is_enabled(BuildPolicy::EMPTY_INCLUDE_FOLDER)) { return LintStatus::SUCCESS; } @@ -511,16 +503,12 @@ namespace vcpkg::PostBuildLint return LintStatus::ERROR_DETECTED; } - static LintStatus check_lib_files_are_available_if_dlls_are_available(const std::map<BuildPolicies, bool>& policies, + static LintStatus check_lib_files_are_available_if_dlls_are_available(const Build::BuildPolicies& policies, const size_t lib_count, const size_t dll_count, const fs::path& lib_dir) { - auto it = policies.find(BuildPoliciesC::DLLS_WITHOUT_LIBS); - if (it != policies.cend() && it->second) - { - return LintStatus::SUCCESS; - } + if (policies.is_enabled(BuildPolicy::DLLS_WITHOUT_LIBS)) return LintStatus::SUCCESS; if (lib_count == 0 && dll_count != 0) { @@ -528,7 +516,7 @@ namespace vcpkg::PostBuildLint System::println(System::Color::warning, "If this is intended, add the following line in the portfile:\n" " SET(%s enabled)", - BuildPoliciesC::DLLS_WITHOUT_LIBS.cmake_variable()); + to_cmake_variable(BuildPolicy::DLLS_WITHOUT_LIBS)); return LintStatus::ERROR_DETECTED; } @@ -750,7 +738,7 @@ namespace vcpkg::PostBuildLint size_t error_count = 0; - if (contains_and_enabled(build_info.policies, BuildPoliciesC::EMPTY_PACKAGE)) + if (build_info.policies.is_enabled(BuildPolicy::EMPTY_PACKAGE)) { return error_count; } @@ -822,7 +810,7 @@ namespace vcpkg::PostBuildLint error_count += check_bin_folders_are_not_present_in_static_build(fs, package_dir); - if (!contains_and_enabled(build_info.policies, BuildPoliciesC::ONLY_RELEASE_CRT)) + if (!build_info.policies.is_enabled(BuildPolicy::ONLY_RELEASE_CRT)) { error_count += check_crt_linkage_of_libs( BuildType::value_of(ConfigurationTypeC::DEBUG, build_info.crt_linkage), diff --git a/toolsrc/src/PostBuildLint_BuildPolicies.cpp b/toolsrc/src/PostBuildLint_BuildPolicies.cpp deleted file mode 100644 index d2189e20d..000000000 --- a/toolsrc/src/PostBuildLint_BuildPolicies.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#include "pch.h" - -#include "PostBuildLint_BuildPolicies.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Enums.h" - -namespace vcpkg::PostBuildLint -{ - static const std::string NULLVALUE_STRING = Enums::nullvalue_to_string(BuildPoliciesC::ENUM_NAME); - - static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; - static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; - static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; - static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; - static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; - - BuildPolicies BuildPolicies::parse(const std::string& s) - { - if (s == NAME_EMPTY_PACKAGE) - { - return BuildPoliciesC::EMPTY_PACKAGE; - } - - if (s == NAME_DLLS_WITHOUT_LIBS) - { - return BuildPoliciesC::DLLS_WITHOUT_LIBS; - } - - if (s == NAME_ONLY_RELEASE_CRT) - { - return BuildPoliciesC::ONLY_RELEASE_CRT; - } - - if (s == NAME_EMPTY_INCLUDE_FOLDER) - { - return BuildPoliciesC::EMPTY_INCLUDE_FOLDER; - } - - if (s == NAME_ALLOW_OBSOLETE_MSVCRT) - { - return BuildPoliciesC::ALLOW_OBSOLETE_MSVCRT; - } - - return BuildPoliciesC::NULLVALUE; - } - - const std::string& BuildPolicies::to_string() const - { - switch (this->backing_enum) - { - case BuildPoliciesC::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE; - case BuildPoliciesC::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; - case BuildPoliciesC::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT; - case BuildPoliciesC::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; - case BuildPoliciesC::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; - case BuildPoliciesC::NULLVALUE: return NULLVALUE_STRING; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - } - - const std::string& BuildPolicies::cmake_variable() const - { - static const std::string CMAKE_VARIABLE_EMPTY_PACKAGE = "VCPKG_POLICY_EMPTY_PACKAGE"; - static const std::string CMAKE_VARIABLE_DLLS_WITHOUT_LIBS = "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; - static const std::string CMAKE_VARIABLE_ONLY_RELEASE_CRT = "VCPKG_POLICY_ONLY_RELEASE_CRT"; - static const std::string CMAKE_VARIABLE_EMPTY_INCLUDE_FOLDER = "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER"; - static const std::string CMAKE_VARIABLE_ALLOW_OBSOLETE_MSVCRT = "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; - - switch (this->backing_enum) - { - case BuildPoliciesC::EMPTY_PACKAGE: return CMAKE_VARIABLE_EMPTY_PACKAGE; - case BuildPoliciesC::DLLS_WITHOUT_LIBS: return CMAKE_VARIABLE_DLLS_WITHOUT_LIBS; - case BuildPoliciesC::ONLY_RELEASE_CRT: return CMAKE_VARIABLE_ONLY_RELEASE_CRT; - case BuildPoliciesC::EMPTY_INCLUDE_FOLDER: return CMAKE_VARIABLE_EMPTY_INCLUDE_FOLDER; - case BuildPoliciesC::ALLOW_OBSOLETE_MSVCRT: return CMAKE_VARIABLE_ALLOW_OBSOLETE_MSVCRT; - case BuildPoliciesC::NULLVALUE: Enums::nullvalue_used(VCPKG_LINE_INFO, BuildPoliciesC::ENUM_NAME); - default: Checks::unreachable(VCPKG_LINE_INFO); - } - } -} diff --git a/toolsrc/src/coff_file_reader.cpp b/toolsrc/src/coff_file_reader.cpp index 467fc9a64..6c38c452b 100644 --- a/toolsrc/src/coff_file_reader.cpp +++ b/toolsrc/src/coff_file_reader.cpp @@ -80,14 +80,14 @@ namespace vcpkg::COFFFileReader return ret; } - MachineType machineType() const + MachineType machine_type() const { static const size_t MACHINE_TYPE_OFFSET = 0; static const size_t MACHINE_TYPE_SIZE = 2; std::string machine_field_as_string = data.substr(MACHINE_TYPE_OFFSET, MACHINE_TYPE_SIZE); const uint16_t machine = reinterpret_bytes<uint16_t>(machine_field_as_string.c_str()); - return getMachineType(machine); + return to_machine_type(machine); } private: @@ -203,14 +203,14 @@ namespace vcpkg::COFFFileReader return ret; } - MachineType machineType() const + MachineType machine_type() const { static const size_t MACHINE_TYPE_OFFSET = 6; static const size_t MACHINE_TYPE_SIZE = 2; std::string machine_field_as_string = data.substr(MACHINE_TYPE_OFFSET, MACHINE_TYPE_SIZE); const uint16_t machine = reinterpret_bytes<uint16_t>(machine_field_as_string.c_str()); - return getMachineType(machine); + return to_machine_type(machine); } private: @@ -236,7 +236,7 @@ namespace vcpkg::COFFFileReader read_and_verify_PE_signature(fs); CoffFileHeader header = CoffFileHeader::read(fs); - MachineType machine = header.machineType(); + MachineType machine = header.machine_type(); return {machine}; } @@ -297,9 +297,9 @@ namespace vcpkg::COFFFileReader marker.set_to_offset(offset + ArchiveMemberHeader::HEADER_SIZE); // Skip the header, no need to read it. marker.seek_to_marker(fs); const uint16_t first_two_bytes = peek_value_from_stream<uint16_t>(fs); - const bool isImportHeader = getMachineType(first_two_bytes) == MachineType::UNKNOWN; + const bool isImportHeader = to_machine_type(first_two_bytes) == MachineType::UNKNOWN; const MachineType machine = - isImportHeader ? ImportHeader::read(fs).machineType() : CoffFileHeader::read(fs).machineType(); + isImportHeader ? ImportHeader::read(fs).machine_type() : CoffFileHeader::read(fs).machine_type(); machine_types.insert(machine); } diff --git a/toolsrc/src/vcpkg_Build.cpp b/toolsrc/src/vcpkg_Build.cpp index 6605fa4fb..d44a673fc 100644 --- a/toolsrc/src/vcpkg_Build.cpp +++ b/toolsrc/src/vcpkg_Build.cpp @@ -13,8 +13,6 @@ #include "vcpkglib.h" #include "vcpkglib_helpers.h" -using vcpkg::PostBuildLint::BuildPolicies; -namespace BuildPoliciesC = vcpkg::PostBuildLint::BuildPoliciesC; using vcpkg::PostBuildLint::LinkageType; namespace LinkageTypeC = vcpkg::PostBuildLint::LinkageTypeC; @@ -214,7 +212,7 @@ namespace vcpkg::Build Commands::Version::version()); } - BuildInfo BuildInfo::create(std::unordered_map<std::string, std::string> pgh) + static BuildInfo inner_create_buildinfo(std::unordered_map<std::string, std::string> pgh) { BuildInfo build_info; const std::string crt_linkage_as_string = @@ -240,20 +238,35 @@ namespace vcpkg::Build pgh.erase(it_version); } + std::map<BuildPolicy, bool> policies; + // The remaining entries are policies for (const std::unordered_map<std::string, std::string>::value_type& p : pgh) { - const BuildPolicies policy = BuildPolicies::parse(p.first); - Checks::check_exit( - VCPKG_LINE_INFO, policy != BuildPoliciesC::NULLVALUE, "Unknown policy found: %s", p.first); - if (p.second == "enabled") - build_info.policies.emplace(policy, true); - else if (p.second == "disabled") - build_info.policies.emplace(policy, false); + auto maybe_policy = to_build_policy(p.first); + if (auto policy = maybe_policy.get()) + { + Checks::check_exit(VCPKG_LINE_INFO, + policies.find(*policy) == policies.end(), + "Policy specified multiple times: %s", + p.first); + + if (p.second == "enabled") + policies.emplace(*policy, true); + else if (p.second == "disabled") + policies.emplace(*policy, false); + else + Checks::exit_with_message( + VCPKG_LINE_INFO, "Unknown setting for policy '%s': %s", p.first, p.second); + } else - Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown setting for policy '%s': %s", p.first, p.second); + { + Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown policy found: %s", p.first); + } } + build_info.policies = BuildPolicies(std::move(policies)); + return build_info; } @@ -262,7 +275,7 @@ namespace vcpkg::Build const Expected<std::unordered_map<std::string, std::string>> pghs = Paragraphs::get_single_paragraph(fs, filepath); Checks::check_exit(VCPKG_LINE_INFO, pghs.get() != nullptr, "Invalid BUILD_INFO file for package"); - return BuildInfo::create(*pghs.get()); + return inner_create_buildinfo(*pghs.get()); } PreBuildInfo PreBuildInfo::from_triplet_file(const VcpkgPaths& paths, const Triplet& triplet) diff --git a/toolsrc/src/vcpkg_Build_BuildPolicy.cpp b/toolsrc/src/vcpkg_Build_BuildPolicy.cpp new file mode 100644 index 000000000..e75e176a2 --- /dev/null +++ b/toolsrc/src/vcpkg_Build_BuildPolicy.cpp @@ -0,0 +1,51 @@ +#include "pch.h" + +#include "vcpkg_Build.h" +#include "vcpkg_Checks.h" +#include "vcpkg_Enums.h" + +namespace vcpkg::Build +{ + static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; + static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; + static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; + static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; + static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; + + Optional<BuildPolicy> to_build_policy(const std::string& s) + { + if (s == NAME_EMPTY_PACKAGE) return BuildPolicy::EMPTY_PACKAGE; + if (s == NAME_DLLS_WITHOUT_LIBS) return BuildPolicy::DLLS_WITHOUT_LIBS; + if (s == NAME_ONLY_RELEASE_CRT) return BuildPolicy::ONLY_RELEASE_CRT; + if (s == NAME_EMPTY_INCLUDE_FOLDER) return BuildPolicy::EMPTY_INCLUDE_FOLDER; + if (s == NAME_ALLOW_OBSOLETE_MSVCRT) return BuildPolicy::ALLOW_OBSOLETE_MSVCRT; + + return nullopt; + } + + const std::string& to_string(BuildPolicy policy) + { + switch (policy) + { + case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE; + case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; + case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT; + case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; + case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } + + CStringView to_cmake_variable(BuildPolicy policy) + { + switch (policy) + { + case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE"; + case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; + case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT"; + case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER"; + case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } +} diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 472f4d4e9..4ec37a16d 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -141,8 +141,8 @@ <ClInclude Include="..\include\lazy.h" /> <ClInclude Include="..\include\LineInfo.h" /> <ClInclude Include="..\include\ParagraphParseResult.h" /> + <ClInclude Include="..\include\PostBuildLint_BuildType.h" /> <ClInclude Include="..\include\vcpkg_Build.h" /> - <ClInclude Include="..\include\PostBuildLint_BuildPolicies.h" /> <ClInclude Include="..\include\coff_file_reader.h" /> <ClInclude Include="..\include\vcpkg_expected.h" /> <ClInclude Include="..\include\filesystem_fs.h" /> @@ -154,7 +154,6 @@ <ClInclude Include="..\include\Paragraphs.h" /> <ClInclude Include="..\include\pch.h" /> <ClInclude Include="..\include\PostBuildLint.h" /> - <ClInclude Include="..\include\PostBuildLint_BuildType.h" /> <ClInclude Include="..\include\PostBuildLint_ConfigurationType.h" /> <ClInclude Include="..\include\PostBuildLint_LinkageType.h" /> <ClInclude Include="..\include\SourceParagraph.h" /> @@ -189,7 +188,7 @@ <ClCompile Include="..\src\LineInfo.cpp" /> <ClCompile Include="..\src\ParagraphParseResult.cpp" /> <ClCompile Include="..\src\vcpkg_Build.cpp" /> - <ClCompile Include="..\src\PostBuildLint_BuildPolicies.cpp" /> + <ClCompile Include="..\src\vcpkg_Build_BuildPolicy.cpp" /> <ClCompile Include="..\src\coff_file_reader.cpp" /> <ClCompile Include="..\src\commands_available_commands.cpp" /> <ClCompile Include="..\src\commands_build.cpp" /> diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index f8958b4a6..895eb2a4a 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -129,9 +129,6 @@ <ClCompile Include="..\src\PostBuildLint.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\PostBuildLint_BuildPolicies.cpp"> - <Filter>Source Files</Filter> - </ClCompile> <ClCompile Include="..\src\PostBuildLint_LinkageType.cpp"> <Filter>Source Files</Filter> </ClCompile> @@ -183,6 +180,9 @@ <ClCompile Include="..\src\vcpkg_Build.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\src\vcpkg_Build_BuildPolicy.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\include\SourceParagraph.h"> @@ -257,18 +257,12 @@ <ClInclude Include="..\include\PostBuildLint.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\include\PostBuildLint_BuildPolicies.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="..\include\PostBuildLint_LinkageType.h"> <Filter>Header Files</Filter> </ClInclude> <ClInclude Include="..\include\PostBuildLint_ConfigurationType.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\include\PostBuildLint_BuildType.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="..\include\vcpkg_Enums.h"> <Filter>Header Files</Filter> </ClInclude> @@ -314,5 +308,8 @@ <ClInclude Include="..\include\vcpkg_Build.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\include\PostBuildLint_BuildType.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project>
\ No newline at end of file |
