diff options
| author | Ryan Saunders <saunders@aggienetwork.com> | 2019-04-10 23:07:17 -0700 |
|---|---|---|
| committer | Ryan Saunders <saunders@aggienetwork.com> | 2019-04-10 23:07:17 -0700 |
| commit | a492caf9d5a069987b6309c6cbf8e5cc8c3ec6a8 (patch) | |
| tree | 11f6f1c5e3f4caa03f297162ffab9f79941f676c | |
| parent | 80965287d1483f98f49ba83e026f022369798990 (diff) | |
| parent | b625cbf82f792409fa59262546cb5ed1ef7944e3 (diff) | |
| download | vcpkg-a492caf9d5a069987b6309c6cbf8e5cc8c3ec6a8.tar.gz vcpkg-a492caf9d5a069987b6309c6cbf8e5cc8c3ec6a8.zip | |
Merge branch 'master' into query_deps
246 files changed, 3865 insertions, 3465 deletions
diff --git a/bootstrap-vcpkg.sh b/bootstrap-vcpkg.sh index a7643894c..7165a725f 100755 --- a/bootstrap-vcpkg.sh +++ b/bootstrap-vcpkg.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -e vcpkgRootDir=$(X= cd -- "$(dirname -- "$0")" && pwd -P) . "$vcpkgRootDir/scripts/bootstrap.sh" diff --git a/ports/ace/CONTROL b/ports/ace/CONTROL index d3e25dcf9..9d4d36cd5 100644 --- a/ports/ace/CONTROL +++ b/ports/ace/CONTROL @@ -1,3 +1,3 @@ Source: ace -Version: 6.5.4-3 +Version: 6.5.5-1 Description: The ADAPTIVE Communication Environment diff --git a/ports/ace/portfile.cmake b/ports/ace/portfile.cmake index 87fd822ad..d33028c9a 100644 --- a/ports/ace/portfile.cmake +++ b/ports/ace/portfile.cmake @@ -13,9 +13,9 @@ set(ACE_ROOT ${CURRENT_BUILDTREES_DIR}/src/ACE_wrappers) set(ENV{ACE_ROOT} ${ACE_ROOT}) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/ACE_wrappers/ace) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_4/ACE-src-6.5.4.zip" - FILENAME ACE-src-6.5.4.zip - SHA512 e699b24aa65c44137b7bdbe3c045b6c8d76c43ff4c78a05efe6d0d7fd05acdd1166b74529cc4d7ba9440b6b29cce3aa2dcc97f574c94afc05b0fef18475d6ce3 + URLS "https://github.com/DOCGroup/ACE_TAO/releases/download/ACE%2BTAO-6_5_5/ACE-src-6.5.5.zip" + FILENAME ACE-src-6.5.5.zip + SHA512 65696e6f2776fd9c015adb78a92f1c87edacde62ff11f20f88c416d4420a6fc6e5176412c5f93262d06e67b89717499f8108f68582f70fea6ce05466c53415e9 ) vcpkg_extract_source_archive(${ARCHIVE}) @@ -36,7 +36,9 @@ endif() if(NOT VCPKG_CMAKE_SYSTEM_NAME) set(LIB_RELEASE_SUFFIX .lib) set(LIB_DEBUG_SUFFIX d.lib) - if(VCPKG_PLATFORM_TOOLSET MATCHES "v141") + if(VCPKG_PLATFORM_TOOLSET MATCHES "v142") + set(SOLUTION_TYPE vs2019) + elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(SOLUTION_TYPE vs2017) else() set(SOLUTION_TYPE vc14) diff --git a/ports/activemq-cpp/CONTROL b/ports/activemq-cpp/CONTROL new file mode 100644 index 000000000..ee3c4300c --- /dev/null +++ b/ports/activemq-cpp/CONTROL @@ -0,0 +1,4 @@ +Source: activemq-cpp
+Version: 3.9.5
+Build-Depends: apr
+Description: Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns server.
diff --git a/ports/activemq-cpp/FunctionLevelLinkingOn.diff b/ports/activemq-cpp/FunctionLevelLinkingOn.diff new file mode 100644 index 000000000..8d00b1da6 --- /dev/null +++ b/ports/activemq-cpp/FunctionLevelLinkingOn.diff @@ -0,0 +1,76 @@ +diff --git a/vs2010-build/activemq-cpp.vcxproj b/vs2010-build/activemq-cpp.vcxproj +index a43f072..54b4822 100644 +--- a/vs2010-build/activemq-cpp.vcxproj ++++ b/vs2010-build/activemq-cpp.vcxproj +@@ -2576,7 +2576,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> +@@ -2602,7 +2602,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> +@@ -2628,7 +2628,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> +@@ -2656,7 +2656,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> +@@ -2684,7 +2684,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> +@@ -2710,7 +2710,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> +@@ -2736,7 +2736,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> +@@ -2764,7 +2764,7 @@ + <AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <MinimalRebuild>false</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> +- <FunctionLevelLinking>false</FunctionLevelLinking> ++ <FunctionLevelLinking>true</FunctionLevelLinking> + <CreateHotpatchableImage>false</CreateHotpatchableImage> + <RuntimeTypeInfo>true</RuntimeTypeInfo> + <PrecompiledHeaderFile> diff --git a/ports/activemq-cpp/portfile.cmake b/ports/activemq-cpp/portfile.cmake new file mode 100644 index 000000000..b165efbcd --- /dev/null +++ b/ports/activemq-cpp/portfile.cmake @@ -0,0 +1,84 @@ +include(vcpkg_common_functions)
+
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ message(FATAL_ERROR "${PORT} does not currently support UWP")
+endif()
+
+set(VERSION 3.9.5)
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/activemq-cpp-library-${VERSION})
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.apache.org/dist/activemq/activemq-cpp/${VERSION}/activemq-cpp-library-${VERSION}-src.tar.bz2"
+ FILENAME "activemq-cpp-library-${VERSION}-src.tar.bz2"
+ SHA512 83692d3dfd5ecf557fc88d204a03bf169ce6180bcff27be41b09409b8f7793368ffbeed42d98ef6374c6b6b477d9beb8a4a9ac584df9e56725ec59ceceaa6ae2
+)
+
+vcpkg_extract_source_archive_ex(
+ OUT_SOURCE_PATH SOURCE_PATH
+ ARCHIVE ${ARCHIVE}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/FunctionLevelLinkingOn.diff
+)
+
+set(RELEASE_CONF "ReleaseDLL")
+set(DEBUG_CONF "DebugDLL")
+
+if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
+ set(BUILD_ARCH "Win32")
+ set(OUTPUT_DIR "Win32")
+elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
+ set(BUILD_ARCH "x64")
+ set(OUTPUT_DIR "Win64")
+else()
+ message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
+endif()
+
+
+vcpkg_build_msbuild(
+ PROJECT_PATH ${SOURCE_PATH}/vs2010-build/activemq-cpp.vcxproj
+ RELEASE_CONFIGURATION ${RELEASE_CONF}
+ DEBUG_CONFIGURATION ${DEBUG_CONF}
+ PLATFORM ${BUILD_ARCH}
+ USE_VCPKG_INTEGRATION
+)
+
+vcpkg_copy_pdbs()
+
+# Handle copyright
+file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/activemq-cpp)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/activemq-cpp/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/activemq-cpp/copyright)
+
+
+file(
+ COPY
+ ${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/activemq-cpp.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib
+)
+file(
+ COPY
+ ${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/activemq-cpp.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+)
+file(
+ COPY
+ ${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/activemq-cpp.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin
+)
+file(
+ COPY
+ ${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/activemq-cppd.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
+)
+file(
+ COPY
+ ${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/activemq-cppd.dll
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+)
+file(
+ COPY
+ ${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/activemq-cppd.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
+)
+
+file(COPY ${SOURCE_PATH}/src/main/activemq DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.h)
+file(COPY ${SOURCE_PATH}/src/main/cms DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.h)
+file(COPY ${SOURCE_PATH}/src/main/decaf DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.h)
diff --git a/ports/anax/CONTROL b/ports/anax/CONTROL index 12be38d11..459692ac5 100644 --- a/ports/anax/CONTROL +++ b/ports/anax/CONTROL @@ -1,3 +1,3 @@ Source: anax -Version: 2.1.0-3 +Version: 2.1.0-4 Description: An open source C++ entity system. <https://github.com/miguelmartin75/anax> diff --git a/ports/anax/portfile.cmake b/ports/anax/portfile.cmake index 8881957fc..49fbb372d 100644 --- a/ports/anax/portfile.cmake +++ b/ports/anax/portfile.cmake @@ -1,11 +1,3 @@ -# 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) vcpkg_from_github( @@ -14,17 +6,15 @@ vcpkg_from_github( REF v2.1.0 SHA512 b573733b5f9634bf8cfc5b0715074f9a8ee29ecb48dc981d9371254a1f6ff8afbbb9ba6aa0877d53e518e5486ecc398a6d331fb9b5dbfd17d8707679216e11a3 HEAD_REF master -) - -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES ${CMAKE_CURRENT_LIST_DIR}/Add-bin-output.patch + PATCHES + Add-bin-output.patch ) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + DISABLE_PARALLEL_CONFIGURE OPTIONS - -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON + -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON ) vcpkg_install_cmake() diff --git a/ports/angle/CMakeLists.txt b/ports/angle/CMakeLists.txt index 82caf9289..f83f6294e 100644 --- a/ports/angle/CMakeLists.txt +++ b/ports/angle/CMakeLists.txt @@ -6,11 +6,6 @@ if(WIN32 AND NOT WINDOWS_STORE) else()
set(WINDOWS_DESKTOP 0)
endif()
-if (WINDOWS_DESKTOP OR WINDOWS_STORE)
- set(WINDOWS_ANY 1)
-else()
- set(WINDOWS_ANY 0)
-endif()
if(UNIX AND NOT APPLE)
set(LINUX 1)
@@ -18,7 +13,7 @@ else() set(LINUX 0)
endif()
-if(WINDOWS_ANY)
+if(MSVC)
add_compile_options(/d2guard4 /Wv:18 /guard:cf /permissive)
else()
set(CMAKE_CXX_STANDARD 17)
@@ -46,7 +41,7 @@ include_directories(include src ${CMAKE_CURRENT_BINARY_DIR}/include) ##########
# angle::common
-if(WINDOWS_ANY)
+if(WIN32)
set(ANGLE_COMMON_PLATFORM_FILTER "_linux|_mac|_posix")
elseif(LINUX)
set(ANGLE_COMMON_PLATFORM_FILTER "_win|_mac")
@@ -152,7 +147,7 @@ if(WINDOWS_DESKTOP OR LINUX OR APPLE) endif()
# D3D Renderers
-if(WINDOWS_ANY)
+if(WIN32)
## All D3D Sources
file(GLOB_RECURSE LIBANGLE_D3D_SOURCES
"src/libANGLE/renderer/d3d/*.cpp"
@@ -197,7 +192,7 @@ if(WINDOWS_ANY) endif()
## Core libANGLE library
-if(WINDOWS_ANY)
+if(WIN32)
set(LIBANGLE_SOURCES_PLATFORM
"src/third_party/systeminfo/SystemInfo.cpp"
)
@@ -296,7 +291,7 @@ add_library(libEGL )
target_link_libraries(libEGL PRIVATE angle::common angle::libANGLE libGLESv2)
target_include_directories(libEGL PUBLIC "$<INSTALL_INTERFACE:include>")
-target_include_directories(libEGL PUBLIC "${CMAKE_CURRENT_LIST_DIR}/include")
+target_include_directories(libEGL PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>")
SET_TARGET_PROPERTIES(libANGLE PROPERTIES PREFIX "")
@@ -309,7 +304,7 @@ install(TARGETS libEGL libGLESv2 EXPORT ANGLEExport ARCHIVE DESTINATION lib
)
-#install(EXPORT ANGLEExport FILE unofficial-angle-config.cmake NAMESPACE unofficial::angle:: DESTINATION share/unofficial-angle)
+install(EXPORT ANGLEExport FILE unofficial-angle-config.cmake NAMESPACE unofficial::angle:: DESTINATION share/unofficial-angle)
if(NOT DISABLE_INSTALL_HEADERS)
install(
@@ -322,4 +317,3 @@ if(NOT DISABLE_INSTALL_HEADERS) PATTERN "export.h" EXCLUDE
)
endif()
-
diff --git a/ports/angle/CONTROL b/ports/angle/CONTROL index afdb07262..8fd8e8523 100644 --- a/ports/angle/CONTROL +++ b/ports/angle/CONTROL @@ -1,5 +1,5 @@ Source: angle
-Version: 2019-03-13-c2ee2cc-1
+Version: 2019-03-13-c2ee2cc-2
Description: A conformant OpenGL ES implementation for Windows, Mac and Linux.
The goal of ANGLE is to allow users of multiple operating systems to seamlessly run WebGL and other OpenGL ES content by translating OpenGL ES API calls to one of the hardware-supported APIs available for that platform. ANGLE currently provides translation from OpenGL ES 2.0 and 3.0 to desktop OpenGL, OpenGL ES, Direct3D 9, and Direct3D 11. Support for translation from OpenGL ES to Vulkan is underway, and future plans include compute shader support (ES 3.1) and MacOS support.
Build-Depends: egl-registry
diff --git a/ports/angle/portfile.cmake b/ports/angle/portfile.cmake index 3799a24b7..2ad6a7553 100644 --- a/ports/angle/portfile.cmake +++ b/ports/angle/portfile.cmake @@ -20,17 +20,16 @@ vcpkg_from_github( REPO google/angle
REF chromium/3672
SHA512 dd6a05f0f1f4544b8646c41ffcb4d5e3b41f5261771ada47889345a24d4e55e6370df55a26c354a7073efcde307644cec6c6064ea6fe498ed6b52c3017249f81
-)
-vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES ${CMAKE_CURRENT_LIST_DIR}/001-fix-uwp.patch
+ PATCHES
+ 001-fix-uwp.patch
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY ${CMAKE_CURRENT_LIST_DIR}/commit.h DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS_DEBUG -DDISABLE_INSTALL_HEADERS=1
OPTIONS
-D${ANGLE_CPU_BITNESS}=1
@@ -38,8 +37,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake()
-#vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-angle)
-#file(RENAME ${CURRENT_PACKAGES_DIR}/share/angle ${CURRENT_PACKAGES_DIR}/share/unofficial-angle)
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-angle TARGET_PATH share/unofficial-angle)
vcpkg_copy_pdbs()
diff --git a/ports/arrow/CONTROL b/ports/arrow/CONTROL index cedc63bf4..aaf6c0535 100644 --- a/ports/arrow/CONTROL +++ b/ports/arrow/CONTROL @@ -1,4 +1,4 @@ Source: arrow -Version: 0.11.1 +Version: 0.13.0 Build-Depends: boost-system, boost-filesystem, boost-multiprecision, boost-algorithm, flatbuffers, rapidjson, zlib, lz4, brotli, zstd, snappy, gflags, thrift, double-conversion, glog Description: Apache Arrow is a columnar in-memory analytics layer designed to accelerate big data. It houses a set of canonical in-memory representations of flat and hierarchical data along with multiple language-bindings for structure manipulation. It also provides IPC and common algorithm implementations. diff --git a/ports/arrow/all.patch b/ports/arrow/all.patch index 31be15f5b..2e994af9b 100644 --- a/ports/arrow/all.patch +++ b/ports/arrow/all.patch @@ -1,1350 +1,297 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 4448b98..d6aa484 100644 +index 52081c4..e1e13b5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -743,10 +743,10 @@ elseif (PTHREAD_LIBRARY) - # linking order. - set(ARROW_LINK_LIBS - ${ARROW_LINK_LIBS} -- ${PTHREAD_LIBRARY}) -+ pthreadshared) - set(ARROW_STATIC_LINK_LIBS - ${ARROW_STATIC_LINK_LIBS} -- ${PTHREAD_LIBRARY}) -+ pthreadshared) +@@ -804,6 +804,9 @@ if(ARROW_USE_GLOG) + list(APPEND ARROW_LINK_LIBS GLOG::glog) + list(APPEND ARROW_STATIC_LINK_LIBS GLOG::glog) + list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS GLOG::glog) ++ if(ARROW_NEED_GFLAGS) ++ list(APPEND ARROW_STATIC_LINK_LIBS gflags::gflags) ++ endif() + add_definitions("-DARROW_USE_GLOG") endif() - ############################################################ -@@ -780,3 +780,4 @@ endif() - if(ARROW_GANDIVA) - add_subdirectory(src/gandiva) - endif() -+ diff --git a/cmake_modules/FindBrotli.cmake b/cmake_modules/FindBrotli.cmake -index ea971f0..e8dfb3c 100644 +index e1429a2..6dee036 100644 --- a/cmake_modules/FindBrotli.cmake +++ b/cmake_modules/FindBrotli.cmake -@@ -39,57 +39,27 @@ elseif ( Brotli_HOME ) - endif() - - find_path( BROTLI_INCLUDE_DIR NAMES brotli/decode.h -- PATHS ${_brotli_roots} -- NO_DEFAULT_PATH - PATH_SUFFIXES "include" ) - --find_library( BROTLI_LIBRARY_ENC NAMES libbrotlienc.a libbrotlienc-static.a brotlienc -- PATHS ${_brotli_roots} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib" ) -+find_library( BROTLI_LIBRARY_ENC NAMES libbrotlienc libbrotlienc-static brotlienc brotlienc-static -+ PATH_SUFFIXES "lib" ) +@@ -18,6 +18,7 @@ + # find_package(Brotli) --find_library( BROTLI_LIBRARY_DEC NAMES libbrotlidec.a libbrotlidec-static.a brotlidec -- PATHS ${_brotli_roots} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib" ) -+find_library( BROTLI_LIBRARY_DEC NAMES libbrotlidec libbrotlidec-static brotlidec brotlidec-static -+ PATH_SUFFIXES "lib" ) - --find_library( BROTLI_LIBRARY_COMMON NAMES libbrotlicommon.a libbrotlicommon-static.a brotlicommon -- PATHS ${_brotli_roots} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib" ) -+find_library( BROTLI_LIBRARY_COMMON NAMES libbrotlicommon libbrotlicommon-static brotlicommon brotlicommon-static -+ PATH_SUFFIXES "lib" ) - - set(BROTLI_LIBRARIES ${BROTLI_LIBRARY_ENC} ${BROTLI_LIBRARY_DEC} - ${BROTLI_LIBRARY_COMMON}) -- -+ - if (BROTLI_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR BROTLI_LIBRARIES)) - set(BROTLI_FOUND TRUE) -- get_filename_component( BROTLI_LIBS ${BROTLI_LIBRARY_ENC} PATH ) -- set(BROTLI_LIB_NAME brotli) -- if (BROTLI_MSVC_STATIC_LIB_SUFFIX) -- set(BROTLI_STATIC_LIB_SUFFIX "${BROTLI_MSVC_STATIC_LIB_SUFFIX}") -- endif() -- if (NOT BROTLI_STATIC_LIB_SUFFIX) -- if (EXISTS "${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}enc-static${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(BROTLI_STATIC_LIB_SUFFIX -static) -- else() -- if (MSVC) -- set(BROTLI_STATIC_LIB_SUFFIX _static) -- else() -- set(BROTLI_STATIC_LIB_SUFFIX "") -- endif() -- endif() -- endif() -- set(BROTLI_STATIC_LIB -- ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}enc${BROTLI_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}dec${BROTLI_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}common${BROTLI_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) -- set(BROTLI_STATIC_LIBRARY_ENC ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}enc${BROTLI_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) -- set(BROTLI_STATIC_LIBRARY_DEC ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}dec${BROTLI_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) -- set(BROTLI_STATIC_LIBRARY_COMMON ${BROTLI_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${BROTLI_LIB_NAME}common${BROTLI_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) -- set(BROTLI_SHARED_LIB -- ${BROTLI_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${BROTLI_LIB_NAME}enc${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${BROTLI_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${BROTLI_LIB_NAME}dec${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${BROTLI_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${BROTLI_LIB_NAME}common${CMAKE_SHARED_LIBRARY_SUFFIX}) -+ set(BROTLI_STATIC_LIB ${BROTLI_LIBRARIES}) -+ set(BROTLI_STATIC_LIBRARY_ENC ${BROTLI_LIBRARY_ENC}) -+ set(BROTLI_STATIC_LIBRARY_DEC ${BROTLI_LIBRARY_DEC}) -+ set(BROTLI_STATIC_LIBRARY_COMMON ${BROTLI_LIBRARY_COMMON}) -+ set(BROTLI_SHARED_LIB ${BROTLI_LIBRARIES}) - else () - set(BROTLI_FOUND FALSE) - endif () -diff --git a/cmake_modules/FindFlatbuffers.cmake b/cmake_modules/FindFlatbuffers.cmake -index 975c869..9cee8a0 100644 ---- a/cmake_modules/FindFlatbuffers.cmake -+++ b/cmake_modules/FindFlatbuffers.cmake -@@ -31,31 +31,26 @@ - # FLATBUFFERS_STATIC_LIB, path to libflatbuffers.a - # FLATBUFFERS_FOUND, whether flatbuffers has been found - --if( NOT "${FLATBUFFERS_HOME}" STREQUAL "") -- file( TO_CMAKE_PATH "${FLATBUFFERS_HOME}" _native_path ) -- list( APPEND _flatbuffers_roots "${_native_path}" ) --elseif ( Flatbuffers_HOME ) -- list( APPEND _flatbuffers_roots "${Flatbuffers_HOME}" ) -+if(WIN32) -+ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(FLATBUFFERS_LIB_SUFFIX mdd) -+ else() -+ set(FLATBUFFERS_LIB_SUFFIX md) -+ endif() -+else() -+ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(FLATBUFFERS_LIB_SUFFIX "d") -+ else() -+ set(FLATBUFFERS_LIB_SUFFIX "") -+ endif() + pkg_check_modules(BROTLI_PC libbrotlicommon libbrotlienc libbrotlidec) ++ + if(BROTLI_PC_FOUND) + set(BROTLI_INCLUDE_DIR "${BROTLI_PC_libbrotlicommon_INCLUDEDIR}") + +@@ -25,80 +26,16 @@ if(BROTLI_PC_FOUND) + list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlicommon_LIBDIR}") + list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlienc_LIBDIR}") + list(APPEND BROTLI_PC_LIBRARY_DIRS "${BROTLI_PC_libbrotlidec_LIBDIR}") +- +- find_library(BROTLI_COMMON_LIBRARY brotlicommon +- PATHS ${BROTLI_PC_LIBRARY_DIRS} +- NO_DEFAULT_PATH) +- find_library(BROTLI_ENC_LIBRARY brotlienc +- PATHS ${BROTLI_PC_LIBRARY_DIRS} +- NO_DEFAULT_PATH) +- find_library(BROTLI_DEC_LIBRARY brotlidec +- PATHS ${BROTLI_PC_LIBRARY_DIRS} +- NO_DEFAULT_PATH) + elseif(BROTLI_ROOT) +- find_library( +- BROTLI_COMMON_LIBRARY +- NAMES brotlicommon +- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlicommon${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon-static${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon_static${CMAKE_STATIC_LIBRARY_SUFFIX} +- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" +- PATH_SUFFIXES "lib64" "lib" "bin" +- NO_DEFAULT_PATH) +- find_library( +- BROTLI_ENC_LIBRARY +- NAMES brotlienc +- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlienc${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc-static${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc_static${CMAKE_STATIC_LIBRARY_SUFFIX} +- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" +- PATH_SUFFIXES "lib64" "lib" "bin" +- NO_DEFAULT_PATH) +- find_library( +- BROTLI_DEC_LIBRARY +- NAMES brotlidec +- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlidec${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec-static${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec_static${CMAKE_STATIC_LIBRARY_SUFFIX} +- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" +- PATH_SUFFIXES "lib64" "lib" "bin" +- NO_DEFAULT_PATH) +- find_path(BROTLI_INCLUDE_DIR +- NAMES brotli/decode.h +- PATHS ${BROTLI_ROOT} "${BROTLI_ROOT}/Library" +- NO_DEFAULT_PATH +- PATH_SUFFIXES "include") ++ find_path(BROTLI_INCLUDE_DIR NAMES brotli/decode.h PATH_SUFFIXES "include") + else() +- find_library( +- BROTLI_COMMON_LIBRARY +- NAMES brotlicommon +- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlicommon${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon-static${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon_static${CMAKE_STATIC_LIBRARY_SUFFIX} +- PATH_SUFFIXES "lib64" "lib" "bin") +- find_library( +- BROTLI_ENC_LIBRARY +- NAMES brotlienc +- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlienc${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc-static${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc_static${CMAKE_STATIC_LIBRARY_SUFFIX} +- PATH_SUFFIXES "lib64" "lib" "bin") +- find_library( +- BROTLI_DEC_LIBRARY +- NAMES brotlidec +- ${CMAKE_SHARED_LIBRARY_PREFIX}brotlidec${CMAKE_SHARED_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec-static${CMAKE_STATIC_LIBRARY_SUFFIX} +- ${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec_static${CMAKE_STATIC_LIBRARY_SUFFIX} +- PATH_SUFFIXES "lib64" "lib" "bin") + find_path(BROTLI_INCLUDE_DIR NAMES brotli/decode.h PATH_SUFFIXES "include") endif() --# Try the parameterized roots, if they exist --if ( _flatbuffers_roots ) -- find_path( FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h -- PATHS "${_flatbuffers_roots}" NO_DEFAULT_PATH -- PATH_SUFFIXES "include" ) -- find_library( FLATBUFFERS_LIBRARIES NAMES flatbuffers -- PATHS "${_flatbuffers_roots}" NO_DEFAULT_PATH -- PATH_SUFFIXES "lib" "lib64") --else () -- find_path( FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h ) -- find_library( FLATBUFFERS_LIBRARIES NAMES flatbuffers ) --endif () -+find_path( FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h ) -+find_library( FLATBUFFERS_LIBRARIES NAMES flatbuffers ) - - find_program(FLATBUFFERS_COMPILER flatc -- "${FLATBUFFERS_HOME}/bin" -- /usr/local/bin -- /usr/bin -- NO_DEFAULT_PATH -+ PATH_SUFFIXES -+ "${FLATBUFFERS_HOME}/tools/flatbuffers" - ) - - if (FLATBUFFERS_INCLUDE_DIR AND FLATBUFFERS_LIBRARIES) -diff --git a/cmake_modules/FindGLOG.cmake b/cmake_modules/FindGLOG.cmake -index f22e4df..53e545b 100644 ---- a/cmake_modules/FindGLOG.cmake -+++ b/cmake_modules/FindGLOG.cmake -@@ -29,11 +29,6 @@ - # GLOG_STATIC_LIB, path to libglog.a - # GLOG_FOUND, whether glog has been found - --if( NOT "${GLOG_HOME}" STREQUAL "") -- file( TO_CMAKE_PATH "${GLOG_HOME}" _native_path ) -- list( APPEND _glog_roots ${_native_path} ) --endif() -- - message(STATUS "GLOG_HOME: ${GLOG_HOME}") - # Try the parameterized roots, if they exist - if ( _glog_roots ) -@@ -43,10 +38,10 @@ if ( _glog_roots ) - endif () - - find_path( GLOG_INCLUDE_DIR NAMES glog/logging.h -- PATHS ${_glog_roots} NO_DEFAULT_PATH -+ PATHS ${_glog_roots} - PATH_SUFFIXES "include" ) - find_library( GLOG_LIBRARIES NAMES glog -- PATHS ${_glog_roots} NO_DEFAULT_PATH -+ PATHS ${_glog_roots} - PATH_SUFFIXES ${lib_dirs}) - else () - find_path( GLOG_INCLUDE_DIR NAMES glog/logging.h ) ++find_library(BROTLI_COMMON_LIBRARY NAMES brotlicommon brotlicommon-static libbrotlicommon libbrotlicommon-static) ++find_library(BROTLI_ENC_LIBRARY NAMES libbrotlienc libbrotlienc-static brotlienc brotlienc-static) ++find_library(BROTLI_DEC_LIBRARY NAMES brotlidec libbrotlidec libbrotlidec-static brotlidec brotlidec-static) ++ + find_package_handle_standard_args(Brotli + REQUIRED_VARS + BROTLI_COMMON_LIBRARY diff --git a/cmake_modules/FindLz4.cmake b/cmake_modules/FindLz4.cmake -index 3a89c8d..1e068b4 100644 +index 3606f5c..1d18b7c 100644 --- a/cmake_modules/FindLz4.cmake +++ b/cmake_modules/FindLz4.cmake -@@ -29,23 +29,16 @@ elseif ( Lz4_HOME ) - list( APPEND _lz4_roots ${Lz4_HOME} ) +@@ -19,24 +19,26 @@ if(MSVC AND NOT DEFINED LZ4_MSVC_STATIC_LIB_SUFFIX) + set(LZ4_MSVC_STATIC_LIB_SUFFIX "_static") endif() --if (MSVC AND NOT DEFINED LZ4_MSVC_STATIC_LIB_SUFFIX) -- set(LZ4_MSVC_STATIC_LIB_SUFFIX "_static") +-set(LZ4_STATIC_LIB_SUFFIX "${LZ4_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") +if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(LZ4_LIB_NAME lz4d) -+else() -+ set(LZ4_LIB_NAME lz4) - endif() - --set(LZ4_STATIC_LIB_SUFFIX -- "${LZ4_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") -- --set(LZ4_STATIC_LIB_NAME -- ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_STATIC_LIB_SUFFIX}) -- - find_path(LZ4_INCLUDE_DIR NAMES lz4.h -- PATHS ${_lz4_roots} -- NO_DEFAULT_PATH - PATH_SUFFIXES "include" ) --find_library(LZ4_STATIC_LIB NAMES ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} -- PATHS ${_lz4_roots} -- NO_DEFAULT_PATH -+ -+find_library(LZ4_STATIC_LIB NAMES ${LZ4_LIB_NAME} - PATH_SUFFIXES "lib" ) - - include(FindPackageHandleStandardArgs) -diff --git a/cmake_modules/FindSnappy.cmake b/cmake_modules/FindSnappy.cmake -index 867963c..fd45321 100644 ---- a/cmake_modules/FindSnappy.cmake -+++ b/cmake_modules/FindSnappy.cmake -@@ -31,31 +31,23 @@ - # SNAPPY_SHARED_LIB, path to libsnappy's shared library - # SNAPPY_FOUND, whether snappy has been found - --if( NOT "${SNAPPY_HOME}" STREQUAL "") -- file( TO_CMAKE_PATH "${SNAPPY_HOME}" _native_path ) -- list( APPEND _snappy_roots ${_native_path} ) --elseif ( Snappy_HOME ) -- list( APPEND _snappy_roots ${Snappy_HOME} ) --endif() -- --message(STATUS "SNAPPY_HOME: ${SNAPPY_HOME}") --find_path(SNAPPY_INCLUDE_DIR snappy.h HINTS -- ${_snappy_roots} -- NO_DEFAULT_PATH -+find_path(SNAPPY_INCLUDE_DIR snappy.h - PATH_SUFFIXES "include") - --find_library( SNAPPY_LIBRARIES NAMES snappy PATHS -- ${_snappy_roots} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "lib") -+if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(SNAPPY_LIB_NAME snappyd) -+else() -+ set(SNAPPY_LIB_NAME snappy) ++ set(LZ4_LIB_NAME_DEBUG_SUFFIX d) +endif() -+ -+find_library( SNAPPY_LIBRARIES NAMES ${SNAPPY_LIB_NAME} PATH_SUFFIXES "lib") - if (SNAPPY_INCLUDE_DIR AND (PARQUET_MINIMAL_DEPENDENCY OR SNAPPY_LIBRARIES)) - set(SNAPPY_FOUND TRUE) - get_filename_component( SNAPPY_LIBS ${SNAPPY_LIBRARIES} PATH ) - set(SNAPPY_HEADER_NAME snappy.h) - set(SNAPPY_HEADER ${SNAPPY_INCLUDE_DIR}/${SNAPPY_HEADER_NAME}) -- set(SNAPPY_LIB_NAME snappy) -- set(SNAPPY_STATIC_LIB ${SNAPPY_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_LIB_NAME}${SNAPPY_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) -+ set(SNAPPY_STATIC_LIB ${SNAPPY_LIBS}/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}) - set(SNAPPY_SHARED_LIB ${SNAPPY_LIBS}/${CMAKE_SHARED_LIBRARY_PREFIX}${SNAPPY_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) - else () - set(SNAPPY_FOUND FALSE) +-set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_STATIC_LIB_SUFFIX}) ++set(LZ4_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}lz4${LZ4_MSVC_STATIC_LIB_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}) + + pkg_check_modules(LZ4_PC liblz4) + if(LZ4_PC_FOUND) + set(LZ4_INCLUDE_DIR "${LZ4_PC_INCLUDEDIR}") + + list(APPEND LZ4_PC_LIBRARY_DIRS "${LZ4_PC_LIBDIR}") +- find_library(LZ4_LIB lz4 ++ find_library(LZ4_LIB lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} + PATHS ${LZ4_PC_LIBRARY_DIRS} + NO_DEFAULT_PATH + PATH_SUFFIXES "${CMAKE_LIBRARY_ARCHITECTURE}") + elseif(LZ4_ROOT) + find_library( + LZ4_LIB +- NAMES lz4 ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} +- "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" ++ NAMES lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} ++ "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}" + PATHS ${LZ4_ROOT} "${LZ4_ROOT}/Library" + PATH_SUFFIXES "lib64" "lib" "bin" + NO_DEFAULT_PATH) +@@ -48,8 +50,8 @@ elseif(LZ4_ROOT) + else() + find_library( + LZ4_LIB +- NAMES lz4 ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} +- "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}" ++ NAMES lz4${LZ4_LIB_NAME_DEBUG_SUFFIX} ${LZ4_STATIC_LIB_NAME} lib${LZ4_STATIC_LIB_NAME} ++ "${CMAKE_SHARED_LIBRARY_PREFIX}lz4_static${CMAKE_SHARED_LIBRARY_SUFFIX}${LZ4_LIB_NAME_DEBUG_SUFFIX}" + PATH_SUFFIXES "lib64" "lib" "bin") + find_path(LZ4_INCLUDE_DIR NAMES lz4.h PATH_SUFFIXES "include") + endif() diff --git a/cmake_modules/FindThrift.cmake b/cmake_modules/FindThrift.cmake -index 5402766..6cff9fa 100644 +index a4decf7..78ec7c8 100644 --- a/cmake_modules/FindThrift.cmake +++ b/cmake_modules/FindThrift.cmake -@@ -28,41 +28,31 @@ - # THRIFT_STATIC_LIB, THRIFT static library - # THRIFT_FOUND, If false, do not try to use ant - --# prefer the thrift version supplied in THRIFT_HOME --if( NOT "${THRIFT_HOME}" STREQUAL "") -- file( TO_CMAKE_PATH "${THRIFT_HOME}" _native_path ) -- list( APPEND _thrift_roots ${_native_path} ) --elseif ( Thrift_HOME ) -- list( APPEND _thrift_roots ${Thrift_HOME} ) --endif() -- --message(STATUS "THRIFT_HOME: ${THRIFT_HOME}") --find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h HINTS -- ${_thrift_roots} -- NO_DEFAULT_PATH -+find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h - PATH_SUFFIXES "include" - ) - --find_path(THRIFT_CONTRIB_DIR share/fb303/if/fb303.thrift HINTS -- ${_thrift_roots} -- NO_DEFAULT_PATH --) -- --if (MSVC AND NOT THRIFT_MSVC_STATIC_LIB_SUFFIX) -- set(THRIFT_MSVC_STATIC_LIB_SUFFIX md) -+if(WIN32) -+ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(THRIFT_LIB_SUFFIX mdd) -+ else() -+ set(THRIFT_LIB_SUFFIX md) -+ endif() -+else() -+ if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(THRIFT_LIB_SUFFIX "d") -+ else() -+ set(THRIFT_LIB_SUFFIX "") -+ endif() +@@ -65,6 +65,10 @@ if(MSVC AND NOT THRIFT_MSVC_STATIC_LIB_SUFFIX) + set(THRIFT_MSVC_STATIC_LIB_SUFFIX md) endif() - find_library(THRIFT_STATIC_LIB NAMES -- ${CMAKE_STATIC_LIBRARY_PREFIX}thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} -- HINTS ${_thrift_roots} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib" -+ thrift${THRIFT_LIB_SUFFIX} -+ PATH_SUFFIXES lib - ) - - find_program(THRIFT_COMPILER thrift HINTS -- ${_thrift_roots} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "bin" -+ PATH_SUFFIXES "tools" - ) - - function(EXTRACT_THRIFT_VERSION) -@@ -111,7 +101,6 @@ else () - endif () - endif () - -- - mark_as_advanced( - THRIFT_STATIC_LIB - THRIFT_COMPILER -diff --git a/cmake_modules/FindZLIB.cmake b/cmake_modules/FindZLIB.cmake -index ca6060b..85a4585 100644 ---- a/cmake_modules/FindZLIB.cmake -+++ b/cmake_modules/FindZLIB.cmake -@@ -30,43 +30,15 @@ - # ZLIB_SHARED_LIB, path to libz's shared library - # ZLIB_FOUND, whether zlib has been found - --if( NOT "${ZLIB_HOME}" STREQUAL "") -- file( TO_CMAKE_PATH "${ZLIB_HOME}" _native_path ) -- list( APPEND _zlib_roots ${_native_path} ) --elseif ( ZLIB_HOME ) -- list( APPEND _zlib_roots ${ZLIB_HOME} ) +if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(ZLIB_LIB_NAME_SUFFIX "d") -+else() -+ set(ZLIB_LIB_NAME_SUFFIX "") - endif() - --if (MSVC) -- # zlib uses zlib.lib for Windows. -- set(ZLIB_LIB_NAME zlib.lib) --else () -- # zlib uses libz.so for non Windows. -- set(ZLIB_LIB_NAME -- ${CMAKE_SHARED_LIBRARY_PREFIX}z${CMAKE_SHARED_LIBRARY_SUFFIX}) --endif () -- - # Try the parameterized roots, if they exist --if (_zlib_roots) -- find_path(ZLIB_INCLUDE_DIR NAMES zlib.h -- PATHS ${_zlib_roots} NO_DEFAULT_PATH -- PATH_SUFFIXES "include") -- find_library(ZLIB_SHARED_LIB -- NAMES ${ZLIB_LIB_NAME} -- PATHS ${_zlib_roots} NO_DEFAULT_PATH -- PATH_SUFFIXES "lib") --else () -- pkg_check_modules(PKG_ZLIB zlib) -- if (PKG_ZLIB_FOUND) -- set(ZLIB_INCLUDE_DIR ${PKG_ZLIB_INCLUDEDIR}) -- find_library(ZLIB_SHARED_LIB -- NAMES ${ZLIB_LIB_NAME} -- PATHS ${PKG_ZLIB_LIBDIR} NO_DEFAULT_PATH) -- else () -- find_path(ZLIB_INCLUDE_DIR NAMES zlib.h) -- find_library(ZLIB_SHARED_LIB NAMES ${ZLIB_LIB_NAME}) -- endif () --endif () -+find_path(ZLIB_INCLUDE_DIR NAMES zlib.h PATH_SUFFIXES "include") -+find_library(ZLIB_SHARED_LIB NAMES z zlib${ZLIB_LIB_NAME_SUFFIX} PATH_SUFFIXES "lib") - - if (ZLIB_INCLUDE_DIR AND ZLIB_SHARED_LIB) - set(ZLIB_FOUND TRUE) ++ set(THRIFT_LIB_NAME_DEBUG_SUFFIX d) ++endif() ++ + pkg_check_modules(THRIFT_PC thrift) + + # THRIFT-4760: The pkgconfig files are currently only installed when using autotools. +@@ -74,15 +78,13 @@ if(THRIFT_PC_FOUND) + + list(APPEND THRIFT_PC_LIBRARY_DIRS "${THRIFT_PC_LIBDIR}") + +- find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} +- PATHS ${THRIFT_PC_LIBRARY_DIRS} +- NO_DEFAULT_PATH) ++ find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} ++ PATHS ${THRIFT_PC_LIBRARY_DIRS}) + find_program(THRIFT_COMPILER thrift + HINTS ${THRIFT_PC_PREFIX} +- NO_DEFAULT_PATH + PATH_SUFFIXES "bin") + else() +- find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX} ++ find_library(THRIFT_STATIC_LIB thrift${THRIFT_MSVC_STATIC_LIB_SUFFIX}${THRIFT_LIB_NAME_DEBUG_SUFFIX} + HINTS ${Thrift_ROOT} + PATH_SUFFIXES "lib/${CMAKE_LIBRARY_ARCHITECTURE}" "lib") + find_path(THRIFT_INCLUDE_DIR thrift/Thrift.h diff --git a/cmake_modules/FindZSTD.cmake b/cmake_modules/FindZSTD.cmake -index 810e5c0..d272d8f 100644 +index 17b58a3..fa2ab05 100644 --- a/cmake_modules/FindZSTD.cmake +++ b/cmake_modules/FindZSTD.cmake -@@ -22,30 +22,16 @@ - # ZSTD_STATIC_LIB, path to libzstd static library - # ZSTD_FOUND, whether zstd has been found - --if( NOT "${ZSTD_HOME}" STREQUAL "") -- file( TO_CMAKE_PATH "${ZSTD_HOME}" _native_path ) -- list( APPEND _zstd_roots ${_native_path} ) --elseif ( ZStd_HOME ) -- list( APPEND _zstd_roots ${ZStd_HOME} ) --endif() -+find_path(ZSTD_INCLUDE_DIR NAMES zstd.h -+ PATH_SUFFIXES "include" ) - --if (MSVC AND NOT DEFINED ZSTD_MSVC_STATIC_LIB_SUFFIX) -- set(ZSTD_MSVC_STATIC_LIB_SUFFIX "_static") -+if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") -+ set(ZSTD_LIB_NAME_SUFFIX "d") -+else() -+ set(ZSTD_LIB_NAME_SUFFIX "") +@@ -19,7 +19,11 @@ if(MSVC AND NOT DEFINED ZSTD_MSVC_STATIC_LIB_SUFFIX) + set(ZSTD_MSVC_STATIC_LIB_SUFFIX "_static") endif() --set(ZSTD_STATIC_LIB_SUFFIX -- "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") -- --set(ZSTD_STATIC_LIB_NAME -- ${CMAKE_STATIC_LIBRARY_PREFIX}zstd${ZSTD_STATIC_LIB_SUFFIX}) -- --find_path(ZSTD_INCLUDE_DIR NAMES zstd.h -- PATHS ${_zstd_roots} -- NO_DEFAULT_PATH -- PATH_SUFFIXES "include" ) --find_library(ZSTD_STATIC_LIB NAMES ${ZSTD_STATIC_LIB_NAME} lib${ZSTD_STATIC_LIB_NAME} -- PATHS ${_zstd_roots} -- NO_DEFAULT_PATH -+find_library(ZSTD_STATIC_LIB NAMES zstd${ZSTD_LIB_NAME_SUFFIX} zstd_static${ZSTD_LIB_NAME_SUFFIX} - PATH_SUFFIXES "lib" ) - - include(FindPackageHandleStandardArgs) -diff --git a/cmake_modules/Finddouble-conversion.cmake b/cmake_modules/Finddouble-conversion.cmake -new file mode 100644 -index 0000000..4fa0995 ---- /dev/null -+++ b/cmake_modules/Finddouble-conversion.cmake -@@ -0,0 +1,23 @@ -+# Licensed to the Apache Software Foundation (ASF) under one -+# or more contributor license agreements. See the NOTICE file -+# distributed with this work for additional information -+# regarding copyright ownership. The ASF licenses this file -+# to you under the Apache License, Version 2.0 (the -+# "License"); you may not use this file except in compliance -+# with the License. You may obtain a copy of the License at -+# -+# http://www.apache.org/licenses/LICENSE-2.0 -+# -+# Unless required by applicable law or agreed to in writing, -+# software distributed under the License is distributed on an -+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -+# KIND, either express or implied. See the License for the -+# specific language governing permissions and limitations -+# under the License. -+ -+find_path(DOUBLE_CONVERSION_INCLUDE_DIR NAMES double-conversion.h PATH_SUFFIXES "include/double-conversion" ) -+ -+find_library(DOUBLE_CONVERSION_STATIC_LIB NAMES double-conversion PATH_SUFFIXES "lib" ) -+ -+include(FindPackageHandleStandardArgs) -+find_package_handle_standard_args(DOUBLE_CONVERSION REQUIRED_VARS DOUBLE_CONVERSION_STATIC_LIB DOUBLE_CONVERSION_INCLUDE_DIR) -diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake -index 1c7cd62..572f6e1 100644 ---- a/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cmake_modules/ThirdpartyToolchain.cmake -@@ -302,6 +302,8 @@ if (WIN32) - else() - find_library(PTHREAD_LIBRARY pthread) - message(STATUS "Found pthread: ${PTHREAD_LIBRARY}") -+ add_library(pthreadshared SHARED IMPORTED) -+ set_target_properties(pthreadshared PROPERTIES IMPORTED_LOCATION ${PTHREAD_LIBRARY}) - endif() - - # ---------------------------------------------------------------------- -@@ -322,106 +324,56 @@ set(Boost_ADDITIONAL_VERSIONS - "1.61.0" "1.62" - "1.60.0" "1.60") - --if (ARROW_BOOST_VENDORED) -- set(BOOST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/boost_ep-prefix/src/boost_ep") -- set(BOOST_LIB_DIR "${BOOST_PREFIX}/stage/lib") -- set(BOOST_BUILD_LINK "static") -- set(BOOST_STATIC_SYSTEM_LIBRARY -- "${BOOST_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}boost_system${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(BOOST_STATIC_FILESYSTEM_LIBRARY -- "${BOOST_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}boost_filesystem${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(BOOST_STATIC_REGEX_LIBRARY -- "${BOOST_LIB_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}boost_regex${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(BOOST_SYSTEM_LIBRARY "${BOOST_STATIC_SYSTEM_LIBRARY}") -- set(BOOST_FILESYSTEM_LIBRARY "${BOOST_STATIC_FILESYSTEM_LIBRARY}") -- set(BOOST_REGEX_LIBRARY "${BOOST_STATIC_REGEX_LIBRARY}") -+if (MSVC) -+ # disable autolinking in boost -+ add_definitions(-DBOOST_ALL_NO_LIB) +-set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") ++if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") ++ set(ZSTD_LIB_NAME_DEBUG_SUFFIX d) +endif() -+if (ARROW_BOOST_USE_SHARED) -+ # Find shared Boost libraries. -+ set(Boost_USE_STATIC_LIBS OFF) -+ -+ if (MSVC) -+ # force all boost libraries to dynamic link -+ add_definitions(-DBOOST_ALL_DYN_LINK) -+ endif() + - if (ARROW_BOOST_HEADER_ONLY) -- set(BOOST_BUILD_PRODUCTS) -- set(BOOST_CONFIGURE_COMMAND "") -- set(BOOST_BUILD_COMMAND "") -+ find_package(Boost REQUIRED) - else() -- set(BOOST_BUILD_PRODUCTS -- ${BOOST_SYSTEM_LIBRARY} -- ${BOOST_FILESYSTEM_LIBRARY} -- ${BOOST_REGEX_LIBRARY}) -- set(BOOST_CONFIGURE_COMMAND -- "./bootstrap.sh" -- "--prefix=${BOOST_PREFIX}" -- "--with-libraries=filesystem,regex,system") -+ find_package(Boost COMPONENTS regex system filesystem REQUIRED) - if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") -- set(BOOST_BUILD_VARIANT "debug") -+ set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG}) -+ set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG}) -+ set(BOOST_SHARED_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_DEBUG}) - else() -- set(BOOST_BUILD_VARIANT "release") -+ set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE}) -+ set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE}) -+ set(BOOST_SHARED_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_RELEASE}) - endif() -- set(BOOST_BUILD_COMMAND -- "./b2" -- "link=${BOOST_BUILD_LINK}" -- "variant=${BOOST_BUILD_VARIANT}" -- "cxxflags=-fPIC") -+ set(BOOST_SYSTEM_LIBRARY boost_system_shared) -+ set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_shared) -+ set(BOOST_REGEX_LIBRARY boost_regex_shared) - endif() -- ExternalProject_Add(boost_ep -- URL ${BOOST_SOURCE_URL} -- BUILD_BYPRODUCTS ${BOOST_BUILD_PRODUCTS} -- BUILD_IN_SOURCE 1 -- CONFIGURE_COMMAND ${BOOST_CONFIGURE_COMMAND} -- BUILD_COMMAND ${BOOST_BUILD_COMMAND} -- INSTALL_COMMAND "" -- ${EP_LOG_OPTIONS}) -- set(Boost_INCLUDE_DIR "${BOOST_PREFIX}") -- set(Boost_INCLUDE_DIRS "${BOOST_INCLUDE_DIR}") -- add_dependencies(arrow_dependencies boost_ep) ++set(ZSTD_STATIC_LIB_SUFFIX "${ZSTD_MSVC_STATIC_LIB_SUFFIX}${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}") + set(ZSTD_STATIC_LIB_NAME ${CMAKE_STATIC_LIBRARY_PREFIX}zstd${ZSTD_STATIC_LIB_SUFFIX}) + + pkg_check_modules(ZSTD_PC libzstd) +@@ -27,18 +31,15 @@ if(ZSTD_PC_FOUND) + set(ZSTD_INCLUDE_DIR "${ZSTD_PC_INCLUDEDIR}") + + list(APPEND ZSTD_PC_LIBRARY_DIRS "${ZSTD_PC_LIBDIR}") +- find_library(ZSTD_LIB zstd ++ find_library(ZSTD_LIB zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} + PATHS ${ZSTD_PC_LIBRARY_DIRS} + NO_DEFAULT_PATH + PATH_SUFFIXES "${CMAKE_LIBRARY_ARCHITECTURE}") + elseif(ZSTD_ROOT) + message(STATUS "Using ZSTD_ROOT: ${ZSTD_ROOT}") + find_library(ZSTD_LIB +- NAMES zstd "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" +- "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" +- PATHS ${ZSTD_ROOT} "${ZSTD_ROOT}/Library" +- PATH_SUFFIXES "lib64" "lib" "bin" +- NO_DEFAULT_PATH) ++ NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" ++ "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") + find_path(ZSTD_INCLUDE_DIR + NAMES zstd.h + PATHS ${ZSTD_ROOT} "${ZSTD_ROOT}/Library" +@@ -46,9 +47,8 @@ elseif(ZSTD_ROOT) + PATH_SUFFIXES "include") else() -- if (MSVC) -- # disable autolinking in boost -- add_definitions(-DBOOST_ALL_NO_LIB) -- endif() -- if (ARROW_BOOST_USE_SHARED) -- # Find shared Boost libraries. -- set(Boost_USE_STATIC_LIBS OFF) -- -- if (MSVC) -- # force all boost libraries to dynamic link -- add_definitions(-DBOOST_ALL_DYN_LINK) -- endif() -- -- if (ARROW_BOOST_HEADER_ONLY) -- find_package(Boost REQUIRED) -- else() -- find_package(Boost COMPONENTS regex system filesystem REQUIRED) -- if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") -- set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG}) -- set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG}) -- set(BOOST_SHARED_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_DEBUG}) -- else() -- set(BOOST_SHARED_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE}) -- set(BOOST_SHARED_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE}) -- set(BOOST_SHARED_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_RELEASE}) -- endif() -- set(BOOST_SYSTEM_LIBRARY boost_system_shared) -- set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_shared) -- set(BOOST_REGEX_LIBRARY boost_regex_shared) -- endif() -+ # Find static boost headers and libs -+ # TODO Differentiate here between release and debug builds -+ set(Boost_USE_STATIC_LIBS ON) -+ if (ARROW_BOOST_HEADER_ONLY) -+ find_package(Boost REQUIRED) - else() -- # Find static boost headers and libs -- # TODO Differentiate here between release and debug builds -- set(Boost_USE_STATIC_LIBS ON) -- if (ARROW_BOOST_HEADER_ONLY) -- find_package(Boost REQUIRED) -+ find_package(Boost COMPONENTS regex system filesystem REQUIRED) -+ if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") -+ set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG}) -+ set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG}) -+ set(BOOST_STATIC_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_DEBUG}) - else() -- find_package(Boost COMPONENTS regex system filesystem REQUIRED) -- if ("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") -- set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_DEBUG}) -- set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_DEBUG}) -- set(BOOST_STATIC_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_DEBUG}) -- else() -- set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE}) -- set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE}) -- set(BOOST_STATIC_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_RELEASE}) -- endif() -- set(BOOST_SYSTEM_LIBRARY boost_system_static) -- set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_static) -- set(BOOST_REGEX_LIBRARY boost_regex_static) -+ set(BOOST_STATIC_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY_RELEASE}) -+ set(BOOST_STATIC_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY_RELEASE}) -+ set(BOOST_STATIC_REGEX_LIBRARY ${Boost_REGEX_LIBRARY_RELEASE}) - endif() -+ set(BOOST_SYSTEM_LIBRARY boost_system_static) -+ set(BOOST_FILESYSTEM_LIBRARY boost_filesystem_static) -+ set(BOOST_REGEX_LIBRARY boost_regex_static) - endif() + find_library(ZSTD_LIB +- NAMES zstd "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" +- "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${CMAKE_SHARED_LIBRARY_SUFFIX}" +- PATH_SUFFIXES "lib64" "lib" "bin") ++ NAMES zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX} "${ZSTD_STATIC_LIB_NAME}" "lib${ZSTD_STATIC_LIB_NAME}" ++ "${CMAKE_SHARED_LIBRARY_PREFIX}zstd${ZSTD_LIB_NAME_DEBUG_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}") + find_path(ZSTD_INCLUDE_DIR NAMES zstd.h PATH_SUFFIXES "include") endif() -@@ -449,28 +401,8 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIR}) - # ---------------------------------------------------------------------- - # Google double-conversion - --if("${DOUBLE_CONVERSION_HOME}" STREQUAL "") -- set(DOUBLE_CONVERSION_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/double-conversion_ep/src/double-conversion_ep") -- set(DOUBLE_CONVERSION_HOME "${DOUBLE_CONVERSION_PREFIX}") -- set(DOUBLE_CONVERSION_INCLUDE_DIR "${DOUBLE_CONVERSION_PREFIX}/include") -- set(DOUBLE_CONVERSION_STATIC_LIB "${DOUBLE_CONVERSION_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}double-conversion${CMAKE_STATIC_LIBRARY_SUFFIX}") -- -- set(DOUBLE_CONVERSION_CMAKE_ARGS -- "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" -- "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}" -- "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS}" -- "-DCMAKE_INSTALL_PREFIX=${DOUBLE_CONVERSION_PREFIX}") -- ExternalProject_Add(double-conversion_ep -- ${EP_LOG_OPTIONS} -- INSTALL_DIR ${DOUBLE_CONVERSION_PREFIX} -- URL ${DOUBLE_CONVERSION_SOURCE_URL} -- CMAKE_ARGS ${DOUBLE_CONVERSION_CMAKE_ARGS} -- BUILD_BYPRODUCTS "${DOUBLE_CONVERSION_STATIC_LIB}") -- set(DOUBLE_CONVERSION_VENDORED 1) --else() -- find_package(double-conversion REQUIRED) -- set(DOUBLE_CONVERSION_VENDORED 0) --endif() -+find_package(double-conversion REQUIRED) -+set(DOUBLE_CONVERSION_VENDORED 0) - - include_directories(SYSTEM ${DOUBLE_CONVERSION_INCLUDE_DIR}) - ADD_THIRDPARTY_LIB(double-conversion -@@ -486,38 +418,8 @@ endif() - if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS) - add_custom_target(unittest ctest -L unittest) - -- if("${GTEST_HOME}" STREQUAL "") -- if(APPLE) -- set(GTEST_CMAKE_CXX_FLAGS "-fPIC -DGTEST_USE_OWN_TR1_TUPLE=1 -Wno-unused-value -Wno-ignored-attributes") -- elseif(NOT MSVC) -- set(GTEST_CMAKE_CXX_FLAGS "-fPIC") -- endif() -- string(TOUPPER ${CMAKE_BUILD_TYPE} UPPERCASE_BUILD_TYPE) -- set(GTEST_CMAKE_CXX_FLAGS "${EP_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}} ${GTEST_CMAKE_CXX_FLAGS}") -- -- set(GTEST_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest_ep-prefix/src/googletest_ep") -- set(GTEST_INCLUDE_DIR "${GTEST_PREFIX}/include") -- set(GTEST_STATIC_LIB -- "${GTEST_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(GTEST_MAIN_STATIC_LIB -- "${GTEST_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(GTEST_VENDORED 1) -- set(GTEST_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DCMAKE_INSTALL_PREFIX=${GTEST_PREFIX} -- -DCMAKE_CXX_FLAGS=${GTEST_CMAKE_CXX_FLAGS}) -- if (MSVC AND NOT ARROW_USE_STATIC_CRT) -- set(GTEST_CMAKE_ARGS ${GTEST_CMAKE_ARGS} -Dgtest_force_shared_crt=ON) -- endif() -- -- ExternalProject_Add(googletest_ep -- URL ${GTEST_SOURCE_URL} -- BUILD_BYPRODUCTS ${GTEST_STATIC_LIB} ${GTEST_MAIN_STATIC_LIB} -- CMAKE_ARGS ${GTEST_CMAKE_ARGS} -- ${EP_LOG_OPTIONS}) -- else() -- find_package(GTest REQUIRED) -- set(GTEST_VENDORED 0) -- endif() -+ find_package(GTest REQUIRED) -+ set(GTEST_VENDORED 0) - - message(STATUS "GTest include dir: ${GTEST_INCLUDE_DIR}") - message(STATUS "GTest static library: ${GTEST_STATIC_LIB}") -@@ -533,40 +435,8 @@ if(ARROW_BUILD_TESTS OR ARROW_BUILD_BENCHMARKS) - endif() - - # gflags (formerly Googleflags) command line parsing -- if("${GFLAGS_HOME}" STREQUAL "") -- set(GFLAGS_CMAKE_CXX_FLAGS ${EP_CXX_FLAGS}) -- -- set(GFLAGS_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gflags_ep-prefix/src/gflags_ep") -- set(GFLAGS_HOME "${GFLAGS_PREFIX}") -- set(GFLAGS_INCLUDE_DIR "${GFLAGS_PREFIX}/include") -- if(MSVC) -- set(GFLAGS_STATIC_LIB "${GFLAGS_PREFIX}/lib/gflags_static.lib") -- else() -- set(GFLAGS_STATIC_LIB "${GFLAGS_PREFIX}/lib/libgflags.a") -- endif() -- set(GFLAGS_VENDORED 1) -- set(GFLAGS_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DCMAKE_INSTALL_PREFIX=${GFLAGS_PREFIX} -- -DBUILD_SHARED_LIBS=OFF -- -DBUILD_STATIC_LIBS=ON -- -DBUILD_PACKAGING=OFF -- -DBUILD_TESTING=OFF -- -BUILD_CONFIG_TESTS=OFF -- -DINSTALL_HEADERS=ON -- -DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS} -- -DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_C_FLAGS} -- -DCMAKE_CXX_FLAGS=${GFLAGS_CMAKE_CXX_FLAGS}) -- -- ExternalProject_Add(gflags_ep -- URL ${GFLAGS_SOURCE_URL} -- ${EP_LOG_OPTIONS} -- BUILD_IN_SOURCE 1 -- BUILD_BYPRODUCTS "${GFLAGS_STATIC_LIB}" -- CMAKE_ARGS ${GFLAGS_CMAKE_ARGS}) -- else() -- set(GFLAGS_VENDORED 0) -- find_package(GFlags REQUIRED) -- endif() -+ set(GFLAGS_VENDORED 0) -+ find_package(GFlags REQUIRED) - - message(STATUS "GFlags include dir: ${GFLAGS_INCLUDE_DIR}") - message(STATUS "GFlags static library: ${GFLAGS_STATIC_LIB}") -@@ -587,37 +457,8 @@ endif() - if(ARROW_BUILD_BENCHMARKS) - add_custom_target(runbenchmark ctest -L benchmark) - -- if("$ENV{GBENCHMARK_HOME}" STREQUAL "") -- if(NOT MSVC) -- set(GBENCHMARK_CMAKE_CXX_FLAGS "-fPIC -std=c++11 ${EP_CXX_FLAGS}") -- endif() -- -- if(APPLE) -- set(GBENCHMARK_CMAKE_CXX_FLAGS "${GBENCHMARK_CMAKE_CXX_FLAGS} -stdlib=libc++") -- endif() -- -- set(GBENCHMARK_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/gbenchmark_ep/src/gbenchmark_ep-install") -- set(GBENCHMARK_INCLUDE_DIR "${GBENCHMARK_PREFIX}/include") -- set(GBENCHMARK_STATIC_LIB "${GBENCHMARK_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}benchmark${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(GBENCHMARK_VENDORED 1) -- set(GBENCHMARK_CMAKE_ARGS -- "-DCMAKE_BUILD_TYPE=Release" -- "-DCMAKE_INSTALL_PREFIX:PATH=${GBENCHMARK_PREFIX}" -- "-DBENCHMARK_ENABLE_TESTING=OFF" -- "-DCMAKE_CXX_FLAGS=${GBENCHMARK_CMAKE_CXX_FLAGS}") -- if (APPLE) -- set(GBENCHMARK_CMAKE_ARGS ${GBENCHMARK_CMAKE_ARGS} "-DBENCHMARK_USE_LIBCXX=ON") -- endif() -- -- ExternalProject_Add(gbenchmark_ep -- URL ${GBENCHMARK_SOURCE_URL} -- BUILD_BYPRODUCTS "${GBENCHMARK_STATIC_LIB}" -- CMAKE_ARGS ${GBENCHMARK_CMAKE_ARGS} -- ${EP_LOG_OPTIONS}) -- else() -- find_package(GBenchmark REQUIRED) -- set(GBENCHMARK_VENDORED 0) -- endif() -+ find_package(GBenchmark REQUIRED) -+ set(GBENCHMARK_VENDORED 0) - - message(STATUS "GBenchmark include dir: ${GBENCHMARK_INCLUDE_DIR}") - message(STATUS "GBenchmark static library: ${GBENCHMARK_STATIC_LIB}") -@@ -632,24 +473,8 @@ endif() - - if (ARROW_IPC) - # RapidJSON, header only dependency -- if("${RAPIDJSON_HOME}" STREQUAL "") -- ExternalProject_Add(rapidjson_ep -- PREFIX "${CMAKE_BINARY_DIR}" -- URL ${RAPIDJSON_SOURCE_URL} -- URL_MD5 ${RAPIDJSON_SOURCE_MD5} -- CONFIGURE_COMMAND "" -- BUILD_COMMAND "" -- BUILD_IN_SOURCE 1 -- ${EP_LOG_OPTIONS} -- INSTALL_COMMAND "") -- -- ExternalProject_Get_Property(rapidjson_ep SOURCE_DIR) -- set(RAPIDJSON_INCLUDE_DIR "${SOURCE_DIR}/include") -- set(RAPIDJSON_VENDORED 1) -- else() -- set(RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_HOME}/include") -- set(RAPIDJSON_VENDORED 0) -- endif() -+ set(RAPIDJSON_INCLUDE_DIR "${RAPIDJSON_HOME}/include") -+ set(RAPIDJSON_VENDORED 0) - message(STATUS "RapidJSON include dir: ${RAPIDJSON_INCLUDE_DIR}") - include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR}) - -@@ -658,32 +483,8 @@ if (ARROW_IPC) - endif() - - ## Flatbuffers -- if("${FLATBUFFERS_HOME}" STREQUAL "") -- set(FLATBUFFERS_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/flatbuffers_ep-prefix/src/flatbuffers_ep-install") -- if (MSVC) -- set(FLATBUFFERS_CMAKE_CXX_FLAGS /EHsc) -- else() -- set(FLATBUFFERS_CMAKE_CXX_FLAGS -fPIC) -- endif() -- # We always need to do release builds, otherwise flatc will not be installed. -- ExternalProject_Add(flatbuffers_ep -- URL ${FLATBUFFERS_SOURCE_URL} -- CMAKE_ARGS -- "-DCMAKE_CXX_FLAGS=${FLATBUFFERS_CMAKE_CXX_FLAGS}" -- "-DCMAKE_INSTALL_PREFIX:PATH=${FLATBUFFERS_PREFIX}" -- "-DFLATBUFFERS_BUILD_TESTS=OFF" -- "-DCMAKE_BUILD_TYPE=RELEASE" -- "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS}" -- "-DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_C_FLAGS}" -- ${EP_LOG_OPTIONS}) -- -- set(FLATBUFFERS_INCLUDE_DIR "${FLATBUFFERS_PREFIX}/include") -- set(FLATBUFFERS_COMPILER "${FLATBUFFERS_PREFIX}/bin/flatc") -- set(FLATBUFFERS_VENDORED 1) -- else() -- find_package(Flatbuffers REQUIRED) -- set(FLATBUFFERS_VENDORED 0) -- endif() -+ find_package(Flatbuffers REQUIRED) -+ set(FLATBUFFERS_VENDORED 0) - - if(FLATBUFFERS_VENDORED) - add_dependencies(arrow_dependencies flatbuffers_ep) -@@ -787,34 +588,7 @@ if (ARROW_WITH_ZLIB) - if(ZLIB_FOUND) - ADD_THIRDPARTY_LIB(zlib SHARED_LIB ${ZLIB_SHARED_LIB}) - else() -- set(ZLIB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/zlib_ep/src/zlib_ep-install") -- set(ZLIB_HOME "${ZLIB_PREFIX}") -- set(ZLIB_INCLUDE_DIR "${ZLIB_PREFIX}/include") -- if (MSVC) -- if (${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG") -- set(ZLIB_STATIC_LIB_NAME zlibstaticd.lib) -- else() -- set(ZLIB_STATIC_LIB_NAME zlibstatic.lib) -- endif() -- else() -- set(ZLIB_STATIC_LIB_NAME libz.a) -- endif() -- set(ZLIB_STATIC_LIB "${ZLIB_PREFIX}/lib/${ZLIB_STATIC_LIB_NAME}") -- set(ZLIB_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DCMAKE_INSTALL_PREFIX=${ZLIB_PREFIX} -- -DCMAKE_C_FLAGS=${EP_C_FLAGS} -- -DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS} -- -DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_C_FLAGS} -- -DBUILD_SHARED_LIBS=OFF) -- ADD_THIRDPARTY_LIB(zlib -- STATIC_LIB ${ZLIB_STATIC_LIB}) -- -- ExternalProject_Add(zlib_ep -- URL ${ZLIB_SOURCE_URL} -- ${EP_LOG_OPTIONS} -- BUILD_BYPRODUCTS "${ZLIB_STATIC_LIB}" -- CMAKE_ARGS ${ZLIB_CMAKE_ARGS}) -- add_dependencies(zlib zlib_ep) -+ message(FATAL_ERROR "zlib not found.") - endif() - - include_directories(SYSTEM ${ZLIB_INCLUDE_DIR}) -@@ -824,62 +598,8 @@ if (ARROW_WITH_SNAPPY) - # ---------------------------------------------------------------------- - # Snappy - -- if("${SNAPPY_HOME}" STREQUAL "") -- set(SNAPPY_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/snappy_ep/src/snappy_ep-install") -- set(SNAPPY_HOME "${SNAPPY_PREFIX}") -- set(SNAPPY_INCLUDE_DIR "${SNAPPY_PREFIX}/include") -- if (MSVC) -- set(SNAPPY_STATIC_LIB_NAME snappy_static) -- else() -- set(SNAPPY_STATIC_LIB_NAME snappy) -- endif() -- set(SNAPPY_STATIC_LIB "${SNAPPY_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${SNAPPY_STATIC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}") -- -- if (${UPPERCASE_BUILD_TYPE} EQUAL "RELEASE") -- if (APPLE) -- set(SNAPPY_CXXFLAGS "CXXFLAGS='-DNDEBUG -O1'") -- else() -- set(SNAPPY_CXXFLAGS "CXXFLAGS='-DNDEBUG -O2'") -- endif() -- endif() -- -- if (WIN32) -- set(SNAPPY_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}" -- "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS}" -- "-DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_C_FLAGS}" -- "-DCMAKE_C_FLAGS=${EP_C_FLAGS}" -- "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") -- set(SNAPPY_UPDATE_COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_SOURCE_DIR}/cmake_modules/SnappyCMakeLists.txt -- ./CMakeLists.txt && -- ${CMAKE_COMMAND} -E copy -- ${CMAKE_SOURCE_DIR}/cmake_modules/SnappyConfig.h -- ./config.h) -- ExternalProject_Add(snappy_ep -- UPDATE_COMMAND ${SNAPPY_UPDATE_COMMAND} -- ${EP_LOG_OPTIONS} -- BUILD_IN_SOURCE 1 -- BUILD_COMMAND ${MAKE} -- INSTALL_DIR ${SNAPPY_PREFIX} -- URL ${SNAPPY_SOURCE_URL} -- CMAKE_ARGS ${SNAPPY_CMAKE_ARGS} -- BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}") -- else() -- ExternalProject_Add(snappy_ep -- CONFIGURE_COMMAND ./configure --with-pic "--prefix=${SNAPPY_PREFIX}" ${SNAPPY_CXXFLAGS} -- ${EP_LOG_OPTIONS} -- BUILD_IN_SOURCE 1 -- BUILD_COMMAND ${MAKE} -- INSTALL_DIR ${SNAPPY_PREFIX} -- URL ${SNAPPY_SOURCE_URL} -- BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}") -- endif() -- set(SNAPPY_VENDORED 1) -- else() -- find_package(Snappy REQUIRED) -- set(SNAPPY_VENDORED 0) -- endif() -+ find_package(Snappy REQUIRED) -+ set(SNAPPY_VENDORED 0) - - include_directories(SYSTEM ${SNAPPY_INCLUDE_DIR}) - ADD_THIRDPARTY_LIB(snappy -@@ -894,47 +614,8 @@ if (ARROW_WITH_BROTLI) - # ---------------------------------------------------------------------- - # Brotli - -- if("${BROTLI_HOME}" STREQUAL "") -- set(BROTLI_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/brotli_ep/src/brotli_ep-install") -- set(BROTLI_HOME "${BROTLI_PREFIX}") -- set(BROTLI_INCLUDE_DIR "${BROTLI_PREFIX}/include") -- if (MSVC) -- set(BROTLI_LIB_DIR bin) -- else() -- set(BROTLI_LIB_DIR lib) -- endif() -- set(BROTLI_STATIC_LIBRARY_ENC "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlienc${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(BROTLI_STATIC_LIBRARY_DEC "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlidec${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(BROTLI_STATIC_LIBRARY_COMMON "${BROTLI_PREFIX}/${BROTLI_LIB_DIR}/${CMAKE_LIBRARY_ARCHITECTURE}/${CMAKE_STATIC_LIBRARY_PREFIX}brotlicommon${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(BROTLI_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}" -- "-DCMAKE_C_FLAGS=${EP_C_FLAGS}" -- "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS}" -- "-DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_C_FLAGS}" -- -DCMAKE_INSTALL_PREFIX=${BROTLI_PREFIX} -- -DCMAKE_INSTALL_LIBDIR=lib/${CMAKE_LIBRARY_ARCHITECTURE} -- -DBUILD_SHARED_LIBS=OFF) -- -- ExternalProject_Add(brotli_ep -- URL ${BROTLI_SOURCE_URL} -- BUILD_BYPRODUCTS "${BROTLI_STATIC_LIBRARY_ENC}" "${BROTLI_STATIC_LIBRARY_DEC}" "${BROTLI_STATIC_LIBRARY_COMMON}" -- ${BROTLI_BUILD_BYPRODUCTS} -- ${EP_LOG_OPTIONS} -- CMAKE_ARGS ${BROTLI_CMAKE_ARGS} -- STEP_TARGETS headers_copy) -- if (MSVC) -- ExternalProject_Get_Property(brotli_ep SOURCE_DIR) -- -- ExternalProject_Add_Step(brotli_ep headers_copy -- COMMAND xcopy /E /I include ..\\..\\..\\brotli_ep\\src\\brotli_ep-install\\include /Y -- DEPENDEES build -- WORKING_DIRECTORY ${SOURCE_DIR}) -- endif() -- set(BROTLI_VENDORED 1) -- else() -- find_package(Brotli REQUIRED) -- set(BROTLI_VENDORED 0) -- endif() -+ find_package(Brotli REQUIRED) -+ set(BROTLI_VENDORED 0) - - include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) - ADD_THIRDPARTY_LIB(brotli_enc -@@ -955,45 +636,8 @@ if (ARROW_WITH_LZ4) - # ---------------------------------------------------------------------- - # Lz4 - -- if("${LZ4_HOME}" STREQUAL "") -- set(LZ4_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/lz4_ep-prefix/src/lz4_ep") -- set(LZ4_HOME "${LZ4_BUILD_DIR}") -- set(LZ4_INCLUDE_DIR "${LZ4_BUILD_DIR}/lib") -- -- if (MSVC) -- if (ARROW_USE_STATIC_CRT) -- if (${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG") -- set(LZ4_RUNTIME_LIBRARY_LINKAGE "/p:RuntimeLibrary=MultiThreadedDebug") -- else() -- set(LZ4_RUNTIME_LIBRARY_LINKAGE "/p:RuntimeLibrary=MultiThreaded") -- endif() -- endif() -- set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/visual/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/liblz4_static.lib") -- set(LZ4_BUILD_COMMAND BUILD_COMMAND msbuild.exe /m /p:Configuration=${CMAKE_BUILD_TYPE} /p:Platform=x64 /p:PlatformToolset=v140 -- ${LZ4_RUNTIME_LIBRARY_LINKAGE} /t:Build ${LZ4_BUILD_DIR}/visual/VS2010/lz4.sln) -- set(LZ4_PATCH_COMMAND PATCH_COMMAND git --git-dir=. apply --verbose --whitespace=fix ${CMAKE_SOURCE_DIR}/build-support/lz4_msbuild_gl_runtimelibrary_params.patch) -- else() -- set(LZ4_STATIC_LIB "${LZ4_BUILD_DIR}/lib/liblz4.a") -- set(LZ4_BUILD_COMMAND BUILD_COMMAND ${CMAKE_SOURCE_DIR}/build-support/build-lz4-lib.sh) -- endif() -- -- ExternalProject_Add(lz4_ep -- URL ${LZ4_SOURCE_URL} -- ${EP_LOG_OPTIONS} -- UPDATE_COMMAND "" -- ${LZ4_PATCH_COMMAND} -- CONFIGURE_COMMAND "" -- INSTALL_COMMAND "" -- BINARY_DIR ${LZ4_BUILD_DIR} -- BUILD_BYPRODUCTS ${LZ4_STATIC_LIB} -- ${LZ4_BUILD_COMMAND} -- ) -- -- set(LZ4_VENDORED 1) -- else() -- find_package(Lz4 REQUIRED) -- set(LZ4_VENDORED 0) -- endif() -+ find_package(Lz4 REQUIRED) -+ set(LZ4_VENDORED 0) - - include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) - ADD_THIRDPARTY_LIB(lz4_static -@@ -1008,45 +652,8 @@ if (ARROW_WITH_ZSTD) - # ---------------------------------------------------------------------- - # ZSTD - -- if("${ZSTD_HOME}" STREQUAL "") -- set(ZSTD_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/zstd_ep-prefix/src/zstd_ep") -- set(ZSTD_INCLUDE_DIR "${ZSTD_BUILD_DIR}/lib") -- -- if (MSVC) -- if (ARROW_USE_STATIC_CRT) -- if (${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG") -- set(ZSTD_RUNTIME_LIBRARY_LINKAGE "/p:RuntimeLibrary=MultiThreadedDebug") -- else() -- set(ZSTD_RUNTIME_LIBRARY_LINKAGE "/p:RuntimeLibrary=MultiThreaded") -- endif() -- endif() -- set(ZSTD_STATIC_LIB "${ZSTD_BUILD_DIR}/build/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/libzstd_static.lib") -- set(ZSTD_BUILD_COMMAND BUILD_COMMAND msbuild ${ZSTD_BUILD_DIR}/build/VS2010/zstd.sln /t:Build /v:minimal /p:Configuration=${CMAKE_BUILD_TYPE} -- ${ZSTD_RUNTIME_LIBRARY_LINKAGE} /p:Platform=x64 /p:PlatformToolset=v140 -- /p:OutDir=${ZSTD_BUILD_DIR}/build/VS2010/bin/x64_${CMAKE_BUILD_TYPE}/ /p:SolutionDir=${ZSTD_BUILD_DIR}/build/VS2010/ ) -- set(ZSTD_PATCH_COMMAND PATCH_COMMAND git --git-dir=. apply --verbose --whitespace=fix ${CMAKE_SOURCE_DIR}/build-support/zstd_msbuild_gl_runtimelibrary_params.patch) -- else() -- set(ZSTD_STATIC_LIB "${ZSTD_BUILD_DIR}/lib/libzstd.a") -- set(ZSTD_BUILD_COMMAND BUILD_COMMAND ${CMAKE_SOURCE_DIR}/build-support/build-zstd-lib.sh) -- endif() -- -- ExternalProject_Add(zstd_ep -- URL ${ZSTD_SOURCE_URL} -- ${EP_LOG_OPTIONS} -- UPDATE_COMMAND "" -- ${ZSTD_PATCH_COMMAND} -- CONFIGURE_COMMAND "" -- INSTALL_COMMAND "" -- BINARY_DIR ${ZSTD_BUILD_DIR} -- BUILD_BYPRODUCTS ${ZSTD_STATIC_LIB} -- ${ZSTD_BUILD_COMMAND} -- ) -- -- set(ZSTD_VENDORED 1) -- else() -- find_package(ZSTD REQUIRED) -- set(ZSTD_VENDORED 0) -- endif() -+ find_package(ZSTD REQUIRED) -+ set(ZSTD_VENDORED 0) - - include_directories(SYSTEM ${ZSTD_INCLUDE_DIR}) - ADD_THIRDPARTY_LIB(zstd_static -@@ -1063,24 +670,8 @@ endif() - - if (ARROW_ORC OR ARROW_FLIGHT) - # protobuf -- if ("${PROTOBUF_HOME}" STREQUAL "") -- set (PROTOBUF_PREFIX "${THIRDPARTY_DIR}/protobuf_ep-install") -- set (PROTOBUF_HOME "${PROTOBUF_PREFIX}") -- set (PROTOBUF_INCLUDE_DIR "${PROTOBUF_PREFIX}/include") -- set (PROTOBUF_STATIC_LIB "${PROTOBUF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}") -- -- ExternalProject_Add(protobuf_ep -- CONFIGURE_COMMAND "./configure" "--disable-shared" "--prefix=${PROTOBUF_PREFIX}" "CXXFLAGS=${EP_CXX_FLAGS}" -- BUILD_IN_SOURCE 1 -- URL ${PROTOBUF_SOURCE_URL} -- BUILD_BYPRODUCTS "${PROTOBUF_STATIC_LIB}" -- ${EP_LOG_OPTIONS}) -- -- set (PROTOBUF_VENDORED 1) -- else () -- find_package (Protobuf REQUIRED) -- set (PROTOBUF_VENDORED 0) -- endif () -+ find_package (Protobuf REQUIRED) -+ set (PROTOBUF_VENDORED 0) - - include_directories (SYSTEM ${PROTOBUF_INCLUDE_DIR}) - if (ARROW_PROTOBUF_USE_SHARED) -@@ -1100,34 +691,8 @@ endif() - # Dependencies for Arrow Flight RPC - - if (ARROW_FLIGHT) -- if ("${GRPC_HOME}" STREQUAL "") -- set(GRPC_VENDORED 1) -- set(GRPC_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/grpc_ep-prefix/src/grpc_ep-build") -- set(GRPC_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/grpc_ep/src/grpc_ep-install") -- set(GRPC_HOME "${GRPC_PREFIX}") -- set(GRPC_INCLUDE_DIR "${GRPC_PREFIX}/include") -- set(GRPC_STATIC_LIBRARY_GPR "${GRPC_BUILD_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gpr${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(GRPC_STATIC_LIBRARY_GRPC "${GRPC_BUILD_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}grpc${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(GRPC_STATIC_LIBRARY_GRPCPP "${GRPC_BUILD_DIR}/${CMAKE_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}grpcpp${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(GRPC_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}" -- "-DCMAKE_C_FLAGS=${EP_C_FLAGS}" -- -DCMAKE_INSTALL_PREFIX=${GRPC_PREFIX} -- -DBUILD_SHARED_LIBS=OFF) -- -- ExternalProject_Add(grpc_ep -- GIT_REPOSITORY "https://github.com/grpc/grpc" -- GIT_TAG ${GRPC_VERSION} -- BUILD_BYPRODUCTS "${GRPC_STATIC_LIBRARY_GPR}" "${GRPC_STATIC_LIBRARY_GRPC}" "${GRPC_STATIC_LIBRARY_GRPCPP}" -- ${GRPC_BUILD_BYPRODUCTS} -- ${EP_LOG_OPTIONS} -- CMAKE_ARGS ${GRPC_CMAKE_ARGS} -- ${EP_LOG_OPTIONS}) -- include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) -- else() -- find_package(gRPC CONFIG REQUIRED) -- set(GRPC_VENDORED 0) -- endif() -+ find_package(gRPC CONFIG REQUIRED) -+ set(GRPC_VENDORED 0) - - get_property(GPR_STATIC_LIB TARGET gRPC::gpr PROPERTY LOCATION) - ADD_THIRDPARTY_LIB(grpc_gpr -@@ -1157,60 +722,9 @@ endif() - - if (ARROW_ORC) - # orc -- if ("${ORC_HOME}" STREQUAL "") -- set(ORC_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/orc_ep-install") -- set(ORC_HOME "${ORC_PREFIX}") -- set(ORC_INCLUDE_DIR "${ORC_PREFIX}/include") -- set(ORC_STATIC_LIB "${ORC_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}orc${CMAKE_STATIC_LIBRARY_SUFFIX}") -- -- if ("${COMPILER_FAMILY}" STREQUAL "clang") -- if ("${COMPILER_VERSION}" VERSION_GREATER "4.0") -- set(ORC_CMAKE_CXX_FLAGS " -Wno-zero-as-null-pointer-constant \ -- -Wno-inconsistent-missing-destructor-override ") -- endif() -- endif() -- -- set(ORC_CMAKE_CXX_FLAGS "${EP_CXX_FLAGS} ${ORC_CMAKE_CXX_FLAGS}") -- -- # Since LZ4 isn't installed, the header file is in ${LZ4_HOME}/lib instead of -- # ${LZ4_HOME}/include, which forces us to specify the include directory -- # manually as well. -- set (ORC_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DCMAKE_INSTALL_PREFIX=${ORC_PREFIX} -- -DCMAKE_CXX_FLAGS=${ORC_CMAKE_CXX_FLAGS} -- -DBUILD_LIBHDFSPP=OFF -- -DBUILD_JAVA=OFF -- -DBUILD_TOOLS=OFF -- -DBUILD_CPP_TESTS=OFF -- -DINSTALL_VENDORED_LIBS=OFF -- -DPROTOBUF_HOME=${PROTOBUF_HOME} -- -DLZ4_HOME=${LZ4_HOME} -- -DLZ4_INCLUDE_DIR=${LZ4_INCLUDE_DIR} -- -DSNAPPY_HOME=${SNAPPY_HOME} -- -DZLIB_HOME=${ZLIB_HOME}) -- -- ExternalProject_Add(orc_ep -- URL ${ORC_SOURCE_URL} -- BUILD_BYPRODUCTS ${ORC_STATIC_LIB} -- CMAKE_ARGS ${ORC_CMAKE_ARGS} -- ${EP_LOG_OPTIONS}) -- -- set(ORC_VENDORED 1) -- add_dependencies(orc_ep zlib) -- if (LZ4_VENDORED) -- add_dependencies(orc_ep lz4_static) -- endif() -- if (SNAPPY_VENDORED) -- add_dependencies(orc_ep snappy) -- endif() -- if (PROTOBUF_VENDORED) -- add_dependencies(orc_ep protobuf_ep) -- endif() -- else() -- set(ORC_INCLUDE_DIR "${ORC_HOME}/include") -- set(ORC_STATIC_LIB "${ORC_HOME}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}orc${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(ORC_VENDORED 0) -- endif() -+ set(ORC_INCLUDE_DIR "${ORC_HOME}/include") -+ set(ORC_STATIC_LIB "${ORC_HOME}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}orc${CMAKE_STATIC_LIBRARY_SUFFIX}") -+ set(ORC_VENDORED 0) - - include_directories(SYSTEM ${ORC_INCLUDE_DIR}) - ADD_THIRDPARTY_LIB(orc -@@ -1231,97 +745,7 @@ if (ARROW_WITH_THRIFT) - # find thrift headers and libs - find_package(Thrift) - --if (NOT THRIFT_FOUND) -- set(THRIFT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/thrift_ep/src/thrift_ep-install") -- set(THRIFT_HOME "${THRIFT_PREFIX}") -- set(THRIFT_INCLUDE_DIR "${THRIFT_PREFIX}/include") -- set(THRIFT_COMPILER "${THRIFT_PREFIX}/bin/thrift") -- set(THRIFT_CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" -- "-DCMAKE_CXX_FLAGS=${EP_CXX_FLAGS}" -- "-DCMAKE_C_FLAGS=${EP_C_FLAGS}" -- "-DCMAKE_INSTALL_PREFIX=${THRIFT_PREFIX}" -- "-DCMAKE_INSTALL_RPATH=${THRIFT_PREFIX}/lib" -- "-DBUILD_SHARED_LIBS=OFF" -- "-DBUILD_TESTING=OFF" -- "-DBUILD_EXAMPLES=OFF" -- "-DBUILD_TUTORIALS=OFF" -- "-DWITH_QT4=OFF" -- "-DWITH_C_GLIB=OFF" -- "-DWITH_JAVA=OFF" -- "-DWITH_PYTHON=OFF" -- "-DWITH_HASKELL=OFF" -- "-DWITH_CPP=ON" -- "-DWITH_STATIC_LIB=ON" -- "-DWITH_LIBEVENT=OFF" -- ) -- -- # Thrift also uses boost. Forward important boost settings if there were ones passed. -- if (DEFINED BOOST_ROOT) -- set(THRIFT_CMAKE_ARGS ${THRIFT_CMAKE_ARGS} "-DBOOST_ROOT=${BOOST_ROOT}") -- endif() -- if (DEFINED Boost_NAMESPACE) -- set(THRIFT_CMAKE_ARGS ${THRIFT_CMAKE_ARGS} "-DBoost_NAMESPACE=${Boost_NAMESPACE}") -- endif() -- -- set(THRIFT_STATIC_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}thrift") -- if (MSVC) -- if (ARROW_USE_STATIC_CRT) -- set(THRIFT_STATIC_LIB_NAME "${THRIFT_STATIC_LIB_NAME}mt") -- set(THRIFT_CMAKE_ARGS ${THRIFT_CMAKE_ARGS} "-DWITH_MT=ON") -- else() -- set(THRIFT_STATIC_LIB_NAME "${THRIFT_STATIC_LIB_NAME}md") -- set(THRIFT_CMAKE_ARGS ${THRIFT_CMAKE_ARGS} "-DWITH_MT=OFF") -- endif() -- endif() -- if (${UPPERCASE_BUILD_TYPE} STREQUAL "DEBUG") -- set(THRIFT_STATIC_LIB_NAME "${THRIFT_STATIC_LIB_NAME}d") -- endif() -- set(THRIFT_STATIC_LIB "${THRIFT_PREFIX}/lib/${THRIFT_STATIC_LIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}") -- -- if (ZLIB_SHARED_LIB) -- set(THRIFT_CMAKE_ARGS "-DZLIB_LIBRARY=${ZLIB_SHARED_LIB}" -- ${THRIFT_CMAKE_ARGS}) -- else() -- set(THRIFT_CMAKE_ARGS "-DZLIB_LIBRARY=${ZLIB_STATIC_LIB}" -- ${THRIFT_CMAKE_ARGS}) -- endif() -- set(THRIFT_DEPENDENCIES ${THRIFT_DEPENDENCIES} zlib) -- -- if (MSVC) -- set(WINFLEXBISON_VERSION 2.4.9) -- set(WINFLEXBISON_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/winflexbison_ep/src/winflexbison_ep-install") -- ExternalProject_Add(winflexbison_ep -- URL https://github.com/lexxmark/winflexbison/releases/download/v.${WINFLEXBISON_VERSION}/win_flex_bison-${WINFLEXBISON_VERSION}.zip -- URL_HASH MD5=a2e979ea9928fbf8567e995e9c0df765 -- SOURCE_DIR ${WINFLEXBISON_PREFIX} -- CONFIGURE_COMMAND "" -- BUILD_COMMAND "" -- INSTALL_COMMAND "" -- ${EP_LOG_OPTIONS}) -- set(THRIFT_DEPENDENCIES ${THRIFT_DEPENDENCIES} winflexbison_ep) -- -- set(THRIFT_CMAKE_ARGS "-DFLEX_EXECUTABLE=${WINFLEXBISON_PREFIX}/win_flex.exe" -- "-DBISON_EXECUTABLE=${WINFLEXBISON_PREFIX}/win_bison.exe" -- "-DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIR}" -- "-DWITH_SHARED_LIB=OFF" -- "-DWITH_PLUGIN=OFF" -- ${THRIFT_CMAKE_ARGS}) -- elseif (APPLE) -- if (DEFINED BISON_EXECUTABLE) -- set(THRIFT_CMAKE_ARGS "-DBISON_EXECUTABLE=${BISON_EXECUTABLE}" -- ${THRIFT_CMAKE_ARGS}) -- endif() -- endif() -- -- ExternalProject_Add(thrift_ep -- URL ${THRIFT_SOURCE_URL} -- BUILD_BYPRODUCTS "${THRIFT_STATIC_LIB}" "${THRIFT_COMPILER}" -- CMAKE_ARGS ${THRIFT_CMAKE_ARGS} -- DEPENDS ${THRIFT_DEPENDENCIES} -- ${EP_LOG_OPTIONS}) -- -- set(THRIFT_VENDORED 1) +diff --git a/cmake_modules/FindgflagsAlt.cmake b/cmake_modules/FindgflagsAlt.cmake +index a9b8684..fdb815a 100644 +--- a/cmake_modules/FindgflagsAlt.cmake ++++ b/cmake_modules/FindgflagsAlt.cmake +@@ -15,18 +15,13 @@ + # specific language governing permissions and limitations + # under the License. + +-if(gflags_ROOT) +- find_library(gflags_LIB NAMES gflags PATHS ${gflags_ROOT} NO_DEFAULT_PATH) +- find_path(GFLAGS_INCLUDE_DIR +- NAMES gflags/gflags.h +- PATHS ${gflags_ROOT} +- NO_DEFAULT_PATH +- PATH_SUFFIXES "include") -else() -+if (THRIFT_FOUND) - set(THRIFT_VENDORED 0) +- find_library(gflags_LIB NAMES gflags) +- find_path(GFLAGS_INCLUDE_DIR NAMES gflags/gflags.h PATH_SUFFIXES "include") ++if(CMAKE_BUILD_TYPE STREQUAL "DEBUG") ++ set(GFLAGS_LIB_NAME_DEBUG_SUFFIX _debug) endif() -@@ -1347,45 +771,8 @@ endif() # ARROW_HIVESERVER2 - # GLOG ++find_library(gflags_LIB NAMES gflags${GFLAGS_LIB_NAME_DEBUG_SUFFIX} gflags_static${GFLAGS_LIB_NAME_DEBUG_SUFFIX}) ++find_path(GFLAGS_INCLUDE_DIR NAMES gflags/gflags.h PATH_SUFFIXES "include") ++ + find_package_handle_standard_args(gflagsAlt REQUIRED_VARS gflags_LIB GFLAGS_INCLUDE_DIR) - if (ARROW_USE_GLOG) -- if("${GLOG_HOME}" STREQUAL "") -- set(GLOG_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/glog_ep-prefix/src/glog_ep") -- set(GLOG_INCLUDE_DIR "${GLOG_BUILD_DIR}/include") -- set(GLOG_STATIC_LIB "${GLOG_BUILD_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}glog${CMAKE_STATIC_LIBRARY_SUFFIX}") -- set(GLOG_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") -- set(GLOG_CMAKE_C_FLAGS "${EP_C_FLAGS} -fPIC") -- if (PTHREAD_LIBRARY) -- set(GLOG_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread") -- set(GLOG_CMAKE_C_FLAGS "${EP_C_FLAGS} -fPIC -pthread") -- endif() -- message(STATUS "GLOG_CMAKE_CXX_FLAGS: ${GLOG_CMAKE_CXX_FLAGS}") -- message(STATUS "CMAKE_CXX_FLAGS in glog: ${GLOG_CMAKE_CXX_FLAGS}") -- -- if(APPLE) -- # If we don't set this flag, the binary built with 10.13 cannot be used in 10.12. -- set(GLOG_CMAKE_CXX_FLAGS "${GLOG_CMAKE_CXX_FLAGS} -mmacosx-version-min=10.9") + if(gflagsAlt_FOUND) +diff --git a/cmake_modules/ThirdpartyToolchain.cmake b/cmake_modules/ThirdpartyToolchain.cmake +index bdb122b..58c123e 100644 +--- a/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cmake_modules/ThirdpartyToolchain.cmake +@@ -923,10 +923,7 @@ if(ARROW_NEED_GFLAGS) + elseif(gflags_SOURCE STREQUAL "SYSTEM") + # gflagsConfig.cmake is not installed on Ubuntu/Debian + # TODO: Make a bug report upstream +- find_package(gflags) +- if(NOT gflags_FOUND) +- find_package(gflagsAlt REQUIRED) - endif() -- -- set(GLOG_CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DCMAKE_INSTALL_PREFIX=${GLOG_BUILD_DIR} -- -DBUILD_SHARED_LIBS=OFF -- -DBUILD_TESTING=OFF -- -DWITH_GFLAGS=OFF -- -DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${GLOG_CMAKE_CXX_FLAGS} -- -DCMAKE_C_FLAGS_${UPPERCASE_BUILD_TYPE}=${GLOG_CMAKE_C_FLAGS} -- -DCMAKE_CXX_FLAGS=${GLOG_CMAKE_CXX_FLAGS}) -- message(STATUS "Glog version: ${GLOG_VERSION}") -- ExternalProject_Add(glog_ep -- URL ${GLOG_SOURCE_URL} -- BUILD_IN_SOURCE 1 -- BUILD_BYPRODUCTS "${GLOG_STATIC_LIB}" -- CMAKE_ARGS ${GLOG_CMAKE_ARGS} -- ${EP_LOG_OPTIONS}) -- -- set(GLOG_VENDORED 1) -- else() -- find_package(GLOG REQUIRED) -- set(GLOG_VENDORED 0) -- endif() -+ find_package(GLOG REQUIRED) -+ set(GLOG_VENDORED 0) - - message(STATUS "Glog include dir: ${GLOG_INCLUDE_DIR}") - message(STATUS "Glog static library: ${GLOG_STATIC_LIB}") ++ find_package(gflagsAlt REQUIRED) + endif() + # TODO: Don't use global includes but rather target_include_directories + include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) +@@ -1558,7 +1555,7 @@ if(ARROW_WITH_FLATBUFFERS) + elseif(Flatbuffers_SOURCE STREQUAL "BUNDLED") + build_flatbuffers() + elseif(Flatbuffers_SOURCE STREQUAL "SYSTEM") +- find_package(Flatbuffers QUIET) ++ #find_package(Flatbuffers QUIET) - disabled because on vcpkg this looks in the wrong place for the fb compiler and causes an error + if(NOT Flatbuffers_FOUND) + find_package(FlatbuffersAlt REQUIRED) + endif() diff --git a/ports/arrow/portfile.cmake b/ports/arrow/portfile.cmake index 73cf90eb2..28b58e8bf 100644 --- a/ports/arrow/portfile.cmake +++ b/ports/arrow/portfile.cmake @@ -7,8 +7,8 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO apache/arrow - REF apache-arrow-0.11.1 - SHA512 8a2de7e4b40666e4ea7818fac488549f1348e961e7cb6a4166ae4019976a574fd115dc1cabaf44bc1cbaabf15fb8e5133c8232b34fca250d8ff7c5b65c5407c8 + REF apache-arrow-0.13.0 + SHA512 bbb14d11abf267a6902c7c9e0215ba7c5284f07482be2de42707145265d2809c89c2d4d8f8b918fdb8c33a5ecbd650875b987a1a694cdf653e766822be67a47d HEAD_REF master ) @@ -27,33 +27,31 @@ string(COMPARE EQUAL ${VCPKG_LIBRARY_LINKAGE} "static" IS_STATIC) if (IS_STATIC) set(PARQUET_ARROW_LINKAGE static) + set(BOOST_USE_SHARED off) + set(USE_STATIC_CRT on) else() set(PARQUET_ARROW_LINKAGE shared) + set(BOOST_USE_SHARED on) + set(USE_STATIC_CRT off) endif() vcpkg_configure_cmake( SOURCE_PATH ${CPP_SOURCE_PATH} PREFER_NINJA OPTIONS + -DARROW_DEPENDENCY_SOURCE=SYSTEM -DARROW_BUILD_TESTS=off - -DRAPIDJSON_HOME=${CURRENT_INSTALLED_DIR} - -DFLATBUFFERS_HOME=${CURRENT_INSTALLED_DIR} - -DARROW_ZLIB_VENDORED=ON - -DBROTLI_HOME=${CURRENT_INSTALLED_DIR} - -DLZ4_HOME=${CURRENT_INSTALLED_DIR} - -DZSTD_HOME=${CURRENT_INSTALLED_DIR} - -DSNAPPY_HOME=${CURRENT_INSTALLED_DIR} -DBOOST_ROOT=${CURRENT_INSTALLED_DIR} - -DGFLAGS_HOME=${CURRENT_INSTALLED_DIR} - -DZLIB_HOME=${CURRENT_INSTALLED_DIR} -DARROW_PARQUET=ON -DARROW_BUILD_STATIC=${ARROW_BUILD_STATIC} -DARROW_BUILD_SHARED=${ARROW_BUILD_SHARED} -DBUILD_STATIC=${ARROW_BUILD_STATIC} -DBUILD_SHARED=${ARROW_BUILD_SHARED} -DPARQUET_ARROW_LINKAGE=${PARQUET_ARROW_LINKAGE} - -DDOUBLE_CONVERSION_HOME=${CURRENT_INSTALLED_DIR} - -DGLOG_HOME=${CURRENT_INSTALLED_DIR} + -DARROW_BOOST_USE_SHARED=${BOOST_USE_SHARED} + -DARROW_USE_STATIC_CRT=${USE_STATIC_CRT} + -DARROW_GFLAGS_USE_SHARED=off + -DARROW_JEMALLOC=off ) vcpkg_install_cmake() @@ -70,6 +68,15 @@ if(WIN32) endif() endif() +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share/arrow/cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/arrow/arrowConfig.cmake ${CURRENT_PACKAGES_DIR}/share/arrow/cmake/arrowConfig.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/arrow/arrowConfigVersion.cmake ${CURRENT_PACKAGES_DIR}/share/arrow/cmake/arrowConfigVersion.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/arrow/arrowTargets-release.cmake ${CURRENT_PACKAGES_DIR}/share/arrow/cmake/arrowTargets-release.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/lib/cmake/arrow/arrowTargets.cmake ${CURRENT_PACKAGES_DIR}/share/arrow/cmake/arrowTargets.cmake) +file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/cmake/arrow/arrowTargets-debug.cmake ${CURRENT_PACKAGES_DIR}/share/arrow/cmake/arrowTargets-debug.cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/cmake) + file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/arrow RENAME copyright) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/brunocodutra-metal/CONTROL b/ports/brunocodutra-metal/CONTROL new file mode 100644 index 000000000..9a0519df9 --- /dev/null +++ b/ports/brunocodutra-metal/CONTROL @@ -0,0 +1,3 @@ +Source: brunocodutra-metal
+Version: v2.0.1-1
+Description: A single header C++11 library designed to make you love template metaprogramming
diff --git a/ports/brunocodutra-metal/portfile.cmake b/ports/brunocodutra-metal/portfile.cmake new file mode 100644 index 000000000..857fc7dea --- /dev/null +++ b/ports/brunocodutra-metal/portfile.cmake @@ -0,0 +1,31 @@ +# header-only library
+
+include(vcpkg_common_functions)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO brunocodutra/metal
+ REF v2.0.1
+ SHA512 6aca54e2f2a6d99466d247dbd57706caef33d2399989c2eb14e99d1419922eff753acb53248f8684c1ed11bb87d79b2e850637190e8949f69e0f5ee7304281dc
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(
+ CONFIG_PATH lib/cmake/Metal
+ TARGET_PATH share/metal
+)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib)
+
+# Handle copyright
+configure_file(${SOURCE_PATH}/LICENSE ${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright COPYONLY)
+
+# CMake integration test
+vcpkg_test_cmake(PACKAGE_NAME ${PORT})
diff --git a/ports/cgal/CONTROL b/ports/cgal/CONTROL index 7412e414a..e3131bb20 100644 --- a/ports/cgal/CONTROL +++ b/ports/cgal/CONTROL @@ -1,6 +1,6 @@ Source: cgal -Version: 4.13-3 -Build-Depends: mpfr, mpir, zlib, boost-format, boost-container, boost-iterator, boost-variant, boost-any, boost-unordered, boost-random, boost-foreach, boost-graph, boost-heap, boost-logic +Version: 4.14-1 +Build-Depends: mpfr, mpir, zlib, boost-format, boost-container, boost-iterator, boost-variant, boost-any, boost-unordered, boost-random, boost-foreach, boost-graph, boost-heap, boost-logic, boost-multiprecision Description: The Computational Geometry Algorithms Library (CGAL) is a C++ library that aims to provide easy access to efficient and reliable algorithms in computational geometry. Feature: qt diff --git a/ports/cgal/portfile.cmake b/ports/cgal/portfile.cmake index ce9553226..58199cc54 100644 --- a/ports/cgal/portfile.cmake +++ b/ports/cgal/portfile.cmake @@ -10,8 +10,8 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO CGAL/cgal - REF releases/CGAL-4.13 - SHA512 3a12d7f567487c282928a162a47737c41c22258556ca0083b9cf492fc8f0a7c334b491b14dbfd6a62e71feeeb1b4995769c13a604e0882548f21c41b996d4eaf + REF releases/CGAL-4.14 + SHA512 c70b3ad475f6b2c03ecb540e195b4d26a709205c511b0c705dfddb5b14ef372453ce1d4d49ed342fcd21ba654dea793e91c058afae626276bfb3cfd72bccb382 HEAD_REF master ) @@ -49,11 +49,6 @@ else() endforeach() endif() -file(READ ${CURRENT_PACKAGES_DIR}/share/cgal/CGALConfig.cmake _contents) -string(REPLACE "CGAL_IGNORE_PRECONFIGURED_GMP" "1" _contents "${_contents}") -string(REPLACE "CGAL_IGNORE_PRECONFIGURED_MPFR" "1" _contents "${_contents}") - -file(WRITE ${CURRENT_PACKAGES_DIR}/share/cgal/CGALConfig.cmake "${_contents}") file(WRITE ${CURRENT_PACKAGES_DIR}/lib/cgal/CGALConfig.cmake "include (\$\{CMAKE_CURRENT_LIST_DIR\}/../../share/cgal/CGALConfig.cmake)") file(COPY ${SOURCE_PATH}/Installation/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/cgal) @@ -67,3 +62,5 @@ file( ${SOURCE_PATH}/Installation/LICENSE.LGPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/cgal ) + +vcpkg_test_cmake(PACKAGE_NAME CGAL) diff --git a/ports/curl/CONTROL b/ports/curl/CONTROL index dfa3f229a..a84dab006 100644 --- a/ports/curl/CONTROL +++ b/ports/curl/CONTROL @@ -1,5 +1,5 @@ Source: curl -Version: 7.61.1-3 +Version: 7.61.1-5 Build-Depends: zlib Description: A library for transferring data with URLs Default-Features: ssl diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake index 534a54aea..4c742025b 100644 --- a/ports/curl/portfile.cmake +++ b/ports/curl/portfile.cmake @@ -107,10 +107,23 @@ endif() file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/curl RENAME copyright) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) -if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/curl.exe") +# the native CMAKE_EXECUTABLE_SUFFIX does not work in portfiles, so emulate it +if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") # Windows + set(EXECUTABLE_SUFFIX ".exe") +else() + set(EXECUTABLE_SUFFIX "") +endif() + +if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/curl${EXECUTABLE_SUFFIX}") file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/curl") - file(RENAME ${CURRENT_PACKAGES_DIR}/bin/curl.exe ${CURRENT_PACKAGES_DIR}/tools/curl/curl.exe) + file(RENAME "${CURRENT_PACKAGES_DIR}/bin/curl${EXECUTABLE_SUFFIX}" "${CURRENT_PACKAGES_DIR}/tools/curl/curl${EXECUTABLE_SUFFIX}") vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/curl) + + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(READ "${CURRENT_PACKAGES_DIR}/share/curl/curl-target-release.cmake" RELEASE_MODULE) + string(REPLACE "\${_IMPORT_PREFIX}/bin/curl${EXECUTABLE_SUFFIX}" "\${_IMPORT_PREFIX}/tools/curl/curl${EXECUTABLE_SUFFIX}" RELEASE_MODULE "${RELEASE_MODULE}") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/curl/curl-target-release.cmake" "${RELEASE_MODULE}") + endif() endif() if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") @@ -118,14 +131,26 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") # Drop debug suffix, as FindCURL.cmake does not look for it if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d.lib") file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl.lib) + # Fixup libcurl-target-debug.cmake to match + file(READ "${CURRENT_PACKAGES_DIR}/share/curl/libcurl-target-debug.cmake" DEBUG_MODULE) + string(REPLACE "\${_IMPORT_PREFIX}/debug/lib/libcurl-d.lib" "\${_IMPORT_PREFIX}/debug/lib/libcurl.lib" DEBUG_MODULE "${DEBUG_MODULE}") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/curl/libcurl-target-debug.cmake" "${DEBUG_MODULE}") endif() else() file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/curl-config ${CURRENT_PACKAGES_DIR}/debug/bin/curl-config) if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/libcurl_imp.lib") file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libcurl_imp.lib ${CURRENT_PACKAGES_DIR}/lib/libcurl.lib) + # Fixup libcurl-target-release.cmake to match + file(READ "${CURRENT_PACKAGES_DIR}/share/curl/libcurl-target-release.cmake" RELEASE_MODULE) + string(REPLACE "\${_IMPORT_PREFIX}/lib/libcurl_imp.lib" "\${_IMPORT_PREFIX}/lib/libcurl.lib" RELEASE_MODULE "${RELEASE_MODULE}") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/curl/libcurl-target-release.cmake" "${RELEASE_MODULE}") endif() if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d_imp.lib") file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl-d_imp.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libcurl.lib) + # Fixup libcurl-target-debug.cmake to match + file(READ "${CURRENT_PACKAGES_DIR}/share/curl/libcurl-target-debug.cmake" DEBUG_MODULE) + string(REPLACE "\${_IMPORT_PREFIX}/debug/lib/libcurl-d_imp.lib" "\${_IMPORT_PREFIX}/debug/lib/libcurl.lib" DEBUG_MODULE "${DEBUG_MODULE}") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/curl/libcurl-target-debug.cmake" "${DEBUG_MODULE}") endif() endif() diff --git a/ports/darknet/CONTROL b/ports/darknet/CONTROL index bc6526318..f291bdd3d 100644 --- a/ports/darknet/CONTROL +++ b/ports/darknet/CONTROL @@ -1,5 +1,5 @@ Source: darknet -Version: 1.0.0-1 +Version: 1.0.0-2 Description: Darknet is an open source neural network framework written in C and CUDA. You only look once (YOLO) is a state-of-the-art, real-time object detection system, best example of darknet functionalities. Build-Depends: pthreads (windows), stb Default-Features: weights @@ -16,5 +16,5 @@ Feature: weights Description: Download common weights from official websites, using vcpkg proxy-enabled functions Feature: opencv-cuda -Build-Depends: darknet[cuda], opencv[cuda] +Build-Depends: opencv[cuda] Description: Build darknet with support for a CUDA-enabled OpenCV diff --git a/ports/darknet/fix_cmakelists.patch b/ports/darknet/fix_cmakelists.patch index 62aa61fa6..b9593d85f 100644 --- a/ports/darknet/fix_cmakelists.patch +++ b/ports/darknet/fix_cmakelists.patch @@ -1,18 +1,18 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 6a5076a..52d19a3 100644 +index acd6ca0..0e7de91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -25,8 +25,7 @@ enable_language(CXX) +@@ -28,8 +28,7 @@ enable_language(CXX) set(CMAKE_CXX_STANDARD 11) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH}) -set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Install prefix" FORCE) -set(INSTALL_BIN_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Path where exe and dll will be installed" FORCE) -+set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed" FORCE) ++set(INSTALL_BIN_DIR "bin" CACHE PATH "Path where exe and dll will be installed") set(INSTALL_LIB_DIR "lib" CACHE PATH "Path where lib will be installed") set(INSTALL_INCLUDE_DIR "include" CACHE PATH "Path where headers will be installed") set(INSTALL_CMAKE_DIR "share/darknet" CACHE PATH "Path where cmake configs will be installed") -@@ -76,7 +75,6 @@ if(USE_INTEGRATED_LIBS) +@@ -79,7 +78,6 @@ if(USE_INTEGRATED_LIBS) set(PThreads_windows_DIR ${CMAKE_CURRENT_LIST_DIR}/3rdparty/pthreads CACHE PATH "Path where pthreads for windows can be located") add_definitions(-D_TIMESPEC_DEFINED) endif() @@ -20,30 +20,3 @@ index 6a5076a..52d19a3 100644 set(CMAKE_DEBUG_POSTFIX d) add_definitions(-DUSE_CMAKE_LIBS) -@@ -323,21 +321,19 @@ endif() - - set_target_properties(darklib PROPERTIES PUBLIC_HEADER "${exported_headers};${CMAKE_CURRENT_LIST_DIR}/include/yolo_v2_class.hpp") - --install(TARGETS darklib uselib darknet EXPORT DarknetTargets -+install(TARGETS darklib EXPORT DarknetTargets - RUNTIME DESTINATION "${INSTALL_BIN_DIR}" - LIBRARY DESTINATION "${INSTALL_LIB_DIR}" - ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" - PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" - COMPONENT dev - ) -+install(TARGETS uselib darknet -+ DESTINATION "${INSTALL_BIN_DIR}" -+) - if(OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK) - install(TARGETS uselib_track -- EXPORT DarknetTargets -- RUNTIME DESTINATION "${INSTALL_BIN_DIR}" -- LIBRARY DESTINATION "${INSTALL_LIB_DIR}" -- ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" -- PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDE_DIR}" -- COMPONENT dev -+ DESTINATION "${INSTALL_BIN_DIR}" - ) - endif() - diff --git a/ports/darknet/portfile.cmake b/ports/darknet/portfile.cmake index d4551e6fb..a494d49bf 100644 --- a/ports/darknet/portfile.cmake +++ b/ports/darknet/portfile.cmake @@ -11,8 +11,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO AlexeyAB/darknet - REF 1cd332e4cac001ffcc12a24c72640fe02b69a8a0 - SHA512 313018d51747b40244d3a828dce8deb35f900a6be1198f0f1af5647f3889ead7f1ac78cdc4223cfe85d279ca21000df1c8feac02e703e5b91af939e26e4d5571 + REF 1cad888641804b1ddddf03ad316aa3a6e9e679ad + SHA512 8d7fc673bc318fd606f7c9de04291cd0fe5c3b8f8d2076e719a6c35fe226a45c10a3f65c38be5476a72b34ac7a31c8f9e1b5ea15d061eddcdda38357bc2a8bca HEAD_REF master PATCHES fix_cmakelists.patch @@ -28,6 +28,11 @@ if("opencv" IN_LIST FEATURES) set(ENABLE_OPENCV ON) endif() +if("opencv-cuda" IN_LIST FEATURES) + set(ENABLE_OPENCV ON) + set(ENABLE_CUDA ON) +endif() + if("weights" IN_LIST FEATURES) vcpkg_download_distfile(YOLOV3_WEIGHTS URLS "https://pjreddie.com/media/files/yolov3.weights" diff --git a/ports/date/CONTROL b/ports/date/CONTROL index f9a86d671..99d514b8d 100644 --- a/ports/date/CONTROL +++ b/ports/date/CONTROL @@ -1,5 +1,5 @@ Source: date -Version: 2.4.1 +Version: 9dc96fd Description: A date and time library based on the C++11/14/17 <chrono> header Feature: remote-api diff --git a/ports/date/fix-date.patch b/ports/date/fix-date.patch deleted file mode 100644 index bf4c05b38..000000000 --- a/ports/date/fix-date.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/include/date/tz.h b/include/date/tz.h -index 280a598..f9b5a35 100644 ---- a/include/date/tz.h -+++ b/include/date/tz.h -@@ -1963,7 +1963,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt, - bool is_60_sec = fds.tod.seconds() == seconds{60}; - if (is_60_sec) - fds.tod.seconds() -= seconds{1}; -- auto tmp = to_utc_time(sys_days(fds.ymd) - *offptr + fds.tod.to_duration()); -+ auto tmp = utc_clock::from_sys(sys_days(fds.ymd) - *offptr + fds.tod.to_duration()); - if (is_60_sec) - tmp += seconds{1}; - if (is_60_sec != is_leap_second(tmp).first || !fds.tod.in_conventional_range()) -@@ -2197,7 +2197,7 @@ from_stream(std::basic_istream<CharT, Traits>& is, const CharT* fmt, - return is; - } - --#if !defined(_MSC_VER) || _MSC_VER > 1912 -+#if !defined(_MSC_VER) || _MSC_VER > 1913 - - // clock_time_conversion - -@@ -2471,7 +2471,7 @@ clock_cast(const std::chrono::time_point<SrcClock, Duration>& tp) - return clock_cast_detail::cc_impl<DstClock>(tp, &tp); - } - --#endif // !defined(_MSC_VER) || _MSC_VER > 1912 -+#endif // !defined(_MSC_VER) || _MSC_VER > 1913 - - // Deprecated API - -@@ -2579,3 +2579,4 @@ to_gps_time(const tai_time<Duration>& t) - } // namespace date - - #endif // TZ_H -+ diff --git a/ports/date/portfile.cmake b/ports/date/portfile.cmake index 749c0c5f0..5eedde942 100644 --- a/ports/date/portfile.cmake +++ b/ports/date/portfile.cmake @@ -10,16 +10,11 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO HowardHinnant/date - REF v2.4.1 - SHA512 ce7d1c4518558d3690b3a33cd3da1066b43a5f641282c331c60be73e9b010227d4998bca5f34694215ae52f6514a2f5eccd6b0a5ee3dcf8cef2f2d1644c8beee + REF 9dc96fd9b5e4e1e7885aa80dc24a3ceb407c3730 + SHA512 1acb78f1ae7f5b1278a9e034fa5ccbb64643ad381ef9bd76bf42fb04d714c6742f2129b6892024cd98bb925e1a6136337fccb636e3f991b428be1ed05ab8901e HEAD_REF master ) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} - PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-date.patch -) - file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) set(HAS_REMOTE_API 0) diff --git a/ports/ebml/CONTROL b/ports/ebml/CONTROL index 1b3ec442a..ee257603f 100644 --- a/ports/ebml/CONTROL +++ b/ports/ebml/CONTROL @@ -1,3 +1,3 @@ Source: ebml
-Version: 1.3.6-1
+Version: 1.3.7
Description: a C++ libary to parse EBML files
diff --git a/ports/ebml/portfile.cmake b/ports/ebml/portfile.cmake index 573801fb6..3eb8d642d 100644 --- a/ports/ebml/portfile.cmake +++ b/ports/ebml/portfile.cmake @@ -4,12 +4,11 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") message(FATAL_ERROR "${PORT} does not currently support UWP")
endif()
-
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Matroska-Org/libebml
- REF release-1.3.6
- SHA512 249ff2e9b381d827311eaec910962685243a3b65335c7bd404a35e11cd204c63bc7ea69787f0e27ea9c9144024e45867fd4ae7d30688a3695cd45fee1ce89ec9
+ REF release-1.3.7
+ SHA512 754dee128db2eb6f0ba09962312ddda79f3178238464dd6161cce50bd08fd4193490a48bb537c4e2a388dc339951909a8857617cb30500d76d5689da4f855b47
HEAD_REF master
PATCHES export-endofstreamx.patch
)
@@ -22,7 +21,11 @@ vcpkg_configure_cmake( vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
+if (WIN32)
+ vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
+else ()
+ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/ebml)
+endif ()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
diff --git a/ports/effolkronium-random/CONTROL b/ports/effolkronium-random/CONTROL index 33e61c639..77facd63b 100644 --- a/ports/effolkronium-random/CONTROL +++ b/ports/effolkronium-random/CONTROL @@ -1,3 +1,3 @@ Source: effolkronium-random -Version: 1.2.0 +Version: 1.3.0 Description: Random with a modern C++ API diff --git a/ports/effolkronium-random/portfile.cmake b/ports/effolkronium-random/portfile.cmake index d96401e22..d6e3cbba8 100644 --- a/ports/effolkronium-random/portfile.cmake +++ b/ports/effolkronium-random/portfile.cmake @@ -3,14 +3,11 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO effolkronium/random - REF v1.2.0 - SHA512 92c5447196601d7dfb0320b517494f4e75cb55011c800cd2f18655cd4ab867672ad39830a3dbb3fc5f39a41c8ae03b6a6910f1eac4a2f131cffca896554be561 + REF v1.3.0 + SHA512 68bd42e696a784832376950df7df9ddc8fc52ad073f44eddc7bcc2547278096ad3ec6463ce3a0e2e60a223e0852e68be4c2e9bcec4b237b9017ac2b03d5be812 HEAD_REF master ) -vcpkg_replace_string(${SOURCE_PATH}/CMakeLists.txt "effolkronium_random" "effolkronium-random") -vcpkg_replace_string(${SOURCE_PATH}/cmake/config.cmake.in "effolkronium_random" "effolkronium-random") - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -19,7 +16,7 @@ vcpkg_configure_cmake( ) vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH cmake/ TARGET_PATH /share/effolkronium-random) +vcpkg_fixup_cmake_targets(CONFIG_PATH cmake/ TARGET_PATH /share/effolkronium_random) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/lib) file(INSTALL ${SOURCE_PATH}/LICENSE.MIT DESTINATION ${CURRENT_PACKAGES_DIR}/share/effolkronium-random RENAME copyright) diff --git a/ports/fcl/CONTROL b/ports/fcl/CONTROL index 0e425f59b..e486cf90a 100644 --- a/ports/fcl/CONTROL +++ b/ports/fcl/CONTROL @@ -1,4 +1,4 @@ Source: fcl -Version: 0.5.0-3 +Version: 0.5.0-4 Description: a library for performing three types of proximity queries on a pair of geometric models composed of triangles Build-Depends: ccd, octomap diff --git a/ports/fcl/portfile.cmake b/ports/fcl/portfile.cmake index 851a013c2..92781872f 100644 --- a/ports/fcl/portfile.cmake +++ b/ports/fcl/portfile.cmake @@ -36,7 +36,12 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() -vcpkg_fixup_cmake_targets(CONFIG_PATH "cmake/") +if(EXISTS ${CURRENT_PACKAGES_DIR}/CMake) + vcpkg_fixup_cmake_targets(CONFIG_PATH "CMake") +else() + vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/fcl") +endif() + file(READ ${CURRENT_PACKAGES_DIR}/share/fcl/fclConfig.cmake FCL_CONFIG) string(REPLACE "unset(_expectedTargets)" diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL index ce69402dc..2060e37af 100644 --- a/ports/ffmpeg/CONTROL +++ b/ports/ffmpeg/CONTROL @@ -1,5 +1,5 @@ Source: ffmpeg -Version: 4.1-1 +Version: 4.1-3 Description: a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations. diff --git a/ports/ffmpeg/FindFFMPEG.cmake b/ports/ffmpeg/FindFFMPEG.cmake index bd373bfae..f8e65f53a 100644 --- a/ports/ffmpeg/FindFFMPEG.cmake +++ b/ports/ffmpeg/FindFFMPEG.cmake @@ -6,6 +6,8 @@ foreach(FFMPEG_SUBLIBRARY avformat avdevice avcodec avutil swscale) find_library(FFMPEG_lib${FFMPEG_SUBLIBRARY}_LIBRARY NAMES ${FFMPEG_SUBLIBRARY}) list(APPEND FFMPEG_LIBRARIES ${FFMPEG_lib${FFMPEG_SUBLIBRARY}_LIBRARY}) endforeach() -list(APPEND FFMPEG_LIBRARIES wsock32 ws2_32 Secur32) +if(WIN32) + list(APPEND FFMPEG_LIBRARIES wsock32 ws2_32 Secur32) +endif() find_package_handle_standard_args(FFMPEG REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) diff --git a/ports/ffmpeg/build_linux.sh b/ports/ffmpeg/build_linux.sh new file mode 100644 index 000000000..b24be1346 --- /dev/null +++ b/ports/ffmpeg/build_linux.sh @@ -0,0 +1,23 @@ +#!/usr/bin/bash +set -e +export PATH=/usr/bin:$PATH +# Export HTTP(S)_PROXY as http(s)_proxy: +if [ "$HTTP_PROXY" ]; then + export http_proxy=$HTTP_PROXY +fi +if [ "$HTTPS_PROXY" ]; then + export https_proxy=$HTTPS_PROXY +fi + +PATH_TO_BUILD_DIR=$1 +PATH_TO_SRC_DIR=$2 +PATH_TO_PACKAGE_DIR=$3 +# Note: $4 is extra configure options + +cd "$PATH_TO_BUILD_DIR" +echo "=== CONFIGURING ===" +"$PATH_TO_SRC_DIR/configure" "--prefix=$PATH_TO_PACKAGE_DIR" $4 +echo "=== BUILDING ===" +make -j6 +echo "=== INSTALLING ===" +make install diff --git a/ports/ffmpeg/configure_opencv.patch b/ports/ffmpeg/configure_opencv.patch index 66678661e..ac5c82797 100644 --- a/ports/ffmpeg/configure_opencv.patch +++ b/ports/ffmpeg/configure_opencv.patch @@ -1,11 +1,11 @@ --- a/configure
+++ b/configure
-@@ -5804,7 +5804,7 @@
+@@ -6110,7 +6110,7 @@ enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec
enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
- enabled libopencv && { check_header opencv2/core/core_c.h &&
- { use_pkg_config opencv opencv2/core/core_c.h cvCreateImageHeader ||
-- require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
+ enabled libopencv && { check_headers opencv2/core/core_c.h &&
+ { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
+- require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
+ require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core341 -lopencv_imgproc341; } ||
- require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
- enabled libopenh264 && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
- enabled libopenjpeg && { { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
+ require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
+ enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
+ enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
diff --git a/ports/ffmpeg/detect-openssl.patch b/ports/ffmpeg/detect-openssl.patch index cb8a77e0a..affd37d15 100644 --- a/ports/ffmpeg/detect-openssl.patch +++ b/ports/ffmpeg/detect-openssl.patch @@ -12,14 +12,11 @@ diff --git a/configure b/configure index a1818dc..1cf2a7c 100755 --- a/configure +++ b/configure -@@ -5836,6 +5836,7 @@ enabled openssl && { use_pkg_config openssl openssl/ssl.h OPENSSL_init - check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto || - check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 || - check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || -+ check_lib openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 || +@@ -6127,6 +6127,7 @@ + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto || + check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || + check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || ++ check_lib openssl openssl/ssl.h SSL_library_init -llibeay32 -lssleay32 || die "ERROR: openssl not found"; } - enabled qtkit_indev && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; } - --- -2.10.1.windows.1 - + enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && + require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create && diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index f8c0c9f38..2a35d6b94 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -21,14 +21,24 @@ vcpkg_apply_patches( vcpkg_find_acquire_program(YASM) get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY) -set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") - vcpkg_acquire_msys(MSYS_ROOT PACKAGES perl gcc diffutils make) +if (WIN32) + set(ENV{PATH} "$ENV{PATH};${YASM_EXE_PATH}") + set(BUILD_SCRIPT ${CMAKE_CURRENT_LIST_DIR}\\build.sh) + + if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") + vcpkg_acquire_msys(MSYS_ROOT PACKAGES perl gcc diffutils make) + else() + vcpkg_acquire_msys(MSYS_ROOT PACKAGES diffutils make) + endif() + + set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) else() - vcpkg_acquire_msys(MSYS_ROOT PACKAGES diffutils make) + set(ENV{PATH} "$ENV{PATH}:${YASM_EXE_PATH}") + set(BASH /bin/bash) + set(BUILD_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/build_linux.sh) endif() -set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) + set(ENV{INCLUDE} "${CURRENT_INSTALLED_DIR}/include;$ENV{INCLUDE}") set(ENV{LIB} "${CURRENT_INSTALLED_DIR}/lib;$ENV{LIB}") @@ -122,18 +132,20 @@ endif() message(STATUS "Building Options: ${OPTIONS}") -if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") - set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MDd --extra-cxxflags=-MDd") - set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-cflags=-MD --extra-cxxflags=-MD") -else() - set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MTd --extra-cxxflags=-MTd") - set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-cflags=-MT --extra-cxxflags=-MT") +if(WIN32) + if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") + set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MDd --extra-cxxflags=-MDd") + set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-cflags=-MD --extra-cxxflags=-MD") + else() + set(OPTIONS_DEBUG "${OPTIONS_DEBUG} --extra-cflags=-MTd --extra-cxxflags=-MTd") + set(OPTIONS_RELEASE "${OPTIONS_RELEASE} --extra-cflags=-MT --extra-cxxflags=-MT") + endif() endif() message(STATUS "Building ${_csc_PROJECT_PATH} for Release") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) vcpkg_execute_required_process( - COMMAND ${BASH} --noprofile --norc "${CMAKE_CURRENT_LIST_DIR}\\build.sh" + COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" # BUILD DIR "${SOURCE_PATH}" # SOURCE DIR "${CURRENT_PACKAGES_DIR}" # PACKAGE DIR @@ -145,7 +157,7 @@ vcpkg_execute_required_process( message(STATUS "Building ${_csc_PROJECT_PATH} for Debug") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) vcpkg_execute_required_process( - COMMAND ${BASH} --noprofile --norc "${CMAKE_CURRENT_LIST_DIR}\\build.sh" + COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" # BUILD DIR "${SOURCE_PATH}" # SOURCE DIR "${CURRENT_PACKAGES_DIR}/debug" # PACKAGE DIR diff --git a/ports/fftw3/CONTROL b/ports/fftw3/CONTROL index c1986ce4d..1ff42851f 100644 --- a/ports/fftw3/CONTROL +++ b/ports/fftw3/CONTROL @@ -1,5 +1,5 @@ Source: fftw3
-Version: 3.3.8-2
+Version: 3.3.8-3
Description: FFTW is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size, and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST).
Feature: openmp
diff --git a/ports/fftw3/fftw3_arch_fix.patch b/ports/fftw3/fftw3_arch_fix.patch index a3462ea60..922d86b97 100644 --- a/ports/fftw3/fftw3_arch_fix.patch +++ b/ports/fftw3/fftw3_arch_fix.patch @@ -1,8 +1,8 @@ -diff --git a/CMakeLists - Kopie.txt b/CMakeLists.txt -index 95bd537a..245acc8f 100644 ---- a/CMakeLists - Kopie.txt -+++ b/CMakeLists.txt -@@ -131,6 +131,7 @@ endif () +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 95bd537a..245acc8f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -131,6 +131,7 @@ endif ()
include (CheckCCompilerFlag)
@@ -10,7 +10,7 @@ index 95bd537a..245acc8f 100644 if (ENABLE_SSE)
foreach (FLAG "-msse" "/arch:SSE")
unset (HAVE_SSE CACHE)
-@@ -176,8 +177,9 @@ if (ENABLE_AVX2) +@@ -176,8 +177,9 @@ if (ENABLE_AVX2)
endif ()
# AVX2 codelets require FMA support as well
diff --git a/ports/folly/portfile.cmake b/ports/folly/portfile.cmake index 8ef2ad566..3c695cc99 100644 --- a/ports/folly/portfile.cmake +++ b/ports/folly/portfile.cmake @@ -82,10 +82,10 @@ set(FOLLY_TARGETS_CMAKE "${CURRENT_PACKAGES_DIR}/share/folly/folly-targets.cmake FILE(READ ${FOLLY_TARGETS_CMAKE} _contents) STRING(REPLACE [[ -"Threads::Threads;Iphlpapi.lib;Ws2_32.lib;${_IMPORT_PREFIX}/lib/boost_context-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_chrono-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_date_time-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_filesystem-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_program_options-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_regex-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_system-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_thread-vc140-mt.lib;${_IMPORT_PREFIX}/lib/boost_atomic-vc140-mt.lib;${_IMPORT_PREFIX}/lib/double-conversion.lib;${_IMPORT_PREFIX}/lib/ssleay32.lib;${_IMPORT_PREFIX}/lib/libeay32.lib;${_IMPORT_PREFIX}/lib/zlib.lib;gflags;glog::glog;event" +"Threads::Threads;Iphlpapi.lib;Ws2_32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_context-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_context-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_chrono-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_chrono-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_date_time-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_date_time-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_filesystem-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_filesystem-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_program_options-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_program_options-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_regex-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_regex-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_system-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_system-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_thread-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_thread-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_atomic-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_atomic-vc140-mt-gd.lib>;${_IMPORT_PREFIX}/lib/double-conversion.lib;${_IMPORT_PREFIX}/lib/ssleay32.lib;${_IMPORT_PREFIX}/lib/libeay32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/zlib.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/zlibd.lib>;gflags;glog::glog;event" ]] [[ -"Threads::Threads;Iphlpapi.lib;Ws2_32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_context-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_context-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_chrono-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_chrono-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_date_time-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_date_time-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_filesystem-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_filesystem-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_program_options-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_program_options-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_regex-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_regex-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_system-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_system-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_thread-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_thread-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_atomic-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_atomic-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/double-conversion.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/double-conversion.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/ssleay32.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/ssleay32.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/libeay32.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/libeay32.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/zlib.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/zlibd.lib>;gflags;glog::glog;event" +"Threads::Threads;Iphlpapi.lib;Ws2_32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_context-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_context-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_chrono-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_chrono-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_date_time-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_date_time-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_filesystem-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_filesystem-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_program_options-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_program_options-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_regex-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_regex-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_system-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_system-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_thread-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_thread-vc140-mt-gd.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/boost_atomic-vc140-mt.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/boost_atomic-vc140-mt-gd.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/double-conversion.lib>;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/double-conversion.lib>;${_IMPORT_PREFIX}/lib/ssleay32.lib;${_IMPORT_PREFIX}/lib/libeay32.lib;\$<\$<NOT:\$<CONFIG:DEBUG>>:${_IMPORT_PREFIX}/lib/zlib.lib>;\$<\$<CONFIG:DEBUG>:${_IMPORT_PREFIX}/debug/lib/zlibd.lib>;gflags;glog::glog;event" ]] _contents "${_contents}") FILE(WRITE ${FOLLY_TARGETS_CMAKE} "${_contents}") diff --git a/ports/freeimage/CONTROL b/ports/freeimage/CONTROL index 0d2277772..51ebbbc69 100644 --- a/ports/freeimage/CONTROL +++ b/ports/freeimage/CONTROL @@ -1,4 +1,4 @@ Source: freeimage -Version: 3.18.0-4 -Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp, libraw, jxrlib, openexr +Version: 3.18.0-5 +Build-Depends: zlib, libpng, libjpeg-turbo, tiff, openjpeg, libwebp[all], libraw, jxrlib, openexr Description: Support library for graphics image formats diff --git a/ports/g2o/CONTROL b/ports/g2o/CONTROL index cdad4d19a..57999aece 100644 --- a/ports/g2o/CONTROL +++ b/ports/g2o/CONTROL @@ -1,4 +1,4 @@ Source: g2o -Version: 20170730_git-3 +Version: 20170730_git-4 Build-Depends: suitesparse, eigen3, clapack, ceres Description: g2o: A General Framework for Graph Optimization http://openslam.org/g2o.html diff --git a/ports/g2o/portfile.cmake b/ports/g2o/portfile.cmake index ba8186789..6d09b8a8c 100644 --- a/ports/g2o/portfile.cmake +++ b/ports/g2o/portfile.cmake @@ -23,6 +23,10 @@ vcpkg_install_cmake() vcpkg_copy_pdbs() +if(VCPKG_USE_HEAD_VERSION) + vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/g2o") +endif() + if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) file(GLOB_RECURSE HEADERS "${CURRENT_PACKAGES_DIR}/include/*") foreach(HEADER ${HEADERS}) diff --git a/ports/gdal/CONTROL b/ports/gdal/CONTROL index 0814046f5..a5c79363a 100644 --- a/ports/gdal/CONTROL +++ b/ports/gdal/CONTROL @@ -1,5 +1,5 @@ Source: gdal -Version: 2.4.0 +Version: 2.4.0-2 Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data. Build-Depends: proj, libpng, geos, sqlite3, curl, expat, libpq, openjpeg, libwebp, libxml2, liblzma, netcdf-c, hdf5 diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake index daa9c0a04..8c0c9a04d 100644 --- a/ports/gdal/portfile.cmake +++ b/ports/gdal/portfile.cmake @@ -37,14 +37,23 @@ endif() foreach(BUILD_TYPE IN LISTS BUILD_TYPES) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}) vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}) - vcpkg_apply_patches( - SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-${GDAL_VERSION_STR} - PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-debug-crt-flags.patch - ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-static-build.patch - ) + if (VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-${GDAL_VERSION_STR} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-debug-crt-flags.patch + ${CMAKE_CURRENT_LIST_DIR}/0002-Fix-static-build.patch + ) + else() + vcpkg_apply_patches( + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-${GDAL_VERSION_STR} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-debug-crt-flags.patch + ) + endif() endforeach() + find_program(NMAKE nmake REQUIRED) file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" NATIVE_PACKAGES_DIR) @@ -63,8 +72,13 @@ file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libpng16d.lib" PNG_LIBRA # Setup geos libraries + include path file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" GEOS_INCLUDE_DIR) -file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libgeos.lib" GEOS_LIBRARY_REL) -file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libgeosd.lib" GEOS_LIBRARY_DBG) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/libgeos.lib" GEOS_LIBRARY_REL) + file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/libgeosd.lib" GEOS_LIBRARY_DBG) +else() + file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib" GEOS_LIBRARY_REL) + file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib" GEOS_LIBRARY_DBG) +endif() # Setup expat libraries + include path file(TO_NATIVE_PATH "${CURRENT_INSTALLED_DIR}/include" EXPAT_INCLUDE_DIR) @@ -200,7 +214,7 @@ list(APPEND NMAKE_OPTIONS_DBG ) if(NOT VCPKG_LIBRARY_LINKAGE STREQUAL "static") # Static Build does not like PG_LIB - list(APPEND NMAKE_OPTIONS_REL PG_LIB=${PGSQL_LIBRARY_DBG}) + list(APPEND NMAKE_OPTIONS_DBG PG_LIB=${PGSQL_LIBRARY_DBG}) endif() if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") diff --git a/ports/giflib/portfile.cmake b/ports/giflib/portfile.cmake index 86a7f9465..aeca810ed 100644 --- a/ports/giflib/portfile.cmake +++ b/ports/giflib/portfile.cmake @@ -22,6 +22,7 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS_DEBUG -DGIFLIB_SKIP_HEADERS=ON ) diff --git a/ports/glew/CONTROL b/ports/glew/CONTROL index ecf948c5d..54b2d09df 100644 --- a/ports/glew/CONTROL +++ b/ports/glew/CONTROL @@ -1,3 +1,3 @@ -Source: glew -Version: 2.1.0-1 -Description: The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. +Source: glew
+Version: 2.1.0-3
+Description: The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library.
diff --git a/ports/glew/portfile.cmake b/ports/glew/portfile.cmake index 45f711f77..9b982db7f 100644 --- a/ports/glew/portfile.cmake +++ b/ports/glew/portfile.cmake @@ -3,7 +3,7 @@ include(vcpkg_common_functions) set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/glew/glew-2.1.0) # Don't change to vcpkg_from_github! The github-auto-generated archives are missing some files. -# More info: https://github.com/nigels-com/glew/issues/31 +# More info: https://github.com/nigels-com/glew/issues/31 and https://github.com/nigels-com/glew/issues/13 vcpkg_download_distfile(ARCHIVE_FILE URLS "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0.tgz" FILENAME "glew-2.1.0.tgz" @@ -13,7 +13,10 @@ vcpkg_extract_source_archive(${ARCHIVE_FILE} ${CURRENT_BUILDTREES_DIR}/src/glew) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH}/build/cmake -) + DISABLE_PARALLEL_CONFIGURE + OPTIONS + -DBUILD_UTILS=OFF + ) vcpkg_install_cmake() @@ -40,11 +43,6 @@ if(EXISTS ${CURRENT_PACKAGES_DIR}/debug/lib/libglew32d.lib) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libglew32d.lib ${CURRENT_PACKAGES_DIR}/debug/lib/glew32d.lib) endif() -file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/glewinfo.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/bin/visualinfo.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/glewinfo.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/visualinfo.exe) - if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) diff --git a/ports/google-cloud-cpp/CONTROL b/ports/google-cloud-cpp/CONTROL index a23a885b4..006b8fe2b 100644 --- a/ports/google-cloud-cpp/CONTROL +++ b/ports/google-cloud-cpp/CONTROL @@ -1,4 +1,4 @@ Source: google-cloud-cpp
-Version: 0.7.0
-Build-Depends: grpc, curl, crc32c
+Version: 0.8.0-1
+Build-Depends: grpc, curl[ssl], crc32c
Description: C++ Client Libraries for Google Cloud Platform APIs.
diff --git a/ports/google-cloud-cpp/cmake-libcurl-find-config.patch b/ports/google-cloud-cpp/cmake-libcurl-find-config.patch new file mode 100644 index 000000000..0c1d6dd6f --- /dev/null +++ b/ports/google-cloud-cpp/cmake-libcurl-find-config.patch @@ -0,0 +1,142 @@ +diff --git a/cmake/IncludeCurl.cmake b/cmake/IncludeCurl.cmake +index 6ea7ca3e6..3c2db6b28 100644 +--- a/cmake/IncludeCurl.cmake ++++ b/cmake/IncludeCurl.cmake +@@ -34,49 +34,57 @@ set_property(CACHE GOOGLE_CLOUD_CPP_CURL_PROVIDER + if ("${GOOGLE_CLOUD_CPP_CURL_PROVIDER}" STREQUAL "external") + include(external/curl) + elseif("${GOOGLE_CLOUD_CPP_CURL_PROVIDER}" STREQUAL "package") +- # Search for libcurl, in CMake 3.5 this does not define a target, but it +- # will in 3.12 (see https://cmake.org/cmake/help/git- +- # stage/module/FindCURL.html for details). Until then, define the target +- # ourselves if it is missing. +- find_package(CURL REQUIRED) +- if (NOT TARGET CURL::libcurl) +- add_library(CURL::libcurl UNKNOWN IMPORTED) +- set_property(TARGET CURL::libcurl +- APPEND +- PROPERTY INTERFACE_INCLUDE_DIRECTORIES +- "${CURL_INCLUDE_DIR}") +- set_property(TARGET CURL::libcurl +- APPEND +- PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") +- endif () +- # If the library is static, we need to explicitly link its dependencies. +- # However, we should not do so for shared libraries, because the version of +- # OpenSSL (for example) found by find_package() may be newer than the +- # version linked against libcurl. +- if ("${CURL_LIBRARY}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") +- find_package(OpenSSL REQUIRED) +- find_package(ZLIB REQUIRED) +- set_property(TARGET CURL::libcurl +- APPEND +- PROPERTY INTERFACE_LINK_LIBRARIES +- OpenSSL::SSL +- OpenSSL::Crypto +- ZLIB::ZLIB) +- message(STATUS "CURL linkage will be static") +- if (WIN32) ++ # Search for libcurl, first using CONFIG mode, and retrying ++ # using MODULE mode if that fails ++ find_package(CURL CONFIG QUIET) # Deliberately quiet, so we can handle the result ++ if(CURL_FOUND) ++ message(STATUS "CURL library found via CONFIG mode") ++ else() ++ # CONFIG mode failed - fallback to MODULE mode ++ # In CMake 3.5 this does not define a target, but it ++ # will in 3.12 (see https://cmake.org/cmake/help/git- ++ # stage/module/FindCURL.html for details). Until then, define the target ++ # ourselves if it is missing. ++ find_package(CURL MODULE REQUIRED) # Use REQUIRED the second time to fail out ++ if (NOT TARGET CURL::libcurl) ++ add_library(CURL::libcurl UNKNOWN IMPORTED) + set_property(TARGET CURL::libcurl + APPEND +- PROPERTY INTERFACE_LINK_LIBRARIES +- crypt32 +- wsock32 +- ws2_32) ++ PROPERTY INTERFACE_INCLUDE_DIRECTORIES ++ "${CURL_INCLUDE_DIR}") ++ set_property(TARGET CURL::libcurl ++ APPEND ++ PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + endif () +- if (APPLE) ++ # If the library is static, we need to explicitly link its dependencies. ++ # However, we should not do so for shared libraries, because the version of ++ # OpenSSL (for example) found by find_package() may be newer than the ++ # version linked against libcurl. ++ if ("${CURL_LIBRARY}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") ++ find_package(OpenSSL REQUIRED) ++ find_package(ZLIB REQUIRED) + set_property(TARGET CURL::libcurl + APPEND +- PROPERTY INTERFACE_LINK_LIBRARIES ldap) ++ PROPERTY INTERFACE_LINK_LIBRARIES ++ OpenSSL::SSL ++ OpenSSL::Crypto ++ ZLIB::ZLIB) ++ message(STATUS "CURL linkage will be static") ++ if (WIN32) ++ set_property(TARGET CURL::libcurl ++ APPEND ++ PROPERTY INTERFACE_LINK_LIBRARIES ++ crypt32 ++ wsock32 ++ ws2_32) ++ endif () ++ if (APPLE) ++ set_property(TARGET CURL::libcurl ++ APPEND ++ PROPERTY INTERFACE_LINK_LIBRARIES ldap) ++ endif () ++ else() ++ message(STATUS "CURL linkage will be non-static") + endif () +- else() +- message(STATUS "CURL linkage will be non-static") + endif () + endif () +diff --git a/google/cloud/storage/config.cmake.in b/google/cloud/storage/config.cmake.in +index a4d261815..640089e09 100644 +--- a/google/cloud/storage/config.cmake.in ++++ b/google/cloud/storage/config.cmake.in +@@ -13,21 +13,25 @@ + # limitations under the License. + + include(CMakeFindDependencyMacro) +-find_dependency(CURL) ++# Search for libcurl, first using CONFIG mode, and retrying ++# using MODULE mode if that fails ++find_package(CURL CONFIG QUIET) # find_package so we can explicitly specify QUIET ++if(NOT CURL_FOUND) ++ find_dependency(CURL MODULE) ++ # Some versions of FindCURL do not define CURL::libcurl, so we define it ourselves. ++ if (NOT TARGET CURL::libcurl) ++ add_library(CURL::libcurl UNKNOWN IMPORTED) ++ set_property(TARGET CURL::libcurl ++ APPEND ++ PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}") ++ set_property(TARGET CURL::libcurl ++ APPEND ++ PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") ++ endif () ++endif() + find_dependency(Crc32c) + find_dependency(google_cloud_cpp_common) + find_dependency(OpenSSL) + find_dependency(ZLIB) + +-# Some versions of FindCURL do not define CURL::libcurl, so we define it ourselves. +-if (NOT TARGET CURL::libcurl) +- add_library(CURL::libcurl UNKNOWN IMPORTED) +- set_property(TARGET CURL::libcurl +- APPEND +- PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}") +- set_property(TARGET CURL::libcurl +- APPEND +- PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") +-endif () +- + include("${CMAKE_CURRENT_LIST_DIR}/storage-targets.cmake") diff --git a/ports/google-cloud-cpp/cmake-libcurl-target.patch b/ports/google-cloud-cpp/cmake-libcurl-target.patch new file mode 100644 index 000000000..97e66e69f --- /dev/null +++ b/ports/google-cloud-cpp/cmake-libcurl-target.patch @@ -0,0 +1,144 @@ +diff --git a/cmake/IncludeCurl.cmake b/cmake/IncludeCurl.cmake +index d3323e3b8..6ea7ca3e6 100644 +--- a/cmake/IncludeCurl.cmake ++++ b/cmake/IncludeCurl.cmake +@@ -39,13 +39,13 @@ elseif("${GOOGLE_CLOUD_CPP_CURL_PROVIDER}" STREQUAL "package") + # stage/module/FindCURL.html for details). Until then, define the target + # ourselves if it is missing. + find_package(CURL REQUIRED) +- if (NOT TARGET CURL::CURL) +- add_library(CURL::CURL UNKNOWN IMPORTED) +- set_property(TARGET CURL::CURL ++ if (NOT TARGET CURL::libcurl) ++ add_library(CURL::libcurl UNKNOWN IMPORTED) ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_INCLUDE_DIRECTORIES + "${CURL_INCLUDE_DIR}") +- set_property(TARGET CURL::CURL ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + endif () +@@ -56,7 +56,7 @@ elseif("${GOOGLE_CLOUD_CPP_CURL_PROVIDER}" STREQUAL "package") + if ("${CURL_LIBRARY}" MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$") + find_package(OpenSSL REQUIRED) + find_package(ZLIB REQUIRED) +- set_property(TARGET CURL::CURL ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES + OpenSSL::SSL +@@ -64,7 +64,7 @@ elseif("${GOOGLE_CLOUD_CPP_CURL_PROVIDER}" STREQUAL "package") + ZLIB::ZLIB) + message(STATUS "CURL linkage will be static") + if (WIN32) +- set_property(TARGET CURL::CURL ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES + crypt32 +@@ -72,7 +72,7 @@ elseif("${GOOGLE_CLOUD_CPP_CURL_PROVIDER}" STREQUAL "package") + ws2_32) + endif () + if (APPLE) +- set_property(TARGET CURL::CURL ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES ldap) + endif () +diff --git a/cmake/external/curl.cmake b/cmake/external/curl.cmake +index 54753ada9..2a83e19df 100644 +--- a/cmake/external/curl.cmake ++++ b/cmake/external/curl.cmake +@@ -88,10 +88,10 @@ if (NOT TARGET curl_project) + endif () + + include(ExternalProjectHelper) +- add_library(CURL::CURL INTERFACE IMPORTED) +- add_dependencies(CURL::CURL curl_project) +- set_library_properties_for_external_project(CURL::CURL curl) +- set_property(TARGET CURL::CURL ++ add_library(CURL::libcurl INTERFACE IMPORTED) ++ add_dependencies(CURL::libcurl curl_project) ++ set_library_properties_for_external_project(CURL::libcurl curl) ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES + c-ares::cares +@@ -99,7 +99,7 @@ if (NOT TARGET curl_project) + OpenSSL::Crypto + ZLIB::ZLIB) + if (WIN32) +- set_property(TARGET CURL::CURL ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES + crypt32 +@@ -107,7 +107,7 @@ if (NOT TARGET curl_project) + ws2_32) + endif () + if (APPLE) +- set_property(TARGET CURL::CURL ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES ldap) + endif () +diff --git a/google/cloud/storage/CMakeLists.txt b/google/cloud/storage/CMakeLists.txt +index 1e750af8a..a0a04caab 100644 +--- a/google/cloud/storage/CMakeLists.txt ++++ b/google/cloud/storage/CMakeLists.txt +@@ -226,7 +226,7 @@ target_link_libraries(storage_client + PUBLIC google_cloud_cpp_common + nlohmann_json + Crc32c::crc32c +- CURL::CURL ++ CURL::libcurl + Threads::Threads + OpenSSL::SSL + OpenSSL::Crypto +@@ -396,7 +396,7 @@ if (BUILD_TESTING) + GTest::gmock_main + GTest::gmock + GTest::gtest +- CURL::CURL ++ CURL::libcurl + storage_common_options + nlohmann_json) + if (MSVC) +diff --git a/google/cloud/storage/config.cmake.in b/google/cloud/storage/config.cmake.in +index 660829ae4..a4d261815 100644 +--- a/google/cloud/storage/config.cmake.in ++++ b/google/cloud/storage/config.cmake.in +@@ -19,13 +19,13 @@ find_dependency(google_cloud_cpp_common) + find_dependency(OpenSSL) + find_dependency(ZLIB) + +-# Some versions of FindCURL do not define CURL::CURL, so we define it ourselves. +-if (NOT TARGET CURL::CURL) +- add_library(CURL::CURL UNKNOWN IMPORTED) +- set_property(TARGET CURL::CURL ++# Some versions of FindCURL do not define CURL::libcurl, so we define it ourselves. ++if (NOT TARGET CURL::libcurl) ++ add_library(CURL::libcurl UNKNOWN IMPORTED) ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}") +- set_property(TARGET CURL::CURL ++ set_property(TARGET CURL::libcurl + APPEND + PROPERTY IMPORTED_LOCATION "${CURL_LIBRARY}") + endif () +diff --git a/google/cloud/storage/tests/CMakeLists.txt b/google/cloud/storage/tests/CMakeLists.txt +index 9e5fb663d..987958396 100644 +--- a/google/cloud/storage/tests/CMakeLists.txt ++++ b/google/cloud/storage/tests/CMakeLists.txt +@@ -50,7 +50,7 @@ foreach (fname ${storage_client_integration_tests}) + GTest::gmock_main + GTest::gmock + GTest::gtest +- CURL::CURL ++ CURL::libcurl + Threads::Threads + nlohmann_json + storage_common_options) diff --git a/ports/google-cloud-cpp/portfile.cmake b/ports/google-cloud-cpp/portfile.cmake index b9ca818b1..b227b3b53 100644 --- a/ports/google-cloud-cpp/portfile.cmake +++ b/ports/google-cloud-cpp/portfile.cmake @@ -5,22 +5,14 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO GoogleCloudPlatform/google-cloud-cpp - REF v0.7.0 - SHA512 8e01096b569e78f74ee0015fa7f04729354f9001234acd098333c883247ede209582c929903460264f1155bfa0225837fd770f75ba021f8287cafa78e87e6975 + REF v0.8.0 + SHA512 cdb527169c7badab395eb38ba554022a364a99b9cb32705bf69a9613cee74acc1e2402e00ffdcb740467e85603e617f73b01e557afeb1f2786872f8d60f3a75a HEAD_REF master + PATCHES + cmake-libcurl-target.patch # Not needed _after_ v0.8.0 + cmake-libcurl-find-config.patch ) -set(GOOGLEAPIS_VERSION 6a3277c0656219174ff7c345f31fb20a90b30b97) -vcpkg_download_distfile(GOOGLEAPIS - URLS "https://github.com/google/googleapis/archive/${GOOGLEAPIS_VERSION}.zip" - FILENAME "googleapis-${GOOGLEAPIS_VERSION}.zip" - SHA512 809b7cf0429df9867c8ab558857785e9d7d70aea033c6d588b60d29d2754001e9aea5fcdd8cae22fad8145226375bedbd1516d86af7d1e9731fffea331995ad9 -) - -file(REMOVE_RECURSE ${SOURCE_PATH}/third_party) -vcpkg_extract_source_archive(${GOOGLEAPIS} ${SOURCE_PATH}/third_party) -file(RENAME ${SOURCE_PATH}/third_party/googleapis-${GOOGLEAPIS_VERSION} ${SOURCE_PATH}/third_party/googleapis) - vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA @@ -35,6 +27,7 @@ vcpkg_install_cmake(ADD_BIN_TO_PATH) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/google-cloud-cpp RENAME copyright) vcpkg_copy_pdbs() diff --git a/ports/hdf5/CONTROL b/ports/hdf5/CONTROL index fa8cb7058..229d659e7 100644 --- a/ports/hdf5/CONTROL +++ b/ports/hdf5/CONTROL @@ -1,5 +1,5 @@ Source: hdf5 -Version: 1.10.5-1 +Version: 1.10.5-4 Description: HDF5 is a data model, library, and file format for storing and managing data Build-Depends: zlib, szip diff --git a/ports/hdf5/portfile.cmake b/ports/hdf5/portfile.cmake index 6172586c0..eef241163 100644 --- a/ports/hdf5/portfile.cmake +++ b/ports/hdf5/portfile.cmake @@ -3,13 +3,11 @@ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") endif() include(vcpkg_common_functions) -#set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/CMake-hdf5-1.10.5/hdf5-1.10.5) vcpkg_download_distfile(ARCHIVE URLS "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/CMake-hdf5-1.10.5.tar.gz" FILENAME "CMake-hdf5-1.10.5.tar.gz" - SHA512 a25ea28d7a511f9184d97b5b8cd4c6d52dcdcad2bffd670e24a1c9a6f98b03108014a853553fa2b00d4be7523128b5fd6a4454545e3b17ff8c66fea16a09e962 + SHA512 a25ea28d7a511f9184d97b5b8cd4c6d52dcdcad2bffd670e24a1c9a6f98b03108014a853553fa2b00d4be7523128b5fd6a4454545e3b17ff8c66fea16a09e962 ) -vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_extract_source_archive_ex( OUT_SOURCE_PATH SOURCE_PATH @@ -32,11 +30,12 @@ else() set(ENABLE_CPP OFF) endif() -#Note: HDF5 Builds by default static as well as shared libraries set BUILD_SHARED_LIBS to OFF to only get static libraries +#Note: HDF5 Builds by default static as well as shared libraries. Set BUILD_SHARED_LIBS to OFF to only get static libraries string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED_LIBS) vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + DISABLE_PARALLEL_CONFIGURE PREFER_NINJA OPTIONS -DBUILD_TESTING=OFF @@ -55,14 +54,15 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() -file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright) - vcpkg_fixup_cmake_targets(CONFIG_PATH share/hdf5) #Linux build create additional scripts here. I dont know what they are doing so I am deleting them and hope for the best -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +file(RENAME ${CURRENT_PACKAGES_DIR}/share/hdf5/data/COPYING ${CURRENT_PACKAGES_DIR}/share/hdf5/copyright) +configure_file(${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake ${CURRENT_PACKAGES_DIR}/share/hdf5/vcpkg-cmake-wrapper.cmake @ONLY) diff --git a/ports/hdf5/vcpkg-cmake-wrapper.cmake b/ports/hdf5/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..96d8a53c9 --- /dev/null +++ b/ports/hdf5/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,15 @@ +
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.3)
+ cmake_policy(PUSH)
+ cmake_policy(SET CMP0057 NEW)
+ if(NOT "CONFIG" IN_LIST ARGS AND NOT "NO_MODULE" IN_LIST ARGS AND "HDF5" IN_LIST ARGS)
+ # The caller hasn't said "CONFIG", so they want the built-in FindHDF5.cmake behavior. Set configurations macros to ensure the built-in script finds us.
+ if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
+ set(HDF5_USE_STATIC_LIBRARIES ON)
+ else()
+ set(HDF5_USE_STATIC_LIBRARIES OFF)
+ endif()
+ endif()
+ cmake_policy(POP)
+endif()
+_find_package(${ARGS})
diff --git a/ports/highfive/CONTROL b/ports/highfive/CONTROL index b82598048..af4df7993 100644 --- a/ports/highfive/CONTROL +++ b/ports/highfive/CONTROL @@ -1,4 +1,4 @@ Source: highfive -Version: 1.5-1 +Version: 2.0 Description: HighFive is a modern C++/C++11 friendly interface for libhdf5 Build-Depends: hdf5 diff --git a/ports/highfive/portfile.cmake b/ports/highfive/portfile.cmake index b0fe41e73..ed88a45c9 100644 --- a/ports/highfive/portfile.cmake +++ b/ports/highfive/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO BlueBrain/HighFive - REF v1.5 - SHA512 4133ec2768f54cb3e56c32f3193d6c61ea96013dc73901c39d31ecaf10b04ea2861b0f6f5c9795985050ef72a75e2d360a4b906c9cdeb8ee49309961e15d39bf + REF v2.0 + SHA512 d6bc38ae421adfa3cb9ee761ec92819bebe385cb100a8227bd9ff436cd7ae31725a96264a7963cfe5ce806cdd3b7978a8a630e9312c1567f6df6029062c6b8a0 HEAD_REF master ) @@ -28,7 +28,7 @@ vcpkg_install_cmake() vcpkg_fixup_cmake_targets(CONFIG_PATH share/HighFive/CMake) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) -if(NOT WIN32) +if(NOT WIN32 AND NOT APPLE) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/HighFive) endif() diff --git a/ports/inja/CONTROL b/ports/inja/CONTROL index a905ab796..ec53d0748 100644 --- a/ports/inja/CONTROL +++ b/ports/inja/CONTROL @@ -1,4 +1,4 @@ Source: inja -Version: 1.0.0 +Version: 2.1.0 Build-Depends: nlohmann-json Description: Inja - A Template Engine for Modern C++ diff --git a/ports/inja/portfile.cmake b/ports/inja/portfile.cmake index dc9dc1a6b..17bde913a 100644 --- a/ports/inja/portfile.cmake +++ b/ports/inja/portfile.cmake @@ -2,10 +2,10 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO pantor/inja - REF v1.0.0 - SHA512 39598df84766a0d2a28dc92e083e27b7072600372e0313727cd5dd1fe6ad1efc055dc98055247f5cb1fc4096ffb37b59995107f3456a4495bd01381ac6c74a2b + REF v2.1.0 + SHA512 6b3a3a6a9e2adff14083a8e83c95fdc5ccf0c930acff40c4cf6c11d67b0df18fd941307e5d1f0c45dcfcb4c4afd0026b718ca510a2b297b9c6be048f5b144d42 HEAD_REF master ) -file(INSTALL ${SOURCE_PATH}/src/inja.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include) -file(INSTALL ${SOURCE_PATH}/src/inja.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/share/inja RENAME copyright) +file(INSTALL ${SOURCE_PATH}/single_include/inja/inja.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/include) +file(INSTALL ${SOURCE_PATH}/single_include/inja/inja.hpp DESTINATION ${CURRENT_PACKAGES_DIR}/share/inja RENAME copyright) vcpkg_copy_pdbs() diff --git a/ports/itk/CONTROL b/ports/itk/CONTROL index 2957c8742..79df1234e 100644 --- a/ports/itk/CONTROL +++ b/ports/itk/CONTROL @@ -1,7 +1,7 @@ Source: itk -Version: 4.13.0-2 +Version: 4.13.0-906736bd Description: Insight Segmentation and Registration Toolkit (ITK) is used for image processing and analysis. -Build-Depends: double-conversion, libjpeg-turbo, zlib, libpng, tiff, expat, hdf5[cpp] +Build-Depends: double-conversion, libjpeg-turbo, zlib, libpng, tiff, expat, eigen3, hdf5[cpp] Feature: vtk Description: Build ITKVtkGlue module. diff --git a/ports/itk/portfile.cmake b/ports/itk/portfile.cmake index 6d0445caf..77a62ac2a 100644 --- a/ports/itk/portfile.cmake +++ b/ports/itk/portfile.cmake @@ -3,16 +3,15 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO InsightSoftwareConsortium/ITK - REF d92873e33e8a54e933e445b92151191f02feab42 - SHA512 0e3ebd27571543e1c497377dd9576a9bb0711129be12131109fe9b3c8413655ad14ce4d9ac6e281bac83c57e6032b614bc9ff53ed357d831544ca52f41513b62 + REF 906736bd453e95ccf03b318d3d07cb7884285161 + SHA512 8ac62262d46e7acbb0e5b2e964292ec17e1687bb162b8cec666e5b67acbe3449f093a0b1c03737e9951cb88248ed890805ffd57df6eae21220488620da833c57 HEAD_REF master - PATCHES hdf5_config_mode_find_package.patch ) if ("vtk" IN_LIST FEATURES) - set(ITKVtkGlue ON ) + set(ITKVtkGlue ON) else() - set(ITKVtkGlue OFF ) + set(ITKVtkGlue OFF) endif() # directory path length needs to be shorter than 50 characters @@ -45,6 +44,7 @@ vcpkg_configure_cmake( -DITK_USE_SYSTEM_PNG=ON -DITK_USE_SYSTEM_TIFF=ON -DITK_USE_SYSTEM_ZLIB=ON + -DITK_USE_SYSTEM_EIGEN=ON # This should be turned on some day, however for now ITK does download specific versions so it shouldn't spontaneously break -DITK_FORBID_DOWNLOADS=OFF @@ -54,8 +54,8 @@ vcpkg_configure_cmake( #-DITK_WRAP_PYTHON=ON #-DITK_PYTHON_VERSION=3 - -DITK_USE_SYSTEM_HDF5=ON - -DModule_ITKVtkGlue=${ITKVtkGlue} # this option requires VTK to be a dependency in CONTROL file. VTK depends on HDF5! + -DITK_USE_SYSTEM_HDF5=ON # HDF5 was problematic in the past + -DModule_ITKVtkGlue=${ITKVtkGlue} # optional feature -DModule_IOSTL=ON # example how to turn on a non-default module -DModule_MorphologicalContourInterpolation=ON # example how to turn on a remote module @@ -68,8 +68,11 @@ vcpkg_copy_pdbs() vcpkg_fixup_cmake_targets() # combines release and debug build configurations +file(RENAME ${CURRENT_PACKAGES_DIR}/vcl_compiler_detection.h ${CURRENT_PACKAGES_DIR}/include/ITK-5.0/vcl_compiler_detection.h) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/vcl_compiler_detection.h) # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/itk) diff --git a/ports/libharu/CONTROL b/ports/libharu/CONTROL index 623628ab8..72778aa6b 100644 --- a/ports/libharu/CONTROL +++ b/ports/libharu/CONTROL @@ -1,4 +1,4 @@ Source: libharu -Version: 2017-08-15-d84867ebf9f-4 +Version: 2017-08-15-d84867ebf9f-6 Description: libharu - free PDF library Build-Depends: zlib, libpng diff --git a/ports/libharu/add-boolean-typedef.patch b/ports/libharu/add-boolean-typedef.patch new file mode 100644 index 000000000..7768ed301 --- /dev/null +++ b/ports/libharu/add-boolean-typedef.patch @@ -0,0 +1,12 @@ +diff --git a/include/hpdf.h b/include/hpdf.h
+index 1cf0dd9..cce9b59 100644
+--- a/include/hpdf.h
++++ b/include/hpdf.h
+@@ -54,6 +54,7 @@
+ #include "hpdf_types.h"
+
+ typedef void *HPDF_HANDLE;
++typedef HPDF_HANDLE HPDF_Boolean;
+ typedef HPDF_HANDLE HPDF_Doc;
+ typedef HPDF_HANDLE HPDF_Page;
+ typedef HPDF_HANDLE HPDF_Pages;
diff --git a/ports/libharu/fix-build-fail.patch b/ports/libharu/fix-build-fail.patch new file mode 100644 index 000000000..2f7066575 --- /dev/null +++ b/ports/libharu/fix-build-fail.patch @@ -0,0 +1,21 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 9d2a604..be8e964 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -79,11 +79,11 @@ if(LIBHPDF_STATIC)
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+ )
+- if(WIN32 AND NOT CYGWIN)
+- foreach(addlib ${ADDITIONAL_LIBRARIES})
+- install(FILES ${addlib} DESTINATION lib)
+- endforeach(addlib)
+- endif(WIN32 AND NOT CYGWIN)
++ #if(WIN32 AND NOT CYGWIN)
++ #foreach(addlib ${ADDITIONAL_LIBRARIES})
++ #install(FILES ${addlib} DESTINATION lib)
++ #endforeach(addlib)
++ #endif(WIN32 AND NOT CYGWIN)
+ endif(LIBHPDF_STATIC)
+ if(LIBHPDF_SHARED)
+ add_library(${LIBHPDF_NAME} SHARED ${LIBHPDF_SRCS})
diff --git a/ports/libharu/portfile.cmake b/ports/libharu/portfile.cmake index c8e9250b9..7855dedc7 100644 --- a/ports/libharu/portfile.cmake +++ b/ports/libharu/portfile.cmake @@ -1,10 +1,22 @@ include(vcpkg_common_functions) + +vcpkg_download_distfile(SHADING_PR + URLS "https://github.com/libharu/libharu/pull/157.diff" + FILENAME "libharu-shading-pr-157.patch" + SHA512 f2ddb22b54b4eccc79400b6a4b2d245a221898f75456a5a559523eab7a523a87dfc5dfd0ec5fb17a771697e03c7ea6ed4c6095eff73e0a4302cd6eb24584c957 +) + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libharu/libharu REF d84867ebf9f3de6afd661d2cdaff102457fbc371 SHA512 789579dd52c1056ae90a4ce5360c26ba92cadae5341a3901c4159afe624129a1f628fa6412952a398e048b0e5040c93f7ed5b4e4bc620a22d897098298fe2a99 HEAD_REF master + PATCHES + fix-build-fail.patch + add-boolean-typedef.patch + # This patch adds shading support which is required for VTK. If desired, this could be moved into an on-by-default feature. + ${SHADING_PR} ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LIBHPDF_STATIC) @@ -20,7 +32,7 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(RENAME ${CURRENT_PACKAGES_DIR}/lib/libhpdfs.lib ${CURRENT_PACKAGES_DIR}/lib/libhpdf.lib) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/libhpdfsd.lib ${CURRENT_PACKAGES_DIR}/debug/lib/libhpdfd.lib) endif() diff --git a/ports/libmodbus/CONTROL b/ports/libmodbus/CONTROL index 1fd7d4791..ef880d2a0 100644 --- a/ports/libmodbus/CONTROL +++ b/ports/libmodbus/CONTROL @@ -1,3 +1,3 @@ Source: libmodbus
-Version: 3.1.4-1
+Version: 3.1.4-2
Description: libmodbus is a free software library to send/receive data with a device which respects the Modbus protocol
diff --git a/ports/libmodbus/portfile.cmake b/ports/libmodbus/portfile.cmake index 8d6f2c062..95e3b8720 100644 --- a/ports/libmodbus/portfile.cmake +++ b/ports/libmodbus/portfile.cmake @@ -24,3 +24,5 @@ vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake") # Handle copyright
file(INSTALL ${SOURCE_PATH}/COPYING.LESSER DESTINATION ${CURRENT_PACKAGES_DIR}/share/libmodbus RENAME copyright)
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
\ No newline at end of file diff --git a/ports/libodb-sqlite/CMakeLists.txt b/ports/libodb-sqlite/CMakeLists.txt index 99fb0c236..79f9bc2bf 100644 --- a/ports/libodb-sqlite/CMakeLists.txt +++ b/ports/libodb-sqlite/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.0) project(libodb-sqlite VERSION 2.4.0 LANGUAGES CXX) find_package(odb 2.4.0 REQUIRED COMPONENTS libodb) -find_package(sqlite3 REQUIRED) +find_package(sqlite3 CONFIG) configure_file(config.unix.h.in ${CMAKE_CURRENT_SOURCE_DIR}/odb/sqlite/details/config.h COPYONLY) diff --git a/ports/libodb-sqlite/CONTROL b/ports/libodb-sqlite/CONTROL index 89be9ee88..6a98869bd 100644 --- a/ports/libodb-sqlite/CONTROL +++ b/ports/libodb-sqlite/CONTROL @@ -1,4 +1,4 @@ Source: libodb-sqlite -Version: 2.4.0-1 +Version: 2.4.0-2 Description: Sqlite support for the ODB ORM library Build-Depends: libodb, sqlite3 diff --git a/ports/libuv/CMakeLists.txt b/ports/libuv/CMakeLists.txt index 0f46ec07e..b51630d78 100644 --- a/ports/libuv/CMakeLists.txt +++ b/ports/libuv/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.5) project(libuv C) +find_package(Threads REQUIRED) + file(GLOB UV_SOURCES_COMMON src/*.c) file(GLOB UV_SOURCES_UNIX @@ -51,7 +53,7 @@ file(GLOB UV_SOURCES_WIN src/win/*.c) if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") add_library(libuv ${UV_SOURCES_COMMON} ${UV_SOURCES_WIN}) target_compile_definitions(libuv PRIVATE WIN32_LEAN_AND_MEAN "_WIN32_WINNT=0x0600") - target_link_libraries(libuv iphlpapi psapi shell32 userenv ws2_32) + target_link_libraries(libuv PRIVATE iphlpapi psapi shell32 userenv ws2_32) elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") add_library(libuv ${UV_SOURCES_COMMON} ${UV_SOURCES_UNIX} ${UV_SOURCES_DARWIN}) elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") @@ -60,6 +62,7 @@ else() # Assume some Linux variant add_library(libuv ${UV_SOURCES_COMMON} ${UV_SOURCES_UNIX} ${UV_SOURCES_LINUX}) endif() +target_link_libraries(libuv PRIVATE Threads::Threads) target_include_directories(libuv PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>) set_target_properties(libuv PROPERTIES DEFINE_SYMBOL BUILDING_UV_SHARED) diff --git a/ports/libuv/CONTROL b/ports/libuv/CONTROL index 611be7070..8f452cb4f 100644 --- a/ports/libuv/CONTROL +++ b/ports/libuv/CONTROL @@ -1,3 +1,3 @@ Source: libuv -Version: 1.25.0 +Version: 1.27.0 Description: libuv is a multi-platform support library with a focus on asynchronous I/O. diff --git a/ports/libuv/portfile.cmake b/ports/libuv/portfile.cmake index 8179c28bb..d870d8e76 100644 --- a/ports/libuv/portfile.cmake +++ b/ports/libuv/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libuv/libuv - REF v1.25.0 - SHA512 d1024f9193e2ad69cc670441b74ff7c63ca7d295e9a7a43c90da6781a39352687465bfe7e852d6e9085c21821bf8d11c10139c7229759fdce567d809c605acfd + REF v1.27.0 + SHA512 42dfb7bee21f3f875ae5e6e4531aff52cff59d4c000f9cee1bde1b12c127beb7adefd6d6a11c6f0180868ee5ef15351a21a36c10b1be0aa7bedc15f0c50f87e0 HEAD_REF v1.x ) diff --git a/ports/libwebp/CONTROL b/ports/libwebp/CONTROL index 9ffa6426d..ed3ff55ca 100644 --- a/ports/libwebp/CONTROL +++ b/ports/libwebp/CONTROL @@ -1,8 +1,7 @@ Source: libwebp -Version: 1.0.2-1 +Version: 1.0.2-2 Description: Lossy compression of digital photographic images. Build-Depends: opengl -Default-Features: all Feature: all Description: enable all webp features diff --git a/ports/live555/CONTROL b/ports/live555/CONTROL index 39c8e4a65..1a59ed6e7 100644 --- a/ports/live555/CONTROL +++ b/ports/live555/CONTROL @@ -1,3 +1,3 @@ Source: live555 -Version: latest +Version: 2019.03.06 Description: A complete RTSP server application diff --git a/ports/live555/portfile.cmake b/ports/live555/portfile.cmake index 55d15a88c..d31a4a6c8 100644 --- a/ports/live555/portfile.cmake +++ b/ports/live555/portfile.cmake @@ -3,41 +3,38 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") set(VCPKG_LIBRARY_LINKAGE "static") endif() -if(NOT VCPKG_USE_HEAD_VERSION) - message(FATAL_ERROR "Live555 does not have persistent releases. Please re-run the installation with --head.") -else() - # The current Live555 version from http://www.live555.com/liveMedia/public/ - set(LIVE_VERSION latest) - - include(vcpkg_common_functions) - set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIVE_VERSION}/live) - vcpkg_download_distfile(ARCHIVE - URLS "http://www.live555.com/liveMedia/public/live555-${LIVE_VERSION}.tar.gz" - FILENAME "live555-${LIVE_VERSION}.tar.gz" - SKIP_SHA512 - ) - - vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src/${LIVE_VERSION}) - - file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) - - vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA - ) - - vcpkg_install_cmake() - - file(GLOB HEADERS - "${SOURCE_PATH}/BasicUsageEnvironment/include/*.h*" - "${SOURCE_PATH}/groupsock/include/*.h*" - "${SOURCE_PATH}/liveMedia/include/*.h*" - "${SOURCE_PATH}/UsageEnvironment/include/*.h*" - ) - - file(COPY ${HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include) - file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/live555 RENAME copyright) - - vcpkg_copy_pdbs() -endif() +# The current Live555 version from http://www.live555.com/live.2019.03.06 +set(LIVE_VERSION 2019.03.06) + +include(vcpkg_common_functions) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/${LIVE_VERSION}/live) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.live555.com/live.2019.03.06.tar.gz" + FILENAME "live555-${LIVE_VERSION}.tar.gz" + SHA512 cf3cbf57ec43d392fa82f06bd02f6d829208c9a9ec1c505d9eb6c5e2dd3393bbd8829b6216163deb8ea8356c180f30f610a639044a6941df5c9a92f29d4f1a75 +) + +vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src/${LIVE_VERSION}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) + +vcpkg_install_cmake() + +file(GLOB HEADERS + "${SOURCE_PATH}/BasicUsageEnvironment/include/*.h*" + "${SOURCE_PATH}/groupsock/include/*.h*" + "${SOURCE_PATH}/liveMedia/include/*.h*" + "${SOURCE_PATH}/UsageEnvironment/include/*.h*" +) + +file(COPY ${HEADERS} DESTINATION ${CURRENT_PACKAGES_DIR}/include) +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/live555 RENAME copyright) + +vcpkg_copy_pdbs() + diff --git a/ports/llvm/CONTROL b/ports/llvm/CONTROL index 9beb04e29..d4e631680 100644 --- a/ports/llvm/CONTROL +++ b/ports/llvm/CONTROL @@ -1,4 +1,4 @@ Source: llvm
-Version: 7.0.0
+Version: 7.0.0-2
Description: The LLVM Compiler Infrastructure
Build-Depends: atlmfc (windows)
diff --git a/ports/llvm/install-cmake-modules-to-share.patch b/ports/llvm/install-cmake-modules-to-share.patch index b5193beca..1a2b3b0db 100644 --- a/ports/llvm/install-cmake-modules-to-share.patch +++ b/ports/llvm/install-cmake-modules-to-share.patch @@ -1,10 +1,26 @@ -diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt -index ac4b0b7..13a271d 100644 ---- a/cmake/modules/CMakeLists.txt -+++ b/cmake/modules/CMakeLists.txt +diff -urN llvm-7.0.0.src-orig/cmake/modules/CMakeLists.txt llvm-7.0.0.src/cmake/modules/CMakeLists.txt +--- llvm-7.0.0.src-orig/cmake/modules/CMakeLists.txt 2018-07-27 13:57:51.000000000 +0300 ++++ llvm-7.0.0.src/cmake/modules/CMakeLists.txt 2019-03-26 14:56:34.645434190 +0200 @@ -1,4 +1,4 @@ -set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) +set(LLVM_INSTALL_PACKAGE_DIR share/llvm) set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") # First for users who use an installed LLVM, create the LLVMExports.cmake file. +diff -urN llvm-7.0.0.src-orig/tools/clang/cmake/modules/CMakeLists.txt llvm-7.0.0.src/tools/clang/cmake/modules/CMakeLists.txt +--- llvm-7.0.0.src-orig/tools/clang/cmake/modules/CMakeLists.txt 2018-01-24 21:26:50.000000000 +0200 ++++ llvm-7.0.0.src/tools/clang/cmake/modules/CMakeLists.txt 2019-03-26 14:57:07.173362736 +0200 +@@ -1,11 +1,11 @@ + # Generate a list of CMake library targets so that other CMake projects can + # link against them. LLVM calls its version of this file LLVMExports.cmake, but + # the usual CMake convention seems to be ${Project}Targets.cmake. +-set(CLANG_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/clang) ++set(CLANG_INSTALL_PACKAGE_DIR share/clang) + set(clang_cmake_builddir "${CMAKE_BINARY_DIR}/${CLANG_INSTALL_PACKAGE_DIR}") + + # Keep this in sync with llvm/cmake/CMakeLists.txt! +-set(LLVM_INSTALL_PACKAGE_DIR lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm) ++set(LLVM_INSTALL_PACKAGE_DIR share/llvm) + set(llvm_cmake_builddir "${LLVM_BINARY_DIR}/${LLVM_INSTALL_PACKAGE_DIR}") + + get_property(CLANG_EXPORTS GLOBAL PROPERTY CLANG_EXPORTS) diff --git a/ports/llvm/portfile.cmake b/ports/llvm/portfile.cmake index fd0507080..a471ec1ae 100644 --- a/ports/llvm/portfile.cmake +++ b/ports/llvm/portfile.cmake @@ -46,6 +46,7 @@ vcpkg_configure_cmake( -DLLVM_INCLUDE_TESTS=OFF
-DLLVM_ABI_BREAKING_CHECKS=FORCE_OFF
-DLLVM_TOOLS_INSTALL_DIR=tools/llvm
+ -DLLVM_PARALLEL_LINK_JOBS=1
)
vcpkg_install_cmake()
@@ -62,10 +63,30 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") file(REMOVE ${DEBUG_EXE})
endif()
-vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/clang TARGET_PATH share/clang)
+vcpkg_fixup_cmake_targets(CONFIG_PATH share/clang TARGET_PATH share/clang)
vcpkg_fixup_cmake_targets(CONFIG_PATH share/llvm)
vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/llvm)
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ file(READ ${CURRENT_PACKAGES_DIR}/share/clang/ClangTargets-release.cmake RELEASE_MODULE)
+ string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/tools/llvm" RELEASE_MODULE "${RELEASE_MODULE}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/share/clang/ClangTargets-release.cmake "${RELEASE_MODULE}")
+
+ file(READ ${CURRENT_PACKAGES_DIR}/share/llvm/LLVMExports-release.cmake RELEASE_MODULE)
+ string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/tools/llvm" RELEASE_MODULE "${RELEASE_MODULE}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/share/llvm/LLVMExports-release.cmake "${RELEASE_MODULE}")
+endif()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(READ ${CURRENT_PACKAGES_DIR}/share/clang/ClangTargets-debug.cmake DEBUG_MODULE)
+ string(REPLACE "\${_IMPORT_PREFIX}/debug/bin" "\${_IMPORT_PREFIX}/tools/llvm" DEBUG_MODULE "${DEBUG_MODULE}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/share/clang/ClangTargets-debug.cmake "${DEBUG_MODULE}")
+
+ file(READ ${CURRENT_PACKAGES_DIR}/share/llvm/LLVMExports-debug.cmake DEBUG_MODULE)
+ string(REPLACE "\${_IMPORT_PREFIX}/debug/bin" "\${_IMPORT_PREFIX}/tools/llvm" DEBUG_MODULE "${DEBUG_MODULE}")
+ file(WRITE ${CURRENT_PACKAGES_DIR}/share/llvm/LLVMExports-debug.cmake "${DEBUG_MODULE}")
+endif()
+
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/tools
diff --git a/ports/matroska/CMakeLists.txt b/ports/matroska/CMakeLists.txt deleted file mode 100644 index 58308866c..000000000 --- a/ports/matroska/CMakeLists.txt +++ /dev/null @@ -1,110 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) - -project(matroska VERSION 1.4.8) - -option(DISABLE_PKGCONFIG "Disable PkgConfig module generation" OFF) -option(DISABLE_CMAKE_CONFIG "Disable CMake package config module generation" OFF) - -find_package(ebml 1.3.5 REQUIRED) - -include(GNUInstallDirs) - -set(libmatroska_SOURCES - src/FileKax.cpp - src/KaxAttached.cpp - src/KaxAttachments.cpp - src/KaxBlock.cpp - src/KaxBlockData.cpp - src/KaxCluster.cpp - src/KaxContexts.cpp - src/KaxCues.cpp - src/KaxCuesData.cpp - src/KaxInfoData.cpp - src/KaxSeekHead.cpp - src/KaxSegment.cpp - src/KaxSemantic.cpp - src/KaxTracks.cpp - src/KaxVersion.cpp) - -set(libmatroska_PUBLIC_HEADERS - matroska/FileKax.h - matroska/KaxAttached.h - matroska/KaxAttachments.h - matroska/KaxBlockData.h - matroska/KaxBlock.h - matroska/KaxChapters.h - matroska/KaxClusterData.h - matroska/KaxCluster.h - matroska/KaxConfig.h - matroska/KaxContentEncoding.h - matroska/KaxContexts.h - matroska/KaxCuesData.h - matroska/KaxCues.h - matroska/KaxDefines.h - matroska/KaxInfoData.h - matroska/KaxInfo.h - matroska/KaxSeekHead.h - matroska/KaxSegment.h - matroska/KaxSemantic.h - matroska/KaxTag.h - matroska/KaxTags.h - matroska/KaxTrackAudio.h - matroska/KaxTrackEntryData.h - matroska/KaxTracks.h - matroska/KaxTrackVideo.h - matroska/KaxTypes.h - matroska/KaxVersion.h) - -set (libmatroska_C_PUBLIC_HEADERS - matroska/c/libmatroska.h - matroska/c/libmatroska_t.h) - -add_library(matroska ${libmatroska_SOURCES} ${limatroska_PUBLIC_HEADERS} ${libmatroska_C_PUBLIC_HEADERS}) -target_link_libraries(matroska PUBLIC ebml) -set_target_properties(matroska PROPERTIES - VERSION 6.0.0 - SOVERSION 6) -target_include_directories(matroska PUBLIC - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> - $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) -if(MSVC) - target_compile_definitions(matroska PRIVATE _CRT_SECURE_NO_WARNINGS) -endif() -if(BUILD_SHARED_LIBS) - target_compile_definitions(matroska PUBLIC MATROSKA_DLL) - set_target_properties(matroska PROPERTIES DEFINE_SYMBOL "MATROSKA_DLL_EXPORT") -endif() - -install(TARGETS matroska - EXPORT MatroskaTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -install(FILES ${libmatroska_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/matroska) -install(FILES ${libmatroska_C_PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/matroska/c) - -if(NOT DISABLE_PKGCONFIG) - set(prefix ${CMAKE_INSTALL_PREFIX}) - set(exec_prefix "\$\{prefix\}") - set(libdir "\$\{prefix\}/${CMAKE_INSTALL_LIBDIR}") - set(includedir "\$\{prefix\}/${CMAKE_INSTALL_INCLUDEDIR}") - set(PACKAGE_VERSION ${PROJECT_VERSION}) - configure_file(libmatroska.pc.in libmatroska.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libmatroska.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -endif() - -if(NOT DISABLE_CMAKE_CONFIG) - if(WIN32) - set(CMAKE_INSTALL_PACKAGEDIR cmake) - elseif(WIN32) - set(CMAKE_INSTALL_PACKAGEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) - endif() - include(CMakePackageConfigHelpers) - write_basic_package_version_file(MatroskaConfigVersion.cmake COMPATIBILITY SameMajorVersion) - install(EXPORT MatroskaTargets DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}) - install(FILES - ${CMAKE_CURRENT_SOURCE_DIR}/MatroskaConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/MatroskaConfigVersion.cmake - DESTINATION ${CMAKE_INSTALL_PACKAGEDIR}) -endif() diff --git a/ports/matroska/CONTROL b/ports/matroska/CONTROL index 04feb0dd4..627c2e93f 100644 --- a/ports/matroska/CONTROL +++ b/ports/matroska/CONTROL @@ -1,4 +1,4 @@ Source: matroska -Version: 1.4.9 +Version: 1.4.9-1 Description: a C++ libary to parse Matroska files (.mkv and .mka) Build-Depends: ebml diff --git a/ports/matroska/portfile.cmake b/ports/matroska/portfile.cmake index b89a1cb6e..946ee81bc 100644 --- a/ports/matroska/portfile.cmake +++ b/ports/matroska/portfile.cmake @@ -1,15 +1,3 @@ -# Common Ambient Variables: -# CURRENT_BUILDTREES_DIR = ${VCPKG_ROOT_DIR}\buildtrees\${PORT} -# CURRENT_PACKAGES_DIR = ${VCPKG_ROOT_DIR}\packages\${PORT}_${TARGET_TRIPLET} -# CURRENT_PORT_DIR = ${VCPKG_ROOT_DIR}\ports\${PORT} -# PORT = current port name (zlib, etc) -# TARGET_TRIPLET = current triplet (x86-windows, x64-windows-static, etc) -# VCPKG_CRT_LINKAGE = C runtime linkage type (static, dynamic) -# VCPKG_LIBRARY_LINKAGE = target library linkage type (static, dynamic) -# VCPKG_ROOT_DIR = <C:\path\to\current\vcpkg> -# VCPKG_TARGET_ARCHITECTURE = target architecture (x64, x86, arm) -# - include(vcpkg_common_functions) if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") @@ -26,15 +14,17 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA # Disable this option if project cannot be built with Ninja + PREFER_NINJA OPTIONS -DDISABLE_PKGCONFIG=1 - # OPTIONS_RELEASE -DOPTIMIZE=1 - # OPTIONS_DEBUG -DDEBUGGABLE=1 ) vcpkg_install_cmake() -vcpkg_fixup_cmake_targets(CONFIG_PATH cmake) +if (WIN32) + vcpkg_fixup_cmake_targets(CONFIG_PATH cmake) +else () + vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/matroska) +endif () file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/milerius-sfml-imgui/CONTROL b/ports/milerius-sfml-imgui/CONTROL index 88eb539ef..7d3ec477d 100644 --- a/ports/milerius-sfml-imgui/CONTROL +++ b/ports/milerius-sfml-imgui/CONTROL @@ -1,4 +1,4 @@ Source: milerius-sfml-imgui
-Version: 1.1-1
+Version: 1.1-2
Description: imgui dll for sfml usage
Build-Depends: sfml (windows), imgui
diff --git a/ports/milerius-sfml-imgui/FixFindPackageIssue.patch b/ports/milerius-sfml-imgui/FixFindPackageIssue.patch new file mode 100644 index 000000000..be47cfada --- /dev/null +++ b/ports/milerius-sfml-imgui/FixFindPackageIssue.patch @@ -0,0 +1,53 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 27b8bd8..33fe623 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -2,7 +2,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
+ message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the source code and call cmake from there")
+ endif ()
+
+-project(sfml-imgui)
++project(milerius-sfml-imgui)
+ cmake_minimum_required(VERSION 3.9)
+ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
+@@ -26,7 +26,7 @@ include(CMakePackageConfigHelpers)
+
+ install(TARGETS
+ ${PROJECT_NAME}
+- EXPORT sfml-imgui-targets
++ EXPORT milerius-sfml-imgui-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+@@ -39,7 +39,7 @@ install(EXPORT ${PROJECT_NAME}-targets
+ )
+
+ configure_package_config_file(
+- "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in"
++ "${PROJECT_SOURCE_DIR}/cmake/sfml-imgui-config.cmake.in"
+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
+ INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
+ )
+@@ -51,6 +51,6 @@ install(FILES
+ install(DIRECTORY
+ ${CMAKE_CURRENT_SOURCE_DIR}/sfml-imgui
+ DESTINATION
+- ${CMAKE_INSTALL_INCLUDEDIR}/sfml-imgui
++ ${CMAKE_INSTALL_INCLUDEDIR}/
+ FILES_MATCHING PATTERN "*.h*"
+ )
+diff --git a/cmake/sfml-imgui-config.cmake.in b/cmake/sfml-imgui-config.cmake.in
+index cd790be..e1bdd77 100644
+--- a/cmake/sfml-imgui-config.cmake.in
++++ b/cmake/sfml-imgui-config.cmake.in
+@@ -2,5 +2,5 @@
+ find_package(SFML CONFIG REQUIRED graphics)
+ find_package(imgui CONFIG REQUIRED)
+ find_package(OpenGL REQUIRED)
+-include("${CMAKE_CURRENT_LIST_DIR}/sfml-imgui-targets.cmake")
+-check_required_components("sfml-imgui")
+\ No newline at end of file
++include("${CMAKE_CURRENT_LIST_DIR}/milerius-sfml-imgui-targets.cmake")
++check_required_components("milerius-sfml-imgui")
+\ No newline at end of file
diff --git a/ports/milerius-sfml-imgui/portfile.cmake b/ports/milerius-sfml-imgui/portfile.cmake index d4975da15..c5191cb85 100644 --- a/ports/milerius-sfml-imgui/portfile.cmake +++ b/ports/milerius-sfml-imgui/portfile.cmake @@ -8,6 +8,7 @@ vcpkg_from_github( REF 1.1
SHA512 191184f7b302f643bd7c241b69d9f9edc0d03c6f5a0b3a49f57ac84f3828202f8065291fb17993073a2c07f1237ba491de677c47e2f8160dc70ea77f20eb1946
HEAD_REF master
+ PATCHES FixFindPackageIssue.patch
)
vcpkg_configure_cmake(
@@ -16,9 +17,9 @@ vcpkg_configure_cmake( )
vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/sfml-imgui)
+vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/milerius-sfml-imgui)
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/milerius-sfml-imgui)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/milerius-sfml-imgui/LICENSE ${CURRENT_PACKAGES_DIR}/share/milerius-sfml-imgui/copyright)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/milerius-sfml-imgui/LICENSE ${CURRENT_PACKAGES_DIR}/share/milerius-sfml-imgui/copyright)
\ No newline at end of file diff --git a/ports/msgpack/CONTROL b/ports/msgpack/CONTROL index 7c9933d27..e75f0743f 100644 --- a/ports/msgpack/CONTROL +++ b/ports/msgpack/CONTROL @@ -1,3 +1,3 @@ Source: msgpack -Version: 2.1.5-1 +Version: 3.1.1 Description: MessagePack is an efficient binary serialization format, which lets you exchange data among multiple languages like JSON, except that it's faster and smaller. diff --git a/ports/msgpack/portfile.cmake b/ports/msgpack/portfile.cmake index 9328811dd..33873e990 100644 --- a/ports/msgpack/portfile.cmake +++ b/ports/msgpack/portfile.cmake @@ -2,8 +2,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO msgpack/msgpack-c - REF cpp-2.1.5 - SHA512 aab8357e494bb5aa7407b53e5e650382869ea95812a6677e085530d5f27cde6946fbfd0095b19608c75163dbb82de9ccb6a695234e7c03659fc6efc2da300e19 + REF cpp-3.1.1 + SHA512 2d1607f482160d8860b07d7597af760bfefcb3afa4e82602df43487d15950ab235e7efeabd7e08996807935de71d4dcdab424c91bff806279419db2ec9500227 HEAD_REF master) vcpkg_apply_patches(SOURCE_PATH ${SOURCE_PATH} diff --git a/ports/muparser/CONTROL b/ports/muparser/CONTROL index 547e7c67e..5a62e603c 100644 --- a/ports/muparser/CONTROL +++ b/ports/muparser/CONTROL @@ -1,3 +1,3 @@ Source: muparser -Version: 6cf2746 +Version: 2.2.6.1 Description: Fast math parser library diff --git a/ports/muparser/portfile.cmake b/ports/muparser/portfile.cmake index 7afb8adb1..aa3839598 100644 --- a/ports/muparser/portfile.cmake +++ b/ports/muparser/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO beltoforion/muparser - REF 6cf2746f7ce3ecbe0fd91098a3c2123e5253bb0e - SHA512 a44720507806beb577fee9480102dbdcbf8b95612e8e51e1c57688c27e69f5fec0261beb03d034471519d8a4430954d74fdb626f63d21000160eeaa081a83861 + REF v2.2.6.1 + SHA512 01bfc8cc48158c8413ae5e1da2ddbac1c9f0b9075470b1ab75853587d641dd195ebea268e1060a340098fd8015bc5f77d8e9cde5f81cffeade2f157c5f295496 HEAD_REF master ) diff --git a/ports/netcdf-c/CONTROL b/ports/netcdf-c/CONTROL index 33fe98162..512fdb8b2 100644 --- a/ports/netcdf-c/CONTROL +++ b/ports/netcdf-c/CONTROL @@ -1,4 +1,4 @@ Source: netcdf-c -Version: 4.6.2 +Version: 4.6.2-1 Build-Depends: hdf5, curl Description: a set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. diff --git a/ports/netcdf-c/portfile.cmake b/ports/netcdf-c/portfile.cmake index 4f8f67c96..4f9046106 100644 --- a/ports/netcdf-c/portfile.cmake +++ b/ports/netcdf-c/portfile.cmake @@ -1,22 +1,11 @@ -# 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/netcdf-c-4.6.2) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Unidata/netcdf-c/archive/v4.6.2.tar.gz" - FILENAME "netcdf-c-v4.6.2.tar.gz" - SHA512 7c7084e80cf2fb86cd05101f5be7b74797ee96bf49afadfae6ab32ceed6cd9a049bfa90175e7cc0742806bcd2f61156e33fe7930c7b646661d9c89be6b20dea3 -) -vcpkg_extract_source_archive(${ARCHIVE}) -vcpkg_apply_patches( - SOURCE_PATH ${SOURCE_PATH} +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Unidata/netcdf-c + REF v4.6.2 + SHA512 7c7084e80cf2fb86cd05101f5be7b74797ee96bf49afadfae6ab32ceed6cd9a049bfa90175e7cc0742806bcd2f61156e33fe7930c7b646661d9c89be6b20dea3 + HEAD_REF master PATCHES no-install-deps.patch config-pkg-location.patch @@ -26,7 +15,8 @@ vcpkg_apply_patches( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA # Disable this option if project cannot be built with Ninja + DISABLE_PARALLEL_CONFIGURE + PREFER_NINJA OPTIONS -DBUILD_UTILITIES=OFF -DBUILD_TESTING=OFF @@ -36,9 +26,6 @@ vcpkg_configure_cmake( -DENABLE_DAP_REMOTE_TESTS=OFF -DDISABLE_INSTALL_DEPENDENCIES=ON -DConfigPackageLocation=share/netcdf - - # OPTIONS_RELEASE -DOPTIMIZE=1 - # OPTIONS_DEBUG -DDEBUGGABLE=1 ) vcpkg_install_cmake() diff --git a/ports/octomap/CONTROL b/ports/octomap/CONTROL index 21c72834f..71e76163a 100644 --- a/ports/octomap/CONTROL +++ b/ports/octomap/CONTROL @@ -1,3 +1,3 @@ Source: octomap -Version: cefed0c1d79afafa5aeb05273cf1246b093b771c-3 +Version: cefed0c1d79afafa5aeb05273cf1246b093b771c-5 Description: An Efficient Probabilistic 3D Mapping Framework Based on Octrees diff --git a/ports/octomap/portfile.cmake b/ports/octomap/portfile.cmake index e07551dbe..98630922e 100644 --- a/ports/octomap/portfile.cmake +++ b/ports/octomap/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_from_github( vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + DISABLE_PARALLEL_CONFIGURE OPTIONS -DBUILD_OCTOVIS_SUBPROJECT=OFF -DBUILD_DYNAMICETD3D_SUBPROJECT=OFF @@ -25,23 +26,28 @@ vcpkg_install_cmake() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/octomap) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/binvox2bt.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/binvox2bt.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/bt2vrml.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/bt2vrml.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/compare_octrees.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/compare_octrees.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/convert_octree.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/convert_octree.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/edit_octree.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/edit_octree.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/eval_octree_accuracy.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/eval_octree_accuracy.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/graph2tree.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/graph2tree.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/log2graph.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/log2graph.exe) - -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/binvox2bt.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/bt2vrml.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/compare_octrees.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/convert_octree.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/edit_octree.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/eval_octree_accuracy.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/graph2tree.exe) -file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/log2graph.exe) +if(WIN32) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/binvox2bt.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/binvox2bt.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/bt2vrml.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/bt2vrml.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/compare_octrees.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/compare_octrees.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/convert_octree.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/convert_octree.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/edit_octree.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/edit_octree.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/eval_octree_accuracy.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/eval_octree_accuracy.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/graph2tree.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/graph2tree.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/log2graph.exe ${CURRENT_PACKAGES_DIR}/tools/octomap/log2graph.exe) + + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/binvox2bt.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/bt2vrml.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/compare_octrees.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/convert_octree.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/edit_octree.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/eval_octree_accuracy.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/graph2tree.exe) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/log2graph.exe) +else() + file(RENAME ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/tools/octomap) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() vcpkg_fixup_cmake_targets(CONFIG_PATH share/octomap) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) diff --git a/ports/opencv/portfile.cmake b/ports/opencv/portfile.cmake index 7c6594e1b..9ea245ed3 100644 --- a/ports/opencv/portfile.cmake +++ b/ports/opencv/portfile.cmake @@ -383,6 +383,11 @@ file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules-debug.cmake "${OPE file(RENAME ${CURRENT_PACKAGES_DIR}/debug/share/opencv/OpenCVModules.cmake ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake) +file(READ ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake OPENCV_MODULES) +string(REPLACE "${CURRENT_INSTALLED_DIR}" + "\${_VCPKG_INSTALLED_DIR}/\${VCPKG_TARGET_TRIPLET}" OPENCV_MODULES "${OPENCV_MODULES}") +file(WRITE ${CURRENT_PACKAGES_DIR}/share/opencv/OpenCVModules.cmake "${OPENCV_MODULES}") + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/openmesh/CONTROL b/ports/openmesh/CONTROL index cf502b2a2..d8a61f1f6 100644 --- a/ports/openmesh/CONTROL +++ b/ports/openmesh/CONTROL @@ -1,3 +1,3 @@ Source: openmesh
-Version: 7.0
+Version: 8.0
Description: A generic and efficient polygon mesh data structure
diff --git a/ports/openmesh/portfile.cmake b/ports/openmesh/portfile.cmake index 7bfacfe0e..04e624a03 100644 --- a/ports/openmesh/portfile.cmake +++ b/ports/openmesh/portfile.cmake @@ -1,12 +1,12 @@ include(vcpkg_common_functions)
-set(VERSION 7.0)
+set(VERSION 8.0)
# Note: upstream GitLab instance at https://graphics.rwth-aachen.de:9000 often goes down
vcpkg_download_distfile(ARCHIVE
URLS "https://www.openmesh.org/media/Releases/${VERSION}/OpenMesh-${VERSION}.tar.gz"
FILENAME "OpenMesh-${VERSION}.tar.gz"
- SHA512 29280c8fe7208d39bd923c4d0444a24463e36b95402e6a75f42adc27bc1b261df9113442f69e1001dc1a8b1198488069ffb049742dcf6eac6ac1ecf4f216fad8
+ SHA512 6c9cb323d83d48daca7ddefe51df67f611befd657655d8013c2c620ad53e0b8521e6b8e25ebf3f5321f94182252ae0c75795875ff7ac11585e4ffa79e16f8008
)
vcpkg_extract_source_archive_ex(
diff --git a/ports/openssl-windows/CONTROL b/ports/openssl-windows/CONTROL index a62c2fbdc..bdbf764ab 100644 --- a/ports/openssl-windows/CONTROL +++ b/ports/openssl-windows/CONTROL @@ -1,3 +1,3 @@ Source: openssl-windows -Version: 1.0.2q +Version: 1.0.2q-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. diff --git a/ports/openssl-windows/EnableWinARM64.patch b/ports/openssl-windows/EnableWinARM64.patch new file mode 100644 index 000000000..9ec813a4e --- /dev/null +++ b/ports/openssl-windows/EnableWinARM64.patch @@ -0,0 +1,16 @@ +diff --git a/Configure b/Configure
+index 36a7a66..b31543d 100644
+--- a/Configure
++++ b/Configure
+@@ -592,9 +592,9 @@ my %table=(
+ "debug-VC-WIN64A","cl:-W3 -Gs0 -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DUNICODE -D_UNICODE -D_CRT_SECURE_NO_DEPRECATE:::WIN64A::SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:".eval{my $asm=$x86_64_asm;$asm=~s/x86_64-gcc\.o/bn_asm.o/;$asm}.":auto:win32",
+ # x86 Win32 target defaults to ANSI API, if you want UNICODE, complement
+ # 'perl Configure VC-WIN32' with '-DUNICODE -D_UNICODE'
+-"VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
++"VC-WIN32","cl:-W3 -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
+ # Unified CE target
+-"debug-VC-WIN32","cl:-W3 -WX -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
++"debug-VC-WIN32","cl:-W3 -Gs0 -GF -Gy -Zi -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS:::WIN32::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${x86_asm}:win32n:win32",
+ "VC-CE","cl::::WINCE::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}:${no_asm}:win32",
+
+ # Borland C++ 4.5
diff --git a/ports/openssl-windows/portfile.cmake b/ports/openssl-windows/portfile.cmake index 8a95bd6c1..4331c2eab 100644 --- a/ports/openssl-windows/portfile.cmake +++ b/ports/openssl-windows/portfile.cmake @@ -6,7 +6,7 @@ include(vcpkg_common_functions) set(OPENSSL_VERSION 1.0.2q) set(MASTER_COPY_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-${OPENSSL_VERSION}) -vcpkg_find_acquire_program(PERL) +vcpkg_find_acquire_program(PERL) get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY) set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH}") @@ -20,10 +20,12 @@ vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE vcpkg_extract_source_archive(${OPENSSL_SOURCE_ARCHIVE}) vcpkg_apply_patches( SOURCE_PATH ${MASTER_COPY_SOURCE_PATH} - PATCHES ${CMAKE_CURRENT_LIST_DIR}/ConfigureIncludeQuotesFix.patch - ${CMAKE_CURRENT_LIST_DIR}/STRINGIFYPatch.patch - ${CMAKE_CURRENT_LIST_DIR}/EnableWinARM32.patch - ${CMAKE_CURRENT_LIST_DIR}/EmbedSymbolsInStaticLibsZ7.patch + PATCHES + ConfigureIncludeQuotesFix.patch + STRINGIFYPatch.patch + EnableWinARM32.patch + EmbedSymbolsInStaticLibsZ7.patch + EnableWinARM64.patch ) vcpkg_find_acquire_program(NASM) @@ -52,6 +54,13 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") no-asm -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE ) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(OPENSSL_ARCH VC-WIN32) + set(OPENSSL_DO "ms\\do_ms.bat") + set(CONFIGURE_COMMAND ${CONFIGURE_COMMAND} + no-asm + -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE + ) else() message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}") endif() diff --git a/ports/opentracing/CONTROL b/ports/opentracing/CONTROL new file mode 100644 index 000000000..293dd179c --- /dev/null +++ b/ports/opentracing/CONTROL @@ -0,0 +1,3 @@ +Source: opentracing
+Version: 1.5.1
+Description: C++ implementation of the OpenTracing API http://opentracing.io
diff --git a/ports/opentracing/portfile.cmake b/ports/opentracing/portfile.cmake new file mode 100644 index 000000000..cf82ddbf6 --- /dev/null +++ b/ports/opentracing/portfile.cmake @@ -0,0 +1,63 @@ +include(vcpkg_common_functions)
+
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore)
+ message(FATAL_ERROR "Error: UWP build is not supported.")
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ set( LOCAL_OPTIONS
+ -DBUILD_STATIC_LIBS=OFF
+ )
+else()
+ message("Static building is only possible when compiling static and dynamic versions at the same time. Enabling both.")
+ set(VCPKG_LIBRARY_LINKAGE dynamic)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO opentracing/opentracing-cpp
+ REF cf9b9d5c26ef985af2213521a4f0701b7e715db2
+ SHA512 75b77781c075c6814bf4a81d793e872ca47447fe82a4cad878bee99ffb2082e13e95ee285f32fb2e599765b08b4404d8e475bacff79a412a954d227b93ba53ef
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+ OPTIONS
+ ${OPTIONS}
+ ${LOCAL_OPTIONS}
+)
+
+vcpkg_install_cmake()
+
+vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/OpenTracing")
+
+vcpkg_copy_pdbs()
+
+# Move DLLs to /bin
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR NOT VCPKG_CMAKE_SYSTEM_NAME)
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/lib/opentracing.dll ${CURRENT_PACKAGES_DIR}/bin/opentracing.dll)
+
+ file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/bin)
+ file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/opentracing.dll ${CURRENT_PACKAGES_DIR}/debug/bin/opentracing.dll)
+
+ # Fix targets
+ file(READ ${CURRENT_PACKAGES_DIR}/share/opentracing/OpenTracingTargets-release.cmake RELEASE_CONFIG)
+ string(REPLACE "\${_IMPORT_PREFIX}/lib/opentracing.dll"
+ "\${_IMPORT_PREFIX}/bin/opentracing.dll" RELEASE_CONFIG ${RELEASE_CONFIG})
+ file(WRITE ${CURRENT_PACKAGES_DIR}/share/opentracing/OpenTracingTargets-release.cmake "${RELEASE_CONFIG}")
+
+ file(READ ${CURRENT_PACKAGES_DIR}/share/opentracing/OpenTracingTargets-debug.cmake DEBUG_CONFIG)
+ string(REPLACE "\${_IMPORT_PREFIX}/debug/lib/opentracing.dll"
+ "\${_IMPORT_PREFIX}/debug/bin/opentracing.dll" DEBUG_CONFIG ${DEBUG_CONFIG})
+ file(WRITE ${CURRENT_PACKAGES_DIR}/share/opentracing/OpenTracingTargets-debug.cmake "${DEBUG_CONFIG}")
+ endif()
+endif()
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/opentracing RENAME copyright)
+
+# Remove duplicate headers
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
diff --git a/ports/openvdb/0001-fix-cmake-modules.patch b/ports/openvdb/0001-fix-cmake-modules.patch index 1e613e602..03cc2461e 100644 --- a/ports/openvdb/0001-fix-cmake-modules.patch +++ b/ports/openvdb/0001-fix-cmake-modules.patch @@ -67,6 +67,15 @@ index cea0b86..07ea09e 100644 FIND_PACKAGE_HANDLE_STANDARD_ARGS ( GLFW3 REQUIRED_VARS GLFW3_LOCATION +@@ -59,7 +59,7 @@ IF (GLFW3_FOUND) + NO_CMAKE_SYSTEM_PATH + ) + ELSE (GLFW3_USE_STATIC_LIBS) +- FIND_LIBRARY ( GLFW3_glfw_LIBRARY glfw ++ FIND_LIBRARY ( GLFW3_glfw_LIBRARY glfw3dll + PATHS ${GLFW3_LOCATION}/lib + PATH_SUFFIXES ${GLFW3_PATH_SUFFIXES} + NO_DEFAULT_PATH diff --git a/cmake/FindILMBase.cmake b/cmake/FindILMBase.cmake index 664affd..5197110 100644 --- a/cmake/FindILMBase.cmake diff --git a/ports/openvdb/0003-build-only-necessary-targets.patch b/ports/openvdb/0003-build-only-necessary-targets.patch index 55b480ce4..8be8263a5 100644 --- a/ports/openvdb/0003-build-only-necessary-targets.patch +++ b/ports/openvdb/0003-build-only-necessary-targets.patch @@ -1,8 +1,8 @@ diff --git a/openvdb/CMakeLists.txt b/openvdb/CMakeLists.txt -index 9404dbc..b4129e3 100644 +index 9404dbc..94daf8c 100644 --- a/openvdb/CMakeLists.txt +++ b/openvdb/CMakeLists.txt -@@ -29,12 +29,13 @@ PROJECT ( OpenVDBCore ) +@@ -29,28 +29,31 @@ PROJECT ( OpenVDBCore ) set(CMAKE_CXX_STANDARD 11) @@ -11,21 +11,25 @@ index 9404dbc..b4129e3 100644 FIND_PACKAGE ( GLFW3 REQUIRED ) SET ( OPENVDB_USE_GLFW_FLAG "-DOPENVDB_USE_GLFW_3" ) IF ( UNIX AND NOT APPLE ) - SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) +- SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) - ENDIF ( UNIX AND NOT APPLE ) ++ SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) + ENDIF () SET ( GLFW_LINK_LIBRARY ${GLFW3_glfw_LIBRARY} ) SET ( GLFW_INCLUDE_DIRECTORY ${GLFW3_INCLUDE_DIR} CACHE STRING "GLFW3 include directory") ELSE () -@@ -45,12 +46,14 @@ ELSE () + FIND_PACKAGE ( GLFW REQUIRED ) + IF ( UNIX AND NOT APPLE ) +- SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) ++ SET ( GLFW_DEPENDENT_LIBRARIES "X11;Xi;Xrandr;Xinerama;Xcursor;Xxf86vm" ) + ENDIF () SET ( GLFW_LINK_LIBRARY ${GLFW_glfw_LIBRARY} ) SET ( GLFW_INCLUDE_DIRECTORY ${GLFW_INCLUDE_DIR} CACHE STRING "GLFW include directory") ENDIF () +ENDIF () --IF (WIN32) +IF ( OPENVDB_BUILD_TOOLS ) -+IF ( WIN32 ) + IF (WIN32) FIND_PACKAGE ( GLEW REQUIRED ) -ELSE () - FIND_PACKAGE ( Threads REQUIRED ) @@ -57,7 +61,8 @@ index 9404dbc..b4129e3 100644 - COMPILE_FLAGS "-DOPENVDB_PRIVATE -DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG}" + COMPILE_FLAGS "-DOPENVDB_PRIVATE -DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} $<$<CXX_COMPILER_ID:MSVC>:/bigobj>" ) - +- ++ +IF ( OPENVDB_STATIC ) ADD_LIBRARY ( openvdb_static STATIC ${OPENVDB_LIBRARY_SOURCE_FILES} @@ -121,7 +126,19 @@ index 9404dbc..b4129e3 100644 ADD_EXECUTABLE ( vdb_print ${VDB_PRINT_SOURCE_FILES} ) -@@ -236,7 +257,7 @@ TARGET_LINK_LIBRARIES ( vdb_print +@@ -229,14 +250,19 @@ TARGET_LINK_LIBRARIES ( vdb_print + openvdb_shared + ${CMAKE_THREAD_LIBS_INIT} + ${BLOSC_blosc_LIBRARY} ++ ) ++ ++IF (NOT WIN32) ++TARGET_LINK_LIBRARIES ( vdb_print + m + stdc++ + ) ++ENDIF () + SET ( VDB_RENDER_SOURCE_FILES cmd/openvdb_render/main.cc ) SET_SOURCE_FILES_PROPERTIES ( ${VDB_RENDER_SOURCE_FILES} PROPERTIES @@ -130,56 +147,81 @@ index 9404dbc..b4129e3 100644 ) ADD_EXECUTABLE ( vdb_render ${VDB_RENDER_SOURCE_FILES} -@@ -263,31 +284,40 @@ SET ( VDB_VIEW_SOURCE_FILES +@@ -249,9 +275,14 @@ TARGET_LINK_LIBRARIES ( vdb_render + ${Openexr_ILMIMF_LIBRARY} + ${Ilmbase_ILMTHREAD_LIBRARY} + ${Ilmbase_IEX_LIBRARY} ++ ) ++ ++IF (NOT WIN32) ++TARGET_LINK_LIBRARIES ( vdb_render + m + stdc++ + ) ++ENDIF () + + SET ( VDB_VIEW_SOURCE_FILES + cmd/openvdb_view/main.cc +@@ -263,29 +294,38 @@ SET ( VDB_VIEW_SOURCE_FILES ) SET_SOURCE_FILES_PROPERTIES ( ${VDB_VIEW_SOURCE_FILES} PROPERTIES - COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} -DGL_GLEXT_PROTOTYPES=1" + COMPILE_FLAGS "-DOPENVDB_USE_BLOSC ${OPENVDB_USE_GLFW_FLAG} -DGL_GLEXT_PROTOTYPES=1 $<$<CXX_COMPILER_ID:MSVC>:/bigobj>" ++ ) ++ ++ADD_EXECUTABLE ( vdb_view ++ ${VDB_VIEW_SOURCE_FILES} ) -IF (NOT WIN32) -+ - ADD_EXECUTABLE ( vdb_view - ${VDB_VIEW_SOURCE_FILES} - ) -- -+ - target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} ) +- ADD_EXECUTABLE ( vdb_view +- ${VDB_VIEW_SOURCE_FILES} +- ) + +- target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} ) ++target_include_directories ( vdb_view SYSTEM PRIVATE ${Boost_INCLUDE_DIR} ) - TARGET_LINK_LIBRARIES ( vdb_view - openvdb_shared +- TARGET_LINK_LIBRARIES ( vdb_view +- openvdb_shared - ${Boost_THREAD_LIBRARY} -+ ${Boost_LIBRARIES} - ${OPENGL_gl_LIBRARY} - ${OPENGL_glu_LIBRARY} +- ${OPENGL_gl_LIBRARY} +- ${OPENGL_glu_LIBRARY} - ${COCOA_LIBRARY} - ${IOKIT_LIBRARY} - ${COREVIDEO_LIBRARY} - ${GLFW_LINK_LIBRARY} - ${GLFW_DEPENDENT_LIBRARIES} - ${GLEW_GLEW_LIBRARY} -+ ) -+ IF (APPLE) -+ TARGET_LINK_LIBRARIES ( vdb_view -+ ${COCOA_LIBRARY} -+ ${IOKIT_LIBRARY} -+ ${COREVIDEO_LIBRARY} -+ ) -+ ENDIF () -+ IF (NOT WIN32) -+ TARGET_LINK_LIBRARIES ( vdb_view - m - stdc++ +- ${GLFW_LINK_LIBRARY} +- ${GLFW_DEPENDENT_LIBRARIES} +- ${GLEW_GLEW_LIBRARY} +- m +- stdc++ - ) ++TARGET_LINK_LIBRARIES ( vdb_view ++ openvdb_shared ++ ${Boost_LIBRARIES} ++ ${OPENGL_gl_LIBRARY} ++ ${OPENGL_glu_LIBRARY} ++ ${GLFW_LINK_LIBRARY} ++ ${GLFW_DEPENDENT_LIBRARIES} ++ ${GLEW_GLEW_LIBRARY} ++ ) ++IF (APPLE) ++TARGET_LINK_LIBRARIES ( vdb_view ++ ${COCOA_LIBRARY} ++ ${IOKIT_LIBRARY} ++ ${COREVIDEO_LIBRARY} ++) ++ENDIF () ++IF (NOT WIN32) ++TARGET_LINK_LIBRARIES ( vdb_view ++ m ++ stdc++ + ) -+ ENDIF () ++ ++ENDIF () ENDIF () -+ SET ( UNITTEST_SOURCE_FILES - unittest/main.cc - unittest/TestAttributeArray.cc -@@ -398,7 +428,7 @@ IF ( OPENVDB_BUILD_UNITTESTS ) +@@ -398,7 +438,7 @@ IF ( OPENVDB_BUILD_UNITTESTS ) ADD_TEST ( vdb_unit_test vdb_test ) @@ -188,7 +230,7 @@ index 9404dbc..b4129e3 100644 # Doxygen docmentation IF (OPENVDB_BUILD_DOCS) -@@ -419,26 +449,29 @@ IF (OPENVDB_BUILD_DOCS) +@@ -419,26 +459,29 @@ IF (OPENVDB_BUILD_DOCS) ENDIF () # Installation @@ -199,28 +241,38 @@ index 9404dbc..b4129e3 100644 DESTINATION bin ) --ENDIF () - INSTALL ( TARGETS - vdb_print - vdb_render - DESTINATION - bin - ) -+ENDIF () ++ INSTALL ( TARGETS ++ vdb_print ++ vdb_render ++ DESTINATION ++ bin ++ ) + ENDIF () +-INSTALL ( TARGETS +- vdb_print +- vdb_render +- DESTINATION +- bin +- ) +-INSTALL ( TARGETS +- openvdb_static +- DESTINATION +- lib +- ) +IF ( OPENVDB_STATIC) - INSTALL ( TARGETS - openvdb_static - DESTINATION - lib - ) ++ INSTALL ( TARGETS ++ openvdb_static ++ DESTINATION ++ lib ++ ) +ENDIF () +IF ( OPENVDB_SHARED ) IF (WIN32) INSTALL ( TARGETS openvdb_shared -@@ -452,6 +485,7 @@ ELSE() +@@ -452,6 +495,7 @@ ELSE() lib ) ENDIF () diff --git a/ports/openvdb/0004-add-necessary-head.patch b/ports/openvdb/0004-add-necessary-head.patch new file mode 100644 index 000000000..bbe7246b1 --- /dev/null +++ b/ports/openvdb/0004-add-necessary-head.patch @@ -0,0 +1,59 @@ +diff --git a/openvdb/viewer/ClipBox.h b/openvdb/viewer/ClipBox.h
+index ad62d39..c68c5be 100644
+--- a/openvdb/viewer/ClipBox.h
++++ b/openvdb/viewer/ClipBox.h
+@@ -37,6 +37,7 @@
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glu.h>
+ #else
++#include <windows.h>
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #endif
+diff --git a/openvdb/viewer/Font.h b/openvdb/viewer/Font.h
+index da62993..b341165 100644
+--- a/openvdb/viewer/Font.h
++++ b/openvdb/viewer/Font.h
+@@ -37,6 +37,7 @@
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glu.h>
+ #else
++#include <windows.h>
+ #include <GL/gl.h>
+ #include <GL/glu.h>
+ #endif
+diff --git a/openvdb/viewer/RenderModules.h b/openvdb/viewer/RenderModules.h
+index b9fa5b1..fd38a50 100644
+--- a/openvdb/viewer/RenderModules.h
++++ b/openvdb/viewer/RenderModules.h
+@@ -31,6 +31,7 @@
+ #ifndef OPENVDB_VIEWER_RENDERMODULES_HAS_BEEN_INCLUDED
+ #define OPENVDB_VIEWER_RENDERMODULES_HAS_BEEN_INCLUDED
+
++#include <GL/glew.h>
+ #include <openvdb/openvdb.h>
+ #include <openvdb/tools/VolumeToMesh.h>
+ #include <openvdb/tools/MeshToVolume.h>
+@@ -41,6 +42,7 @@
+ #include <vector>
+
+ #if defined(__APPLE__) || defined(MACOSX)
++#include <windows.h>
+ #include <OpenGL/gl.h>
+ #include <OpenGL/glu.h>
+ #else
+diff --git a/openvdb/viewer/Viewer.cc b/openvdb/viewer/Viewer.cc
+index 31bb7a4..88bd308 100644
+--- a/openvdb/viewer/Viewer.cc
++++ b/openvdb/viewer/Viewer.cc
+@@ -31,9 +31,9 @@
+ #include "Viewer.h"
+
+ #include "Camera.h"
++#include "RenderModules.h"
+ #include "ClipBox.h"
+ #include "Font.h"
+-#include "RenderModules.h"
+ #include <openvdb/util/Formats.h> // for formattedInt()
+ #include <openvdb/util/logging.h>
+ #include <openvdb/points/PointDataGrid.h>
diff --git a/ports/openvdb/CONTROL b/ports/openvdb/CONTROL index acf11cd00..b2db99e4c 100644 --- a/ports/openvdb/CONTROL +++ b/ports/openvdb/CONTROL @@ -1,5 +1,5 @@ Source: openvdb -Version: 6.0.0 +Version: 6.0.0-1 Build-Depends: boost-ptr-container, openexr, tbb, blosc, boost-iostreams, boost-system, boost-thread, boost-date-time, boost-any, boost-uuid, boost-interprocess Description: Sparse volume data structure and tools diff --git a/ports/openvdb/portfile.cmake b/ports/openvdb/portfile.cmake index 7f2fa6c29..5b24e7600 100644 --- a/ports/openvdb/portfile.cmake +++ b/ports/openvdb/portfile.cmake @@ -7,9 +7,10 @@ vcpkg_from_github( SHA512 6b9e267fff46647b39e1e6faa12059442196c1858df1fda1515cfc375e25bc3033e2828c80e63a652509cfba386376e022cebf81ec85aaccece421b0c721529b HEAD_REF master PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001-fix-cmake-modules.patch - ${CMAKE_CURRENT_LIST_DIR}/0002-add-custom-options.patch - ${CMAKE_CURRENT_LIST_DIR}/0003-build-only-necessary-targets.patch + 0001-fix-cmake-modules.patch + 0002-add-custom-options.patch + 0003-build-only-necessary-targets.patch + 0004-add-necessary-head.patch ) if (VCPKG_LIBRARY_LINKAGE STREQUAL static) diff --git a/ports/opus/CONTROL b/ports/opus/CONTROL index a40b11c64..ce09b87bf 100644 --- a/ports/opus/CONTROL +++ b/ports/opus/CONTROL @@ -1,3 +1,3 @@ Source: opus -Version: 1.3-1 +Version: 1.3-2 Description: Totally open, royalty-free, highly versatile audio codec diff --git a/ports/opus/no-main.patch b/ports/opus/no-main.patch deleted file mode 100644 index 6c373de7b..000000000 --- a/ports/opus/no-main.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/win32/VS2015/opus.vcxproj b/win32/VS2015/opus.vcxproj
-index 33bf706..296bc79 100644
---- a/win32/VS2015/opus.vcxproj
-+++ b/win32/VS2015/opus.vcxproj
-@@ -350,9 +350,6 @@
- <ClCompile Include="..\..\src\mlp.c" />
- <ClCompile Include="..\..\src\mlp_data.c" />
- <ClCompile Include="..\..\src\opus.c" />
-- <ClCompile Include="..\..\src\opus_compare.c">
-- <DisableSpecificWarnings>4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
-- </ClCompile>
- <ClCompile Include="..\..\src\opus_decoder.c" />
- <ClCompile Include="..\..\src\opus_encoder.c" />
- <ClCompile Include="..\..\src\opus_multistream.c" />
diff --git a/ports/opus/package_version.in b/ports/opus/package_version.in deleted file mode 100644 index 4bc971b33..000000000 --- a/ports/opus/package_version.in +++ /dev/null @@ -1 +0,0 @@ -PACKAGE_VERSION="@OPUS_VERSION@" diff --git a/ports/opus/portfile.cmake b/ports/opus/portfile.cmake index ae257690c..59cc33b37 100644 --- a/ports/opus/portfile.cmake +++ b/ports/opus/portfile.cmake @@ -1,84 +1,28 @@ -if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore) - message(FATAL_ERROR "UWP builds not supported") -endif() - include(vcpkg_common_functions) -set(OPUS_VERSION "1.3") - vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO xiph/opus - REF v1.3 - SHA512 5ac067514b6471432fcd027b912dcaa765e2bdc986ea289a2aeb57660d18fa1460a0a697b9736d8e2b65eb7b72ad4fa36b9b213389fe1e64335db8e9ad51b750 - HEAD_REF master - PATCHES "${CMAKE_CURRENT_LIST_DIR}/no-main.patch" -) - -configure_file( - ${CMAKE_CURRENT_LIST_DIR}/package_version.in - ${SOURCE_PATH}/package_version -) - -# Ensure proper crt linkage -file(READ ${SOURCE_PATH}/win32/VS2015/common.props OPUS_PROPS) -if(VCPKG_CRT_LINKAGE STREQUAL dynamic) - string(REPLACE ">MultiThreaded<" ">MultiThreadedDLL<" OPUS_PROPS "${OPUS_PROPS}") - string(REPLACE ">MultiThreadedDebug<" ">MultiThreadedDebugDLL<" OPUS_PROPS "${OPUS_PROPS}") -else() - string(REPLACE ">MultiThreadedDLL<" ">MultiThreaded<" OPUS_PROPS "${OPUS_PROPS}") - string(REPLACE ">MultiThreadedDebugDLL<" ">MultiThreadedDebug<" OPUS_PROPS "${OPUS_PROPS}") -endif() -file(WRITE ${SOURCE_PATH}/win32/VS2015/common.props "${OPUS_PROPS}") - -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - set(RELEASE_CONFIGURATION "Release") - set(DEBUG_CONFIGURATION "Debug") -else() - set(RELEASE_CONFIGURATION "ReleaseDll") - set(DEBUG_CONFIGURATION "DebugDll") -endif() - -if(TARGET_TRIPLET MATCHES "x86") - set(ARCH_DIR "Win32") -elseif(TARGET_TRIPLET MATCHES "x64") - set(ARCH_DIR "x64") -else() - message(FATAL_ERROR "Architecture not supported") -endif() - -vcpkg_build_msbuild( - PROJECT_PATH ${SOURCE_PATH}/win32/VS2015/opus.vcxproj - RELEASE_CONFIGURATION ${RELEASE_CONFIGURATION} - DEBUG_CONFIGURATION ${DEBUG_CONFIGURATION} -) - -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - # Install release build - file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) - - # Install debug build - file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) -else() - # Install release build - file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/) - file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${RELEASE_CONFIGURATION}/opus.dll DESTINATION ${CURRENT_PACKAGES_DIR}/bin/) - - # Install debug build - file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/) - file(INSTALL ${SOURCE_PATH}/win32/VS2015/${ARCH_DIR}/${DEBUG_CONFIGURATION}/opus.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin/) -endif() - + OUT_SOURCE_PATH + SOURCE_PATH + REPO + xiph/opus + REF + f9d3d432d135253357ba457ecd0e4f68f12a4584 + SHA512 + 9d77d063e0215c4f4e46b044d2f51106b3a599aeab7b1b788efa1fc79d0d2bc7780adafef6ffe6d3276f24223490898aa695cbbe36df174da9ba2317b21cb369 + HEAD_REF + master) + +vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA) +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/Opus) vcpkg_copy_pdbs() -# Install headers -file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}/include RENAME opus) - -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(READ ${CURRENT_PACKAGES_DIR}/include/opus/opus_defines.h OPUS_DEFINES) - string(REPLACE "define OPUS_EXPORT" "define OPUS_EXPORT __declspec(dllimport)" OPUS_DEFINES "${OPUS_DEFINES}") - file(WRITE ${CURRENT_PACKAGES_DIR}/include/opus/opus_defines.h "${OPUS_DEFINES}") -endif() +file(INSTALL + ${SOURCE_PATH}/COPYING + DESTINATION + ${CURRENT_PACKAGES_DIR}/share/opus + RENAME copyright) -# Handle copyright -file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/opus RENAME copyright) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/lib/cmake + ${CURRENT_PACKAGES_DIR}/lib/cmake + ${CURRENT_PACKAGES_DIR}/debug/include) diff --git a/ports/osg/CONTROL b/ports/osg/CONTROL index 2cca0cdaa..e78458d25 100644 --- a/ports/osg/CONTROL +++ b/ports/osg/CONTROL @@ -1,5 +1,5 @@ Source: osg -Version: 3.6.2 +Version: 3.6.2-1 Description: The OpenSceneGraph is an open source high performance 3D graphics toolkit. Build-Depends: freetype, jasper, openexr, zlib, gdal, giflib, libjpeg-turbo, libpng, tiff diff --git a/ports/osg/portfile.cmake b/ports/osg/portfile.cmake index e72b5807b..98a0ec293 100644 --- a/ports/osg/portfile.cmake +++ b/ports/osg/portfile.cmake @@ -11,10 +11,6 @@ # include(vcpkg_common_functions) -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building will not support load data through plugins.") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH @@ -24,15 +20,24 @@ vcpkg_from_github( HEAD_REF master PATCHES "${CMAKE_CURRENT_LIST_DIR}/collada.patch" + "${CMAKE_CURRENT_LIST_DIR}/static.patch" ) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + set(OSG_DYNAMIC OFF) +else() + set(OSG_DYNAMIC ON) +endif() + vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} # PREFER_NINJA # Disable this option if project cannot be built with Ninja OPTIONS -DOSG_USE_UTF8_FILENAME=ON - # OPTIONS_RELEASE -DOPTIMIZE=1 - # OPTIONS_DEBUG -DDEBUGGABLE=1 + -DDYNAMIC_OPENSCENEGRAPH=${OSG_DYNAMIC} + -DDYNAMIC_OPENTHREADS=${OSG_DYNAMIC} + -DBUILD_OSG_EXAMPLES=ON + -DBUILD_OSG_APPLICATIONS=ON ) vcpkg_install_cmake() @@ -59,3 +64,11 @@ file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin/osgPlugins-3.6.2/) # Handle copyright file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/osg) file(RENAME ${CURRENT_PACKAGES_DIR}/share/osg/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/osg/copyright) + +#Cleanup +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib/pkgconfig ${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif()
\ No newline at end of file diff --git a/ports/osg/static.patch b/ports/osg/static.patch new file mode 100644 index 000000000..c7278d282 --- /dev/null +++ b/ports/osg/static.patch @@ -0,0 +1,7 @@ +--- a/src/osgPlugins/curl/CMakeLists.txt
++++ b/src/osgPlugins/curl/CMakeLists.txt
+@@ -35,3 +35,3 @@
+ ADD_DEFINITIONS(-DCURL_STATICLIB)
+- SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} ws2_32 winmm wldap32)
++ SET(TARGET_EXTERNAL_LIBRARIES ${TARGET_EXTERNAL_LIBRARIES} ws2_32 winmm wldap32 crypt32)
+ ENDIF()
diff --git a/ports/parallel-hashmap/CONTROL b/ports/parallel-hashmap/CONTROL new file mode 100644 index 000000000..8935060a4 --- /dev/null +++ b/ports/parallel-hashmap/CONTROL @@ -0,0 +1,3 @@ +Source: parallel-hashmap +Version: 1.1.0 +Description: A header-only, very fast and memory-friendly hash map family. diff --git a/ports/parallel-hashmap/portfile.cmake b/ports/parallel-hashmap/portfile.cmake new file mode 100644 index 000000000..9c2c02289 --- /dev/null +++ b/ports/parallel-hashmap/portfile.cmake @@ -0,0 +1,24 @@ +#header-only library +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO greg7mdp/parallel-hashmap + REF 1.1.0 + SHA512 ff9497d2a8009c9aa955f50e66269e5963a86d8593e3eb07ef968a8ea5e162fea7e145d6d4d9e7aa91380b49f22166d1a08445fa40d02f43327e4c39612f52d9 + HEAD_REF master +) + +# Use greg7mdp/parallel-hashmap's own build process, skipping examples and tests +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA +) +vcpkg_install_cmake() + +# Delete redundant directories +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/lib ${CURRENT_PACKAGES_DIR}/debug ${CURRENT_PACKAGES_DIR}/share/doc) + +# Put the licence file where vcpkg expects it +file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/parallel-hashmap) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/parallel-hashmap/LICENSE ${CURRENT_PACKAGES_DIR}/share/parallel-hashmap/copyright) diff --git a/ports/pixman/CMakeLists.txt b/ports/pixman/CMakeLists.txt index c75574865..55adf8b9c 100644 --- a/ports/pixman/CMakeLists.txt +++ b/ports/pixman/CMakeLists.txt @@ -56,6 +56,10 @@ target_compile_definitions(pixman-1 USE_SSE2 ) +if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 4) + target_compile_options(pixman-1 PRIVATE -msse2) +endif() + # pixman produces a lot of warnings which are disabled here because they otherwise fill up the log files if(MSVC) target_compile_options(pixman-1 PRIVATE "/wd4244" "/wd4146" "/wd4996") # PUBLIC "/D_CRT_SECURE_NO_WARNINGS" diff --git a/ports/pixman/CONTROL b/ports/pixman/CONTROL index 9f889e9ca..7ea0dc3d7 100644 --- a/ports/pixman/CONTROL +++ b/ports/pixman/CONTROL @@ -1,3 +1,3 @@ Source: pixman -Version: 0.38.0 +Version: 0.38.0-1 Description: Pixman is a low-level software library for pixel manipulation, providing features such as image compositing and trapezoid rasterization. diff --git a/ports/qca/CONTROL b/ports/qca/CONTROL index 72f20869f..4c09bf3b1 100644 --- a/ports/qca/CONTROL +++ b/ports/qca/CONTROL @@ -1,4 +1,4 @@ Source: qca -Version: 2.2.0-3 +Version: 2.2.0-4 Description: Qt Cryptographic Architecture (QCA). Sources: https://cgit.kde.org/qca.git/ Build-Depends: qt5-base diff --git a/ports/qca/portfile.cmake b/ports/qca/portfile.cmake index ff667cd6c..55acdc0b6 100644 --- a/ports/qca/portfile.cmake +++ b/ports/qca/portfile.cmake @@ -33,12 +33,12 @@ message(STATUS "Importing certstore") file(REMOVE ${SOURCE_PATH}/certs/rootcerts.pem) # Using file(DOWNLOAD) to use https file(DOWNLOAD https://raw.githubusercontent.com/mozilla/gecko-dev/master/security/nss/lib/ckfw/builtins/certdata.txt - ${CMAKE_CURRENT_LIST_DIR}/certdata.txt + ${CURRENT_BUILDTREES_DIR}/cert/certdata.txt TLS_VERIFY ON ) vcpkg_execute_required_process( COMMAND ${PERL} ${CMAKE_CURRENT_LIST_DIR}/mk-ca-bundle.pl -n ${SOURCE_PATH}/certs/rootcerts.pem - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/cert LOGNAME ca-bundle ) message(STATUS "Importing certstore done") diff --git a/ports/roaring/CONTROL b/ports/roaring/CONTROL index 7b5b05949..0b1327da4 100644 --- a/ports/roaring/CONTROL +++ b/ports/roaring/CONTROL @@ -1,3 +1,3 @@ Source: roaring
-Version: 2019-03-05-1
+Version: 2019-03-05-2
Description: A better compressed bitset in C (and C++)
diff --git a/ports/roaring/portfile.cmake b/ports/roaring/portfile.cmake index 8748c4e57..937fd0751 100644 --- a/ports/roaring/portfile.cmake +++ b/ports/roaring/portfile.cmake @@ -17,6 +17,7 @@ string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ROARING_BUILD_STATIC) vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
+ DISABLE_PARALLEL_CONFIGURE
OPTIONS
-DROARING_BUILD_STATIC=${ROARING_BUILD_STATIC}
-DENABLE_ROARING_TESTS=OFF
diff --git a/ports/rocksdb/0004-use-find-package.patch b/ports/rocksdb/0004-use-find-package.patch index a6c7b5f58..c2b9e5a4f 100644 --- a/ports/rocksdb/0004-use-find-package.patch +++ b/ports/rocksdb/0004-use-find-package.patch @@ -1,11 +1,11 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 43256fc04..204761256 100644 +index 1bae9a7..0303186 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -49,7 +49,7 @@ option(WITH_SNAPPY "build with SNAPPY" OFF) - option(WITH_LZ4 "build with lz4" OFF) - option(WITH_ZLIB "build with zlib" OFF) - option(WITH_ZSTD "build with zstd" OFF) +@@ -53,7 +53,7 @@ option(WITH_WINDOWS_UTF8_FILENAMES "use UTF8 as characterset for opening files, + if (WITH_WINDOWS_UTF8_FILENAMES) + add_definitions(-DROCKSDB_WINDOWS_UTF8_FILENAMES) + endif() -if(MSVC) +if(MSVC AND NOT VCPKG_TOOLCHAIN) # Defaults currently different for GFLAGS. diff --git a/ports/rocksdb/CONTROL b/ports/rocksdb/CONTROL index 8ec367068..1f47bcca8 100644 --- a/ports/rocksdb/CONTROL +++ b/ports/rocksdb/CONTROL @@ -1,5 +1,5 @@ Source: rocksdb -Version: 5.17.2 +Version: 5.18.3 Description: A library that provides an embeddable, persistent key-value store for fast storage Default-Features: zlib diff --git a/ports/rocksdb/portfile.cmake b/ports/rocksdb/portfile.cmake index 202ef61a8..7d96d55c2 100644 --- a/ports/rocksdb/portfile.cmake +++ b/ports/rocksdb/portfile.cmake @@ -3,8 +3,8 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO facebook/rocksdb - REF v5.17.2 - SHA512 c9f9bff747d0d2c97f8adb71d6a3bd5dc206c2fc567a47d0400abac61fec7f2a386d16cda5447bcf592cca006fd6d4c5ae1a68d122e2e2a03d3ebcc002dae147 + REF v5.18.3 + SHA512 5f8c9e66dd7d7f1071dbbdd0442519df403f92876f9ed120b6a89788446cabf86275866a8ea273ab6fcb9d62cc7f3dc4d5b1684aa39c3956eea47b5b93938d54 HEAD_REF master PATCHES 0001-disable-gtest.patch diff --git a/ports/sdl1-net/CMakeLists.txt b/ports/sdl1-net/CMakeLists.txt index 05bdac9f8..1e1f95171 100644 --- a/ports/sdl1-net/CMakeLists.txt +++ b/ports/sdl1-net/CMakeLists.txt @@ -5,8 +5,7 @@ if (MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4996") endif() -find_path(SDL_INCLUDE_DIR SDL.h) -find_library(SDL_LIBRARY NAMES SDLd SDL) +find_package(SDL) add_library(SDL_net SDLnet.c SDLnetselect.c SDLnetTCP.c SDLnetUDP.c version.rc) diff --git a/ports/sdl1-net/CONTROL b/ports/sdl1-net/CONTROL index ae968e581..61544abec 100644 --- a/ports/sdl1-net/CONTROL +++ b/ports/sdl1-net/CONTROL @@ -1,4 +1,4 @@ Source: sdl1-net -Version: 1.2.8-2 +Version: 1.2.8-3 Description: Networking library for SDL Build-Depends: sdl1 diff --git a/ports/sdl1/CONTROL b/ports/sdl1/CONTROL index 483813f51..ce37bc05d 100644 --- a/ports/sdl1/CONTROL +++ b/ports/sdl1/CONTROL @@ -1,3 +1,3 @@ Source: sdl1 -Version: 1.2.15-3 +Version: 1.2.15-5 Description: Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. diff --git a/ports/sdl1/portfile.cmake b/ports/sdl1/portfile.cmake index de2d855e6..2cbdfc42c 100644 --- a/ports/sdl1/portfile.cmake +++ b/ports/sdl1/portfile.cmake @@ -1,7 +1,5 @@ include(vcpkg_common_functions) -vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY ONLY_DYNAMIC_CRT) - vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO SDL-Mirror/SDL @@ -17,6 +15,14 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/SDLmain.vcxproj DESTINATION ${SOURCE_PATH}/V configure_file(${SOURCE_PATH}/include/SDL_config.h.default ${SOURCE_PATH}/include/SDL_config.h COPYONLY) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + ${CMAKE_CURRENT_LIST_DIR}/static-build.patch + ) +endif() + # This text file gets copied as a library, and included as one in the package file(REMOVE_RECURSE ${SOURCE_PATH}/src/hermes/COPYING.LIB) @@ -28,7 +34,13 @@ vcpkg_install_msbuild( ALLOW_ROOT_INCLUDES ) -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/doxyfile) +#Take all the fils into include/SDL to sovle conflict with SDL2 port +file(GLOB files ${CURRENT_PACKAGES_DIR}/include/*) +foreach(file ${files}) + file(COPY ${file} DESTINATION ${CURRENT_PACKAGES_DIR}/include/SDL) + file(REMOVE ${file}) +endforeach() +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include/SDL/doxyfile) if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/lib/manual-link) diff --git a/ports/sdl1/static-build.patch b/ports/sdl1/static-build.patch new file mode 100644 index 000000000..89bc39ddc --- /dev/null +++ b/ports/sdl1/static-build.patch @@ -0,0 +1,74 @@ +--- a/VisualC/SDL/SDL.vcxproj Sun Mar 31 11:28:40 2019
++++ b/VisualC/SDL/SDL.vcxproj Sun Mar 31 19:00:00 2019
+@@ -26,3 +26,3 @@
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+- <ConfigurationType>DynamicLibrary</ConfigurationType>
++ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+@@ -31,3 +31,3 @@
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+- <ConfigurationType>DynamicLibrary</ConfigurationType>
++ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+@@ -36,3 +36,3 @@
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+- <ConfigurationType>DynamicLibrary</ConfigurationType>
++ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+@@ -41,3 +41,3 @@
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+- <ConfigurationType>DynamicLibrary</ConfigurationType>
++ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <PlatformToolset>v141</PlatformToolset>
+@@ -100,3 +100,3 @@
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+@@ -137,3 +137,3 @@
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;_DEBUG;_WINDOWS;_WIN32_WINNT=0x0400;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+@@ -176,3 +176,3 @@
+ <StringPooling>true</StringPooling>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+@@ -213,3 +213,3 @@
+ <StringPooling>true</StringPooling>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <BufferSecurityCheck>false</BufferSecurityCheck>
+--- a/VisualC/SDLmain/SDLmain.vcxproj Sun Mar 31 11:28:40 2019
++++ b/VisualC/SDLmain/SDLmain.vcxproj Sun Mar 31 19:00:00 2019
+@@ -123,3 +123,3 @@
+ <StringPooling>true</StringPooling>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+@@ -140,3 +140,3 @@
+ <StringPooling>true</StringPooling>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+@@ -154,3 +154,3 @@
+ <StringPooling>true</StringPooling>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+@@ -171,3 +171,3 @@
+ <StringPooling>true</StringPooling>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+@@ -184,3 +184,3 @@
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader />
+@@ -200,3 +200,3 @@
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
++ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <PrecompiledHeader />
diff --git a/ports/soci/CONTROL b/ports/soci/CONTROL index 3cb5c230d..aaab2490e 100644 --- a/ports/soci/CONTROL +++ b/ports/soci/CONTROL @@ -1,5 +1,5 @@ Source: soci -Version: 3.2.3-2 +Version: 3.2.3-3 Description: SOCI database access library Feature: boost diff --git a/ports/soci/find-libpqd.patch b/ports/soci/find-libpqd.patch deleted file mode 100644 index 950f74f25..000000000 --- a/ports/soci/find-libpqd.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/src/cmake/modules/FindPostgreSQL.cmake b/src/cmake/modules/FindPostgreSQL.cmake -index 8178418..6e15d5b 100644 ---- a/src/cmake/modules/FindPostgreSQL.cmake -+++ b/src/cmake/modules/FindPostgreSQL.cmake -@@ -65,6 +65,25 @@ find_library(POSTGRESQL_LIBRARIES NAMES pq libpq - $ENV{ProgramFiles}/PostgreSQL/*/lib/ms - $ENV{SystemDrive}/PostgreSQL/*/lib/ms) - -+find_library(POSTGRESQL_LIBRARIES_DEBUG NAMES pqd libpqd -+ PATHS -+ ${PG_CONFIG_LIBDIR} -+ /usr/lib -+ /usr/local/lib -+ /usr/lib/postgresql -+ /usr/lib64 -+ /usr/local/lib64 -+ /usr/lib64/postgresql -+ $ENV{ProgramFiles}/PostgreSQL/*/lib -+ $ENV{SystemDrive}/PostgreSQL/*/lib -+ $ENV{ProgramFiles}/PostgreSQL/*/lib/ms -+ $ENV{SystemDrive}/PostgreSQL/*/lib/ms) -+ -+if(WIN32 AND POSTGRESQL_LIBRARIES AND POSTGRESQL_LIBRARIES_DEBUG) -+ set(POSTGRESQL_LIBRARIES optimized ${POSTGRESQL_LIBRARIES} -+ debug ${POSTGRESQL_LIBRARIES_DEBUG}) -+endif() -+ - if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES) - set(POSTGRESQL_FOUND TRUE) - else() diff --git a/ports/soci/no-define-snprintf.patch b/ports/soci/no-define-snprintf.patch deleted file mode 100644 index ab6db0d1a..000000000 --- a/ports/soci/no-define-snprintf.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git a/src/core/soci-platform.h b/src/core/soci-platform.h
-index aa5e4b1..2d8c5c7 100644
---- a/src/core/soci-platform.h
-+++ b/src/core/soci-platform.h
-@@ -24,7 +24,9 @@
- #endif
-
- // Define if you have the snprintf variants.
-+#if _MSC_VER < 1900
- #define snprintf _snprintf
-+#endif
-
- // Define if you have the strtoll and strtoull variants.
- #if _MSC_VER < 1300
diff --git a/ports/soci/portfile.cmake b/ports/soci/portfile.cmake index 6a4746414..1ba4115ae 100644 --- a/ports/soci/portfile.cmake +++ b/ports/soci/portfile.cmake @@ -2,11 +2,9 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO SOCI/soci - REF 3.2.3 - SHA512 8c597b37efe82c85e6d951f66cb0f818d2c12cb673914bc7b322bc0a9da676e6c02f221c9104fb06d1b4b02fed4e5a4fb872dd3370b9117f248c3b948faf4fb3 + REF c15b178a44b99ed3ff7fd953837fb97f6314abb7 + SHA512 037c44f29e80b5ec57046606b4672088917d469e9d2254e3e15253e170026cf0fe17e4f79a4b01df22fe7032708ca87354b1560d9880d4d165cdef869c3c6081 HEAD_REF master - PATCHES "${CMAKE_CURRENT_LIST_DIR}/no-define-snprintf.patch" - "${CMAKE_CURRENT_LIST_DIR}/find-libpqd.patch" ) string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" SOCI_DYNAMIC) @@ -29,7 +27,7 @@ foreach(_feature IN LISTS ALL_FEATURES) endforeach() vcpkg_configure_cmake( - SOURCE_PATH ${SOURCE_PATH}/src + SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS -DSOCI_TESTS=OFF @@ -48,10 +46,10 @@ vcpkg_configure_cmake( vcpkg_install_cmake() -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/cmake ${CURRENT_PACKAGES_DIR}/debug/cmake ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share) # Handle copyright -file(COPY ${SOURCE_PATH}/src/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/soci) +file(COPY ${SOURCE_PATH}/LICENSE_1_0.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/soci) file(RENAME ${CURRENT_PACKAGES_DIR}/share/soci/LICENSE_1_0.txt ${CURRENT_PACKAGES_DIR}/share/soci/copyright) -vcpkg_copy_pdbs()
\ No newline at end of file +vcpkg_copy_pdbs() diff --git a/ports/solid3/CONTROL b/ports/solid3/CONTROL new file mode 100644 index 000000000..7dce173ee --- /dev/null +++ b/ports/solid3/CONTROL @@ -0,0 +1,3 @@ +Source: solid3 +Version: 3.5.8 +Description: Software Library for Interference Detection diff --git a/ports/solid3/disable-examples.patch b/ports/solid3/disable-examples.patch new file mode 100644 index 000000000..5af3b2645 --- /dev/null +++ b/ports/solid3/disable-examples.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0303a8f..be43838 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -97,7 +97,7 @@ if(UNIX) + endif(UNIX) + + add_subdirectory(src) +-add_subdirectory(examples) ++#add_subdirectory(examples) + #add_subdirectory(doc) + + include(CMakePackageConfigHelpers) diff --git a/ports/solid3/portfile.cmake b/ports/solid3/portfile.cmake new file mode 100644 index 000000000..dc61a5654 --- /dev/null +++ b/ports/solid3/portfile.cmake @@ -0,0 +1,41 @@ +include(vcpkg_common_functions) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO dtecta/solid3 + REF c53f6bb1eaaafb1cfb305ef71b1c3a2edb4844e6 + SHA512 ae42ba75f5309fecba836e5786d4cb81eeb1240f6fd7c458c6d1329d8e1075021504b927ea0aedb66162deeb79ad674cacb0190385afe456420c0d9184596f1f + HEAD_REF master + PATCHES + disable-examples.patch + potentially-uninitialized-local-pointer-variable.patch +) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + set(DYNAMIC_SOLID OFF) +else() + set(DYNAMIC_SOLID ON) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DDYNAMIC_SOLID=${DYNAMIC_SOLID} +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() +vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/solid3) + +file(COPY ${SOURCE_PATH}/README.md DESTINATION ${CURRENT_PACKAGES_DIR}/share/solid3) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/solid3/README.md ${CURRENT_PACKAGES_DIR}/share/solid3/copyright) +file(COPY ${SOURCE_PATH}/LICENSE_GPL.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/solid3) +file(COPY ${SOURCE_PATH}/LICENSE_QPL.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/solid3) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) + file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin) +endif() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) diff --git a/ports/solid3/potentially-uninitialized-local-pointer-variable.patch b/ports/solid3/potentially-uninitialized-local-pointer-variable.patch new file mode 100644 index 000000000..baec56793 --- /dev/null +++ b/ports/solid3/potentially-uninitialized-local-pointer-variable.patch @@ -0,0 +1,26 @@ +diff --git a/src/qhull/geom2.c b/src/qhull/geom2.c +index bd58ce1..c4798d2 100644 +--- a/src/qhull/geom2.c ++++ b/src/qhull/geom2.c +@@ -2080,7 +2080,7 @@ boolT qh_sharpnewfacets () { + pointT *qh_voronoi_center (int dim, setT *points) { + pointT *point, **pointp, *point0; + pointT *center= (pointT*)qh_memalloc (qh center_size); +- setT *simplex; ++ setT *simplex= NULL; + int i, j, k, size= qh_setsize(points); + coordT *gmcoord; + realT *diffp, sum2, *sum2row, *sum2p, det, factor; +diff --git a/src/qhull/io.c b/src/qhull/io.c +index 79ca799..41c18bc 100644 +--- a/src/qhull/io.c ++++ b/src/qhull/io.c +@@ -3740,7 +3740,7 @@ coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc) { + coordT *points, *coords, *infinity= NULL; + realT paraboloid, maxboloid= -REALmax, value; + realT *coordp= NULL, *offsetp= NULL, *normalp= NULL; +- char *s, *t, firstline[qh_MAXfirst+1]; ++ char *s= NULL, *t, firstline[qh_MAXfirst+1]; + int diminput=0, numinput=0, dimfeasible= 0, newnum, k, tempi; + int firsttext=0, firstshort=0, firstlong=0, firstpoint=0; + int tokcount= 0, linecount=0, maxcount, coordcount=0; diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index 38a874439..ab5f103fd 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -1,5 +1,5 @@ Source: sqlite3 -Version: 3.26.0 +Version: 3.27.2 Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. Feature: tool diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index d2a078d29..789cfe948 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -1,10 +1,10 @@ include(vcpkg_common_functions)
-set(SQLITE_VERSION 3260000)
-set(SQLITE_HASH ba089abd16857a65fc6cf26558a0d3e6f20c278b8df451b357eea5154f8ccd5645c9cfdb30d0fd4fe64f19dd2f876a6cc4a28455b7b013770c2ce9a607171107)
+set(SQLITE_VERSION 3270200)
+set(SQLITE_HASH f84a6a3101c989164f17b85a6c2674ae2728a75d70daf5e33627a6eaa399adaf763deb968d891ad0660f1ebe660d27fbd55ace379d807f3bb8af4e95c01b68c4)
vcpkg_download_distfile(ARCHIVE
- URLS "https://sqlite.org/2018/sqlite-amalgamation-${SQLITE_VERSION}.zip"
+ URLS "https://sqlite.org/2019/sqlite-amalgamation-${SQLITE_VERSION}.zip"
FILENAME "sqlite-amalgamation-${SQLITE_VERSION}.zip"
SHA512 ${SQLITE_HASH}
)
diff --git a/ports/sqlitecpp/0001-Find-external-sqlite3.patch b/ports/sqlitecpp/0001-Find-external-sqlite3.patch index ef6700e14..f9473ff53 100644 --- a/ports/sqlitecpp/0001-Find-external-sqlite3.patch +++ b/ports/sqlitecpp/0001-Find-external-sqlite3.patch @@ -16,7 +16,7 @@ index 4a3e492..f7e22a5 100644 # TODO NOCOMMIT -#find_package(sqlite3) -+find_package(sqlite3 REQUIRED) ++find_package(sqlite3 CONFIG) +target_link_libraries(SQLiteCpp PRIVATE sqlite3) #if(sqlite3_VERSION VERSION_LESS "3.19") # set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-DSQLITECPP_HAS_MEM_STRUCT") diff --git a/ports/sqlitecpp/CONTROL b/ports/sqlitecpp/CONTROL index 133ac6703..119c94091 100644 --- a/ports/sqlitecpp/CONTROL +++ b/ports/sqlitecpp/CONTROL @@ -1,4 +1,4 @@ Source: sqlitecpp -Version: 2.2 +Version: 2.2-1 Build-Depends: sqlite3 Description: SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper. diff --git a/ports/sqlitecpp/portfile.cmake b/ports/sqlitecpp/portfile.cmake index 2af9c8cfa..a7e9a4267 100644 --- a/ports/sqlitecpp/portfile.cmake +++ b/ports/sqlitecpp/portfile.cmake @@ -23,6 +23,7 @@ vcpkg_configure_cmake( -DSQLITECPP_RUN_CPPCHECK=OFF -DSQLITECPP_INTERNAL_SQLITE=OFF -DSQLITE_ENABLE_COLUMN_METADATA=OFF + -DSQLITECPP_INTERNAL_SQLITE=OFF ) vcpkg_install_cmake() diff --git a/ports/tbb/CONTROL b/ports/tbb/CONTROL index 496c8c20f..048f711e0 100644 --- a/ports/tbb/CONTROL +++ b/ports/tbb/CONTROL @@ -1,3 +1,3 @@ Source: tbb -Version: 2019_U4 +Version: 2019_U5 Description: Intel's Threading Building Blocks. diff --git a/ports/tbb/portfile.cmake b/ports/tbb/portfile.cmake index 3050a38a9..a0895442d 100644 --- a/ports/tbb/portfile.cmake +++ b/ports/tbb/portfile.cmake @@ -10,8 +10,8 @@ endif() vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO 01org/tbb - REF 2019_U4 - SHA512 f8ba92663c822e36f68f2b1837aa66d4fc285abe8c0c9b501f6cc31d3186d39b193588e49988e488beb9d400a1c3aa3fe72580f428e7ceca3581e649f28ae59e + REF 2019_U5 + SHA512 227b12e3864fbb922ddbc99700bf94d7d8897d62e2056bf3beb608efacf3ca785dd416b94ad65b421b6c9fc11caff688147b5fbe400c51e98678cee5dc04f274 HEAD_REF tbb_2019 ) @@ -25,7 +25,7 @@ if(VCPKG_CMAKE_SYSTEM_NAME AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStor vcpkg_install_cmake() - # Settings for TBBConfigForSource.cmake.in + # Settings for TBBConfigInternal.cmake.in set(TBB_LIB_EXT a) set(TBB_LIB_PREFIX lib) else() @@ -43,7 +43,7 @@ else() RELEASE_CONFIGURATION ${RELEASE_CONFIGURATION} DEBUG_CONFIGURATION ${DEBUG_CONFIGURATION} ) - # Settings for TBBConfigForSource.cmake.in + # Settings for TBBConfigInternal.cmake.in set(TBB_LIB_EXT lib) set(TBB_LIB_PREFIX) endif() @@ -53,12 +53,13 @@ file(COPY ${SOURCE_PATH}/include/serial DESTINATION ${CURRENT_PACKAGES_DIR}/include) -# Settings for TBBConfigForSource.cmake.in +# Settings for TBBConfigInternal.cmake.in if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") set(TBB_DEFAULT_COMPONENTS tbb tbbmalloc) else() set(TBB_DEFAULT_COMPONENTS tbb tbbmalloc tbbmalloc_proxy) endif() + file(READ "${SOURCE_PATH}/include/tbb/tbb_stddef.h" _tbb_stddef) string(REGEX REPLACE ".*#define TBB_VERSION_MAJOR ([0-9]+).*" "\\1" _tbb_ver_major "${_tbb_stddef}") string(REGEX REPLACE ".*#define TBB_VERSION_MINOR ([0-9]+).*" "\\1" _tbb_ver_minor "${_tbb_stddef}") @@ -68,7 +69,7 @@ set(TBB_RELEASE_DIR "\${_tbb_root}/lib") set(TBB_DEBUG_DIR "\${_tbb_root}/debug/lib") configure_file( - ${SOURCE_PATH}/cmake/templates/TBBConfigForSource.cmake.in + ${SOURCE_PATH}/cmake/templates/TBBConfigInternal.cmake.in ${CURRENT_PACKAGES_DIR}/share/tbb/TBBConfig.cmake @ONLY ) @@ -79,6 +80,18 @@ string(REPLACE _contents "${_contents}" ) +string(REPLACE + "set(_tbb_release_lib \"/\${_tbb_component}.lib\")" + "set(_tbb_release_lib \"\${_tbb_root}/lib/\${_tbb_component}.lib\")" + _contents + "${_contents}" +) +string(REPLACE + "set(_tbb_debug_lib \"/\${_tbb_component}_debug.lib\")" + "set(_tbb_debug_lib \"\${_tbb_root}/debug/lib/\${_tbb_component}_debug.lib\")" + _contents + "${_contents}" +) string(REPLACE "SHARED IMPORTED)" "UNKNOWN IMPORTED)" _contents "${_contents}") file(WRITE ${CURRENT_PACKAGES_DIR}/share/tbb/TBBConfig.cmake "${_contents}") diff --git a/ports/thrift/CONTROL b/ports/thrift/CONTROL index 2180e3932..039218167 100644 --- a/ports/thrift/CONTROL +++ b/ports/thrift/CONTROL @@ -1,4 +1,4 @@ Source: thrift -Version: 2019-01-30 +Version: 2019-03-29 Build-Depends: zlib, libevent, openssl, boost-range, boost-smart-ptr, boost-date-time, boost-locale, boost-scope-exit Description: Apache Thrift is a software project spanning a variety of programming languages and use cases. Our goal is to make reliable, performant communication and data serialization across languages as efficient and seamless as possible. Originally developed at Facebook, Thrift was open sourced in April 2007 and entered the Apache Incubator in May, 2008. Thrift became an Apache TLP in October, 2010. diff --git a/ports/thrift/portfile.cmake b/ports/thrift/portfile.cmake index cd0faf0f1..284f0b344 100644 --- a/ports/thrift/portfile.cmake +++ b/ports/thrift/portfile.cmake @@ -15,8 +15,8 @@ vcpkg_find_acquire_program(BISON) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO apache/thrift - REF 2ec93c8a2da2531755078ab6d5a65a96e26cf4c2 - SHA512 6e6787e04ec963516be669511a18e128e5aff19bf33c70b37d9488b4abf42c20de75c8e72d60a81e679dea2faa8abe526deb71a6fc8ef7ba27216990be07c22c + REF 7b94dd422117ffb6c646d1217c643efb80a8cf45 + SHA512 56b1810031b26ccc921cc39a2511fbee9af165c618b5ecb72d8f3dbdf9ae1d05b8adfe59e6f7ece8be837ca69a58e279997dd76c93e28c96607f18e2badcfbd1 HEAD_REF master ) @@ -42,6 +42,9 @@ vcpkg_install_cmake() file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/thrift RENAME copyright) +# Move CMake config files to the right place +vcpkg_fixup_cmake_targets(CONFIG_PATH "lib/cmake/thrift") + file(GLOB COMPILER "${CURRENT_PACKAGES_DIR}/bin/thrift*") if(COMPILER) file(COPY ${COMPILER} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/thrift) diff --git a/ports/uvw/CMakeLists.txt b/ports/uvw/CMakeLists.txt new file mode 100644 index 000000000..f359b7351 --- /dev/null +++ b/ports/uvw/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.8)
+project(uvw)
+
+find_package(unofficial-libuv CONFIG REQUIRED)
+
+add_library(uvw INTERFACE)
+target_link_libraries(uvw INTERFACE unofficial::libuv::libuv)
+
+install(TARGETS uvw
+ EXPORT uvw
+ INCLUDES DESTINATION include/)
+
+install(EXPORT uvw
+ DESTINATION "share/uvw"
+ FILE uvw-targets.cmake
+ NAMESPACE uvw::)
+
+install(DIRECTORY
+ src/uvw/
+ DESTINATION include/uvw/)
+
+install(FILES
+ src/uvw.hpp
+ DESTINATION include/
+)
diff --git a/ports/uvw/CONTROL b/ports/uvw/CONTROL index 0a055ad8b..59926f1a9 100644 --- a/ports/uvw/CONTROL +++ b/ports/uvw/CONTROL @@ -1,3 +1,4 @@ Source: uvw -Version: 1.11.3 +Version: 1.15.0 Description: Header-only, event based, tiny and easy to use libuv wrapper in modern C++. <https://github.com/skypjack/uvw> +Build-Depends: libuv diff --git a/ports/uvw/portfile.cmake b/ports/uvw/portfile.cmake index e7d2c9b00..0fca53590 100644 --- a/ports/uvw/portfile.cmake +++ b/ports/uvw/portfile.cmake @@ -4,19 +4,23 @@ include(vcpkg_common_functions) vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO skypjack/uvw - REF v1.11.2_libuv-v1.23 - SHA512 0125233645351b94acb1b42f1632365a60892c64f00b27f04ae76fa523c4ee32c9910f0fcfb160b15269bfb0b5ae0c0f8b46d83a1ca9f9fc661b75eecb7a04d3 + REF v1.15.0_libuv-v1.27 + SHA512 acf1f1bdbc34ec5d040514ca08c99ee05b5bbb112828a4acf5f4c50e1910d2c74864a0793d4087b7a4a0704dd2ba1a973f65cee032fffea9247009be9cd0243c ) -file(INSTALL - ${SOURCE_PATH}/src/uvw - DESTINATION ${CURRENT_PACKAGES_DIR}/include +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA ) +vcpkg_install_cmake() +vcpkg_fixup_cmake_targets(CONFIG_PATH "share/uvw") file(INSTALL - ${SOURCE_PATH}/src/uvw.hpp - DESTINATION ${CURRENT_PACKAGES_DIR}/include + ${CMAKE_CURRENT_LIST_DIR}/uvw-config.cmake + DESTINATION ${CURRENT_PACKAGES_DIR}/share/uvw/ ) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug) # Handle copyright/readme/package files file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/uvw RENAME copyright) diff --git a/ports/uvw/uvw-config.cmake b/ports/uvw/uvw-config.cmake new file mode 100644 index 000000000..1fdc98f53 --- /dev/null +++ b/ports/uvw/uvw-config.cmake @@ -0,0 +1,2 @@ +find_package(unofficial-libuv CONFIG REQUIRED)
+include ("${CMAKE_CURRENT_LIST_DIR}/uvw-targets.cmake")
diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL index 0d489e677..0625a3ac1 100644 --- a/ports/vtk/CONTROL +++ b/ports/vtk/CONTROL @@ -1,7 +1,7 @@ Source: vtk Version: 8.2.0-2 Description: Software system for 3D computer graphics, image processing, and visualization -Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora, atlmfc (windows) +Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, libjpeg-turbo, proj4, lz4, libtheora, atlmfc (windows), eigen3, double-conversion, pugixml, libharu, sqlite3, netcdf-c Feature: openvr Description: OpenVR functionality for VTK @@ -18,7 +18,3 @@ Build-Depends: msmpi, hdf5[parallel] Feature: python Description: Python functionality for VTK Build-Depends: python3 - -Feature: libharu -Description: PDF libharu functionality for VTK -Build-Depends: libharu diff --git a/ports/vtk/fix-pugixml-link.patch b/ports/vtk/fix-pugixml-link.patch new file mode 100644 index 000000000..8708506b6 --- /dev/null +++ b/ports/vtk/fix-pugixml-link.patch @@ -0,0 +1,14 @@ +diff --git a/IO/CityGML/CMakeLists.txt b/IO/CityGML/CMakeLists.txt
+index ce979ba..322e2de 100644
+--- a/IO/CityGML/CMakeLists.txt
++++ b/IO/CityGML/CMakeLists.txt
+@@ -4,8 +4,5 @@ vtk_module_library(vtkIOCityGML ${Module_SRCS})
+ # pugixml does not set _INCLUDE_DIRS or _LIBRARIES
+ if(VTK_USE_SYSTEM_PUGIXML AND NOT pugixml_INCLUDE_DIRS)
+ find_package(pugixml REQUIRED)
+- get_target_property(pugixml_INCLUDE_DIRS pugixml INTERFACE_INCLUDE_DIRECTORIES)
+- get_target_property(pugixml_LIBRARIES pugixml LOCATION)
+- include_directories(${pugixml_INCLUDE_DIRS})
+- vtk_module_link_libraries(vtkIOCityGML LINK_PRIVATE ${pugixml_LIBRARIES})
++ vtk_module_link_libraries(vtkIOCityGML LINK_PRIVATE pugixml)
+ endif()
diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index baff2cb06..536a81141 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -16,9 +16,9 @@ else() endif() if ("mpi" IN_LIST FEATURES) - set(VTK_WITH_MPI ON ) + set(VTK_Group_MPI ON) else() - set(VTK_WITH_MPI OFF ) + set(VTK_Group_MPI OFF) endif() if ("python" IN_LIST FEATURES) @@ -28,15 +28,9 @@ else() endif() if("openvr" IN_LIST FEATURES) - set(VTK_WITH_OPENVR ON) + set(Module_vtkRenderingOpenVR ON) else() - set(VTK_WITH_OPENVR OFF) -endif() - -if("libharu" IN_LIST FEATURES) - set(VTK_WITH_LIBHARU ON) -else() - set(VTK_WITH_LIBHARU OFF) + set(Module_vtkRenderingOpenVR OFF) endif() set(VTK_WITH_ALL_MODULES OFF) # IMPORTANT: if ON make sure `qt5`, `mpi`, `python3`, `ffmpeg`, `gdal`, `fontconfig`, @@ -46,14 +40,16 @@ set(VTK_WITH_ALL_MODULES OFF) # IMPORTANT: if ON make sure `qt5` # Clone & patch vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH - REPO "Kitware/VTK" + REPO Kitware/VTK REF "v${VTK_LONG_VERSION}" SHA512 fd1d9c2872baa6eca7f8105b0057b56ec554e9d5eaf25985302e7fc032bdce72255d79e3f5f16ca50504151bda49cb3a148272ba32e0f410b4bdb70959b8f3f4 - HEAD_REF "master" + HEAD_REF master PATCHES fix-find-lz4.patch fix_ogg_linkage.patch + fix-pugixml-link.patch ) + # Remove the FindGLEW.cmake and FindPythonLibs.cmake that are distributed with VTK, # since they do not detect the debug libraries correctly. # The default files distributed with CMake (>= 3.9) should be superior by all means. @@ -73,12 +69,6 @@ if(VTK_WITH_QT) ) endif() -if(VTK_WITH_MPI) - list(APPEND ADDITIONAL_OPTIONS - -DVTK_Group_MPI=ON - ) -endif() - if(VTK_WITH_PYTHON) list(APPEND ADDITIONAL_OPTIONS -DVTK_WRAP_PYTHON=ON @@ -86,18 +76,6 @@ if(VTK_WITH_PYTHON) ) endif() -if(VTK_WITH_OPENVR) - list(APPEND ADDITIONAL_OPTIONS - -DModule_vtkRenderingOpenVR=ON - ) -endif() - -if(VTK_WITH_LIBHARU) - list(APPEND ADDITIONAL_OPTIONS - -DVTK_USE_SYSTEM_LIBHARU=ON - ) -endif() - if(VTK_WITH_ALL_MODULES) list(APPEND ADDITIONAL_OPTIONS -DVTK_BUILD_ALL_MODULES=ON @@ -123,44 +101,31 @@ endif() # ============================================================================= # Configure & Install -if(${VCPKG_LIBRARY_LINKAGE} MATCHES "static") - set(HDF5_USE_STATIC_LIBRARIES ON) -endif() vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DHDF5_USE_STATIC_LIBRARIES=${HDF5_USE_STATIC_LIBRARIES} - -DHAVE_SNPRINTF=ON - -DVTK_Group_Imaging=ON - -DVTK_Group_Views=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF - -DVTK_USE_SYSTEM_EXPAT=ON - -DVTK_USE_SYSTEM_FREETYPE=ON - # -DVTK_USE_SYSTEM_GL2PS=ON - -DVTK_USE_SYSTEM_JPEG=ON - -DVTK_USE_SYSTEM_GLEW=ON - -DVTK_USE_SYSTEM_HDF5=ON - -DVTK_USE_SYSTEM_JSONCPP=ON - -DVTK_USE_SYSTEM_LIBPROJ=ON - -DVTK_USE_SYSTEM_LIBXML2=ON - -DVTK_USE_SYSTEM_LZ4=ON - # -DVTK_USE_SYSTEM_NETCDF=ON - # -DVTK_USE_SYSTEM_NETCDFCPP=ON - -DVTK_USE_SYSTEM_OGG=ON - -DVTK_USE_SYSTEM_THEORA=ON - -DVTK_USE_SYSTEM_PNG=ON - -DVTK_USE_SYSTEM_TIFF=ON - -DVTK_USE_SYSTEM_ZLIB=ON -DVTK_INSTALL_INCLUDE_DIR=include -DVTK_INSTALL_DATA_DIR=share/vtk/data -DVTK_INSTALL_DOC_DIR=share/vtk/doc -DVTK_INSTALL_PACKAGE_DIR=share/vtk -DVTK_INSTALL_RUNTIME_DIR=bin -DVTK_FORBID_DOWNLOADS=ON + + # We set all libraries to "system" and explicitly list the ones that should use embedded copies + -DVTK_USE_SYSTEM_LIBRARIES=ON + -DVTK_USE_SYSTEM_GL2PS=OFF + + # Select modules / groups to install + -DVTK_Group_Imaging=ON + -DVTK_Group_Views=ON -DModule_vtkGUISupportMFC=${Module_vtkGUISupportMFC} + -DModule_vtkRenderingOpenVR=${Module_vtkRenderingOpenVR} + -DVTK_Group_MPI=${VTK_Group_MPI} + ${ADDITIONAL_OPTIONS} ) @@ -286,7 +251,7 @@ if(VTK_WITH_ALL_MODULES) file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/XdmfConfig.cmake) endif() -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) endif() diff --git a/ports/xerces-c/CONTROL b/ports/xerces-c/CONTROL index 63b4e9ad1..dc204b51b 100644 --- a/ports/xerces-c/CONTROL +++ b/ports/xerces-c/CONTROL @@ -1,5 +1,5 @@ Source: xerces-c -Version: 3.2.2-7 +Version: 3.2.2-8 Description: Xerces-C++ is a XML parser, for parsing, generating, manipulating, and validating XML documents using the DOM, SAX, and SAX2 APIs. Feature: icu diff --git a/ports/xerces-c/portfile.cmake b/ports/xerces-c/portfile.cmake index aa5700121..017cb7cab 100644 --- a/ports/xerces-c/portfile.cmake +++ b/ports/xerces-c/portfile.cmake @@ -45,6 +45,12 @@ string(REPLACE ) file(WRITE ${CURRENT_PACKAGES_DIR}/share/xercesc/XercesCConfigInternal.cmake "${_contents}") +configure_file( + ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake + ${CURRENT_PACKAGES_DIR}/share/xercesc + @ONLY +) + file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" diff --git a/ports/xerces-c/vcpkg-cmake-wrapper.cmake b/ports/xerces-c/vcpkg-cmake-wrapper.cmake new file mode 100644 index 000000000..c6cfff8a4 --- /dev/null +++ b/ports/xerces-c/vcpkg-cmake-wrapper.cmake @@ -0,0 +1,9 @@ +_find_package(${ARGS})
+
+if (APPLE)
+ if (TARGET XercesC::XercesC)
+ set_property(TARGET XercesC::XercesC APPEND PROPERTY INTERFACE_LINK_LIBRARIES "-framework CoreServices" "-framework CoreFoundation" curl)
+ list(APPEND XercesC_LIBRARIES "-framework CoreServices" "-framework CoreFoundation" curl)
+ endif()
+endif()
+
diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 7a1b2777b..056b21cac 100644 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -78,7 +78,7 @@ vcpkgCheckEqualFileHash() echo " File path: [ $downloadPath ]" echo " Expected hash: [ $sha512 ]" echo " Actual hash: [ $actualHash ]" - exit + exit 1 fi } @@ -234,8 +234,8 @@ buildDir="$vcpkgRootDir/toolsrc/build.rel" rm -rf "$buildDir" mkdir -p "$buildDir" -(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DDEFINE_DISABLE_METRICS=$vcpkgDisableMetrics") -(cd "$buildDir" && "$cmakeExe" --build .) +(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DDEFINE_DISABLE_METRICS=$vcpkgDisableMetrics") || exit 1 +(cd "$buildDir" && "$cmakeExe" --build .) || exit 1 rm -rf "$vcpkgRootDir/vcpkg" cp "$buildDir/vcpkg" "$vcpkgRootDir/" diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index b8037f466..b2a589421 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -192,6 +192,7 @@ macro(find_package name) set(Boost_USE_STATIC_LIBS OFF) set(Boost_USE_MULTITHREADED ON) unset(Boost_USE_STATIC_RUNTIME) + set(Boost_NO_BOOST_CMAKE ON) unset(Boost_USE_STATIC_RUNTIME CACHE) set(Boost_COMPILER "-vc140") _find_package(${ARGV}) diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index 2f0da07f9..e86632c7e 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -162,6 +162,33 @@ function(vcpkg_build_cmake) endif() endwhile() endif() + elseif(out_contents MATCHES "mt : general error c101008d: ") + # Antivirus workaround - occasionally files are locked and cause mt.exe to fail + set(ITERATION 0) + while (ITERATION LESS 3 AND out_contents MATCHES "mt : general error c101008d: ") + MATH(EXPR ITERATION "${ITERATION}+1") + message(STATUS "Restarting Build ${TARGET_TRIPLET}-${SHORT_BUILDTYPE} because of mt.exe file locking issue. Iteration: ${ITERATION}") + execute_process( + COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} + OUTPUT_FILE "${LOGPREFIX}-out-${ITERATION}.log" + ERROR_FILE "${LOGPREFIX}-err-${ITERATION}.log" + RESULT_VARIABLE error_code + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) + + if(error_code) + file(READ "${LOGPREFIX}-out-${ITERATION}.log" out_contents) + file(READ "${LOGPREFIX}-err-${ITERATION}.log" err_contents) + + if(out_contents) + list(APPEND LOGS "${LOGPREFIX}-out-${ITERATION}.log") + endif() + if(err_contents) + list(APPEND LOGS "${LOGPREFIX}-err-${ITERATION}.log") + endif() + else() + break() + endif() + endwhile() endif() if(error_code) @@ -170,7 +197,7 @@ function(vcpkg_build_cmake) file(TO_NATIVE_PATH "${LOG}" NATIVE_LOG) list(APPEND STRINGIFIED_LOGS " ${NATIVE_LOG}\n") endforeach() - set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${NO_PARALLEL_ARG}) + set(_eb_COMMAND ${CMAKE_COMMAND} --build . --config ${CONFIG} ${TARGET_PARAM} -- ${BUILD_ARGS} ${PARALLEL_ARG}) set(_eb_WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${SHORT_BUILDTYPE}) message(FATAL_ERROR " Command failed: ${_eb_COMMAND}\n" diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index 584e93251..ceff199ab 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -109,16 +109,20 @@ function(vcpkg_configure_cmake) elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017") set(ARCH "ARM64") - elseif(VCPKG_PLATFORM_TOOLSET MATCHES "v142") - if(NOT VCPKG_CMAKE_SYSTEM_NAME) - set(VCPKG_CMAKE_SYSTEM_NAME Windows) - endif() - message(FATAL_ERROR -"Unable to determine appropriate CMake MSBuild generator for: ${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_PLATFORM_TOOLSET}. -This is because CMake 3.12.4 does not currently have a 'Visual Studio 16 2019' option. -This can be worked around by either: - 1. Install Visual Studio 2017 Stable -") + + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142") + set(GENERATOR "Visual Studio 16 2019") + set(ARCH "Win32") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142") + set(GENERATOR "Visual Studio 16 2019") + set(ARCH "x64") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142") + set(GENERATOR "Visual Studio 16 2019") + set(ARCH "ARM") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v142") + set(GENERATOR "Visual Studio 16 2019") + set(ARCH "ARM64") + else() if(NOT VCPKG_CMAKE_SYSTEM_NAME) set(VCPKG_CMAKE_SYSTEM_NAME Windows) diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index d8dd10b2b..1642bf3b4 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -136,7 +136,9 @@ function(vcpkg_find_acquire_program VAR) set(PATHS "${DOWNLOADS}/tools/nuget") set(BREW_PACKAGE_NAME "nuget") set(URL "https://dist.nuget.org/win-x86-commandline/v4.8.1/nuget.exe") - set(HASH 42CB744338AF8DECC033A75BCE5B4C4DF28E102BAFC45F9A8BA86D7BC010F5B43EBACAE80D7B28C4F85AC900EEFC2A349620AE65F27F6CA1C21C53B63B92924B) + set(ARCHIVE "nuget.exe") + set(NOEXTRACT ON) + set(HASH 42cb744338af8decc033a75bce5b4c4df28e102bafc45f9a8ba86d7bc010f5b43ebacae80d7b28c4f85ac900eefc2a349620ae65f27f6ca1c21c53b63b92924b) elseif(VAR MATCHES "MESON") set(PROGNAME meson) set(REQUIRED_INTERPRETER PYTHON3) diff --git a/scripts/toolchains/windows.cmake b/scripts/toolchains/windows.cmake index 266e023b1..12b1ae7f9 100644 --- a/scripts/toolchains/windows.cmake +++ b/scripts/toolchains/windows.cmake @@ -9,7 +9,6 @@ if(NOT _CMAKE_IN_TRY_COMPILE) message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"")
endif()
- set(CHARSET_FLAG "/utf-8")
if(VCPKG_PLATFORM_TOOLSET MATCHES "v120")
# VS 2013 does not support /utf-8
set(CHARSET_FLAG)
diff --git a/scripts/vcpkgTools.xml b/scripts/vcpkgTools.xml index 18ca741c2..15f891979 100644 --- a/scripts/vcpkgTools.xml +++ b/scripts/vcpkgTools.xml @@ -1,25 +1,25 @@ <?xml version="1.0"?> <tools version="2"> <tool name="cmake" os="windows"> - <version>3.12.4</version> - <exeRelativePath>cmake-3.12.4-win32-x86\bin\cmake.exe</exeRelativePath> - <url>https://github.com/Kitware/CMake/releases/download/v3.12.4/cmake-3.12.4-win32-x86.zip</url> - <sha512>ca7097c5917101c39d5fa5325cd256ad3aa616a7e5811915cb2869c24961dc133726015b3576908fbd0666f89c8e31886bed9cf6b532a3fe44681d5245bc25c7</sha512> - <archiveName>cmake-3.12.4-win32-x86.zip</archiveName> + <version>3.14.0</version> + <exeRelativePath>cmake-3.14.0-win32-x86\bin\cmake.exe</exeRelativePath> + <url>https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-win32-x86.zip</url> + <sha512>60eb6a0790883da4152a957bd1133405f620f4b7a073af3bea97695b3ef8c22c41d9b90e45815f2a896df5be0cd6dedb73a6df5f17a42761ca8f457c9f3b708c</sha512> + <archiveName>cmake-3.14.0-win32-x86.zip</archiveName> </tool> <tool name="cmake" os="osx"> - <version>3.12.4</version> - <exeRelativePath>cmake-3.12.4-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath> - <url>https://github.com/Kitware/CMake/releases/download/v3.12.4/cmake-3.12.4-Darwin-x86_64.tar.gz</url> - <sha512>67ce23394d9679818ab0f2792f5d585c8c6f385e18584d488a47d48b768d1ee20b58247d22945aeff1ff9f84b7e843457dac98a50801ac3068ab1fbcbe0b0f45</sha512> - <archiveName>cmake-3.12.4-Darwin-x86_64.tar.gz</archiveName> + <version>3.14.0</version> + <exeRelativePath>cmake-3.14.0-Darwin-x86_64/CMake.app/Contents/bin/cmake</exeRelativePath> + <url>https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Darwin-x86_64.tar.gz</url> + <sha512>a5a7217a049be3bb2ef5c93292b1d92eb4dd5ec6ab2dd04984aae01d2732eb343cea4f9741b333a5e21a27eb7934f568f780f3558e7ff870150c3309fc4656b3</sha512> + <archiveName>cmake-3.14.0-Darwin-x86_64.tar.gz</archiveName> </tool> <tool name="cmake" os="linux"> - <version>3.12.4</version> - <exeRelativePath>cmake-3.12.4-Linux-x86_64/bin/cmake</exeRelativePath> - <url>https://github.com/Kitware/CMake/releases/download/v3.12.4/cmake-3.12.4-Linux-x86_64.tar.gz</url> - <sha512>ee9eded0c72e06ef99554f09553d40842478700ca6f07319c28247f1d45301708c703c65ad617cf618833257bacc3b9f63a54b32288bfb619d38758669dcd20f</sha512> - <archiveName>cmake-3.12.4-Linux-x86_64.tar.gz</archiveName> + <version>3.14.0</version> + <exeRelativePath>cmake-3.14.0-Linux-x86_64/bin/cmake</exeRelativePath> + <url>https://github.com/Kitware/CMake/releases/download/v3.14.0/cmake-3.14.0-Linux-x86_64.tar.gz</url> + <sha512>e687c0f3acfb15c880ddac67e2821907f833cb900c6ecedb4ab5df5102604d82753c948e3c7dca6e5bcce6278a09b7d577b1afade2e133aec5b2057ac48d3c74</sha512> + <archiveName>cmake-3.14.0-Linux-x86_64.tar.gz</archiveName> </tool> <tool name="cmake" os="freebsd"> <version>3.12.4</version> @@ -30,7 +30,7 @@ </tool> <tool name="git" os="windows"> <version>2.20.0</version> - <exeRelativePath>cmd\git.exe</exeRelativePath> + <exeRelativePath>mingw32\bin\git.exe</exeRelativePath> <url>https://github.com/git-for-windows/git/releases/download/v2.20.0.windows.1/PortableGit-2.20.0-32-bit.7z.exe</url> <sha512>81647a87df9fde0945ef597cb1cafd8f5f42859da89e9b1db55222a261407bc16bdcc0cf1e86e315697f0981832fe10fc02845cad4b4c82ea64bbd218aec6a49</sha512> <archiveName>PortableGit-2.20.0-32-bit.7z.exe</archiveName> diff --git a/toolsrc/CMakeLists.txt b/toolsrc/CMakeLists.txt index 342765c1c..706162bd3 100644 --- a/toolsrc/CMakeLists.txt +++ b/toolsrc/CMakeLists.txt @@ -18,7 +18,7 @@ If you would like to try anyway, set VCPKG_ALLOW_APPLE_CLANG.") elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
set(CLANG 1)
elseif(MSVC)
- add_compile_options(/std:c++latest)
+ add_compile_options(/std:c++17)
else()
message(FATAL_ERROR "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
@@ -59,8 +59,17 @@ elseif(CLANG) target_link_libraries(vcpkg PRIVATE c++experimental)
endif()
-if(WIN32)
- target_link_libraries(vcpkg PRIVATE bcrypt)
+if(MSVC)
+ get_target_property(_srcs vcpkg SOURCES)
+
+ if(NOT CMAKE_GENERATOR MATCHES "Visual Studio .*")
+ set_property(SOURCE src/pch.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
+ set_property(SOURCE ${_srcs} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
+ endif()
+
+ set_source_files_properties(src/pch.cpp PROPERTIES COMPILE_FLAGS "/Ycpch.h")
+ target_sources(vcpkg PRIVATE src/pch.cpp)
+ target_compile_options(vcpkg PRIVATE /Yupch.h /FIpch.h /Zm200)
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 9c9deeb3f..fa2c2bb72 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,5 +1,15 @@ #pragma once +#if defined(_MSC_VER) && _MSC_VER < 1911 +// [[nodiscard]] is not recognized before VS 2017 version 15.3 +#pragma warning(disable : 5030) +#endif + +#if defined(__GNUC__) && __GNUC__ < 7 +// [[nodiscard]] is not recognized before GCC version 7 +#pragma GCC diagnostic ignored "-Wattributes" +#endif + #if defined(_WIN32) #define NOMINMAX #define WIN32_LEAN_AND_MEAN diff --git a/toolsrc/include/vcpkg/base/checks.h b/toolsrc/include/vcpkg/base/checks.h index bceee3428..3c0c073d2 100644 --- a/toolsrc/include/vcpkg/base/checks.h +++ b/toolsrc/include/vcpkg/base/checks.h @@ -6,7 +6,7 @@ namespace vcpkg::Checks { - void register_console_ctrl_handler(); + void register_global_shutdown_handler(void (*func)()); // Indicate that an internal error has occurred and exit the tool. This should be used when invariants have been // broken. @@ -21,7 +21,7 @@ namespace vcpkg::Checks [[noreturn]] inline void exit_success(const LineInfo& line_info) { exit_with_code(line_info, EXIT_SUCCESS); } // Display an error message to the user and exit the tool. - [[noreturn]] void exit_with_message(const LineInfo& line_info, const CStringView error_message); + [[noreturn]] void exit_with_message(const LineInfo& line_info, StringView error_message); template<class Arg1, class... Args> // Display an error message to the user and exit the tool. @@ -36,7 +36,7 @@ namespace vcpkg::Checks void check_exit(const LineInfo& line_info, bool expression); - void check_exit(const LineInfo& line_info, bool expression, const CStringView error_message); + void check_exit(const LineInfo& line_info, bool expression, StringView error_message); template<class Conditional, class Arg1, class... Args> void check_exit(const LineInfo& line_info, diff --git a/toolsrc/include/vcpkg/base/chrono.h b/toolsrc/include/vcpkg/base/chrono.h index 6f6e2b317..26294fdf8 100644 --- a/toolsrc/include/vcpkg/base/chrono.h +++ b/toolsrc/include/vcpkg/base/chrono.h @@ -1,8 +1,10 @@ #pragma once +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/optional.h> + #include <chrono> #include <string> -#include <vcpkg/base/optional.h> namespace vcpkg::Chrono { @@ -21,6 +23,7 @@ namespace vcpkg::Chrono } std::string to_string() const; + void to_string(std::string& into) const; private: std::chrono::high_resolution_clock::time_point::duration m_duration; @@ -41,6 +44,7 @@ namespace vcpkg::Chrono double microseconds() const { return elapsed().as<std::chrono::duration<double, std::micro>>().count(); } std::string to_string() const; + void to_string(std::string& into) const; private: std::chrono::high_resolution_clock::time_point m_start_tick; @@ -65,5 +69,7 @@ namespace vcpkg::Chrono mutable tm m_tm; }; + tm get_current_date_time(); + tm get_current_date_time_local(); } diff --git a/toolsrc/include/vcpkg/base/cstringview.h b/toolsrc/include/vcpkg/base/cstringview.h index f285aa36c..d49bfc82f 100644 --- a/toolsrc/include/vcpkg/base/cstringview.h +++ b/toolsrc/include/vcpkg/base/cstringview.h @@ -1,6 +1,6 @@ #pragma once -#include <string.h> +#include <cstring> #include <string> namespace vcpkg @@ -14,6 +14,8 @@ namespace vcpkg constexpr const char* c_str() const { return cstr; } + void to_string(std::string& str) const { str.append(cstr); } + private: const char* cstr; }; diff --git a/toolsrc/include/vcpkg/base/expected.h b/toolsrc/include/vcpkg/base/expected.h index e20f723db..c273d71e6 100644 --- a/toolsrc/include/vcpkg/base/expected.h +++ b/toolsrc/include/vcpkg/base/expected.h @@ -1,6 +1,7 @@ #pragma once #include <vcpkg/base/checks.h> +#include <vcpkg/base/stringliteral.h> #include <system_error> @@ -20,7 +21,7 @@ namespace vcpkg const Err& error() const { return m_err; } Err& error() { return m_err; } - CStringView to_string() const { return "value was error"; } + StringLiteral to_string() const { return "value was error"; } private: bool m_is_error; @@ -28,6 +29,27 @@ namespace vcpkg }; template<> + struct ErrorHolder<std::string> + { + ErrorHolder() : m_is_error(false) {} + template<class U> + ErrorHolder(U&& err) : m_is_error(true), m_err(std::forward<U>(err)) + { + } + + bool has_error() const { return m_is_error; } + + const std::string& error() const { return m_err; } + std::string& error() { return m_err; } + + const std::string& to_string() const { return m_err; } + + private: + bool m_is_error; + std::string m_err; + }; + + template<> struct ErrorHolder<std::error_code> { ErrorHolder() = default; @@ -38,12 +60,21 @@ namespace vcpkg const std::error_code& error() const { return m_err; } std::error_code& error() { return m_err; } - CStringView to_string() const { return m_err.message(); } + std::string to_string() const { return m_err.message(); } private: std::error_code m_err; }; + struct ExpectedLeftTag + { + }; + struct ExpectedRightTag + { + }; + constexpr ExpectedLeftTag expected_left_tag; + constexpr ExpectedRightTag expected_right_tag; + template<class T, class S> class ExpectedT { @@ -52,11 +83,11 @@ namespace vcpkg // Constructors are intentionally implicit - ExpectedT(const S& s) : m_s(s) {} - ExpectedT(S&& s) : m_s(std::move(s)) {} + ExpectedT(const S& s, ExpectedRightTag = {}) : m_s(s) {} + ExpectedT(S&& s, ExpectedRightTag = {}) : m_s(std::move(s)) {} - ExpectedT(const T& t) : m_t(t) {} - ExpectedT(T&& t) : m_t(std::move(t)) {} + ExpectedT(const T& t, ExpectedLeftTag = {}) : m_t(t) {} + ExpectedT(T&& t, ExpectedLeftTag = {}) : m_t(std::move(t)) {} ExpectedT(const ExpectedT&) = default; ExpectedT(ExpectedT&&) = default; diff --git a/toolsrc/include/vcpkg/base/graphs.h b/toolsrc/include/vcpkg/base/graphs.h index 6cff75ad3..46831a911 100644 --- a/toolsrc/include/vcpkg/base/graphs.h +++ b/toolsrc/include/vcpkg/base/graphs.h @@ -2,10 +2,11 @@ #include <unordered_map> #include <unordered_set> +#include <utility> #include <vcpkg/base/checks.h> #include <vcpkg/base/span.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> namespace vcpkg::Graphs { @@ -66,12 +67,12 @@ namespace vcpkg::Graphs case ExplorationStatus::FULLY_EXPLORED: return; case ExplorationStatus::PARTIALLY_EXPLORED: { - System::println("Cycle detected within graph at %s:", f.to_string(vertex)); + System::print2("Cycle detected within graph at ", f.to_string(vertex), ":\n"); for (auto&& node : exploration_status) { if (node.second == ExplorationStatus::PARTIALLY_EXPLORED) { - System::println(" %s", f.to_string(node.first)); + System::print2(" ", f.to_string(node.first), '\n'); } } Checks::exit_fail(VCPKG_LINE_INFO); diff --git a/toolsrc/include/vcpkg/base/lineinfo.h b/toolsrc/include/vcpkg/base/lineinfo.h index e0eb8bec9..2f03fef16 100644 --- a/toolsrc/include/vcpkg/base/lineinfo.h +++ b/toolsrc/include/vcpkg/base/lineinfo.h @@ -6,13 +6,15 @@ namespace vcpkg { struct LineInfo { - int line_number; - const char* file_name; - - constexpr LineInfo() noexcept : line_number(0), file_name("") {} - constexpr LineInfo(const int lineno, const char* filename) : line_number(lineno), file_name(filename) {} + constexpr LineInfo() noexcept : m_line_number(0), m_file_name("") {} + constexpr LineInfo(const int lineno, const char* filename) : m_line_number(lineno), m_file_name(filename) {} std::string to_string() const; + void to_string(std::string& out) const; + + private: + int m_line_number; + const char* m_file_name; }; } diff --git a/toolsrc/include/vcpkg/base/optional.h b/toolsrc/include/vcpkg/base/optional.h index 6b84b10aa..4d386a961 100644 --- a/toolsrc/include/vcpkg/base/optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -1,6 +1,9 @@ #pragma once -#include <vcpkg/base/checks.h> +#include <vcpkg/base/lineinfo.h> + +#include <type_traits> +#include <utility> namespace vcpkg { @@ -13,25 +16,146 @@ namespace vcpkg namespace details { - template<class T> + template<class T, bool B = std::is_copy_constructible<T>::value> struct OptionalStorage { - constexpr OptionalStorage() noexcept : m_is_present(false), m_t() {} + constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {} constexpr OptionalStorage(const T& t) : m_is_present(true), m_t(t) {} constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {} + ~OptionalStorage() noexcept + { + if (m_is_present) m_t.~T(); + } + + OptionalStorage(const OptionalStorage& o) : m_is_present(o.m_is_present), m_inactive() + { + if (m_is_present) new (&m_t) T(o.m_t); + } + + OptionalStorage(OptionalStorage&& o) : m_is_present(o.m_is_present), m_inactive() + { + if (m_is_present) + { + new (&m_t) T(std::move(o.m_t)); + } + } + + OptionalStorage& operator=(const OptionalStorage& o) + { + if (m_is_present && o.m_is_present) + { + m_t = o.m_t; + } + else if (!m_is_present && o.m_is_present) + { + m_is_present = true; + new (&m_t) T(o.m_t); + } + else if (m_is_present && !o.m_is_present) + { + clear(); + } + return *this; + } + + OptionalStorage& operator=(OptionalStorage&& o) + { + if (m_is_present && o.m_is_present) + { + m_t = std::move(o.m_t); + } + else if (!m_is_present && o.m_is_present) + { + m_is_present = true; + new (&m_t) T(std::move(o.m_t)); + } + else if (m_is_present && !o.m_is_present) + { + clear(); + } + return *this; + } + constexpr bool has_value() const { return m_is_present; } const T& value() const { return this->m_t; } T& value() { return this->m_t; } private: + void clear() + { + m_is_present = false; + m_t.~T(); + m_inactive = '\0'; + } + bool m_is_present; - T m_t; + union { + char m_inactive; + T m_t; + }; }; template<class T> - struct OptionalStorage<T&> + struct OptionalStorage<T, false> + { + constexpr OptionalStorage() noexcept : m_is_present(false), m_inactive() {} + constexpr OptionalStorage(T&& t) : m_is_present(true), m_t(std::move(t)) {} + + ~OptionalStorage() noexcept + { + if (m_is_present) m_t.~T(); + } + + OptionalStorage(OptionalStorage&& o) : m_is_present(o.m_is_present), m_inactive() + { + if (m_is_present) + { + new (&m_t) T(std::move(o.m_t)); + } + } + + OptionalStorage& operator=(OptionalStorage&& o) + { + if (m_is_present && o.m_is_present) + { + m_t = std::move(o.m_t); + } + else if (!m_is_present && o.m_is_present) + { + m_is_present = true; + new (&m_t) T(std::move(o.m_t)); + } + else if (m_is_present && !o.m_is_present) + { + clear(); + } + return *this; + } + + constexpr bool has_value() const { return m_is_present; } + + const T& value() const { return this->m_t; } + T& value() { return this->m_t; } + + private: + void clear() + { + m_is_present = false; + m_t.~T(); + m_inactive = '\0'; + } + + bool m_is_present; + union { + char m_inactive; + T m_t; + }; + }; + + template<class T, bool B> + struct OptionalStorage<T&, B> { constexpr OptionalStorage() noexcept : m_t(nullptr) {} constexpr OptionalStorage(T& t) : m_t(&t) {} @@ -43,6 +167,9 @@ namespace vcpkg private: T* m_t; }; + + // Note: implemented in checks.cpp to cut the header dependency + void exit_if_null(bool b, const LineInfo& line_info); } template<class T> @@ -53,26 +180,26 @@ namespace vcpkg // Constructors are intentionally implicit constexpr Optional(NullOpt) {} - template<class U> - Optional(U&& t) : m_base(std::forward<U>(t)) + template<class U, class = std::enable_if_t<!std::is_same<std::decay_t<U>, Optional>::value>> + constexpr Optional(U&& t) : m_base(std::forward<U>(t)) { } T&& value_or_exit(const LineInfo& line_info) && { - this->exit_if_null(line_info); + details::exit_if_null(this->m_base.has_value(), line_info); return std::move(this->m_base.value()); } T& value_or_exit(const LineInfo& line_info) & { - this->exit_if_null(line_info); + details::exit_if_null(this->m_base.has_value(), line_info); return this->m_base.value(); } const T& value_or_exit(const LineInfo& line_info) const& { - this->exit_if_null(line_info); + details::exit_if_null(this->m_base.has_value(), line_info); return this->m_base.value(); } @@ -101,11 +228,6 @@ namespace vcpkg typename std::add_pointer<T>::type get() { return this->m_base.has_value() ? &this->m_base.value() : nullptr; } private: - void exit_if_null(const LineInfo& line_info) const - { - Checks::check_exit(line_info, this->m_base.has_value(), "Value was null"); - } - details::OptionalStorage<T> m_base; }; diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h index 2b067d0ac..4c805e2b4 100644 --- a/toolsrc/include/vcpkg/base/span.h +++ b/toolsrc/include/vcpkg/base/span.h @@ -11,8 +11,9 @@ namespace vcpkg struct Span
{
public:
- static_assert(!std::is_reference<T>::value, "Span<&> is illegal");
+ static_assert(std::is_object<T>::value, "Span<non-object-type> is illegal");
+ using value_type = std::decay_t<T>;
using element_type = T;
using pointer = std::add_pointer_t<T>;
using reference = std::add_lvalue_reference_t<T>;
@@ -30,46 +31,28 @@ namespace vcpkg }
template<size_t N>
- constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept
- : m_ptr(arr.data()), m_count(arr.size())
+ constexpr Span(std::remove_const_t<T> (&arr)[N]) noexcept : m_ptr(arr), m_count(N)
{
}
- Span(std::vector<T>& v) noexcept : Span(v.data(), v.size()) {}
- Span(const std::vector<std::remove_const_t<T>>& v) noexcept : Span(v.data(), v.size()) {}
+ template<class Range,
+ class = decltype(std::declval<Range>().data()),
+ class = std::enable_if_t<!std::is_same<std::decay_t<Range>, Span>::value>>
+ constexpr Span(Range&& v) noexcept : Span(v.data(), v.size())
+ {
+ static_assert(std::is_same<typename std::decay_t<Range>::value_type, value_type>::value,
+ "Cannot convert incompatible ranges");
+ }
constexpr iterator begin() const { return m_ptr; }
constexpr iterator end() const { return m_ptr + m_count; }
constexpr reference operator[](size_t i) const { return m_ptr[i]; }
+ constexpr pointer data() const { return m_ptr; }
constexpr size_t size() const { return m_count; }
private:
pointer m_ptr;
size_t m_count;
};
-
- template<class T>
- Span<T> make_span(std::vector<T>& v)
- {
- return {v.data(), v.size()};
- }
-
- template<class T>
- Span<const T> make_span(const std::vector<T>& v)
- {
- return {v.data(), v.size()};
- }
-
- template<class T>
- constexpr T* begin(Span<T> sp)
- {
- return sp.begin();
- }
-
- template<class T>
- constexpr T* end(Span<T> sp)
- {
- return sp.end();
- }
}
diff --git a/toolsrc/include/vcpkg/base/stringliteral.h b/toolsrc/include/vcpkg/base/stringliteral.h index 9970adc2a..602e0bfd2 100644 --- a/toolsrc/include/vcpkg/base/stringliteral.h +++ b/toolsrc/include/vcpkg/base/stringliteral.h @@ -1,27 +1,17 @@ #pragma once -#include <vcpkg/base/cstringview.h> +#include <string> +#include <vcpkg/base/zstringview.h> namespace vcpkg { - struct StringLiteral + struct StringLiteral : ZStringView { template<int N> - constexpr StringLiteral(const char (&str)[N]) - : m_size(N - 1) /* -1 here accounts for the null byte at the end*/, m_cstr(str) + constexpr StringLiteral(const char (&str)[N]) : ZStringView(str) { } - constexpr const char* c_str() const { return m_cstr; } - constexpr size_t size() const { return m_size; } - - operator CStringView() const { return m_cstr; } - operator std::string() const { return m_cstr; } - - private: - size_t m_size; - const char* m_cstr; + operator std::string() const { return std::string(data(), size()); } }; - - inline const char* to_printf_arg(const StringLiteral str) { return str.c_str(); } } diff --git a/toolsrc/include/vcpkg/base/stringrange.h b/toolsrc/include/vcpkg/base/stringrange.h deleted file mode 100644 index 6126ec48f..000000000 --- a/toolsrc/include/vcpkg/base/stringrange.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include <vcpkg/base/optional.h> - -#include <string> -#include <vector> - -namespace vcpkg -{ - struct StringRange - { - static std::vector<StringRange> find_all_enclosed(const StringRange& input, - const std::string& left_delim, - const std::string& right_delim); - - static StringRange find_exactly_one_enclosed(const StringRange& input, - const std::string& left_tag, - const std::string& right_tag); - - static Optional<StringRange> find_at_most_one_enclosed(const StringRange& input, - const std::string& left_tag, - const std::string& right_tag); - - StringRange() = default; - StringRange(const std::string& s); // Implicit by design - StringRange(const std::string::const_iterator begin, const std::string::const_iterator end); - - std::string::const_iterator begin; - std::string::const_iterator end; - - std::string to_string() const; - }; -} diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h index 4b39b0a28..16876cf5c 100644 --- a/toolsrc/include/vcpkg/base/strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -1,7 +1,10 @@ #pragma once #include <vcpkg/base/cstringview.h> +#include <vcpkg/base/optional.h> #include <vcpkg/base/stringliteral.h> +#include <vcpkg/base/stringview.h> +#include <vcpkg/base/view.h> #include <vector> @@ -24,10 +27,63 @@ namespace vcpkg::Strings::details } std::string format_internal(const char* fmtstr, ...); + + inline void append_internal(std::string& into, char c) { into += c; } + template<class T, class = decltype(std::to_string(std::declval<T>()))> + inline void append_internal(std::string& into, T x) + { + into += std::to_string(x); + } + inline void append_internal(std::string& into, const char* v) { into.append(v); } + inline void append_internal(std::string& into, const std::string& s) { into.append(s); } + + template<class T, class = decltype(std::declval<const T&>().to_string(std::declval<std::string&>()))> + void append_internal(std::string& into, const T& t) + { + t.to_string(into); + } + + template<class T, class=void, class = decltype(to_string(std::declval<std::string&>(), std::declval<const T&>()))> + void append_internal(std::string& into, const T& t) + { + to_string(into, t); + } } namespace vcpkg::Strings { + template<class Arg> + std::string& append(std::string& into, const Arg& a) + { + details::append_internal(into, a); + return into; + } + template<class Arg, class... Args> + std::string& append(std::string& into, const Arg& a, const Args&... args) + { + append(into, a); + return append(into, args...); + } + + template<class... Args> + [[nodiscard]] std::string concat(const Args&... args) { + std::string ret; + append(ret, args...); + return ret; + } + + template<class... Args, class = void> + std::string concat_or_view(const Args&... args) + { + return Strings::concat(args...); + } + + template<class T, class = std::enable_if_t<std::is_convertible<T, StringView>::value>> + StringView concat_or_view(const T& v) + { + return v; + } + template<class... Args> std::string format(const char* fmtstr, const Args&... args) { @@ -36,25 +92,25 @@ namespace vcpkg::Strings } #if defined(_WIN32) - std::wstring to_utf16(const CStringView& s); + std::wstring to_utf16(StringView s); std::string to_utf8(const wchar_t* w); + inline std::string to_utf8(const std::wstring& ws) { return to_utf8(ws.c_str()); } #endif - std::string escape_string(const CStringView& s, char char_to_escape, char escape_char); + std::string escape_string(std::string&& s, char char_to_escape, char escape_char); - std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern); + bool case_insensitive_ascii_contains(StringView s, StringView pattern); - bool case_insensitive_ascii_contains(const std::string& s, const std::string& pattern); + bool case_insensitive_ascii_equals(StringView left, StringView right); - bool case_insensitive_ascii_equals(const CStringView left, const CStringView right); + std::string ascii_to_lowercase(std::string&& s); - std::string ascii_to_lowercase(std::string s); + std::string ascii_to_uppercase(std::string&& s); - std::string ascii_to_uppercase(std::string s); - - bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern); - bool ends_with(const std::string& s, StringLiteral pattern); + bool case_insensitive_ascii_starts_with(StringView s, StringView pattern); + bool ends_with(StringView s, StringView pattern); + bool starts_with(StringView s, StringView pattern); template<class Container, class Transformer> std::string join(const char* delimiter, const Container& v, Transformer transformer) @@ -84,7 +140,7 @@ namespace vcpkg::Strings return join(delimiter, v, [](const Element& x) -> const Element& { return x; }); } - std::string replace_all(std::string&& s, const std::string& search, const std::string& rep); + std::string replace_all(std::string&& s, const std::string& search, StringView rep); std::string trim(std::string&& s); @@ -92,6 +148,16 @@ namespace vcpkg::Strings std::vector<std::string> split(const std::string& s, const std::string& delimiter); + std::vector<std::string> split(const std::string& s, const std::string& delimiter, int max_count); + + std::vector<StringView> find_all_enclosed(StringView input, StringView left_delim, StringView right_delim); + + StringView find_exactly_one_enclosed(StringView input, StringView left_tag, StringView right_tag); + + Optional<StringView> find_at_most_one_enclosed(StringView input, StringView left_tag, StringView right_tag); + + bool equals(StringView a, StringView b); + template<class T> std::string serialize(const T& t) { @@ -99,4 +165,8 @@ namespace vcpkg::Strings serialize(t, ret); return ret; } + + const char* search(StringView haystack, StringView needle); + + bool contains(StringView haystack, StringView needle); } diff --git a/toolsrc/include/vcpkg/base/stringview.h b/toolsrc/include/vcpkg/base/stringview.h new file mode 100644 index 000000000..fef5bef4e --- /dev/null +++ b/toolsrc/include/vcpkg/base/stringview.h @@ -0,0 +1,49 @@ +#pragma once + +#include <vcpkg/base/optional.h> + +#include <string> +#include <vector> + +namespace vcpkg +{ + struct StringView + { + static std::vector<StringView> find_all_enclosed(const StringView& input, + const std::string& left_delim, + const std::string& right_delim); + + static StringView find_exactly_one_enclosed(const StringView& input, + const std::string& left_tag, + const std::string& right_tag); + + static Optional<StringView> find_at_most_one_enclosed(const StringView& input, + const std::string& left_tag, + const std::string& right_tag); + + constexpr StringView() = default; + StringView(const std::string& s); // Implicit by design + template<size_t Sz> + StringView(const char (&arr)[Sz]) : m_ptr(arr), m_size(Sz - 1) + { + } + + constexpr StringView(const char* ptr, size_t size) : m_ptr(ptr), m_size(size) {} + constexpr StringView(const char* b, const char* e) : m_ptr(b), m_size(static_cast<size_t>(e - b)) {} + + constexpr const char* begin() const { return m_ptr; } + constexpr const char* end() const { return m_ptr + m_size; } + + constexpr const char* data() const { return m_ptr; } + constexpr size_t size() const { return m_size; } + + std::string to_string() const; + void to_string(std::string& out) const; + + bool operator==(StringView other) const; + + private: + const char* m_ptr = 0; + size_t m_size = 0; + }; +} diff --git a/toolsrc/include/vcpkg/base/system.debug.h b/toolsrc/include/vcpkg/base/system.debug.h new file mode 100644 index 000000000..d9c50ac8e --- /dev/null +++ b/toolsrc/include/vcpkg/base/system.debug.h @@ -0,0 +1,50 @@ +#pragma once + +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/system.print.h> + +#include <atomic> + +namespace vcpkg::Debug +{ + extern std::atomic<bool> g_debugging; + + template<class... Args> + void print(System::Color c, const Args&... args) + { + if (g_debugging) System::print2(c, "[DEBUG] ", args...); + } + + template<class... Args> + void print(const Args&... args) + { + if (g_debugging) System::print2("[DEBUG] ", args...); + } + + template<class F, class R = std::result_of_t<F && ()>, class = std::enable_if_t<!std::is_void<R>::value>> + R time(LineInfo line, F&& f) + { + if (g_debugging) + { + auto timer = Chrono::ElapsedTimer::create_started(); + auto&& result = f(); + System::print2("[DEBUG] ", line, " took ", timer, '\n'); + return static_cast<R&&>(result); + } + else + return f(); + } + + template<class F, class R = std::result_of_t<F && ()>, class = std::enable_if_t<std::is_void<R>::value>> + void time(LineInfo line, F&& f) + { + if (g_debugging) + { + auto timer = Chrono::ElapsedTimer::create_started(); + f(); + System::print2("[DEBUG] ", line, " took ", timer, '\n'); + } + else + f(); + } +} diff --git a/toolsrc/include/vcpkg/base/system.h b/toolsrc/include/vcpkg/base/system.h index af56e45c1..0245b684a 100644 --- a/toolsrc/include/vcpkg/base/system.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -1,85 +1,15 @@ #pragma once -#include <unordered_map> - #include <vcpkg/base/files.h> #include <vcpkg/base/optional.h> -#include <vcpkg/base/strings.h> +#include <vcpkg/base/stringview.h> +#include <vcpkg/base/zstringview.h> namespace vcpkg::System { - fs::path get_exe_path_of_current_process(); - - struct CMakeVariable - { - CMakeVariable(const CStringView varname, const char* varvalue); - CMakeVariable(const CStringView varname, const std::string& varvalue); - CMakeVariable(const CStringView varname, const fs::path& path); - - std::string s; - }; - - std::string make_cmake_cmd(const fs::path& cmake_exe, - const fs::path& cmake_script, - const std::vector<CMakeVariable>& pass_variables); - - struct ExitCodeAndOutput - { - int exit_code; - std::string output; - }; + Optional<std::string> get_environment_variable(ZStringView varname) noexcept; - int cmd_execute_clean(const CStringView cmd_line, - const std::unordered_map<std::string, std::string>& extra_env = {}) noexcept; - - int cmd_execute(const CStringView cmd_line) noexcept; - -#if defined(_WIN32) - void cmd_execute_no_wait(const CStringView cmd_line) noexcept; -#endif - - ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line) noexcept; - - enum class Color - { - success = 10, - error = 12, - warning = 14, - }; - - void println(); - void print(const CStringView message); - void println(const CStringView message); - void print(const Color c, const CStringView message); - void println(const Color c, const CStringView message); - - template<class Arg1, class... Args> - void print(const char* message_template, const Arg1& message_arg1, const Args&... message_args) - { - return System::print(Strings::format(message_template, message_arg1, message_args...)); - } - - template<class Arg1, class... Args> - void print(const Color c, const char* message_template, const Arg1& message_arg1, const Args&... message_args) - { - return System::print(c, Strings::format(message_template, message_arg1, message_args...)); - } - - template<class Arg1, class... Args> - void println(const char* message_template, const Arg1& message_arg1, const Args&... message_args) - { - return System::println(Strings::format(message_template, message_arg1, message_args...)); - } - - template<class Arg1, class... Args> - void println(const Color c, const char* message_template, const Arg1& message_arg1, const Args&... message_args) - { - return System::println(c, Strings::format(message_template, message_arg1, message_args...)); - } - - Optional<std::string> get_environment_variable(const CStringView varname) noexcept; - - Optional<std::string> get_registry_string(void* base_hkey, const CStringView subkey, const CStringView valuename); + Optional<std::string> get_registry_string(void* base_hkey, StringView subkey, StringView valuename); enum class CPUArchitecture { @@ -89,7 +19,7 @@ namespace vcpkg::System ARM64, }; - Optional<CPUArchitecture> to_cpu_architecture(const CStringView& arch); + Optional<CPUArchitecture> to_cpu_architecture(StringView arch); CPUArchitecture get_host_processor(); @@ -99,24 +29,3 @@ namespace vcpkg::System const Optional<fs::path>& get_program_files_platform_bitness(); } - -namespace vcpkg::Debug -{ - void println(const CStringView message); - void println(const System::Color c, const CStringView message); - - template<class Arg1, class... Args> - void println(const char* message_template, const Arg1& message_arg1, const Args&... message_args) - { - return Debug::println(Strings::format(message_template, message_arg1, message_args...)); - } - - template<class Arg1, class... Args> - void println(const System::Color c, - const char* message_template, - const Arg1& message_arg1, - const Args&... message_args) - { - return Debug::println(c, Strings::format(message_template, message_arg1, message_args...)); - } -} diff --git a/toolsrc/include/vcpkg/base/system.print.h b/toolsrc/include/vcpkg/base/system.print.h new file mode 100644 index 000000000..890c13667 --- /dev/null +++ b/toolsrc/include/vcpkg/base/system.print.h @@ -0,0 +1,44 @@ +#pragma once + +#include <vcpkg/base/strings.h> +#include <vcpkg/base/view.h> + +namespace vcpkg::System +{ + enum class Color + { + success = 10, + error = 12, + warning = 14, + }; + + namespace details + { + void print(StringView message); + void print(const Color c, StringView message); + } + + template<class Arg1, class... Args> + void printf(const char* message_template, const Arg1& message_arg1, const Args&... message_args) + { + return ::vcpkg::System::details::print(Strings::format(message_template, message_arg1, message_args...)); + } + + template<class Arg1, class... Args> + void printf(const Color c, const char* message_template, const Arg1& message_arg1, const Args&... message_args) + { + return ::vcpkg::System::details::print(c, Strings::format(message_template, message_arg1, message_args...)); + } + + template<class... Args> + void print2(const Color c, const Args&... args) + { + ::vcpkg::System::details::print(c, Strings::concat_or_view(args...)); + } + + template<class... Args> + void print2(const Args&... args) + { + ::vcpkg::System::details::print(Strings::concat_or_view(args...)); + } +} diff --git a/toolsrc/include/vcpkg/base/system.process.h b/toolsrc/include/vcpkg/base/system.process.h new file mode 100644 index 000000000..e409ff950 --- /dev/null +++ b/toolsrc/include/vcpkg/base/system.process.h @@ -0,0 +1,45 @@ +#pragma once + +#include <vcpkg/base/files.h> +#include <vcpkg/base/zstringview.h> + +#include <string> +#include <unordered_map> +#include <vector> + +namespace vcpkg::System +{ + struct CMakeVariable + { + CMakeVariable(const StringView varname, const char* varvalue); + CMakeVariable(const StringView varname, const std::string& varvalue); + CMakeVariable(const StringView varname, const fs::path& path); + + std::string s; + }; + + std::string make_cmake_cmd(const fs::path& cmake_exe, + const fs::path& cmake_script, + const std::vector<CMakeVariable>& pass_variables); + + fs::path get_exe_path_of_current_process(); + + struct ExitCodeAndOutput + { + int exit_code; + std::string output; + }; + + int cmd_execute_clean(const ZStringView cmd_line, + const std::unordered_map<std::string, std::string>& extra_env = {}); + + int cmd_execute(const ZStringView cmd_line); + +#if defined(_WIN32) + void cmd_execute_no_wait(const StringView cmd_line); +#endif + + ExitCodeAndOutput cmd_execute_and_capture_output(const ZStringView cmd_line); + + void register_console_ctrl_handler(); +} diff --git a/toolsrc/include/vcpkg/base/util.h b/toolsrc/include/vcpkg/base/util.h index 65ce02b99..213adb67c 100644 --- a/toolsrc/include/vcpkg/base/util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -10,7 +10,8 @@ namespace vcpkg::Util { template<class Container> - using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>; + using ElementT = + std::remove_reference_t<decltype(*std::declval<typename std::remove_reference_t<Container>::iterator>())>; namespace Vectors { @@ -41,11 +42,11 @@ namespace vcpkg::Util } } - template<class Cont, class Func> - using FmapOut = decltype(std::declval<Func&>()(*begin(std::declval<Cont&>()))); + template<class Range, class Func> + using FmapOut = std::remove_reference_t<decltype(std::declval<Func&>()(*std::declval<Range>().begin()))>; - template<class Cont, class Func, class Out = FmapOut<Cont, Func>> - std::vector<Out> fmap(Cont&& xs, Func&& f) + template<class Range, class Func, class Out = FmapOut<Range, Func>> + std::vector<Out> fmap(Range&& xs, Func&& f) { std::vector<Out> ret; ret.reserve(xs.size()); @@ -93,12 +94,6 @@ namespace vcpkg::Util return std::find_if(begin(cont), end(cont), pred); } - template<class Container, class T = ElementT<Container>> - std::vector<T*> element_pointers(Container&& cont) - { - return fmap(cont, [](auto&& x) { return &x; }); - } - template<class Container, class Pred> auto find_if_not(Container&& cont, Pred pred) { diff --git a/toolsrc/include/vcpkg/base/view.h b/toolsrc/include/vcpkg/base/view.h new file mode 100644 index 000000000..8a9c40994 --- /dev/null +++ b/toolsrc/include/vcpkg/base/view.h @@ -0,0 +1,9 @@ +#pragma once
+
+#include <vcpkg/base/span.h>
+
+namespace vcpkg
+{
+ template<class T>
+ using View = Span<const T>;
+}
diff --git a/toolsrc/include/vcpkg/base/zstringview.h b/toolsrc/include/vcpkg/base/zstringview.h new file mode 100644 index 000000000..7f80bf726 --- /dev/null +++ b/toolsrc/include/vcpkg/base/zstringview.h @@ -0,0 +1,52 @@ +#pragma once + +#include <algorithm> +#include <cstddef> +#include <cstring> +#include <string> + +#include <vcpkg/base/stringview.h> + +namespace vcpkg +{ + // A counted view of a null-terminated string + struct ZStringView + { + using value_type = char; + + constexpr ZStringView() : m_size(0), m_cstr("") {} + + template<int N> + constexpr ZStringView(const char (&str)[N]) + : m_size(N - 1) /* -1 here accounts for the null byte at the end*/, m_cstr(str) + { + } + + ZStringView(const std::string& s) : m_size(s.size()), m_cstr(s.c_str()) {} + constexpr ZStringView(const char* str, size_t sz) : m_size(sz), m_cstr(str) {} + + constexpr const char* data() const { return m_cstr; } + constexpr size_t size() const { return m_size; } + constexpr char operator[](ptrdiff_t off) const { return m_cstr[off]; } + + constexpr const char* c_str() const { return m_cstr; } + + constexpr const char* begin() const { return m_cstr; } + constexpr const char* end() const { return m_cstr + m_size; } + + std::string to_string() const { return std::string(m_cstr, m_size); } + void to_string(std::string& out) const { out.append(m_cstr, m_size); } + + constexpr operator StringView() const { return StringView(m_cstr, m_size); } + + private: + size_t m_size; + const char* m_cstr; + }; + + inline bool operator==(ZStringView l, ZStringView r) { return std::equal(l.begin(), l.end(), r.begin(), r.end()); } + inline bool operator!=(ZStringView l, ZStringView r) { return !std::equal(l.begin(), l.end(), r.begin(), r.end()); } + + inline bool operator==(const char* l, ZStringView r) { return strcmp(l, r.c_str()) == 0; } + inline bool operator==(ZStringView l, const char* r) { return strcmp(l.c_str(), r) == 0; } +} diff --git a/toolsrc/include/vcpkg/globalstate.h b/toolsrc/include/vcpkg/globalstate.h index ae66ca355..2026ea369 100644 --- a/toolsrc/include/vcpkg/globalstate.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -4,6 +4,7 @@ #include <vcpkg/base/util.h> #include <atomic> +#include <string> namespace vcpkg { @@ -19,26 +20,5 @@ namespace vcpkg static std::atomic<int> g_init_console_cp; static std::atomic<int> g_init_console_output_cp; static std::atomic<bool> g_init_console_initialized; - - struct CtrlCStateMachine - { - CtrlCStateMachine(); - - void transition_to_spawn_process() noexcept; - void transition_from_spawn_process() noexcept; - void transition_handle_ctrl_c() noexcept; - - private: - enum class CtrlCState - { - normal, - blocked_on_child, - exit_requested, - }; - - std::atomic<CtrlCState> m_state; - }; - - static CtrlCStateMachine g_ctrl_c_state; }; } diff --git a/toolsrc/include/vcpkg/input.h b/toolsrc/include/vcpkg/input.h index 621139427..ef481bf52 100644 --- a/toolsrc/include/vcpkg/input.h +++ b/toolsrc/include/vcpkg/input.h @@ -4,10 +4,10 @@ namespace vcpkg::Input { - PackageSpec check_and_get_package_spec(const std::string& package_spec_as_string, + PackageSpec check_and_get_package_spec(std::string&& spec_string, const Triplet& default_triplet, CStringView example_text); - FullPackageSpec check_and_get_full_package_spec(const std::string& full_package_spec_as_string, + FullPackageSpec check_and_get_full_package_spec(std::string&& spec_string, const Triplet& default_triplet, CStringView example_text); diff --git a/toolsrc/include/vcpkg/packagespec.h b/toolsrc/include/vcpkg/packagespec.h index 299a9c401..c87c6a2c6 100644 --- a/toolsrc/include/vcpkg/packagespec.h +++ b/toolsrc/include/vcpkg/packagespec.h @@ -35,6 +35,7 @@ namespace vcpkg std::string dir() const; std::string to_string() const; + void to_string(std::string& s) const; bool operator<(const PackageSpec& other) const { @@ -65,6 +66,7 @@ namespace vcpkg const PackageSpec& spec() const { return m_spec; } std::string to_string() const; + void to_string(std::string& out) const; static std::vector<FeatureSpec> from_strings_and_triplet(const std::vector<std::string>& depends, const Triplet& t); diff --git a/toolsrc/include/vcpkg/packagespecparseresult.h b/toolsrc/include/vcpkg/packagespecparseresult.h index be3497152..4c99c84c7 100644 --- a/toolsrc/include/vcpkg/packagespecparseresult.h +++ b/toolsrc/include/vcpkg/packagespecparseresult.h @@ -12,6 +12,8 @@ namespace vcpkg INVALID_CHARACTERS }; + void to_string(std::string& out, ::vcpkg::PackageSpecParseResult p); + CStringView to_string(PackageSpecParseResult ev) noexcept; template<> diff --git a/toolsrc/include/vcpkg/triplet.h b/toolsrc/include/vcpkg/triplet.h index 334960e49..f33f40fd5 100644 --- a/toolsrc/include/vcpkg/triplet.h +++ b/toolsrc/include/vcpkg/triplet.h @@ -11,7 +11,7 @@ namespace vcpkg public: constexpr Triplet() noexcept : m_instance(&DEFAULT_INSTANCE) {} - static Triplet from_canonical_name(const std::string& triplet_as_string); + static Triplet from_canonical_name(std::string&& triplet_as_string); static const Triplet X86_WINDOWS; static const Triplet X64_WINDOWS; @@ -24,6 +24,7 @@ namespace vcpkg const std::string& canonical_name() const; const std::string& to_string() const; + void to_string(std::string& out) const; size_t hash_code() const; bool operator==(const Triplet& other) const; diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 97565bf41..f8b883e97 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -1,3 +1,13 @@ +#if defined(_MSC_VER) && _MSC_VER < 1911 +// [[nodiscard]] is not recognized before VS 2017 version 15.3 +#pragma warning(disable : 5030) +#endif + +#if defined(__GNUC__) && __GNUC__ < 7 +// [[nodiscard]] is not recognized before GCC version 7 +#pragma GCC diagnostic ignored "-Wattributes" +#endif + #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN #include <Windows.h> @@ -13,7 +23,9 @@ #include <vcpkg/base/chrono.h> #include <vcpkg/base/files.h> #include <vcpkg/base/strings.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.debug.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/commands.h> #include <vcpkg/globalstate.h> #include <vcpkg/help.h> @@ -41,7 +53,7 @@ static constexpr int SURVEY_INITIAL_OFFSET_IN_HOURS = SURVEY_INTERVAL_IN_HOURS - void invalid_command(const std::string& cmd) { - System::println(System::Color::error, "invalid command: %s", cmd); + System::print2(System::Color::error, "invalid command: ", cmd, '\n'); Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -100,7 +112,7 @@ static void inner(const VcpkgCmdArguments& args) Checks::check_exit(VCPKG_LINE_INFO, !vcpkg_root_dir.empty(), "Error: Could not detect vcpkg-root."); - Debug::println("Using vcpkg-root: %s", vcpkg_root_dir.u8string()); + Debug::print("Using vcpkg-root: ", vcpkg_root_dir.u8string(), '\n'); auto default_vs_path = System::get_environment_variable("VCPKG_VISUAL_STUDIO_PATH").value_or(""); @@ -137,10 +149,10 @@ static void inner(const VcpkgCmdArguments& args) if (distribution(generator) == 1) { Metrics::g_metrics.lock()->track_property("surveyprompt", "true"); - System::println( + System::print2( System::Color::success, "Your feedback is important to improve Vcpkg! Please take 3 minutes to complete our survey " - "by running: vcpkg contact --survey"); + "by running: vcpkg contact --survey\n"); } } } @@ -154,14 +166,14 @@ static void inner(const VcpkgCmdArguments& args) Triplet default_triplet; if (args.triplet != nullptr) { - default_triplet = Triplet::from_canonical_name(*args.triplet); + default_triplet = Triplet::from_canonical_name(std::string(*args.triplet)); } else { - const auto vcpkg_default_triplet_env = System::get_environment_variable("VCPKG_DEFAULT_TRIPLET"); - if (const auto v = vcpkg_default_triplet_env.get()) + auto vcpkg_default_triplet_env = System::get_environment_variable("VCPKG_DEFAULT_TRIPLET"); + if (auto v = vcpkg_default_triplet_env.get()) { - default_triplet = Triplet::from_canonical_name(*v); + default_triplet = Triplet::from_canonical_name(std::move(*v)); } else { @@ -279,6 +291,31 @@ int main(const int argc, const char* const* const argv) const std::string trimmed_command_line = trim_path_from_command_line(Strings::to_utf8(GetCommandLineW())); #endif + Checks::register_global_shutdown_handler([]() { + const auto elapsed_us_inner = GlobalState::timer.lock()->microseconds(); + + bool debugging = GlobalState::debugging; + + auto metrics = Metrics::g_metrics.lock(); + metrics->track_metric("elapsed_us", elapsed_us_inner); + GlobalState::debugging = false; + metrics->flush(); + +#if defined(_WIN32) + if (GlobalState::g_init_console_initialized) + { + SetConsoleCP(GlobalState::g_init_console_cp); + SetConsoleOutputCP(GlobalState::g_init_console_output_cp); + } +#endif + + auto elapsed_us = GlobalState::timer.lock()->microseconds(); + if (debugging) + System::printf("[DEBUG] Exiting after %d us (%d us)\n", + static_cast<int>(elapsed_us), + static_cast<int>(elapsed_us_inner)); + }); + { auto locked_metrics = Metrics::g_metrics.lock(); locked_metrics->track_property("version", Commands::Version::version()); @@ -287,7 +324,7 @@ int main(const int argc, const char* const* const argv) #endif } - Checks::register_console_ctrl_handler(); + System::register_console_ctrl_handler(); load_config(); @@ -330,24 +367,24 @@ int main(const int argc, const char* const* const argv) Metrics::g_metrics.lock()->track_property("error", exc_msg); fflush(stdout); - System::print("vcpkg.exe has crashed.\n" - "Please send an email to:\n" - " %s\n" - "containing a brief summary of what you were trying to do and the following data blob:\n" - "\n" - "Version=%s\n" - "EXCEPTION='%s'\n" - "CMD=\n", - Commands::Contact::email(), - Commands::Version::version(), - exc_msg); + System::printf("vcpkg.exe has crashed.\n" + "Please send an email to:\n" + " %s\n" + "containing a brief summary of what you were trying to do and the following data blob:\n" + "\n" + "Version=%s\n" + "EXCEPTION='%s'\n" + "CMD=\n", + Commands::Contact::email(), + Commands::Version::version(), + exc_msg); fflush(stdout); for (int x = 0; x < argc; ++x) { #if defined(_WIN32) - System::println("%s|", Strings::to_utf8(argv[x])); + System::print2(Strings::to_utf8(argv[x]), "|\n"); #else - System::println("%s|", argv[x]); + System::print2(argv[x], "|\n"); #endif } fflush(stdout); diff --git a/toolsrc/src/vcpkg/archives.cpp b/toolsrc/src/vcpkg/archives.cpp index 38efedf87..037cbdc14 100644 --- a/toolsrc/src/vcpkg/archives.cpp +++ b/toolsrc/src/vcpkg/archives.cpp @@ -2,6 +2,7 @@ #include <vcpkg/archives.h> #include <vcpkg/commands.h> +#include <vcpkg/base/system.process.h> namespace vcpkg::Archives { diff --git a/toolsrc/src/vcpkg/base/checks.cpp b/toolsrc/src/vcpkg/base/checks.cpp index cc439adfe..0266ad683 100644 --- a/toolsrc/src/vcpkg/base/checks.cpp +++ b/toolsrc/src/vcpkg/base/checks.cpp @@ -1,41 +1,27 @@ #include "pch.h" -#include <vcpkg/globalstate.h> -#include <vcpkg/metrics.h> - #include <vcpkg/base/checks.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/stringview.h> +#include <vcpkg/base/system.debug.h> -namespace vcpkg::Checks +namespace vcpkg { + static void (*g_shutdown_handler)() = nullptr; + void Checks::register_global_shutdown_handler(void (*func)()) + { + if (g_shutdown_handler) + // Setting the handler twice is a program error. Terminate. + std::abort(); + g_shutdown_handler = func; + } + [[noreturn]] static void cleanup_and_exit(const int exit_code) { static std::atomic<bool> have_entered{false}; if (have_entered) std::terminate(); have_entered = true; - const auto elapsed_us_inner = GlobalState::timer.lock()->microseconds(); - - bool debugging = GlobalState::debugging; - - auto metrics = Metrics::g_metrics.lock(); - metrics->track_metric("elapsed_us", elapsed_us_inner); - GlobalState::debugging = false; - metrics->flush(); - -#if defined(_WIN32) - if (GlobalState::g_init_console_initialized) - { - SetConsoleCP(GlobalState::g_init_console_cp); - SetConsoleOutputCP(GlobalState::g_init_console_output_cp); - } -#endif - - auto elapsed_us = GlobalState::timer.lock()->microseconds(); - if (debugging) - System::println("[DEBUG] Exiting after %d us (%d us)", - static_cast<int>(elapsed_us), - static_cast<int>(elapsed_us_inner)); + if (g_shutdown_handler) g_shutdown_handler(); fflush(nullptr); @@ -46,27 +32,10 @@ namespace vcpkg::Checks #endif } -#if defined(_WIN32) - static BOOL ctrl_handler(DWORD fdw_ctrl_type) + void Checks::unreachable(const LineInfo& line_info) { - switch (fdw_ctrl_type) - { - case CTRL_C_EVENT: GlobalState::g_ctrl_c_state.transition_handle_ctrl_c(); return TRUE; - default: return FALSE; - } - } - - void register_console_ctrl_handler() - { - SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE); - } -#else - void register_console_ctrl_handler() {} -#endif - void unreachable(const LineInfo& line_info) - { - System::println(System::Color::error, "Error: Unreachable code was reached"); - System::println(System::Color::error, line_info.to_string()); // Always print line_info here + System::print2(System::Color::error, "Error: Unreachable code was reached\n"); + System::print2(System::Color::error, line_info, '\n'); // Always print line_info here #ifndef NDEBUG std::abort(); #else @@ -74,19 +43,19 @@ namespace vcpkg::Checks #endif } - void exit_with_code(const LineInfo& line_info, const int exit_code) + void Checks::exit_with_code(const LineInfo& line_info, const int exit_code) { - Debug::println(System::Color::error, line_info.to_string()); + Debug::print(System::Color::error, line_info, '\n'); cleanup_and_exit(exit_code); } - void exit_with_message(const LineInfo& line_info, const CStringView error_message) + void Checks::exit_with_message(const LineInfo& line_info, StringView error_message) { - System::println(System::Color::error, error_message); + System::print2(System::Color::error, error_message, '\n'); exit_fail(line_info); } - void check_exit(const LineInfo& line_info, bool expression) + void Checks::check_exit(const LineInfo& line_info, bool expression) { if (!expression) { @@ -94,11 +63,27 @@ namespace vcpkg::Checks } } - void check_exit(const LineInfo& line_info, bool expression, const CStringView error_message) + void Checks::check_exit(const LineInfo& line_info, bool expression, StringView error_message) { if (!expression) { exit_with_message(line_info, error_message); } } + + std::string LineInfo::to_string() const + { + std::string ret; + this->to_string(ret); + return ret; + } + void LineInfo::to_string(std::string& out) const + { + out += m_file_name; + Strings::append(out, '(', m_line_number, ')'); + } + namespace details + { + void exit_if_null(bool b, const LineInfo& line_info) { Checks::check_exit(line_info, b, "Value was null"); } + } } diff --git a/toolsrc/src/vcpkg/base/chrono.cpp b/toolsrc/src/vcpkg/base/chrono.cpp index 405e76605..959ff90c8 100644 --- a/toolsrc/src/vcpkg/base/chrono.cpp +++ b/toolsrc/src/vcpkg/base/chrono.cpp @@ -113,8 +113,13 @@ namespace vcpkg::Chrono } std::string ElapsedTime::to_string() const { return format_time_userfriendly(as<std::chrono::nanoseconds>()); } + void ElapsedTime::to_string(std::string& into) const + { + into += format_time_userfriendly(as<std::chrono::nanoseconds>()); + } std::string ElapsedTimer::to_string() const { return elapsed().to_string(); } + void ElapsedTimer::to_string(std::string& into) const { return elapsed().to_string(into); } Optional<CTime> CTime::get_current_date_time() { diff --git a/toolsrc/src/vcpkg/base/cofffilereader.cpp b/toolsrc/src/vcpkg/base/cofffilereader.cpp index 2c09e2c19..cb75e0847 100644 --- a/toolsrc/src/vcpkg/base/cofffilereader.cpp +++ b/toolsrc/src/vcpkg/base/cofffilereader.cpp @@ -33,11 +33,13 @@ namespace vcpkg::CoffFileReader return data; } - static void verify_equal_strings( - const LineInfo& line_info, const char* expected, const char* actual, int size, const char* label) + static void verify_equal_strings(const LineInfo& line_info, + StringView expected, + StringView actual, + const char* label) { Checks::check_exit(line_info, - memcmp(expected, actual, size) == 0, + expected == actual, "Incorrect string (%s) found. Expected: (%s) but found (%s)", label, expected, @@ -57,7 +59,7 @@ namespace vcpkg::CoffFileReader fs.seekg(offset_to_pe_signature); char signature[PE_SIGNATURE_SIZE]; fs.read(signature, PE_SIGNATURE_SIZE); - verify_equal_strings(VCPKG_LINE_INFO, PE_SIGNATURE.c_str(), signature, PE_SIGNATURE_SIZE, "PE_SIGNATURE"); + verify_equal_strings(VCPKG_LINE_INFO, PE_SIGNATURE, {signature, PE_SIGNATURE_SIZE}, "PE_SIGNATURE"); fs.seekg(offset_to_pe_signature + PE_SIGNATURE_SIZE, ios_base::beg); } @@ -113,8 +115,7 @@ namespace vcpkg::CoffFileReader if (ret.data[0] != '\0') // Due to freeglut. github issue #223 { const std::string header_end = ret.data.substr(HEADER_END_OFFSET, HEADER_END_SIZE); - verify_equal_strings( - VCPKG_LINE_INFO, HEADER_END.c_str(), header_end.c_str(), HEADER_END_SIZE, "LIB HEADER_END"); + verify_equal_strings(VCPKG_LINE_INFO, HEADER_END, header_end, "LIB HEADER_END"); } return ret; @@ -229,7 +230,7 @@ namespace vcpkg::CoffFileReader char file_start[FILE_START_SIZE]; fs.read(file_start, FILE_START_SIZE); - verify_equal_strings(VCPKG_LINE_INFO, FILE_START.c_str(), file_start, FILE_START_SIZE, "LIB FILE_START"); + verify_equal_strings(VCPKG_LINE_INFO, FILE_START, {file_start, FILE_START_SIZE}, "LIB FILE_START"); } DllInfo read_dll(const fs::path& path) diff --git a/toolsrc/src/vcpkg/base/downloads.cpp b/toolsrc/src/vcpkg/base/downloads.cpp index 571562244..590c48ff5 100644 --- a/toolsrc/src/vcpkg/base/downloads.cpp +++ b/toolsrc/src/vcpkg/base/downloads.cpp @@ -2,6 +2,7 @@ #include <vcpkg/base/downloads.h> #include <vcpkg/base/hash.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> #if defined(_WIN32) @@ -14,9 +15,9 @@ namespace vcpkg::Downloads { #if defined(_WIN32) static void winhttp_download_file(Files::Filesystem& fs, - CStringView target_file_path, - CStringView hostname, - CStringView url_path) + ZStringView target_file_path, + StringView hostname, + StringView url_path) { // Make sure the directories are present, otherwise fopen_s fails const auto dir = fs::path(target_file_path.c_str()).parent_path(); @@ -163,7 +164,7 @@ namespace vcpkg::Downloads std::string hostname(url_no_proto.begin(), path_begin); std::string path(path_begin, url_no_proto.end()); - winhttp_download_file(fs, download_path_part.c_str(), hostname, path); + winhttp_download_file(fs, download_path_part, hostname, path); #else const auto code = System::cmd_execute( Strings::format(R"(curl -L '%s' --create-dirs --output '%s')", url, download_path_part)); diff --git a/toolsrc/src/vcpkg/base/files.cpp b/toolsrc/src/vcpkg/base/files.cpp index 34a6489a8..164394100 100644 --- a/toolsrc/src/vcpkg/base/files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -1,7 +1,10 @@ #include "pch.h" #include <vcpkg/base/files.h> +#include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> #if defined(__linux__) @@ -209,10 +212,11 @@ namespace vcpkg::Files if (this->exists(path)) { - System::println(System::Color::warning, - "Some files in %s were unable to be removed. Close any editors operating in this " - "directory and retry.", - path.string()); + System::print2( + System::Color::warning, + "Some files in ", + path.u8string(), + " were unable to be removed. Close any editors operating in this directory and retry.\n"); } return out; @@ -298,14 +302,14 @@ namespace vcpkg::Files if (Util::find(ret, p) == ret.end() && this->exists(p)) { ret.push_back(p); - Debug::println("Found path: %s", p.u8string()); + Debug::print("Found path: ", p.u8string(), '\n'); } } } return ret; #else - const std::string cmd = Strings::format("which %s", name); + const std::string cmd = Strings::concat("which ", name); auto out = System::cmd_execute_and_capture_output(cmd); if (out.exit_code != 0) { @@ -330,11 +334,12 @@ namespace vcpkg::Files void print_paths(const std::vector<fs::path>& paths) { - System::println(); + std::string message = "\n"; for (const fs::path& p : paths) { - System::println(" %s", p.generic_string()); + Strings::append(message, " ", p.generic_string(), '\n'); } - System::println(); + message.push_back('\n'); + System::print2(message); } } diff --git a/toolsrc/src/vcpkg/base/hash.cpp b/toolsrc/src/vcpkg/base/hash.cpp index 7a74371db..310b8c35e 100644 --- a/toolsrc/src/vcpkg/base/hash.cpp +++ b/toolsrc/src/vcpkg/base/hash.cpp @@ -2,11 +2,12 @@ #include <vcpkg/base/checks.h> #include <vcpkg/base/strings.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> #if defined(_WIN32) #include <bcrypt.h> +#pragma comment(lib, "bcrypt") #ifndef NT_SUCCESS #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) @@ -94,13 +95,13 @@ namespace vcpkg::Hash } public: - explicit BCryptHasher(const std::string& hash_type) + explicit BCryptHasher(std::string hash_type) { - NTSTATUS error_code = - BCryptOpenAlgorithmProvider(&this->algorithm_handle.handle, - Strings::to_utf16(Strings::ascii_to_uppercase(hash_type)).c_str(), - nullptr, - 0); + NTSTATUS error_code = BCryptOpenAlgorithmProvider( + &this->algorithm_handle.handle, + Strings::to_utf16(Strings::ascii_to_uppercase(std::move(hash_type))).c_str(), + nullptr, + 0); Checks::check_exit(VCPKG_LINE_INFO, NT_SUCCESS(error_code), "Failed to open the algorithm provider"); DWORD hash_buffer_bytes; diff --git a/toolsrc/src/vcpkg/base/lineinfo.cpp b/toolsrc/src/vcpkg/base/lineinfo.cpp deleted file mode 100644 index 7435ed666..000000000 --- a/toolsrc/src/vcpkg/base/lineinfo.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include "pch.h" - -#include <vcpkg/base/lineinfo.h> -#include <vcpkg/base/strings.h> - -namespace vcpkg -{ - std::string LineInfo::to_string() const { return Strings::format("%s(%d)", this->file_name, this->line_number); } -} diff --git a/toolsrc/src/vcpkg/base/stringrange.cpp b/toolsrc/src/vcpkg/base/stringrange.cpp deleted file mode 100644 index f7e431c88..000000000 --- a/toolsrc/src/vcpkg/base/stringrange.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "pch.h" - -#include <vcpkg/base/checks.h> -#include <vcpkg/base/stringrange.h> - -namespace vcpkg -{ - std::vector<StringRange> StringRange::find_all_enclosed(const StringRange& input, - const std::string& left_delim, - const std::string& right_delim) - { - std::string::const_iterator it_left = input.begin; - std::string::const_iterator it_right = input.begin; - - std::vector<StringRange> output; - - while (true) - { - it_left = std::search(it_right, input.end, left_delim.cbegin(), left_delim.cend()); - if (it_left == input.end) break; - - it_left += left_delim.length(); - - it_right = std::search(it_left, input.end, right_delim.cbegin(), right_delim.cend()); - if (it_right == input.end) break; - - output.emplace_back(it_left, it_right); - - ++it_right; - } - - return output; - } - - StringRange StringRange::find_exactly_one_enclosed(const StringRange& input, - const std::string& left_tag, - const std::string& right_tag) - { - std::vector<StringRange> result = find_all_enclosed(input, left_tag, right_tag); - Checks::check_exit(VCPKG_LINE_INFO, - result.size() == 1, - "Found %d sets of %s.*%s but expected exactly 1, in block:\n%s", - result.size(), - left_tag, - right_tag, - input); - return result.front(); - } - - Optional<StringRange> StringRange::find_at_most_one_enclosed(const StringRange& input, - const std::string& left_tag, - const std::string& right_tag) - { - std::vector<StringRange> result = find_all_enclosed(input, left_tag, right_tag); - Checks::check_exit(VCPKG_LINE_INFO, - result.size() <= 1, - "Found %d sets of %s.*%s but expected at most 1, in block:\n%s", - result.size(), - left_tag, - right_tag, - input); - - if (result.empty()) - { - return nullopt; - } - - return result.front(); - } - - StringRange::StringRange(const std::string& s) : begin(s.cbegin()), end(s.cend()) {} - - StringRange::StringRange(const std::string::const_iterator begin, const std::string::const_iterator end) - : begin(begin), end(end) - { - } - - std::string StringRange::to_string() const { return std::string(this->begin, this->end); } -} diff --git a/toolsrc/src/vcpkg/base/strings.cpp b/toolsrc/src/vcpkg/base/strings.cpp index 8d43e7af7..ce634a227 100644 --- a/toolsrc/src/vcpkg/base/strings.cpp +++ b/toolsrc/src/vcpkg/base/strings.cpp @@ -10,8 +10,10 @@ namespace vcpkg::Strings::details static bool is_space(const char c) { return std::isspace(c) != 0; } // Avoids C4244 warnings because of char<->int conversion that occur when using std::tolower() - static char tolower_char(const char c) { return static_cast<char>(std::tolower(c)); } - static char toupper_char(const char c) { return static_cast<char>(std::toupper(c)); } + static char tolower_char(const char c) { return (c < 'A' || c > 'Z') ? c : c - 'A' + 'a'; } + static char toupper_char(const char c) { return (c < 'a' || c > 'z') ? c : c - 'a' + 'A'; } + + static bool icase_eq(char a, char b) { return tolower_char(a) == tolower_char(b); } #if defined(_WIN32) static _locale_t& c_locale() @@ -47,146 +49,242 @@ namespace vcpkg::Strings::details } } -namespace vcpkg::Strings -{ +using namespace vcpkg; + #if defined(_WIN32) - std::wstring to_utf16(const CStringView& s) - { - std::wstring output; - const size_t size = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, nullptr, 0); - if (size == 0) return output; - output.resize(size - 1); - MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, output.data(), static_cast<int>(size) - 1); - return output; - } +std::wstring Strings::to_utf16(StringView s) +{ + std::wstring output; + if (s.size() == 0) return output; + Checks::check_exit(VCPKG_LINE_INFO, s.size() < size_t(INT_MAX)); + int size = MultiByteToWideChar(CP_UTF8, 0, s.data(), static_cast<int>(s.size()), nullptr, 0); + output.resize(static_cast<size_t>(size)); + MultiByteToWideChar(CP_UTF8, 0, s.data(), static_cast<int>(s.size()), output.data(), size); + return output; +} #endif #if defined(_WIN32) - std::string to_utf8(const wchar_t* w) - { - std::string output; - const size_t size = WideCharToMultiByte(CP_UTF8, 0, w, -1, nullptr, 0, nullptr, nullptr); - if (size == 0) return output; - output.resize(size - 1); - WideCharToMultiByte(CP_UTF8, 0, w, -1, output.data(), static_cast<int>(size) - 1, nullptr, nullptr); - return output; - } +std::string Strings::to_utf8(const wchar_t* w) +{ + std::string output; + const size_t size = WideCharToMultiByte(CP_UTF8, 0, w, -1, nullptr, 0, nullptr, nullptr); + if (size == 0) return output; + output.resize(size - 1); + WideCharToMultiByte(CP_UTF8, 0, w, -1, output.data(), static_cast<int>(size) - 1, nullptr, nullptr); + return output; +} #endif - std::string escape_string(const CStringView& s, char char_to_escape, char escape_char) +std::string Strings::escape_string(std::string&& s, char char_to_escape, char escape_char) +{ + // Replace '\' with '\\' or '`' with '``' + auto ret = Strings::replace_all(std::move(s), {&escape_char, 1}, std::string{escape_char, escape_char}); + // Replace '"' with '\"' or '`"' + ret = Strings::replace_all(std::move(ret), {&char_to_escape, 1}, std::string{escape_char, char_to_escape}); + return ret; +} + +static const char* case_insensitive_ascii_find(StringView s, StringView pattern) +{ + return std::search(s.begin(), s.end(), pattern.begin(), pattern.end(), &Strings::details::icase_eq); +} + +bool Strings::case_insensitive_ascii_contains(StringView s, StringView pattern) +{ + return case_insensitive_ascii_find(s, pattern) != s.end(); +} + +bool Strings::case_insensitive_ascii_equals(StringView left, StringView right) +{ + return std::equal(left.begin(), left.end(), right.begin(), right.end(), &details::icase_eq); +} + +std::string Strings::ascii_to_lowercase(std::string&& s) +{ + std::transform(s.begin(), s.end(), s.begin(), &details::tolower_char); + return std::move(s); +} + +std::string Strings::ascii_to_uppercase(std::string&& s) +{ + std::transform(s.begin(), s.end(), s.begin(), &details::toupper_char); + return std::move(s); +} + +bool Strings::case_insensitive_ascii_starts_with(StringView s, StringView pattern) +{ + if (s.size() < pattern.size()) return false; + return std::equal(s.begin(), s.begin() + pattern.size(), pattern.begin(), pattern.end(), &details::icase_eq); +} + +bool Strings::ends_with(StringView s, StringView pattern) +{ + if (s.size() < pattern.size()) return false; + return std::equal(s.end() - pattern.size(), s.end(), pattern.begin(), pattern.end()); +} +bool Strings::starts_with(StringView s, StringView pattern) +{ + if (s.size() < pattern.size()) return false; + return std::equal(s.begin(), s.begin() + pattern.size(), pattern.begin(), pattern.end()); +} + +std::string Strings::replace_all(std::string&& s, const std::string& search, StringView rep) +{ + size_t pos = 0; + while ((pos = s.find(search, pos)) != std::string::npos) { - std::string ret = s.c_str(); - // Replace '\' with '\\' or '`' with '``' - ret = Strings::replace_all(std::move(ret), {escape_char}, {escape_char, escape_char}); - // Replace '"' with '\"' or '`"' - ret = Strings::replace_all(std::move(ret), {char_to_escape}, {escape_char, char_to_escape}); - return ret; + s.replace(pos, search.size(), rep.data(), rep.size()); + pos += rep.size(); } + return std::move(s); +} - std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern) +std::string Strings::trim(std::string&& s) +{ + s.erase(std::find_if_not(s.rbegin(), s.rend(), details::is_space).base(), s.end()); + s.erase(s.begin(), std::find_if_not(s.begin(), s.end(), details::is_space)); + return std::move(s); +} + +void Strings::trim_all_and_remove_whitespace_strings(std::vector<std::string>* strings) +{ + for (std::string& s : *strings) { - const std::string pattern_as_lower_case(ascii_to_lowercase(pattern)); - return search(s.begin(), - s.end(), - pattern_as_lower_case.begin(), - pattern_as_lower_case.end(), - [](const char a, const char b) { return details::tolower_char(a) == b; }); + s = trim(std::move(s)); } - bool case_insensitive_ascii_contains(const std::string& s, const std::string& pattern) + Util::erase_remove_if(*strings, [](const std::string& s) { return s.empty(); }); +} + +std::vector<std::string> Strings::split(const std::string& s, const std::string& delimiter) +{ + std::vector<std::string> output; + + if (delimiter.empty()) { - return case_insensitive_ascii_find(s, pattern) != s.end(); + output.push_back(s); + return output; } - bool case_insensitive_ascii_equals(const CStringView left, const CStringView right) + const size_t delimiter_length = delimiter.length(); + size_t i = 0; + for (size_t pos = s.find(delimiter); pos != std::string::npos; pos = s.find(delimiter, pos)) { -#if defined(_WIN32) - return _stricmp(left.c_str(), right.c_str()) == 0; -#else - return strcasecmp(left.c_str(), right.c_str()) == 0; -#endif + output.push_back(s.substr(i, pos - i)); + pos += delimiter_length; + i = pos; } - std::string ascii_to_lowercase(std::string s) + // Add the rest of the string after the last delimiter, unless there is nothing after it + if (i != s.length()) { - std::transform(s.begin(), s.end(), s.begin(), &details::tolower_char); - return s; + output.push_back(s.substr(i, s.length())); } - std::string ascii_to_uppercase(std::string s) + return output; +} + +std::vector<std::string> Strings::split(const std::string& s, const std::string& delimiter, int max_count) +{ + std::vector<std::string> output; + + Checks::check_exit(VCPKG_LINE_INFO, max_count >= 1); + + if (delimiter.empty()) { - std::transform(s.begin(), s.end(), s.begin(), &details::toupper_char); - return s; + output.push_back(s); + return output; } - bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern) + const size_t delimiter_length = delimiter.length(); + size_t i = 0; + for (size_t pos = s.find(delimiter); pos != std::string::npos; pos = s.find(delimiter, pos)) { -#if defined(_WIN32) - return _strnicmp(s.c_str(), pattern.c_str(), pattern.size()) == 0; -#else - return strncasecmp(s.c_str(), pattern.c_str(), pattern.size()) == 0; -#endif + if (output.size() == max_count - 1) break; + output.push_back(s.substr(i, pos - i)); + pos += delimiter_length; + i = pos; } - bool ends_with(const std::string& s, StringLiteral pattern) + // Add the rest of the string after the last delimiter, unless there is nothing after it + if (i != s.length()) { - if (s.size() < pattern.size()) return false; - return std::equal(s.end() - pattern.size(), s.end(), pattern.c_str(), pattern.c_str() + pattern.size()); + output.push_back(s.substr(i, s.length())); } - std::string replace_all(std::string&& s, const std::string& search, const std::string& rep) + return output; +} + +std::vector<StringView> Strings::find_all_enclosed(StringView input, StringView left_delim, StringView right_delim) +{ + auto it_left = input.begin(); + auto it_right = input.begin(); + + std::vector<StringView> output; + + while (true) { - size_t pos = 0; - while ((pos = s.find(search, pos)) != std::string::npos) - { - s.replace(pos, search.size(), rep); - pos += rep.size(); - } - return std::move(s); + it_left = std::search(it_right, input.end(), left_delim.begin(), left_delim.end()); + if (it_left == input.end()) break; + + it_left += left_delim.size(); + + it_right = std::search(it_left, input.end(), right_delim.begin(), right_delim.end()); + if (it_right == input.end()) break; + + output.emplace_back(it_left, it_right); + + ++it_right; } - std::string trim(std::string&& s) + return output; +} + +StringView Strings::find_exactly_one_enclosed(StringView input, StringView left_tag, StringView right_tag) +{ + std::vector<StringView> result = find_all_enclosed(input, left_tag, right_tag); + Checks::check_exit(VCPKG_LINE_INFO, + result.size() == 1, + "Found %d sets of %s.*%s but expected exactly 1, in block:\n%s", + result.size(), + left_tag, + right_tag, + input); + return result.front(); +} + +Optional<StringView> Strings::find_at_most_one_enclosed(StringView input, StringView left_tag, StringView right_tag) +{ + std::vector<StringView> result = find_all_enclosed(input, left_tag, right_tag); + Checks::check_exit(VCPKG_LINE_INFO, + result.size() <= 1, + "Found %d sets of %s.*%s but expected at most 1, in block:\n%s", + result.size(), + left_tag, + right_tag, + input); + + if (result.empty()) { - s.erase(std::find_if_not(s.rbegin(), s.rend(), details::is_space).base(), s.end()); - s.erase(s.begin(), std::find_if_not(s.begin(), s.end(), details::is_space)); - return std::move(s); + return nullopt; } - void trim_all_and_remove_whitespace_strings(std::vector<std::string>* strings) - { - for (std::string& s : *strings) - { - s = trim(std::move(s)); - } + return result.front(); +} - Util::erase_remove_if(*strings, [](const std::string& s) { return s.empty(); }); - } +bool Strings::equals(StringView a, StringView b) +{ + if (a.size() != b.size()) return false; + return std::equal(a.begin(), a.end(), b.begin(), b.end()); +} - std::vector<std::string> split(const std::string& s, const std::string& delimiter) - { - std::vector<std::string> output; - - if (delimiter.empty()) - { - output.push_back(s); - return output; - } - - const size_t delimiter_length = delimiter.length(); - size_t i = 0; - for (size_t pos = s.find(delimiter); pos != std::string::npos; pos = s.find(delimiter, pos)) - { - output.push_back(s.substr(i, pos - i)); - pos += delimiter_length; - i = pos; - } - - // Add the rest of the string after the last delimiter, unless there is nothing after it - if (i != s.length()) - { - output.push_back(s.substr(i, s.length())); - } +const char* Strings::search(StringView haystack, StringView needle) +{ + return std::search(haystack.begin(), haystack.end(), needle.begin(), needle.end()); +} - return output; - } +bool Strings::contains(StringView haystack, StringView needle) +{ + return Strings::search(haystack, needle) != haystack.end(); } diff --git a/toolsrc/src/vcpkg/base/stringview.cpp b/toolsrc/src/vcpkg/base/stringview.cpp new file mode 100644 index 000000000..d0b2cd43a --- /dev/null +++ b/toolsrc/src/vcpkg/base/stringview.cpp @@ -0,0 +1,83 @@ +#include "pch.h" + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/lineinfo.h> +#include <vcpkg/base/stringview.h> + +#include <cstring> + +namespace vcpkg +{ + std::vector<StringView> StringView::find_all_enclosed(const StringView& input, + const std::string& left_delim, + const std::string& right_delim) + { + auto it_left = input.begin(); + auto it_right = input.begin(); + + std::vector<StringView> output; + + while (true) + { + it_left = std::search(it_right, input.end(), left_delim.cbegin(), left_delim.cend()); + if (it_left == input.end()) break; + + it_left += left_delim.length(); + + it_right = std::search(it_left, input.end(), right_delim.cbegin(), right_delim.cend()); + if (it_right == input.end()) break; + + output.emplace_back(it_left, it_right); + + ++it_right; + } + + return output; + } + + StringView StringView::find_exactly_one_enclosed(const StringView& input, + const std::string& left_tag, + const std::string& right_tag) + { + std::vector<StringView> result = find_all_enclosed(input, left_tag, right_tag); + Checks::check_exit(VCPKG_LINE_INFO, + result.size() == 1, + "Found %d sets of %s.*%s but expected exactly 1, in block:\n%s", + result.size(), + left_tag, + right_tag, + input); + return result.front(); + } + + Optional<StringView> StringView::find_at_most_one_enclosed(const StringView& input, + const std::string& left_tag, + const std::string& right_tag) + { + std::vector<StringView> result = find_all_enclosed(input, left_tag, right_tag); + Checks::check_exit(VCPKG_LINE_INFO, + result.size() <= 1, + "Found %d sets of %s.*%s but expected at most 1, in block:\n%s", + result.size(), + left_tag, + right_tag, + input); + + if (result.empty()) + { + return nullopt; + } + + return result.front(); + } + + StringView::StringView(const std::string& s) : m_ptr(s.data()), m_size(s.size()) {} + + std::string StringView::to_string() const { return std::string(m_ptr, m_size); } + void StringView::to_string(std::string& s) const { s.append(m_ptr, m_size); } + + bool StringView::operator==(StringView other) const + { + return other.size() == size() && memcmp(data(), other.data(), size()) == 0; + } +} diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp index 6ddf17496..ffbac3158 100644 --- a/toolsrc/src/vcpkg/base/system.cpp +++ b/toolsrc/src/vcpkg/base/system.cpp @@ -1,9 +1,10 @@ #include "pch.h" #include <vcpkg/base/checks.h> +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/system.debug.h> #include <vcpkg/base/system.h> -#include <vcpkg/globalstate.h> -#include <vcpkg/metrics.h> +#include <vcpkg/base/system.process.h> #include <ctime> @@ -17,9 +18,73 @@ #pragma comment(lib, "Advapi32") -namespace vcpkg::System +using namespace vcpkg::System; + +namespace vcpkg { - fs::path get_exe_path_of_current_process() +#if defined(_WIN32) + namespace + { + struct CtrlCStateMachine + { + CtrlCStateMachine() : m_state(CtrlCState::normal) {} + + void transition_to_spawn_process() noexcept + { + auto expected = CtrlCState::normal; + auto transitioned = m_state.compare_exchange_strong(expected, CtrlCState::blocked_on_child); + if (!transitioned) + { + // Ctrl-C was hit and is asynchronously executing on another thread + Checks::exit_fail(VCPKG_LINE_INFO); + } + } + void transition_from_spawn_process() noexcept + { + auto expected = CtrlCState::blocked_on_child; + auto transitioned = m_state.compare_exchange_strong(expected, CtrlCState::normal); + if (!transitioned) + { + // Ctrl-C was hit while blocked on the child process, so exit immediately + Checks::exit_fail(VCPKG_LINE_INFO); + } + } + void transition_handle_ctrl_c() noexcept + { + auto prev_state = m_state.exchange(CtrlCState::exit_requested); + + if (prev_state == CtrlCState::normal) + { + // Not currently blocked on a child process and Ctrl-C has not been hit. + Checks::exit_fail(VCPKG_LINE_INFO); + } + else if (prev_state == CtrlCState::exit_requested) + { + // Ctrl-C was hit previously? + } + else + { + // We are currently blocked on a child process. Upon return, transition_from_spawn_process() will be + // called and exit. + } + } + + private: + enum class CtrlCState + { + normal, + blocked_on_child, + exit_requested, + }; + + std::atomic<CtrlCState> m_state; + }; + + static CtrlCStateMachine g_ctrl_c_state; + } +#endif + + fs::path System::get_exe_path_of_current_process() { #if defined(_WIN32) wchar_t buf[_MAX_PATH]; @@ -51,7 +116,7 @@ namespace vcpkg::System #endif } - Optional<CPUArchitecture> to_cpu_architecture(const CStringView& arch) + Optional<CPUArchitecture> System::to_cpu_architecture(StringView arch) { if (Strings::case_insensitive_ascii_equals(arch, "x86")) return CPUArchitecture::X86; if (Strings::case_insensitive_ascii_equals(arch, "x64")) return CPUArchitecture::X64; @@ -61,7 +126,7 @@ namespace vcpkg::System return nullopt; } - CPUArchitecture get_host_processor() + CPUArchitecture System::get_host_processor() { #if defined(_WIN32) auto w6432 = get_environment_variable("PROCESSOR_ARCHITEW6432"); @@ -84,7 +149,7 @@ namespace vcpkg::System #endif } - std::vector<CPUArchitecture> get_supported_host_architectures() + std::vector<CPUArchitecture> System::get_supported_host_architectures() { std::vector<CPUArchitecture> supported_architectures; supported_architectures.push_back(get_host_processor()); @@ -98,20 +163,20 @@ namespace vcpkg::System return supported_architectures; } - CMakeVariable::CMakeVariable(const CStringView varname, const char* varvalue) + System::CMakeVariable::CMakeVariable(const StringView varname, const char* varvalue) : s(Strings::format(R"("-D%s=%s")", varname, varvalue)) { } - CMakeVariable::CMakeVariable(const CStringView varname, const std::string& varvalue) + System::CMakeVariable::CMakeVariable(const StringView varname, const std::string& varvalue) : CMakeVariable(varname, varvalue.c_str()) { } - CMakeVariable::CMakeVariable(const CStringView varname, const fs::path& path) + System::CMakeVariable::CMakeVariable(const StringView varname, const fs::path& path) : CMakeVariable(varname, path.generic_u8string()) { } - std::string make_cmake_cmd(const fs::path& cmake_exe, + std::string System::make_cmake_cmd(const fs::path& cmake_exe, const fs::path& cmake_script, const std::vector<CMakeVariable>& pass_variables) { @@ -187,7 +252,7 @@ namespace vcpkg::System for (auto&& var : vars) { - env_wstrings.push_back(Strings::to_utf16(var.c_str())); + env_wstrings.push_back(Strings::to_utf16(var)); } } @@ -228,13 +293,11 @@ namespace vcpkg::System #if defined(_WIN32) /// <param name="maybe_environment">If non-null, an environment block to use for the new process. If null, the new /// process will inherit the current environment.</param> - static void windows_create_process(const CStringView cmd_line, - const wchar_t* maybe_environment, - DWORD dwCreationFlags, - PROCESS_INFORMATION* process_info) noexcept + static void windows_create_process(const StringView cmd_line, + const wchar_t* environment_block, + PROCESS_INFORMATION& process_info, + DWORD dwCreationFlags) noexcept { - Checks::check_exit(VCPKG_LINE_INFO, process_info != nullptr); - STARTUPINFOW startup_info; memset(&startup_info, 0, sizeof(STARTUPINFOW)); startup_info.cb = sizeof(STARTUPINFOW); @@ -244,41 +307,40 @@ namespace vcpkg::System // Wrapping the command in a single set of quotes causes cmd.exe to correctly execute const std::string actual_cmd_line = Strings::format(R"###(cmd.exe /c "%s")###", cmd_line); - Debug::println("CreateProcessW(%s)", actual_cmd_line); + Debug::print("CreateProcessW(", actual_cmd_line, ")\n"); bool succeeded = TRUE == CreateProcessW(nullptr, Strings::to_utf16(actual_cmd_line).data(), nullptr, nullptr, FALSE, IDLE_PRIORITY_CLASS | CREATE_UNICODE_ENVIRONMENT | dwCreationFlags, - (void*)maybe_environment, + (void*)environment_block, nullptr, &startup_info, - process_info); + &process_info); Checks::check_exit(VCPKG_LINE_INFO, succeeded, "Process creation failed with error code: %lu", GetLastError()); } #endif #if defined(_WIN32) - void cmd_execute_no_wait(const CStringView cmd_line) noexcept + void System::cmd_execute_no_wait(StringView cmd_line) { auto timer = Chrono::ElapsedTimer::create_started(); PROCESS_INFORMATION process_info; memset(&process_info, 0, sizeof(PROCESS_INFORMATION)); - windows_create_process(cmd_line, nullptr, DETACHED_PROCESS, &process_info); + windows_create_process(cmd_line, nullptr, process_info, DETACHED_PROCESS); CloseHandle(process_info.hThread); CloseHandle(process_info.hProcess); - Debug::println("CreateProcessW() took %d us", static_cast<int>(timer.microseconds())); + Debug::print("CreateProcessW() took ", static_cast<int>(timer.microseconds()), " us\n"); } #endif - int cmd_execute_clean(const CStringView cmd_line, - const std::unordered_map<std::string, std::string>& extra_env) noexcept + int System::cmd_execute_clean(const ZStringView cmd_line, const std::unordered_map<std::string, std::string>& extra_env) { auto timer = Chrono::ElapsedTimer::create_started(); #if defined(_WIN32) @@ -286,14 +348,14 @@ namespace vcpkg::System PROCESS_INFORMATION process_info; memset(&process_info, 0, sizeof(PROCESS_INFORMATION)); - GlobalState::g_ctrl_c_state.transition_to_spawn_process(); + g_ctrl_c_state.transition_to_spawn_process(); auto clean_env = compute_clean_environment(extra_env); - windows_create_process(cmd_line, clean_env.c_str(), NULL, &process_info); + windows_create_process(cmd_line, clean_env.data(), process_info, NULL); CloseHandle(process_info.hThread); const DWORD result = WaitForSingleObject(process_info.hProcess, INFINITE); - GlobalState::g_ctrl_c_state.transition_from_spawn_process(); + g_ctrl_c_state.transition_from_spawn_process(); Checks::check_exit(VCPKG_LINE_INFO, result != WAIT_FAILED, "WaitForSingleObject failed"); DWORD exit_code = 0; @@ -301,56 +363,56 @@ namespace vcpkg::System CloseHandle(process_info.hProcess); - Debug::println("CreateProcessW() returned %lu after %d us", exit_code, static_cast<int>(timer.microseconds())); - + Debug::print( + "CreateProcessW() returned ", exit_code, " after ", static_cast<int>(timer.microseconds()), " us\n"); return static_cast<int>(exit_code); #else - Debug::println("system(%s)", cmd_line.c_str()); + Debug::print("system(", cmd_line, ")\n"); fflush(nullptr); int rc = system(cmd_line.c_str()); - Debug::println("system() returned %d after %d us", rc, static_cast<int>(timer.microseconds())); + Debug::print("system() returned ", rc, " after ", static_cast<int>(timer.microseconds()), " us\n"); return rc; #endif } - int cmd_execute(const CStringView cmd_line) noexcept + int System::cmd_execute(const ZStringView cmd_line) { // Flush stdout before launching external process fflush(nullptr); #if defined(_WIN32) // We are wrap the command line in quotes to cause cmd.exe to correctly process it - const std::string& actual_cmd_line = Strings::format(R"###("%s")###", cmd_line); - Debug::println("_wsystem(%s)", actual_cmd_line); - GlobalState::g_ctrl_c_state.transition_to_spawn_process(); + auto actual_cmd_line = Strings::concat('"', cmd_line, '"'); + Debug::print("_wsystem(", actual_cmd_line, ")\n"); + g_ctrl_c_state.transition_to_spawn_process(); const int exit_code = _wsystem(Strings::to_utf16(actual_cmd_line).c_str()); - GlobalState::g_ctrl_c_state.transition_from_spawn_process(); - Debug::println("_wsystem() returned %d", exit_code); + g_ctrl_c_state.transition_from_spawn_process(); + Debug::print("_wsystem() returned ", exit_code, '\n'); #else - Debug::println("_system(%s)", cmd_line); + Debug::print("_system(", cmd_line, ")\n"); const int exit_code = system(cmd_line.c_str()); - Debug::println("_system() returned %d", exit_code); + Debug::print("_system() returned ", exit_code, '\n'); #endif return exit_code; } - ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line) noexcept + ExitCodeAndOutput System::cmd_execute_and_capture_output(const ZStringView cmd_line) { auto timer = Chrono::ElapsedTimer::create_started(); #if defined(_WIN32) const auto actual_cmd_line = Strings::format(R"###("%s 2>&1")###", cmd_line); - Debug::println("_wpopen(%s)", actual_cmd_line); + Debug::print("_wpopen(", actual_cmd_line, ")\n"); std::wstring output; wchar_t buf[1024]; - GlobalState::g_ctrl_c_state.transition_to_spawn_process(); + g_ctrl_c_state.transition_to_spawn_process(); // Flush stdout before launching external process fflush(stdout); const auto pipe = _wpopen(Strings::to_utf16(actual_cmd_line).c_str(), L"r"); if (pipe == nullptr) { - GlobalState::g_ctrl_c_state.transition_from_spawn_process(); + g_ctrl_c_state.transition_from_spawn_process(); return {1, Strings::to_utf8(output.c_str())}; } while (fgetws(buf, 1024, pipe)) @@ -359,12 +421,12 @@ namespace vcpkg::System } if (!feof(pipe)) { - GlobalState::g_ctrl_c_state.transition_from_spawn_process(); + g_ctrl_c_state.transition_from_spawn_process(); return {1, Strings::to_utf8(output.c_str())}; } const auto ec = _pclose(pipe); - GlobalState::g_ctrl_c_state.transition_from_spawn_process(); + g_ctrl_c_state.transition_from_spawn_process(); // On Win7, output from powershell calls contain a utf-8 byte order mark in the utf-16 stream, so we strip it // out if it is present. 0xEF,0xBB,0xBF is the UTF-8 byte-order mark @@ -374,13 +436,16 @@ namespace vcpkg::System output.erase(0, 3); } - Debug::println("_pclose() returned %d after %8d us", ec, static_cast<int>(timer.microseconds())); - + Debug::print("_pclose() returned ", + ec, + " after ", + Strings::format("%8d", static_cast<int>(timer.microseconds())), + " us\n"); return {ec, Strings::to_utf8(output.c_str())}; #else const auto actual_cmd_line = Strings::format(R"###(%s 2>&1)###", cmd_line); - Debug::println("popen(%s)", actual_cmd_line); + Debug::print("popen(", actual_cmd_line, ")\n"); std::string output; char buf[1024]; // Flush stdout before launching external process @@ -401,46 +466,13 @@ namespace vcpkg::System const auto ec = pclose(pipe); - Debug::println("_pclose() returned %d after %8d us", ec, (int)timer.microseconds()); + Debug::print("_pclose() returned ", ec, " after ", Strings::format("%8d", (int)timer.microseconds()), " us\n"); return {ec, output}; #endif } - void println() { putchar('\n'); } - - void print(const CStringView message) { fputs(message.c_str(), stdout); } - - void println(const CStringView message) - { - print(message); - println(); - } - - void print(const Color c, const CStringView message) - { -#if defined(_WIN32) - const HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE); - - CONSOLE_SCREEN_BUFFER_INFO console_screen_buffer_info {}; - GetConsoleScreenBufferInfo(console_handle, &console_screen_buffer_info); - const auto original_color = console_screen_buffer_info.wAttributes; - - SetConsoleTextAttribute(console_handle, static_cast<WORD>(c) | (original_color & 0xF0)); - print(message); - SetConsoleTextAttribute(console_handle, original_color); -#else - print(message); -#endif - } - - void println(const Color c, const CStringView message) - { - print(c, message); - println(); - } - - Optional<std::string> get_environment_variable(const CStringView varname) noexcept + Optional<std::string> System::get_environment_variable(ZStringView varname) noexcept { #if defined(_WIN32) const auto w_varname = Strings::to_utf16(varname); @@ -467,37 +499,34 @@ namespace vcpkg::System return hkey_type == REG_SZ || hkey_type == REG_MULTI_SZ || hkey_type == REG_EXPAND_SZ; } - Optional<std::string> get_registry_string(void* base_hkey, const CStringView sub_key, const CStringView valuename) + Optional<std::string> System::get_registry_string(void* base_hkey, StringView sub_key, StringView valuename) { HKEY k = nullptr; const LSTATUS ec = RegOpenKeyExW(reinterpret_cast<HKEY>(base_hkey), Strings::to_utf16(sub_key).c_str(), NULL, KEY_READ, &k); if (ec != ERROR_SUCCESS) return nullopt; + auto w_valuename = Strings::to_utf16(valuename); + DWORD dw_buffer_size = 0; DWORD dw_type = 0; - auto rc = - RegQueryValueExW(k, Strings::to_utf16(valuename).c_str(), nullptr, &dw_type, nullptr, &dw_buffer_size); + auto rc = RegQueryValueExW(k, w_valuename.c_str(), nullptr, &dw_type, nullptr, &dw_buffer_size); if (rc != ERROR_SUCCESS || !is_string_keytype(dw_type) || dw_buffer_size == 0 || dw_buffer_size % sizeof(wchar_t) != 0) return nullopt; std::wstring ret; ret.resize(dw_buffer_size / sizeof(wchar_t)); - rc = RegQueryValueExW(k, - Strings::to_utf16(valuename).c_str(), - nullptr, - &dw_type, - reinterpret_cast<LPBYTE>(ret.data()), - &dw_buffer_size); + rc = RegQueryValueExW( + k, w_valuename.c_str(), nullptr, &dw_type, reinterpret_cast<LPBYTE>(ret.data()), &dw_buffer_size); if (rc != ERROR_SUCCESS || !is_string_keytype(dw_type) || dw_buffer_size != sizeof(wchar_t) * ret.size()) return nullopt; ret.pop_back(); // remove extra trailing null byte - return Strings::to_utf8(ret.c_str()); + return Strings::to_utf8(ret); } #else - Optional<std::string> get_registry_string(void* base_hkey, const CStringView sub_key, const CStringView valuename) + Optional<std::string> System::get_registry_string(void* base_hkey, StringView sub_key, StringView valuename) { return nullopt; } @@ -518,7 +547,7 @@ namespace vcpkg::System return PATH; } - const Optional<fs::path>& get_program_files_32_bit() + const Optional<fs::path>& System::get_program_files_32_bit() { static const auto PATH = []() -> Optional<fs::path> { auto value = System::get_environment_variable("ProgramFiles(x86)"); @@ -531,7 +560,7 @@ namespace vcpkg::System return PATH; } - const Optional<fs::path>& get_program_files_platform_bitness() + const Optional<fs::path>& System::get_program_files_platform_bitness() { static const auto PATH = []() -> Optional<fs::path> { auto value = System::get_environment_variable("ProgramW6432"); @@ -543,23 +572,27 @@ namespace vcpkg::System }(); return PATH; } -} -namespace vcpkg::Debug -{ - void println(const CStringView message) +#if defined(_WIN32) + static BOOL ctrl_handler(DWORD fdw_ctrl_type) { - if (GlobalState::debugging) + switch (fdw_ctrl_type) { - System::println("[DEBUG] %s", message); + case CTRL_C_EVENT: g_ctrl_c_state.transition_handle_ctrl_c(); return TRUE; + default: return FALSE; } } - void println(const System::Color c, const CStringView message) + void System::register_console_ctrl_handler() { - if (GlobalState::debugging) - { - System::println(c, "[DEBUG] %s", message); - } + SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE); } +#else + void System::register_console_ctrl_handler() {} +#endif +} + +namespace vcpkg::Debug +{ + std::atomic<bool> g_debugging(false); } diff --git a/toolsrc/src/vcpkg/base/system.print.cpp b/toolsrc/src/vcpkg/base/system.print.cpp new file mode 100644 index 000000000..c7c9981a7 --- /dev/null +++ b/toolsrc/src/vcpkg/base/system.print.cpp @@ -0,0 +1,28 @@ +#include "pch.h" + +#include <vcpkg/base/system.print.h> + +namespace vcpkg::System +{ + namespace details + { + void print(StringView message) { fwrite(message.data(), 1, message.size(), stdout); } + + void print(const Color c, StringView message) + { +#if defined(_WIN32) + const HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE); + + CONSOLE_SCREEN_BUFFER_INFO console_screen_buffer_info{}; + GetConsoleScreenBufferInfo(console_handle, &console_screen_buffer_info); + const auto original_color = console_screen_buffer_info.wAttributes; + + SetConsoleTextAttribute(console_handle, static_cast<WORD>(c) | (original_color & 0xF0)); + System::print2(message); + SetConsoleTextAttribute(console_handle, original_color); +#else + System::print2(message); +#endif + } + } +} diff --git a/toolsrc/src/vcpkg/binaryparagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp index 73ca23df1..4b80debab 100644 --- a/toolsrc/src/vcpkg/binaryparagraph.cpp +++ b/toolsrc/src/vcpkg/binaryparagraph.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include <vcpkg/base/checks.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/binaryparagraph.h> #include <vcpkg/parse.h> @@ -37,7 +38,7 @@ namespace vcpkg parser.required_field(Fields::PACKAGE, name); std::string architecture; parser.required_field(Fields::ARCHITECTURE, architecture); - this->spec = PackageSpec::from_name_and_triplet(name, Triplet::from_canonical_name(architecture)) + this->spec = PackageSpec::from_name_and_triplet(name, Triplet::from_canonical_name(std::move(architecture))) .value_or_exit(VCPKG_LINE_INFO); } @@ -61,8 +62,7 @@ namespace vcpkg if (const auto err = parser.error_info(this->spec.to_string())) { - System::println( - System::Color::error, "Error: while parsing the Binary Paragraph for %s", this->spec.to_string()); + System::print2(System::Color::error, "Error: while parsing the Binary Paragraph for ", this->spec, '\n'); print_error_message(err); Checks::exit_fail(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index f20367e00..43f1a6288 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -6,7 +6,8 @@ #include <vcpkg/base/hash.h>
#include <vcpkg/base/optional.h>
#include <vcpkg/base/stringliteral.h>
-#include <vcpkg/base/system.h>
+#include <vcpkg/base/system.print.h>
+#include <vcpkg/base/system.process.h>
#include <vcpkg/build.h>
#include <vcpkg/commands.h>
@@ -81,19 +82,18 @@ namespace vcpkg::Build::Command const auto build_timer = Chrono::ElapsedTimer::create_started();
const auto result = Build::build_package(paths, build_config, status_db);
- System::println("Elapsed time for package %s: %s", spec.to_string(), build_timer.to_string());
+ System::print2("Elapsed time for package ", spec, ": ", build_timer, '\n');
if (result.code == BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES)
{
- System::println(System::Color::error,
- "The build command requires all dependencies to be already installed.");
- System::println("The following dependencies are missing:");
- System::println();
+ System::print2(System::Color::error,
+ "The build command requires all dependencies to be already installed.\n");
+ System::print2("The following dependencies are missing:\n\n");
for (const auto& p : result.unmet_dependencies)
{
- System::println(" %s", p);
+ System::print2(" ", p, '\n');
}
- System::println();
+ System::print2('\n');
Checks::exit_fail(VCPKG_LINE_INFO);
}
@@ -101,8 +101,8 @@ namespace vcpkg::Build::Command if (result.code != BuildResult::SUCCEEDED)
{
- System::println(System::Color::error, Build::create_error_message(result.code, spec));
- System::println(Build::create_user_troubleshooting_message(spec));
+ System::print2(System::Color::error, Build::create_error_message(result.code, spec), '\n');
+ System::print2(Build::create_user_troubleshooting_message(spec), '\n');
Checks::exit_fail(VCPKG_LINE_INFO);
}
@@ -125,9 +125,9 @@ namespace vcpkg::Build::Command {
// Build only takes a single package and all dependencies must already be installed
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
- const std::string command_argument = args.command_arguments.at(0);
- const FullPackageSpec spec =
- Input::check_and_get_full_package_spec(command_argument, default_triplet, COMMAND_STRUCTURE.example_text);
+ std::string first_arg = args.command_arguments.at(0);
+ const FullPackageSpec spec = Input::check_and_get_full_package_spec(
+ std::move(first_arg), default_triplet, COMMAND_STRUCTURE.example_text);
Input::check_triplet(spec.package_spec.triplet(), paths);
if (!spec.features.empty() && !GlobalState::feature_packages)
{
@@ -506,7 +506,7 @@ namespace vcpkg::Build std::string key = Strings::format("file_%03d", counter++);
if (GlobalState::debugging)
{
- System::println("[DEBUG] mapping %s from %s", key, port_file.string());
+ System::print2("[DEBUG] mapping ", key, " from ", port_file.u8string(), "\n");
}
abi_tag_entries.emplace_back(AbiEntry{ key, vcpkg::Hash::get_file_hash(fs, port_file, "SHA1") });
}
@@ -531,12 +531,12 @@ namespace vcpkg::Build if (GlobalState::debugging)
{
- System::println("[DEBUG] <abientries>");
+ System::print2("[DEBUG] <abientries>\n");
for (auto&& entry : abi_tag_entries)
{
- System::println("[DEBUG] %s|%s", entry.key, entry.value);
+ System::print2("[DEBUG] ", entry.key, "|", entry.value, "\n");
}
- System::println("[DEBUG] </abientries>");
+ System::print2("[DEBUG] </abientries>\n");
}
auto abi_tag_entries_missing = abi_tag_entries;
@@ -552,9 +552,10 @@ namespace vcpkg::Build return AbiTagAndFile{Hash::get_file_hash(fs, abi_file_path, "SHA1"), abi_file_path};
}
- System::println(
- "Warning: binary caching disabled because abi keys are missing values:\n%s",
- Strings::join("", abi_tag_entries_missing, [](const AbiEntry& e) { return " " + e.key + "\n"; }));
+ System::print2(
+ "Warning: binary caching disabled because abi keys are missing values:\n",
+ Strings::join("", abi_tag_entries_missing, [](const AbiEntry& e) { return " " + e.key + "\n"; }),
+ "\n");
return nullopt;
}
@@ -594,10 +595,8 @@ namespace vcpkg::Build #if defined(_WIN32)
auto&& seven_zip_exe = paths.get_tool_exe(Tools::SEVEN_ZIP);
- System::cmd_execute_clean(Strings::format(R"("%s" a "%s" "%s\*" >nul)",
- seven_zip_exe.u8string(),
- destination.u8string(),
- source.u8string()));
+ System::cmd_execute_clean(Strings::format(
+ R"("%s" a "%s" "%s\*" >nul)", seven_zip_exe.u8string(), destination.u8string(), source.u8string()));
#else
System::cmd_execute_clean(Strings::format(
R"(cd '%s' && zip --quiet -r '%s' *)", source.u8string(), destination.u8string()));
@@ -664,7 +663,7 @@ namespace vcpkg::Build if (fs.exists(archive_path))
{
- System::println("Using cached binary package: %s", archive_path.u8string());
+ System::print2("Using cached binary package: ", archive_path.u8string(), "\n");
decompress_archive(paths, spec, archive_path);
@@ -678,17 +677,17 @@ namespace vcpkg::Build {
if (config.build_package_options.fail_on_tombstone == FailOnTombstone::YES)
{
- System::println("Found failure tombstone: %s", archive_tombstone_path.u8string());
+ System::print2("Found failure tombstone: ", archive_tombstone_path.u8string(), "\n");
return BuildResult::BUILD_FAILED;
}
else
{
- System::println(
- System::Color::warning, "Found failure tombstone: %s", archive_tombstone_path.u8string());
+ System::print2(
+ System::Color::warning, "Found failure tombstone: ", archive_tombstone_path.u8string(), "\n");
}
}
- System::println("Could not locate cached archive: %s", archive_path.u8string());
+ System::print2("Could not locate cached archive: ", archive_path.u8string(), "\n");
ExtendedBuildResult result = do_build_package_and_clean_buildtrees(
paths, pre_build_info, spec, maybe_abi_tag_and_file.value_or(AbiTagAndFile{}).tag, config);
@@ -709,13 +708,13 @@ namespace vcpkg::Build fs.rename_or_copy(tmp_archive_path, archive_path, ".tmp", ec);
if (ec)
{
- System::println(System::Color::warning,
- "Failed to store binary cache %s: %s",
- archive_path.u8string(),
- ec.message());
+ System::printf(System::Color::warning,
+ "Failed to store binary cache %s: %s\n",
+ archive_path.u8string(),
+ ec.message());
}
else
- System::println("Stored binary cache: %s", archive_path.u8string());
+ System::printf("Stored binary cache: %s\n", archive_path.u8string());
}
else if (result.code == BuildResult::BUILD_FAILED || result.code == BuildResult::POST_BUILD_CHECKS_FAILED)
{
@@ -731,7 +730,10 @@ namespace vcpkg::Build {
if (log_file.path().extension() == ".log")
{
- fs.copy_file(log_file.path(), tmp_log_path_destination / log_file.path().filename(), fs::stdfs::copy_options::none, ec);
+ fs.copy_file(log_file.path(),
+ tmp_log_path_destination / log_file.path().filename(),
+ fs::stdfs::copy_options::none,
+ ec);
}
}
diff --git a/toolsrc/src/vcpkg/commands.autocomplete.cpp b/toolsrc/src/vcpkg/commands.autocomplete.cpp index 3b353feec..afef518eb 100644 --- a/toolsrc/src/vcpkg/commands.autocomplete.cpp +++ b/toolsrc/src/vcpkg/commands.autocomplete.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/install.h> #include <vcpkg/metrics.h> @@ -14,7 +14,7 @@ namespace vcpkg::Commands::Autocomplete std::vector<std::string>&& results) { const SortedVector<std::string> sorted_results(results); - System::println(Strings::join("\n", sorted_results)); + System::print2(Strings::join("\n", sorted_results), '\n'); Checks::exit_success(line_info); } @@ -137,7 +137,7 @@ namespace vcpkg::Commands::Autocomplete if (is_option) { results = Util::fmap(command.structure.options.switches, - [](const CommandSwitch& s) -> std::string { return s.name; }); + [](const CommandSwitch& s) -> std::string { return s.name.to_string(); }); auto settings = Util::fmap(command.structure.options.settings, [](auto&& s) { return s.name; }); results.insert(results.end(), settings.begin(), settings.end()); diff --git a/toolsrc/src/vcpkg/commands.buildexternal.cpp b/toolsrc/src/vcpkg/commands.buildexternal.cpp index 82d03db48..19b89c2f5 100644 --- a/toolsrc/src/vcpkg/commands.buildexternal.cpp +++ b/toolsrc/src/vcpkg/commands.buildexternal.cpp @@ -20,7 +20,7 @@ namespace vcpkg::Commands::BuildExternal const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); const FullPackageSpec spec = Input::check_and_get_full_package_spec( - args.command_arguments.at(0), default_triplet, COMMAND_STRUCTURE.example_text); + std::string(args.command_arguments.at(0)), default_triplet, COMMAND_STRUCTURE.example_text); Input::check_triplet(spec.package_spec.triplet(), paths); const fs::path port_dir = args.command_arguments.at(1); diff --git a/toolsrc/src/vcpkg/commands.cache.cpp b/toolsrc/src/vcpkg/commands.cache.cpp index 464f4f9ee..c321de3b5 100644 --- a/toolsrc/src/vcpkg/commands.cache.cpp +++ b/toolsrc/src/vcpkg/commands.cache.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include <vcpkg/base/files.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/binaryparagraph.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> @@ -43,7 +43,7 @@ namespace vcpkg::Commands::Cache const std::vector<BinaryParagraph> binary_paragraphs = read_all_binary_paragraphs(paths); if (binary_paragraphs.empty()) { - System::println("No packages are cached."); + System::print2("No packages are cached.\n"); Checks::exit_success(VCPKG_LINE_INFO); } @@ -51,8 +51,7 @@ namespace vcpkg::Commands::Cache { for (const BinaryParagraph& binary_paragraph : binary_paragraphs) { - const std::string displayname = binary_paragraph.displayname(); - System::println(displayname); + System::print2(binary_paragraph.displayname(), '\n'); } } else @@ -66,7 +65,7 @@ namespace vcpkg::Commands::Cache continue; } - System::println(displayname); + System::print2(displayname, '\n'); } } diff --git a/toolsrc/src/vcpkg/commands.ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 4ff503e1c..10cb7d9fe 100644 --- a/toolsrc/src/vcpkg/commands.ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -327,11 +327,11 @@ namespace vcpkg::Commands::CI b_will_build = true; } - System::println("%40s: %1s %8s: %s", p->spec, (b_will_build ? "*" : " "), state, abi); + System::printf("%40s: %1s %8s: %s\n", p->spec, (b_will_build ? "*" : " "), state, abi); } } - System::print("Time to determine pass/fail: %s\n", timer.elapsed().to_string()); + System::printf("Time to determine pass/fail: %s\n", timer.elapsed()); return ret; } @@ -340,7 +340,7 @@ namespace vcpkg::Commands::CI { if (!GlobalState::g_binary_caching) { - System::println(System::Color::warning, "Warning: Running ci without binary caching!"); + System::print2(System::Color::warning, "Warning: Running ci without binary caching!\n"); } const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); @@ -356,11 +356,8 @@ namespace vcpkg::Commands::CI const auto is_dry_run = Util::Sets::contains(options.switches, OPTION_DRY_RUN); const auto purge_tombstones = Util::Sets::contains(options.switches, OPTION_PURGE_TOMBSTONES); - std::vector<Triplet> triplets; - for (const std::string& triplet : args.command_arguments) - { - triplets.push_back(Triplet::from_canonical_name(triplet)); - } + std::vector<Triplet> triplets = Util::fmap( + args.command_arguments, [](std::string s) { return Triplet::from_canonical_name(std::move(s)); }); if (triplets.empty()) { @@ -491,8 +488,8 @@ namespace vcpkg::Commands::CI for (auto&& result : results) { - System::println("\nTriplet: %s", result.triplet); - System::println("Total elapsed time: %s", result.summary.total_elapsed_time); + System::print2("\nTriplet: ", result.triplet, "\n"); + System::print2("Total elapsed time: ", result.summary.total_elapsed_time, "\n"); result.summary.print(); } diff --git a/toolsrc/src/vcpkg/commands.contact.cpp b/toolsrc/src/vcpkg/commands.contact.cpp index 9f86a67dc..afbdc1fa7 100644 --- a/toolsrc/src/vcpkg/commands.contact.cpp +++ b/toolsrc/src/vcpkg/commands.contact.cpp @@ -1,7 +1,8 @@ #include "pch.h" #include <vcpkg/base/chrono.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> #include <vcpkg/userconfig.h> @@ -45,15 +46,15 @@ namespace vcpkg::Commands::Contact #if defined(_WIN32) System::cmd_execute("start https://aka.ms/NPS_vcpkg"); - System::println("Default browser launched to https://aka.ms/NPS_vcpkg; thank you for your feedback!"); + System::print2("Default browser launched to https://aka.ms/NPS_vcpkg; thank you for your feedback!\n"); #else - System::println( - "Please navigate to https://aka.ms/NPS_vcpkg in your preferred browser. Thank you for your feedback!"); + System::print2("Please navigate to https://aka.ms/NPS_vcpkg in your preferred browser. Thank you for your " + "feedback!\n"); #endif } else { - System::println("Send an email to %s with any feedback.", email()); + System::print2("Send an email to ", email(), " with any feedback.\n"); } Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg/commands.cpp b/toolsrc/src/vcpkg/commands.cpp index db265514f..54e9346ba 100644 --- a/toolsrc/src/vcpkg/commands.cpp +++ b/toolsrc/src/vcpkg/commands.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include <vcpkg/base/hash.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/build.h> #include <vcpkg/commands.h> @@ -77,7 +78,7 @@ namespace vcpkg::Commands::Fetch const std::string tool = args.command_arguments[0]; const fs::path tool_path = paths.get_tool_exe(tool); - System::println(tool_path.u8string()); + System::print2(tool_path.u8string(), '\n'); Checks::exit_success(VCPKG_LINE_INFO); } } @@ -100,7 +101,7 @@ namespace vcpkg::Commands::Hash const fs::path file_to_hash = args.command_arguments[0]; const std::string algorithm = args.command_arguments.size() == 2 ? args.command_arguments[1] : "SHA512"; const std::string hash = vcpkg::Hash::get_file_hash(paths.get_filesystem(), file_to_hash, algorithm); - System::println(hash); + System::print2(hash, '\n'); Checks::exit_success(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/commands.create.cpp b/toolsrc/src/vcpkg/commands.create.cpp index dfb3ab784..a6f2c8838 100644 --- a/toolsrc/src/vcpkg/commands.create.cpp +++ b/toolsrc/src/vcpkg/commands.create.cpp @@ -1,7 +1,8 @@ #include "pch.h" +#include <vcpkg/base/checks.h> #include <vcpkg/base/files.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> diff --git a/toolsrc/src/vcpkg/commands.dependinfo.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp index 6c3697ab4..92ba15c1f 100644 --- a/toolsrc/src/vcpkg/commands.dependinfo.cpp +++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp @@ -1,7 +1,7 @@ #include "pch.h"
#include <vcpkg/base/strings.h>
-#include <vcpkg/base/system.h>
+#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
@@ -145,7 +145,7 @@ namespace vcpkg::Commands::DependInfo }
else
{
- System::println(System::Color::warning, "package '%s' does not exist", requested_package);
+ System::print2(System::Color::warning, "package '", requested_package, "' does not exist\n");
}
}
@@ -171,7 +171,7 @@ namespace vcpkg::Commands::DependInfo if (Util::Sets::contains(options.switches, OPTION_DOT) || Util::Sets::contains(options.switches, OPTION_DGML))
{
const std::string graph_as_string = create_graph_as_string(options.switches, source_control_files);
- System::println(graph_as_string);
+ System::print2(graph_as_string, '\n');
Checks::exit_success(VCPKG_LINE_INFO);
}
@@ -179,7 +179,7 @@ namespace vcpkg::Commands::DependInfo {
const SourceParagraph& source_paragraph = *source_control_file->core_paragraph;
const auto s = Strings::join(", ", source_paragraph.depends, [](const Dependency& d) { return d.name(); });
- System::println("%s: %s", source_paragraph.name, s);
+ System::print2(source_paragraph.name, ": ", s, "\n");
}
Checks::exit_success(VCPKG_LINE_INFO);
diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp index 83ddea014..b2309aa41 100644 --- a/toolsrc/src/vcpkg/commands.edit.cpp +++ b/toolsrc/src/vcpkg/commands.edit.cpp @@ -1,7 +1,8 @@ #include "pch.h" #include <vcpkg/base/strings.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> #include <vcpkg/paragraphs.h> @@ -16,7 +17,7 @@ namespace vcpkg::Commands::Edit struct RegKey { HKEY root; - const char *subkey; + StringLiteral subkey; } REGKEYS[] = { { HKEY_LOCAL_MACHINE, @@ -46,7 +47,7 @@ namespace vcpkg::Commands::Edit System::get_registry_string(keypath.root, keypath.subkey, "InstallLocation"); if (const auto c = code_installpath.get()) { - const fs::path install_path = fs::path(*c); + const fs::path install_path = fs::u8path(*c); output.push_back(install_path / "Code - Insiders.exe"); output.push_back(install_path / "Code.exe"); } @@ -186,12 +187,12 @@ namespace vcpkg::Commands::Edit const auto it = Util::find_if(candidate_paths, [&](const fs::path& p) { return fs.exists(p); }); if (it == candidate_paths.cend()) { - System::println( + System::print2( System::Color::error, - "Error: Visual Studio Code was not found and the environment variable EDITOR is not set or invalid."); - System::println("The following paths were examined:"); + "Error: Visual Studio Code was not found and the environment variable EDITOR is not set or invalid.\n"); + System::print2("The following paths were examined:\n"); Files::print_paths(candidate_paths); - System::println("You can also set the environmental variable EDITOR to your editor of choice."); + System::print2("You can also set the environmental variable EDITOR to your editor of choice.\n"); Checks::exit_fail(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg/commands.env.cpp b/toolsrc/src/vcpkg/commands.env.cpp index ea00617d4..b81aeae55 100644 --- a/toolsrc/src/vcpkg/commands.env.cpp +++ b/toolsrc/src/vcpkg/commands.env.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include <vcpkg/base/strings.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/build.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> diff --git a/toolsrc/src/vcpkg/commands.exportifw.cpp b/toolsrc/src/vcpkg/commands.exportifw.cpp index 62725a90a..ba9e28233 100644 --- a/toolsrc/src/vcpkg/commands.exportifw.cpp +++ b/toolsrc/src/vcpkg/commands.exportifw.cpp @@ -1,5 +1,7 @@ #include "pch.h" +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/commands.h> #include <vcpkg/export.h> #include <vcpkg/export.ifw.h> @@ -81,7 +83,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - package_xml_file_path.generic_string()); + package_xml_file_path.generic_u8string()); auto deps = Strings::join( ",", binary_paragraph.depends, [](const std::string& dep) { return "packages." + dep + ":"; }); @@ -126,7 +128,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - package_xml_file_path.generic_string()); + package_xml_file_path.generic_u8string()); fs.write_contents(package_xml_file_path, Strings::format( R"###(<?xml version="1.0"?> @@ -150,7 +152,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - package_xml_file_path.generic_string()); + package_xml_file_path.generic_u8string()); fs.write_contents(package_xml_file_path, Strings::format( @@ -183,7 +185,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - package_xml_file_path.generic_string()); + package_xml_file_path.generic_u8string()); fs.write_contents(package_xml_file_path, Strings::format( R"###(<?xml version="1.0"?> @@ -204,7 +206,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - package_xml_file_path.generic_string()); + package_xml_file_path.generic_u8string()); fs.write_contents(package_xml_file_path, Strings::format( R"###(<?xml version="1.0"?> @@ -230,7 +232,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - package_xml_file_path.generic_string()); + package_xml_file_path.generic_u8string()); fs.write_contents(package_xml_file_path, Strings::format( @@ -256,7 +258,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for configuration file %s", - config_xml_file_path.generic_string()); + config_xml_file_path.generic_u8string()); std::string formatted_repo_url; std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or(""); @@ -286,7 +288,7 @@ namespace vcpkg::Export::IFW void export_maintenance_tool(const fs::path& ifw_packages_dir_path, const VcpkgPaths& paths) { - System::println("Exporting maintenance tool... "); + System::print2("Exporting maintenance tool...\n"); std::error_code ec; Files::Filesystem& fs = paths.get_filesystem(); @@ -297,10 +299,10 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - tempmaintenancetool.generic_string()); + tempmaintenancetool.generic_u8string()); fs.copy_file(installerbase_exe, tempmaintenancetool, fs::copy_options::overwrite_existing, ec); Checks::check_exit( - VCPKG_LINE_INFO, !ec, "Could not write package file %s", tempmaintenancetool.generic_string()); + VCPKG_LINE_INFO, !ec, "Could not write package file %s", tempmaintenancetool.generic_u8string()); fs::path package_xml_file_path = ifw_packages_dir_path / "maintenance" / "meta" / "package.xml"; fs::path package_xml_dir_path = package_xml_file_path.parent_path(); @@ -308,7 +310,7 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not create directory for package file %s", - package_xml_file_path.generic_string()); + package_xml_file_path.generic_u8string()); fs.write_contents(package_xml_file_path, Strings::format( R"###(<?xml version="1.0"?> @@ -328,9 +330,9 @@ namespace vcpkg::Export::IFW const fs::path script_destination = ifw_packages_dir_path / "maintenance" / "meta" / "maintenance.qs"; fs.copy_file(script_source, script_destination, fs::copy_options::overwrite_existing, ec); Checks::check_exit( - VCPKG_LINE_INFO, !ec, "Could not write package file %s", script_destination.generic_string()); + VCPKG_LINE_INFO, !ec, "Could not write package file %s", script_destination.generic_u8string()); - System::println("Exporting maintenance tool... done"); + System::print2("Exporting maintenance tool... done\n"); } void do_repository(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) @@ -339,14 +341,16 @@ namespace vcpkg::Export::IFW const fs::path packages_dir = get_packages_dir_path(export_id, ifw_options, paths); const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths); - System::println("Generating repository %s...", repository_dir.generic_string()); + System::print2("Generating repository ", repository_dir.generic_u8string(), "...\n"); std::error_code ec; Files::Filesystem& fs = paths.get_filesystem(); fs.remove_all(repository_dir, ec); - Checks::check_exit( - VCPKG_LINE_INFO, !ec, "Could not remove outdated repository directory %s", repository_dir.generic_string()); + Checks::check_exit(VCPKG_LINE_INFO, + !ec, + "Could not remove outdated repository directory %s", + repository_dir.generic_u8string()); const auto cmd_line = Strings::format(R"("%s" --packages "%s" "%s" > nul)", repogen_exe.u8string(), @@ -356,7 +360,8 @@ namespace vcpkg::Export::IFW const int exit_code = System::cmd_execute_clean(cmd_line); Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW repository generating failed"); - System::println(System::Color::success, "Generating repository %s... done.", repository_dir.generic_string()); + System::printf( + System::Color::success, "Generating repository %s... done.\n", repository_dir.generic_u8string()); } void do_installer(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) @@ -367,7 +372,7 @@ namespace vcpkg::Export::IFW const fs::path repository_dir = get_repository_dir_path(export_id, ifw_options, paths); const fs::path installer_file = get_installer_file_path(export_id, ifw_options, paths); - System::println("Generating installer %s...", installer_file.generic_string()); + System::printf("Generating installer %s...\n", installer_file.generic_u8string()); std::string cmd_line; @@ -392,7 +397,7 @@ namespace vcpkg::Export::IFW const int exit_code = System::cmd_execute_clean(cmd_line); Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW installer generating failed"); - System::println(System::Color::success, "Generating installer %s... done.", installer_file.generic_string()); + System::printf(System::Color::success, "Generating installer %s... done.\n", installer_file.generic_u8string()); } void do_export(const std::vector<ExportPlanAction>& export_plan, @@ -410,16 +415,16 @@ namespace vcpkg::Export::IFW Checks::check_exit(VCPKG_LINE_INFO, !ec, "Could not remove outdated packages directory %s", - ifw_packages_dir_path.generic_string()); + ifw_packages_dir_path.generic_u8string()); fs.create_directory(ifw_packages_dir_path, ec); Checks::check_exit( - VCPKG_LINE_INFO, !ec, "Could not create packages directory %s", ifw_packages_dir_path.generic_string()); + VCPKG_LINE_INFO, !ec, "Could not create packages directory %s", ifw_packages_dir_path.generic_u8string()); // Export maintenance tool export_maintenance_tool(ifw_packages_dir_path, paths); - System::println("Exporting packages %s... ", ifw_packages_dir_path.generic_string()); + System::printf("Exporting packages %s...\n", ifw_packages_dir_path.generic_u8string()); // execute the plan std::map<std::string, const ExportPlanAction*> unique_packages; @@ -431,8 +436,7 @@ namespace vcpkg::Export::IFW Checks::unreachable(VCPKG_LINE_INFO); } - const std::string display_name = action.spec.to_string(); - System::println("Exporting package %s... ", display_name); + System::print2("Exporting package ", action.spec, "...\n"); const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO); @@ -449,14 +453,13 @@ namespace vcpkg::Export::IFW (binary_paragraph.fullstem() + ".list")); Install::install_files_and_write_listfile(paths.get_filesystem(), paths.package_dir(action.spec), dirs); - System::println("Exporting package %s... done", display_name); } - System::println("Exporting packages %s... done", ifw_packages_dir_path.generic_string()); + System::printf("Exporting packages %s... done\n", ifw_packages_dir_path.generic_u8string()); const fs::path config_file = get_config_file_path(export_id, ifw_options, paths); - System::println("Generating configuration %s...", config_file.generic_string()); + System::printf("Generating configuration %s...\n", config_file.generic_u8string()); // Unique packages export_unique_packages(ifw_packages_dir_path, unique_packages, fs); @@ -472,7 +475,7 @@ namespace vcpkg::Export::IFW // Configuration export_config(export_id, ifw_options, paths); - System::println("Generating configuration %s... done.", config_file.generic_string()); + System::printf("Generating configuration %s... done.\n", config_file.generic_u8string()); // Do repository (optional) std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or(""); diff --git a/toolsrc/src/vcpkg/commands.import.cpp b/toolsrc/src/vcpkg/commands.import.cpp index 4b595697a..a2fd5d15d 100644 --- a/toolsrc/src/vcpkg/commands.import.cpp +++ b/toolsrc/src/vcpkg/commands.import.cpp @@ -114,7 +114,7 @@ namespace vcpkg::Commands::Import Checks::check_exit(VCPKG_LINE_INFO, pghs.get() != nullptr, "Invalid control file %s for package", - control_file_path.generic_string()); + control_file_path.generic_u8string()); StatusParagraph spgh; spgh.package = BinaryParagraph(*pghs.get()); diff --git a/toolsrc/src/vcpkg/commands.integrate.cpp b/toolsrc/src/vcpkg/commands.integrate.cpp index acac3293f..026ab3b77 100644 --- a/toolsrc/src/vcpkg/commands.integrate.cpp +++ b/toolsrc/src/vcpkg/commands.integrate.cpp @@ -3,7 +3,8 @@ #include <vcpkg/base/checks.h> #include <vcpkg/base/expected.h> #include <vcpkg/base/files.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> #include <vcpkg/commands.h> #include <vcpkg/metrics.h> @@ -73,7 +74,7 @@ namespace vcpkg::Commands::Integrate #if defined(_WIN32) static std::string get_nuget_id(const fs::path& vcpkg_root_dir) { - std::string dir_id = vcpkg_root_dir.generic_string(); + std::string dir_id = vcpkg_root_dir.generic_u8string(); std::replace(dir_id.begin(), dir_id.end(), '/', '.'); dir_id.erase(1, 1); // Erasing the ":" @@ -185,7 +186,7 @@ namespace vcpkg::Commands::Integrate { case ElevationPromptChoice::YES: break; case ElevationPromptChoice::NO: - System::println(System::Color::warning, "Warning: Previous integration file was not removed"); + System::print2(System::Color::warning, "Warning: Previous integration file was not removed\n"); Checks::exit_fail(VCPKG_LINE_INFO); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -219,7 +220,7 @@ namespace vcpkg::Commands::Integrate { case ElevationPromptChoice::YES: break; case ElevationPromptChoice::NO: - System::println(System::Color::warning, "Warning: integration was not applied"); + System::print2(System::Color::warning, "Warning: integration was not applied\n"); Checks::exit_fail(VCPKG_LINE_INFO); default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -247,17 +248,19 @@ namespace vcpkg::Commands::Integrate const fs::path appdata_src_path = tmp_dir / "vcpkg.user.targets"; fs.write_contents(appdata_src_path, - create_appdata_targets_shortcut(paths.buildsystems_msbuild_targets.string())); + create_appdata_targets_shortcut(paths.buildsystems_msbuild_targets.u8string())); auto appdata_dst_path = get_appdata_targets_path(); const auto rc = fs.copy_file(appdata_src_path, appdata_dst_path, fs::copy_options::overwrite_existing, ec); if (!rc || ec) { - System::println(System::Color::error, - "Error: Failed to copy file: %s -> %s", - appdata_src_path.string(), - appdata_dst_path.string()); + System::print2(System::Color::error, + "Error: Failed to copy file: ", + appdata_src_path.u8string(), + " -> ", + appdata_dst_path.u8string(), + "\n"); Checks::exit_fail(VCPKG_LINE_INFO); } } @@ -268,26 +271,28 @@ namespace vcpkg::Commands::Integrate fs.write_contents(pathtxt, paths.root.generic_u8string(), ec); if (ec) { - System::println(System::Color::error, "Error: Failed to write file: %s", pathtxt.string()); + System::print2(System::Color::error, "Error: Failed to write file: ", pathtxt.u8string(), "\n"); Checks::exit_fail(VCPKG_LINE_INFO); } - System::println(System::Color::success, "Applied user-wide integration for this vcpkg root."); + System::print2(System::Color::success, "Applied user-wide integration for this vcpkg root.\n"); const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake"; #if defined(_WIN32) - System::println( + System::printf( R"( All MSBuild C++ projects can now #include any installed libraries. Linking will be handled automatically. Installing new libraries will make them instantly available. -CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s")", - cmake_toolchain.generic_string()); +CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s" +)", + cmake_toolchain.generic_u8string()); #else - System::println( + System::printf( R"( -CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s")", - cmake_toolchain.generic_string()); +CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s" +)", + cmake_toolchain.generic_u8string()); #endif Checks::exit_success(VCPKG_LINE_INFO); @@ -310,11 +315,11 @@ CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s")", if (was_deleted) { - System::println(System::Color::success, "User-wide integration was removed"); + System::print2(System::Color::success, "User-wide integration was removed\n"); } else { - System::println(System::Color::success, "User-wide integration is not installed"); + System::print2(System::Color::success, "User-wide integration is not installed\n"); } Checks::exit_success(VCPKG_LINE_INFO); @@ -354,17 +359,18 @@ CMake projects should use: "-DCMAKE_TOOLCHAIN_FILE=%s")", const fs::path nuget_package = buildsystems_dir / Strings::format("%s.%s.nupkg", nuget_id, nupkg_version); Checks::check_exit( VCPKG_LINE_INFO, exit_code == 0 && fs.exists(nuget_package), "Error: NuGet package creation failed"); - System::println(System::Color::success, "Created nupkg: %s", nuget_package.string()); + System::print2(System::Color::success, "Created nupkg: ", nuget_package.u8string(), '\n'); auto source_path = buildsystems_dir.u8string(); source_path = Strings::replace_all(std::move(source_path), "`", "``"); - System::println(R"( + System::printf(R"( With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste: Install-Package %s -Source "%s" + )", - nuget_id, - source_path); + nuget_id, + source_path); Checks::exit_success(VCPKG_LINE_INFO); } @@ -389,12 +395,12 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console if (rc) { - System::println(System::Color::error, - "%s\n" - "Could not run:\n" - " '%s'", - TITLE, - script_path.generic_string()); + System::printf(System::Color::error, + "%s\n" + "Could not run:\n" + " '%s'\n", + TITLE, + script_path.generic_u8string()); { auto locked_metrics = Metrics::g_metrics.lock(); @@ -432,7 +438,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console if (!matches.empty()) { - System::print("vcpkg bash completion is already imported to your %s file.\n" + System::printf("vcpkg bash completion is already imported to your %s file.\n" "The following entries were found:\n" " %s\n" "Please make sure you have started a new bash shell for the changes to take effect.\n", @@ -441,7 +447,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console Checks::exit_success(VCPKG_LINE_INFO); } - System::print("Adding vcpkg completion entry to %s\n", bashrc_path.u8string()); + System::printf("Adding vcpkg completion entry to %s\n", bashrc_path.u8string()); bashrc_content.push_back(Strings::format("source %s", completion_script_path.u8string())); fs.write_contents(bashrc_path, Strings::join("\n", bashrc_content) + '\n'); Checks::exit_success(VCPKG_LINE_INFO); diff --git a/toolsrc/src/vcpkg/commands.list.cpp b/toolsrc/src/vcpkg/commands.list.cpp index cadc06ad3..71738427c 100644 --- a/toolsrc/src/vcpkg/commands.list.cpp +++ b/toolsrc/src/vcpkg/commands.list.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> #include <vcpkg/vcpkglib.h> @@ -14,14 +14,14 @@ namespace vcpkg::Commands::List { if (full_desc) { - System::println("%-50s %-16s %s", pgh.package.displayname(), pgh.package.version, pgh.package.description); + System::printf("%-50s %-16s %s\n", pgh.package.displayname(), pgh.package.version, pgh.package.description); } else { - System::println("%-50s %-16s %s", - vcpkg::shorten_text(pgh.package.displayname(), 50), - vcpkg::shorten_text(pgh.package.version, 16), - vcpkg::shorten_text(pgh.package.description, 51)); + System::printf("%-50s %-16s %s\n", + vcpkg::shorten_text(pgh.package.displayname(), 50), + vcpkg::shorten_text(pgh.package.version, 16), + vcpkg::shorten_text(pgh.package.description, 51)); } } @@ -48,7 +48,7 @@ namespace vcpkg::Commands::List if (installed_ipv.empty()) { - System::println("No packages are installed. Did you mean `search`?"); + System::print2("No packages are installed. Did you mean `search`?\n"); Checks::exit_success(VCPKG_LINE_INFO); } @@ -63,11 +63,13 @@ namespace vcpkg::Commands::List return lhs->package.displayname() < rhs->package.displayname(); }); + const auto enable_fulldesc = Util::Sets::contains(options.switches, OPTION_FULLDESC.to_string()); + if (args.command_arguments.empty()) { for (const StatusParagraph* status_paragraph : installed_packages) { - do_print(*status_paragraph, Util::Sets::contains(options.switches, OPTION_FULLDESC)); + do_print(*status_paragraph, enable_fulldesc); } } else @@ -81,7 +83,7 @@ namespace vcpkg::Commands::List continue; } - do_print(*status_paragraph, Util::Sets::contains(options.switches, OPTION_FULLDESC)); + do_print(*status_paragraph, enable_fulldesc); } } diff --git a/toolsrc/src/vcpkg/commands.owns.cpp b/toolsrc/src/vcpkg/commands.owns.cpp index ee9584651..58ed69e8b 100644 --- a/toolsrc/src/vcpkg/commands.owns.cpp +++ b/toolsrc/src/vcpkg/commands.owns.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> #include <vcpkg/vcpkglib.h> @@ -18,7 +18,7 @@ namespace vcpkg::Commands::Owns { if (file.find(file_substr) != std::string::npos) { - System::println("%s: %s", pgh.package.displayname(), file); + System::print2(pgh.package.displayname(), ": ", file, '\n'); } } } diff --git a/toolsrc/src/vcpkg/commands.portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp index 2d2b4bd5f..b30c38f43 100644 --- a/toolsrc/src/vcpkg/commands.portsdiff.cpp +++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp @@ -6,7 +6,8 @@ #include <vcpkg/versiont.h> #include <vcpkg/base/sortedvector.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> namespace vcpkg::Commands::PortsDiff @@ -71,7 +72,7 @@ namespace vcpkg::Commands::PortsDiff for (const std::string& name : ports_to_print) { const VersionT& version = names_and_versions.at(name); - System::println(" - %-14s %-16s", name, version); + System::printf(" - %-14s %-16s\n", name, version); } } @@ -155,14 +156,14 @@ namespace vcpkg::Commands::PortsDiff const std::vector<std::string>& added_ports = setp.only_left; if (!added_ports.empty()) { - System::println("\nThe following %zd ports were added:", added_ports.size()); + System::printf("\nThe following %zd ports were added:\n", added_ports.size()); do_print_name_and_version(added_ports, current_names_and_versions); } const std::vector<std::string>& removed_ports = setp.only_right; if (!removed_ports.empty()) { - System::println("\nThe following %zd ports were removed:", removed_ports.size()); + System::printf("\nThe following %zd ports were removed:\n", removed_ports.size()); do_print_name_and_version(removed_ports, previous_names_and_versions); } @@ -172,16 +173,16 @@ namespace vcpkg::Commands::PortsDiff if (!updated_ports.empty()) { - System::println("\nThe following %zd ports were updated:", updated_ports.size()); + System::printf("\nThe following %zd ports were updated:\n", updated_ports.size()); for (const UpdatedPort& p : updated_ports) { - System::println(" - %-14s %-16s", p.port, p.version_diff.to_string()); + System::printf(" - %-14s %-16s\n", p.port, p.version_diff.to_string()); } } if (added_ports.empty() && removed_ports.empty() && updated_ports.empty()) { - System::println("There were no changes in the ports between the two commits."); + System::print2("There were no changes in the ports between the two commits.\n"); } Checks::exit_success(VCPKG_LINE_INFO); diff --git a/toolsrc/src/vcpkg/commands.search.cpp b/toolsrc/src/vcpkg/commands.search.cpp index 263c86698..a0afd69e1 100644 --- a/toolsrc/src/vcpkg/commands.search.cpp +++ b/toolsrc/src/vcpkg/commands.search.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/globalstate.h> #include <vcpkg/help.h> @@ -12,34 +12,35 @@ namespace vcpkg::Commands::Search { static constexpr StringLiteral OPTION_FULLDESC = "--x-full-desc"; // TODO: This should find a better home, eventually - + static void do_print(const SourceParagraph& source_paragraph, bool full_desc) { if (full_desc) { - System::println( - "%-20s %-16s %s", source_paragraph.name, source_paragraph.version, source_paragraph.description); + System::printf( + "%-20s %-16s %s\n", source_paragraph.name, source_paragraph.version, source_paragraph.description); } else { - System::println("%-20s %-16s %s", - vcpkg::shorten_text(source_paragraph.name, 20), - vcpkg::shorten_text(source_paragraph.version, 16), - vcpkg::shorten_text(source_paragraph.description, 81)); + System::printf("%-20s %-16s %s\n", + vcpkg::shorten_text(source_paragraph.name, 20), + vcpkg::shorten_text(source_paragraph.version, 16), + vcpkg::shorten_text(source_paragraph.description, 81)); } } static void do_print(const std::string& name, const FeatureParagraph& feature_paragraph, bool full_desc) { + auto full_feature_name = Strings::concat(name, "[", feature_paragraph.name, "]"); if (full_desc) { - System::println("%-37s %s", name + "[" + feature_paragraph.name + "]", feature_paragraph.description); + System::printf("%-37s %s\n", full_feature_name, feature_paragraph.description); } else { - System::println("%-37s %s", - vcpkg::shorten_text(name + "[" + feature_paragraph.name + "]", 37), - vcpkg::shorten_text(feature_paragraph.description, 81)); + System::printf("%-37s %s\n", + vcpkg::shorten_text(full_feature_name, 37), + vcpkg::shorten_text(feature_paragraph.description, 81)); } } @@ -102,9 +103,9 @@ namespace vcpkg::Commands::Search } } - System::println( + System::print2( "\nIf your library is not listed, please open an issue at and/or consider making a pull request:\n" - " https://github.com/Microsoft/vcpkg/issues"); + " https://github.com/Microsoft/vcpkg/issues\n"); Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg/commands.upgrade.cpp b/toolsrc/src/vcpkg/commands.upgrade.cpp index 0e58b012d..29627db3d 100644 --- a/toolsrc/src/vcpkg/commands.upgrade.cpp +++ b/toolsrc/src/vcpkg/commands.upgrade.cpp @@ -10,6 +10,7 @@ #include <vcpkg/update.h> #include <vcpkg/vcpkglib.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> namespace vcpkg::Commands::Upgrade @@ -47,7 +48,7 @@ namespace vcpkg::Commands::Upgrade // input sanitization const std::vector<PackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_package_spec(arg, default_triplet, COMMAND_STRUCTURE.example_text); + return Input::check_and_get_package_spec(std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text); }); for (auto&& spec : specs) @@ -62,7 +63,7 @@ namespace vcpkg::Commands::Upgrade if (outdated_packages.empty()) { - System::println("All installed packages are up-to-date with the local portfiles."); + System::print2("All installed packages are up-to-date with the local portfiles.\n"); Checks::exit_success(VCPKG_LINE_INFO); } @@ -112,23 +113,29 @@ namespace vcpkg::Commands::Upgrade if (!up_to_date.empty()) { - System::println(System::Color::success, "The following packages are up-to-date:"); - System::println(Strings::join( - "", up_to_date, [](const PackageSpec& spec) { return " " + spec.to_string() + "\n"; })); + System::print2(System::Color::success, "The following packages are up-to-date:\n"); + System::print2(Strings::join("", + up_to_date, + [](const PackageSpec& spec) { return " " + spec.to_string() + "\n"; }), + '\n'); } if (!not_installed.empty()) { - System::println(System::Color::error, "The following packages are not installed:"); - System::println(Strings::join( - "", not_installed, [](const PackageSpec& spec) { return " " + spec.to_string() + "\n"; })); + System::print2(System::Color::error, "The following packages are not installed:\n"); + System::print2(Strings::join("", + not_installed, + [](const PackageSpec& spec) { return " " + spec.to_string() + "\n"; }), + '\n'); } if (!no_portfile.empty()) { - System::println(System::Color::error, "The following packages do not have a valid portfile:"); - System::println(Strings::join( - "", no_portfile, [](const PackageSpec& spec) { return " " + spec.to_string() + "\n"; })); + System::print2(System::Color::error, "The following packages do not have a valid portfile:\n"); + System::print2(Strings::join("", + no_portfile, + [](const PackageSpec& spec) { return " " + spec.to_string() + "\n"; }), + '\n'); } Checks::check_exit(VCPKG_LINE_INFO, not_installed.empty() && no_portfile.empty()); @@ -166,15 +173,15 @@ namespace vcpkg::Commands::Upgrade if (!no_dry_run) { - System::println(System::Color::warning, - "If you are sure you want to rebuild the above packages, run this command with the " - "--no-dry-run option."); + System::print2(System::Color::warning, + "If you are sure you want to rebuild the above packages, run this command with the " + "--no-dry-run option.\n"); Checks::exit_fail(VCPKG_LINE_INFO); } const Install::InstallSummary summary = Install::perform(plan, keep_going, paths, status_db); - System::println("\nTotal elapsed time: %s\n", summary.total_elapsed_time); + System::print2("\nTotal elapsed time: ", summary.total_elapsed_time, "\n\n"); if (keep_going == KeepGoing::YES) { diff --git a/toolsrc/src/vcpkg/commands.version.cpp b/toolsrc/src/vcpkg/commands.version.cpp index 2ad91b57d..7029c8bfd 100644 --- a/toolsrc/src/vcpkg/commands.version.cpp +++ b/toolsrc/src/vcpkg/commands.version.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> #include <vcpkg/metrics.h> @@ -60,15 +60,15 @@ namespace vcpkg::Commands::Version { if (maj1 != maj2 || min1 != min2 || rev1 != rev2) { - System::println(System::Color::warning, - "Warning: Different source is available for vcpkg (%d.%d.%d -> %d.%d.%d). Use " - ".\\bootstrap-vcpkg.bat to update.", - maj2, - min2, - rev2, - maj1, - min1, - rev1); + System::printf(System::Color::warning, + "Warning: Different source is available for vcpkg (%d.%d.%d -> %d.%d.%d). Use " + ".\\bootstrap-vcpkg.bat to update.\n", + maj2, + min2, + rev2, + maj1, + min1, + rev1); } } } @@ -85,10 +85,11 @@ namespace vcpkg::Commands::Version { Util::unused(args.parse_arguments(COMMAND_STRUCTURE)); - System::println("Vcpkg package management program version %s\n" - "\n" - "See LICENSE.txt for license information.", - version()); + System::print2("Vcpkg package management program version ", + version(), + "\n" + "\n" + "See LICENSE.txt for license information.\n"); Checks::exit_success(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/commands.xvsinstances.cpp b/toolsrc/src/vcpkg/commands.xvsinstances.cpp index d748b6b2f..542ebd56c 100644 --- a/toolsrc/src/vcpkg/commands.xvsinstances.cpp +++ b/toolsrc/src/vcpkg/commands.xvsinstances.cpp @@ -1,5 +1,6 @@ #include "pch.h"
+#include <vcpkg/base/system.print.h>
#include <vcpkg/commands.h>
#include <vcpkg/help.h>
#include <vcpkg/visualstudio.h>
@@ -22,7 +23,7 @@ namespace vcpkg::Commands::X_VSInstances const auto instances = vcpkg::VisualStudio::get_visual_studio_instances(paths);
for (const std::string& instance : instances)
{
- System::println(instance);
+ System::print2(instance, '\n');
}
Checks::exit_success(VCPKG_LINE_INFO);
diff --git a/toolsrc/src/vcpkg/dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index 19d8e7ae8..8fde28929 100644 --- a/toolsrc/src/vcpkg/dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -580,9 +580,10 @@ namespace vcpkg::Dependencies auto res = follow_plus_dependencies(f, cluster, graph, graph_plan, prevent_default_features); if (res != MarkPlusResult::SUCCESS) { - System::println(System::Color::warning, - "Warning: could not reinstall feature %s", - FeatureSpec{cluster.spec, f}); + System::print2(System::Color::warning, + "Warning: could not reinstall feature ", + FeatureSpec{cluster.spec, f}, + "\n"); } } @@ -596,9 +597,10 @@ namespace vcpkg::Dependencies auto res = mark_plus(default_feature, cluster, graph, graph_plan, prevent_default_features); if (res != MarkPlusResult::SUCCESS) { - System::println(System::Color::warning, - "Warning: could not install new default feature %s", - FeatureSpec{cluster.spec, default_feature}); + System::print2(System::Color::warning, + "Warning: could not install new default feature ", + FeatureSpec{cluster.spec, default_feature}, + "\n"); } } } @@ -837,40 +839,42 @@ namespace vcpkg::Dependencies if (!excluded.empty()) { - System::println("The following packages are excluded:\n%s", actions_to_output_string(excluded)); + System::print2("The following packages are excluded:\n", actions_to_output_string(excluded), '\n'); } if (!already_installed_plans.empty()) { - System::println("The following packages are already installed:\n%s", - actions_to_output_string(already_installed_plans)); + System::print2("The following packages are already installed:\n", + actions_to_output_string(already_installed_plans), + '\n'); } if (!rebuilt_plans.empty()) { - System::println("The following packages will be rebuilt:\n%s", actions_to_output_string(rebuilt_plans)); + System::print2("The following packages will be rebuilt:\n", actions_to_output_string(rebuilt_plans), '\n'); } if (!new_plans.empty()) { - System::println("The following packages will be built and installed:\n%s", - actions_to_output_string(new_plans)); + System::print2( + "The following packages will be built and installed:\n", actions_to_output_string(new_plans), '\n'); } if (!only_install_plans.empty()) { - System::println("The following packages will be directly installed:\n%s", - actions_to_output_string(only_install_plans)); + System::print2("The following packages will be directly installed:\n", + actions_to_output_string(only_install_plans), + '\n'); } if (has_non_user_requested_packages) - System::println("Additional packages (*) will be modified to complete this operation."); + System::print2("Additional packages (*) will be modified to complete this operation.\n"); if (!remove_plans.empty() && !is_recursive) { - System::println(System::Color::warning, - "If you are sure you want to rebuild the above packages, run the command with the " - "--recurse option"); + System::print2(System::Color::warning, + "If you are sure you want to rebuild the above packages, run the command with the " + "--recurse option\n"); Checks::exit_fail(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index eec9a39f2..870d2c49e 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -11,7 +11,8 @@ #include <vcpkg/vcpkglib.h> #include <vcpkg/base/stringliteral.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> namespace vcpkg::Export @@ -96,10 +97,10 @@ namespace vcpkg::Export switch (plan_type) { case ExportPlanType::ALREADY_BUILT: - System::println("The following packages are already built and will be exported:\n%s", as_string); + System::print2("The following packages are already built and will be exported:\n", as_string, '\n'); continue; case ExportPlanType::NOT_BUILT: - System::println("The following packages need to be built:\n%s", as_string); + System::print2("The following packages need to be built:\n", as_string, '\n'); continue; default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -316,7 +317,7 @@ namespace vcpkg::Export // input sanitization ret.specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_package_spec(arg, default_triplet, COMMAND_STRUCTURE.example_text); + return Input::check_and_get_package_spec(std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text); }); ret.dry_run = options.switches.find(OPTION_DRY_RUN) != options.switches.cend(); ret.raw = options.switches.find(OPTION_RAW) != options.switches.cend(); @@ -329,9 +330,9 @@ namespace vcpkg::Export if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run) { - System::println(System::Color::error, - "Must provide at least one export type: --raw --nuget --ifw --zip --7zip"); - System::print(COMMAND_STRUCTURE.example_text); + System::print2(System::Color::error, + "Must provide at least one export type: --raw --nuget --ifw --zip --7zip\n"); + System::print2(COMMAND_STRUCTURE.example_text); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -382,12 +383,12 @@ namespace vcpkg::Export const fs::path cmake_toolchain = prefix / "scripts" / "buildsystems" / "vcpkg.cmake"; const System::CMakeVariable cmake_variable = System::CMakeVariable("CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string()); - System::println("\n" - "To use the exported libraries in CMake projects use:" - "\n" - " %s" - "\n", - cmake_variable.s); + System::print2("\n" + "To use the exported libraries in CMake projects use:" + "\n" + " ", + cmake_variable.s, + "\n\n"); } static void handle_raw_based_export(Span<const ExportPlanAction> export_plan, @@ -411,7 +412,7 @@ namespace vcpkg::Export } const std::string display_name = action.spec.to_string(); - System::println("Exporting package %s... ", display_name); + System::print2("Exporting package ", display_name, "...\n"); const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO); @@ -421,7 +422,6 @@ namespace vcpkg::Export raw_exported_dir_path / "installed" / "vcpkg" / "info" / (binary_paragraph.fullstem() + ".list")); Install::install_files_and_write_listfile(paths.get_filesystem(), paths.package_dir(action.spec), dirs); - System::println(System::Color::success, "Exporting package %s... done", display_name); } // Copy files needed for integration @@ -429,48 +429,47 @@ namespace vcpkg::Export if (opts.raw) { - System::println( - System::Color::success, R"(Files exported at: "%s")", raw_exported_dir_path.generic_string()); + System::printf(System::Color::success, + R"(Files exported at: "%s")" + "\n", + raw_exported_dir_path.u8string()); print_next_step_info(raw_exported_dir_path); } if (opts.nuget) { - System::println("Creating nuget package... "); + System::print2("Packing nuget package...\n"); const std::string nuget_id = opts.maybe_nuget_id.value_or(raw_exported_dir_path.filename().string()); const std::string nuget_version = opts.maybe_nuget_version.value_or("1.0.0"); const fs::path output_path = do_nuget_export(paths, nuget_id, nuget_version, raw_exported_dir_path, export_to_path); - System::println(System::Color::success, "Creating nuget package... done"); - System::println(System::Color::success, "NuGet package exported at: %s", output_path.generic_string()); + System::print2(System::Color::success, "NuGet package exported at: ", output_path.u8string(), "\n"); - System::println(R"( + System::printf(R"( With a project open, go to Tools->NuGet Package Manager->Package Manager Console and paste: Install-Package %s -Source "%s" )" - "\n", - nuget_id, - output_path.parent_path().u8string()); + "\n\n", + nuget_id, + output_path.parent_path().u8string()); } if (opts.zip) { - System::println("Creating zip archive... "); + System::print2("Creating zip archive...\n"); const fs::path output_path = do_archive_export(paths, raw_exported_dir_path, export_to_path, ArchiveFormatC::ZIP); - System::println(System::Color::success, "Creating zip archive... done"); - System::println(System::Color::success, "Zip archive exported at: %s", output_path.generic_string()); + System::print2(System::Color::success, "Zip archive exported at: ", output_path.u8string(), "\n"); print_next_step_info("[...]"); } if (opts.seven_zip) { - System::println("Creating 7zip archive... "); + System::print2("Creating 7zip archive...\n"); const fs::path output_path = do_archive_export(paths, raw_exported_dir_path, export_to_path, ArchiveFormatC::SEVEN_ZIP); - System::println(System::Color::success, "Creating 7zip archive... done"); - System::println(System::Color::success, "7zip archive exported at: %s", output_path.generic_string()); + System::print2(System::Color::success, "7zip archive exported at: ", output_path.u8string(), "\n"); print_next_step_info("[...]"); } @@ -503,14 +502,14 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console if (has_non_user_requested_packages) { - System::println(System::Color::warning, - "Additional packages (*) need to be exported to complete this operation."); + System::print2(System::Color::warning, + "Additional packages (*) need to be exported to complete this operation.\n"); } const auto it = group_by_plan_type.find(ExportPlanType::NOT_BUILT); if (it != group_by_plan_type.cend() && !it->second.empty()) { - System::println(System::Color::error, "There are packages that have not been built."); + System::print2(System::Color::error, "There are packages that have not been built.\n"); // No need to show all of them, just the user-requested ones. Dependency resolution will handle the rest. std::vector<const ExportPlanAction*> unbuilt = it->second; @@ -518,9 +517,10 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console unbuilt, [](const ExportPlanAction* a) { return a->request_type != RequestType::USER_REQUESTED; }); const auto s = Strings::join(" ", unbuilt, [](const ExportPlanAction* a) { return a->spec.to_string(); }); - System::println("To build them, run:\n" - " vcpkg install %s", - s); + System::print2("To build them, run:\n" + " vcpkg install ", + s, + "\n"); Checks::exit_fail(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg/globalstate.cpp b/toolsrc/src/vcpkg/globalstate.cpp index a54c596fb..1a2c08474 100644 --- a/toolsrc/src/vcpkg/globalstate.cpp +++ b/toolsrc/src/vcpkg/globalstate.cpp @@ -14,47 +14,4 @@ namespace vcpkg std::atomic<int> GlobalState::g_init_console_cp(0); std::atomic<int> GlobalState::g_init_console_output_cp(0); std::atomic<bool> GlobalState::g_init_console_initialized(false); - - GlobalState::CtrlCStateMachine GlobalState::g_ctrl_c_state; - - GlobalState::CtrlCStateMachine::CtrlCStateMachine() : m_state(CtrlCState::normal) {} - - void GlobalState::CtrlCStateMachine::transition_to_spawn_process() noexcept - { - auto expected = CtrlCState::normal; - auto transitioned = m_state.compare_exchange_strong(expected, CtrlCState::blocked_on_child); - if (!transitioned) - { - // Ctrl-C was hit and is asynchronously executing on another thread - Checks::exit_fail(VCPKG_LINE_INFO); - } - } - void GlobalState::CtrlCStateMachine::transition_from_spawn_process() noexcept - { - auto expected = CtrlCState::blocked_on_child; - auto transitioned = m_state.compare_exchange_strong(expected, CtrlCState::normal); - if (!transitioned) - { - // Ctrl-C was hit while blocked on the child process - Checks::exit_fail(VCPKG_LINE_INFO); - } - } - void GlobalState::CtrlCStateMachine::transition_handle_ctrl_c() noexcept - { - auto prev_state = m_state.exchange(CtrlCState::exit_requested); - - if (prev_state == CtrlCState::normal) - { - // Not currently blocked on a child process and Ctrl-C has not been hit. - Checks::exit_fail(VCPKG_LINE_INFO); - } - else if (prev_state == CtrlCState::exit_requested) - { - // Ctrl-C was hit previously - } - else - { - // This is the case where we are currently blocked on a child process - } - } } diff --git a/toolsrc/src/vcpkg/help.cpp b/toolsrc/src/vcpkg/help.cpp index 67a7e852b..1d4687bd0 100644 --- a/toolsrc/src/vcpkg/help.cpp +++ b/toolsrc/src/vcpkg/help.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/export.h> #include <vcpkg/help.h> @@ -34,9 +34,7 @@ namespace vcpkg::Help static void integrate_topic_fn(const VcpkgPaths&) { - System::print("Commands:\n" - "%s", - Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING); + System::print2("Commands:\n", Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING); } static void help_topics(const VcpkgPaths&); @@ -67,60 +65,65 @@ namespace vcpkg::Help static void help_topics(const VcpkgPaths&) { - System::println("Available help topics:\n" - " triplet\n" - " integrate" - "%s", - Strings::join("", topics, [](const Topic& topic) { return std::string("\n ") + topic.name; })); + System::print2("Available help topics:\n" + " triplet\n" + " integrate", + Strings::join("", topics, [](const Topic& topic) { return std::string("\n ") + topic.name; }), + "\n"); } void help_topic_valid_triplet(const VcpkgPaths& paths) { - System::println("Available architecture triplets:"); + System::print2("Available architecture triplets:\n"); for (auto&& triplet : paths.get_available_triplets()) { - System::println(" %s", triplet); + System::print2(" ", triplet, '\n'); } } 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 --outdated Uninstall all out-of-date packages\n" - " vcpkg list List installed packages\n" - " vcpkg update Display list of packages for updating\n" - " vcpkg upgrade Rebuild all outdated packages\n" - " vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n" - " vcpkg help topics Display the list of help topics\n" - " vcpkg help <topic> Display help for a specific topic\n" - "\n" - "%s" // Integration help - "\n" - " vcpkg export <pkg>... [opt]... Exports a package\n" - " vcpkg edit <pkg> Open up a port for editing (uses " ENVVAR(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 env Creates a clean shell environment for development or compiling.\n" - " vcpkg version Display version information\n" - " vcpkg contact Display contact information to send feedback\n" - "\n" - "Options:\n" - " --triplet <t> Specify the target architecture triplet.\n" - " (default: " ENVVAR(VCPKG_DEFAULT_TRIPLET) ", see 'vcpkg help triplet')\n" - "\n" - " --vcpkg-root <path> Specify the vcpkg root directory\n" - " (default: " ENVVAR(VCPKG_ROOT) ")\n" - "\n" - " @response_file Specify a response file to provide additional parameters\n" - "\n" - "For more help (including examples) see the accompanying README.md.", - Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING); + System::print2("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 --outdated Uninstall all out-of-date packages\n" + " vcpkg list List installed packages\n" + " vcpkg update Display list of packages for updating\n" + " vcpkg upgrade Rebuild all outdated packages\n" + " vcpkg hash <file> [alg] Hash a file by specific algorithm, default SHA512\n" + " vcpkg help topics Display the list of help topics\n" + " vcpkg help <topic> Display help for a specific topic\n" + "\n", + Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING, // Integration help + "\n" + " vcpkg export <pkg>... [opt]... Exports a package\n" + " vcpkg edit <pkg> Open up a port for editing (uses " ENVVAR(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 env Creates a clean shell environment for development or " + "compiling.\n" + " vcpkg version Display version information\n" + " vcpkg contact Display contact information to send feedback\n" + "\n" + "Options:\n" + " --triplet <t> Specify the target architecture triplet.\n" + " (default: " ENVVAR(VCPKG_DEFAULT_TRIPLET) // + ", see 'vcpkg help triplet')\n" + "\n" + " --vcpkg-root <path> Specify the vcpkg root " + "directory\n" + " (default: " ENVVAR(VCPKG_ROOT) // + ")\n" + "\n" + " @response_file Specify a " + "response file to provide additional parameters\n" + "\n" + "For more help (including examples) see the " + "accompanying README.md.\n"); } std::string create_example_string(const std::string& command_and_arguments) @@ -154,7 +157,7 @@ namespace vcpkg::Help Checks::exit_success(VCPKG_LINE_INFO); } - System::println(System::Color::error, "Error: unknown topic %s", topic); + System::print2(System::Color::error, "Error: unknown topic ", topic, '\n'); help_topics(paths); Checks::exit_fail(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/vcpkg/input.cpp b/toolsrc/src/vcpkg/input.cpp index aee0fac7f..42f81cbb9 100644 --- a/toolsrc/src/vcpkg/input.cpp +++ b/toolsrc/src/vcpkg/input.cpp @@ -1,18 +1,19 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> #include <vcpkg/input.h> #include <vcpkg/metrics.h> +#include <vcpkg/packagespec.h> -namespace vcpkg::Input +namespace vcpkg { - PackageSpec check_and_get_package_spec(const std::string& package_spec_as_string, - const Triplet& default_triplet, - CStringView example_text) + PackageSpec Input::check_and_get_package_spec(std::string&& spec_string, + const Triplet& default_triplet, + CStringView example_text) { - const std::string as_lowercase = Strings::ascii_to_lowercase(package_spec_as_string); + const std::string as_lowercase = Strings::ascii_to_lowercase(std::move(spec_string)); auto expected_spec = FullPackageSpec::from_string(as_lowercase, default_triplet); if (const auto spec = expected_spec.get()) { @@ -20,27 +21,27 @@ namespace vcpkg::Input } // Intentionally show the lowercased string - System::println(System::Color::error, "Error: %s: %s", vcpkg::to_string(expected_spec.error()), as_lowercase); - System::print(example_text); + System::print2(System::Color::error, "Error: ", expected_spec.error(), ": ", as_lowercase, '\n'); + System::print2(example_text); Checks::exit_fail(VCPKG_LINE_INFO); } - void check_triplet(const Triplet& t, const VcpkgPaths& paths) + void Input::check_triplet(const Triplet& t, const VcpkgPaths& paths) { if (!paths.is_valid_triplet(t)) { - System::println(System::Color::error, "Error: invalid triplet: %s", t); + System::print2(System::Color::error, "Error: invalid triplet: ", t, '\n'); Metrics::g_metrics.lock()->track_property("error", "invalid triplet: " + t.to_string()); Help::help_topic_valid_triplet(paths); Checks::exit_fail(VCPKG_LINE_INFO); } } - FullPackageSpec check_and_get_full_package_spec(const std::string& full_package_spec_as_string, - const Triplet& default_triplet, - CStringView example_text) + FullPackageSpec Input::check_and_get_full_package_spec(std::string&& full_package_spec_as_string, + const Triplet& default_triplet, + CStringView example_text) { - const std::string as_lowercase = Strings::ascii_to_lowercase(full_package_spec_as_string); + const std::string as_lowercase = Strings::ascii_to_lowercase(std::move(full_package_spec_as_string)); auto expected_spec = FullPackageSpec::from_string(as_lowercase, default_triplet); if (const auto spec = expected_spec.get()) { @@ -48,8 +49,8 @@ namespace vcpkg::Input } // Intentionally show the lowercased string - System::println(System::Color::error, "Error: %s: %s", vcpkg::to_string(expected_spec.error()), as_lowercase); - System::print(example_text); + System::print2(System::Color::error, "Error: ", expected_spec.error(), ": ", as_lowercase, '\n'); + System::print2(example_text); Checks::exit_fail(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 434876871..6d4eabc89 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -1,7 +1,7 @@ #include "pch.h" #include <vcpkg/base/files.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/build.h> #include <vcpkg/commands.h> @@ -65,7 +65,7 @@ namespace vcpkg::Install const auto status = fs.symlink_status(file, ec); if (ec) { - System::println(System::Color::error, "failed: %s: %s", file.u8string(), ec.message()); + System::print2(System::Color::error, "failed: ", file.u8string(), ": ", ec.message(), "\n"); continue; } @@ -87,7 +87,7 @@ namespace vcpkg::Install fs.create_directory(target, ec); if (ec) { - System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message()); + System::printf(System::Color::error, "failed: %s: %s\n", target.u8string(), ec.message()); } // Trailing backslash for directories @@ -98,15 +98,15 @@ namespace vcpkg::Install { if (fs.exists(target)) { - System::println(System::Color::warning, - "File %s was already present and will be overwritten", - target.u8string(), - ec.message()); + System::print2(System::Color::warning, + "File ", + target.u8string(), + " was already present and will be overwritten\n"); } fs.copy_file(file, target, fs::copy_options::overwrite_existing, ec); if (ec) { - System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message()); + System::printf(System::Color::error, "failed: %s: %s\n", target.u8string(), ec.message()); } output.push_back(Strings::format(R"(%s/%s)", destination_subdirectory, suffix)); break; @@ -115,21 +115,21 @@ namespace vcpkg::Install { if (fs.exists(target)) { - System::println(System::Color::warning, - "File %s was already present and will be overwritten", - target.u8string(), - ec.message()); + System::print2(System::Color::warning, + "File ", + target.u8string(), + " was already present and will be overwritten\n"); } fs.copy_symlink(file, target, ec); if (ec) { - System::println(System::Color::error, "failed: %s: %s", target.u8string(), ec.message()); + System::printf(System::Color::error, "failed: %s: %s\n", target.u8string(), ec.message()); } output.push_back(Strings::format(R"(%s/%s)", destination_subdirectory, suffix)); break; } default: - System::println(System::Color::error, "failed: %s: cannot handle file type", file.u8string()); + System::printf(System::Color::error, "failed: %s: cannot handle file type\n", file.u8string()); break; } } @@ -209,13 +209,11 @@ namespace vcpkg::Install if (!intersection.empty()) { const fs::path triplet_install_path = paths.installed / triplet.canonical_name(); - System::println(System::Color::error, - "The following files are already installed in %s and are in conflict with %s", - triplet_install_path.generic_string(), - bcf.core_paragraph.spec); - System::print("\n "); - System::println(Strings::join("\n ", intersection)); - System::println(); + System::printf(System::Color::error, + "The following files are already installed in %s and are in conflict with %s\n", + triplet_install_path.generic_string(), + bcf.core_paragraph.spec); + System::print2("\n ", Strings::join("\n ", intersection), "\n\n"); return InstallResult::FILE_CONFLICTS; } @@ -278,20 +276,21 @@ namespace vcpkg::Install if (plan_type == InstallPlanType::ALREADY_INSTALLED) { if (use_head_version && is_user_requested) - System::println( - System::Color::warning, "Package %s is already installed -- not building from HEAD", display_name); + System::printf(System::Color::warning, + "Package %s is already installed -- not building from HEAD\n", + display_name); else - System::println(System::Color::success, "Package %s is already installed", display_name); + System::printf(System::Color::success, "Package %s is already installed\n", display_name); return BuildResult::SUCCEEDED; } auto aux_install = [&](const std::string& name, const BinaryControlFile& bcf) -> BuildResult { - System::println("Installing package %s... ", name); + System::printf("Installing package %s...\n", name); const auto install_result = install_package(paths, bcf, &status_db); switch (install_result) { case InstallResult::SUCCESS: - System::println(System::Color::success, "Installing package %s... done", name); + System::printf(System::Color::success, "Installing package %s... done\n", name); return BuildResult::SUCCEEDED; case InstallResult::FILE_CONFLICTS: return BuildResult::FILE_CONFLICTS; default: Checks::unreachable(VCPKG_LINE_INFO); @@ -301,9 +300,9 @@ namespace vcpkg::Install if (plan_type == InstallPlanType::BUILD_AND_INSTALL) { if (use_head_version) - System::println("Building package %s from HEAD... ", display_name_with_features); + System::printf("Building package %s from HEAD...\n", display_name_with_features); else - System::println("Building package %s... ", display_name_with_features); + System::printf("Building package %s...\n", display_name_with_features); auto result = [&]() -> Build::ExtendedBuildResult { const Build::BuildPackageConfig build_config{action.source_control_file.value_or_exit(VCPKG_LINE_INFO), @@ -316,11 +315,11 @@ namespace vcpkg::Install if (result.code != Build::BuildResult::SUCCEEDED) { - System::println(System::Color::error, Build::create_error_message(result.code, action.spec)); + System::print2(System::Color::error, Build::create_error_message(result.code, action.spec), "\n"); return result; } - System::println("Building package %s... done", display_name_with_features); + System::printf("Building package %s... done\n", display_name_with_features); auto bcf = std::make_unique<BinaryControlFile>( Paragraphs::try_load_cached_package(paths, action.spec).value_or_exit(VCPKG_LINE_INFO)); @@ -339,7 +338,7 @@ namespace vcpkg::Install if (plan_type == InstallPlanType::EXCLUDED) { - System::println(System::Color::warning, "Package %s is excluded", display_name); + System::printf(System::Color::warning, "Package %s is excluded\n", display_name); return BuildResult::EXCLUDED; } @@ -348,11 +347,11 @@ namespace vcpkg::Install void InstallSummary::print() const { - System::println("RESULTS"); + System::print2("RESULTS\n"); for (const SpecSummary& result : this->results) { - System::println(" %s: %s: %s", result.spec, Build::to_string(result.build_result.code), result.timing); + System::printf(" %s: %s: %s\n", result.spec, Build::to_string(result.build_result.code), result.timing); } std::map<BuildResult, int> summary; @@ -366,10 +365,10 @@ namespace vcpkg::Install summary[r.build_result.code]++; } - System::println("\nSUMMARY"); + System::print2("\nSUMMARY\n"); for (const std::pair<const BuildResult, int>& entry : summary) { - System::println(" %s: %d", Build::to_string(entry.first), entry.second); + System::printf(" %s: %d\n", Build::to_string(entry.first), entry.second); } } @@ -391,7 +390,7 @@ namespace vcpkg::Install const PackageSpec& spec = action.spec(); const std::string display_name = spec.to_string(); - System::println("Starting package %zd/%zd: %s", counter, package_count, display_name); + System::printf("Starting package %zd/%zd: %s\n", counter, package_count, display_name); results.emplace_back(spec, &action); @@ -401,7 +400,7 @@ namespace vcpkg::Install if (result.code != BuildResult::SUCCEEDED && keep_going == KeepGoing::NO) { - System::println(Build::create_user_troubleshooting_message(install_action->spec)); + System::print2(Build::create_user_troubleshooting_message(install_action->spec), '\n'); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -417,7 +416,7 @@ namespace vcpkg::Install } results.back().timing = build_timer.elapsed(); - System::println("Elapsed time for package %s: %s", display_name, results.back().timing.to_string()); + System::printf("Elapsed time for package %s: %s\n", display_name, results.back().timing); } return InstallSummary{std::move(results), timer.to_string()}; @@ -471,7 +470,7 @@ namespace vcpkg::Install auto maybe_contents = fs.read_contents(usage_file); if (auto p_contents = maybe_contents.get()) { - System::println(*p_contents); + System::print2(*p_contents, '\n'); } return; } @@ -525,15 +524,15 @@ namespace vcpkg::Install } else { - System::println("The package %s provides CMake targets:\n", bpgh.spec); + System::print2("The package ", bpgh.spec, " provides CMake targets:\n\n"); for (auto&& library_target_pair : library_targets) { auto config_it = config_files.find(library_target_pair.first); if (config_it != config_files.end()) - System::println(" find_package(%s CONFIG REQUIRED)", config_it->second); + System::printf(" find_package(%s CONFIG REQUIRED)\n", config_it->second); else - System::println(" find_package(%s CONFIG REQUIRED)", library_target_pair.first); + System::printf(" find_package(%s CONFIG REQUIRED)\n", library_target_pair.first); std::sort(library_target_pair.second.begin(), library_target_pair.second.end(), @@ -545,18 +544,18 @@ namespace vcpkg::Install if (library_target_pair.second.size() <= 4) { - System::println(" target_link_libraries(main PRIVATE %s)\n", - Strings::join(" ", library_target_pair.second)); + System::printf(" target_link_libraries(main PRIVATE %s)\n\n", + Strings::join(" ", library_target_pair.second)); } else { auto omitted = library_target_pair.second.size() - 4; library_target_pair.second.erase(library_target_pair.second.begin() + 4, library_target_pair.second.end()); - System::println(" # Note: %zd target(s) were omitted.\n" - " target_link_libraries(main PRIVATE %s)\n", - omitted, - Strings::join(" ", library_target_pair.second)); + System::printf(" # Note: %zd target(s) were omitted.\n" + " target_link_libraries(main PRIVATE %s)\n\n", + omitted, + Strings::join(" ", library_target_pair.second)); } } } @@ -574,7 +573,8 @@ namespace vcpkg::Install const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_full_package_spec(arg, default_triplet, COMMAND_STRUCTURE.example_text); + return Input::check_and_get_full_package_spec( + std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text); }); for (auto&& spec : specs) @@ -667,7 +667,7 @@ namespace vcpkg::Install const InstallSummary summary = perform(action_plan, keep_going, paths, status_db); - System::println("\nTotal elapsed time: %s\n", summary.total_elapsed_time); + System::print2("\nTotal elapsed time: ", summary.total_elapsed_time, "\n\n"); if (keep_going == KeepGoing::YES) { @@ -729,7 +729,8 @@ namespace vcpkg::Install case BuildResult::FILE_CONFLICTS: case BuildResult::BUILD_FAILED: result_string = "Fail"; - message_block = Strings::format("<failure><message><![CDATA[%s]]></message></failure>", to_string(code)); + message_block = + Strings::format("<failure><message><![CDATA[%s]]></message></failure>", to_string(code)); break; case BuildResult::EXCLUDED: case BuildResult::CASCADED_DUE_TO_MISSING_DEPENDENCIES: diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp index c34f30974..5ca2b056a 100644 --- a/toolsrc/src/vcpkg/metrics.cpp +++ b/toolsrc/src/vcpkg/metrics.cpp @@ -7,7 +7,7 @@ #include <vcpkg/base/files.h> #include <vcpkg/base/hash.h> #include <vcpkg/base/strings.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.process.h> #pragma comment(lib, "version") #pragma comment(lib, "winhttp") diff --git a/toolsrc/src/vcpkg/packagespec.cpp b/toolsrc/src/vcpkg/packagespec.cpp index 789aaca80..52edf4b6f 100644 --- a/toolsrc/src/vcpkg/packagespec.cpp +++ b/toolsrc/src/vcpkg/packagespec.cpp @@ -1,5 +1,6 @@ #include "pch.h" +#include <vcpkg/base/checks.h> #include <vcpkg/base/util.h> #include <vcpkg/packagespec.h> #include <vcpkg/packagespecparseresult.h> @@ -16,8 +17,14 @@ namespace vcpkg std::string FeatureSpec::to_string() const { - if (feature().empty()) return spec().to_string(); - return Strings::format("%s[%s]:%s", name(), feature(), triplet()); + std::string ret; + this->to_string(ret); + return ret; + } + void FeatureSpec::to_string(std::string& out) const + { + if (feature().empty()) return spec().to_string(out); + Strings::append(out, name(), '[', feature(), "]:", triplet()); } std::vector<FeatureSpec> FeatureSpec::from_strings_and_triplet(const std::vector<std::string>& depends, @@ -71,7 +78,7 @@ namespace vcpkg if (auto p = res.get()) { FullPackageSpec fspec; - Triplet t = p->triplet.empty() ? default_triplet : Triplet::from_canonical_name(p->triplet); + Triplet t = p->triplet.empty() ? default_triplet : Triplet::from_canonical_name(std::move(p->triplet)); fspec.package_spec = PackageSpec::from_name_and_triplet(p->name, t).value_or_exit(VCPKG_LINE_INFO); fspec.features = std::move(p->features); return fspec; @@ -119,6 +126,7 @@ namespace vcpkg std::string PackageSpec::dir() const { return Strings::format("%s_%s", this->m_name, this->m_triplet); } std::string PackageSpec::to_string() const { return Strings::format("%s:%s", this->name(), this->triplet()); } + void PackageSpec::to_string(std::string& s) const { Strings::append(s, this->name(), ':', this->triplet()); } bool operator==(const PackageSpec& left, const PackageSpec& right) { diff --git a/toolsrc/src/vcpkg/packagespecparseresult.cpp b/toolsrc/src/vcpkg/packagespecparseresult.cpp index b12bd12d0..c5254f7be 100644 --- a/toolsrc/src/vcpkg/packagespecparseresult.cpp +++ b/toolsrc/src/vcpkg/packagespecparseresult.cpp @@ -18,4 +18,9 @@ namespace vcpkg default: Checks::unreachable(VCPKG_LINE_INFO); } } + + void to_string(std::string& out, PackageSpecParseResult p) + { + out.append(vcpkg::to_string(p).c_str()); + } } diff --git a/toolsrc/src/vcpkg/paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp index 77c028937..45f939afd 100644 --- a/toolsrc/src/vcpkg/paragraphs.cpp +++ b/toolsrc/src/vcpkg/paragraphs.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include <vcpkg/base/files.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/globalstate.h> #include <vcpkg/paragraphparseresult.h> @@ -286,11 +287,11 @@ namespace vcpkg::Paragraphs { for (auto&& error : results.errors) { - System::println( - System::Color::warning, "Warning: an error occurred while parsing '%s'", error->name); + System::print2( + System::Color::warning, "Warning: an error occurred while parsing '", error->name, "'\n"); } - System::println(System::Color::warning, - "Use '--debug' to get more information about the parse failures.\n"); + System::print2(System::Color::warning, + "Use '--debug' to get more information about the parse failures.\n\n"); } } return std::move(results.paragraphs); diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index a62d4ece5..d6581c2b4 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -2,7 +2,8 @@ #include <vcpkg/base/cofffilereader.h> #include <vcpkg/base/files.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> #include <vcpkg/build.h> #include <vcpkg/packagespec.h> @@ -88,9 +89,9 @@ namespace vcpkg::PostBuildLint const fs::path include_dir = package_dir / "include"; if (!fs.exists(include_dir) || fs.is_empty(include_dir)) { - System::println( - System::Color::warning, - "The folder /include is empty or not present. This indicates the library was not correctly installed."); + System::print2(System::Color::warning, + "The folder /include is empty or not present. This indicates the library was not correctly " + "installed.\n"); return LintStatus::ERROR_DETECTED; } @@ -109,10 +110,10 @@ namespace vcpkg::PostBuildLint if (!files_found.empty()) { - System::println(System::Color::warning, - "Include files should not be duplicated into the /debug/include directory. If this cannot " - "be disabled in the project cmake, use\n" - " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)"); + System::print2(System::Color::warning, + "Include files should not be duplicated into the /debug/include directory. If this cannot " + "be disabled in the project cmake, use\n" + " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)\n"); return LintStatus::ERROR_DETECTED; } @@ -125,9 +126,9 @@ namespace vcpkg::PostBuildLint if (fs.exists(debug_share)) { - System::println(System::Color::warning, - "/debug/share should not exist. Please reorganize any important files, then use\n" - " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)"); + System::print2(System::Color::warning, + "/debug/share should not exist. Please reorganize any important files, then use\n" + " file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)\n"); return LintStatus::ERROR_DETECTED; } @@ -141,9 +142,9 @@ namespace vcpkg::PostBuildLint const fs::path lib_cmake = package_dir / "lib" / "cmake"; if (fs.exists(lib_cmake)) { - System::println( + System::printf( System::Color::warning, - "The /lib/cmake folder should be merged with /debug/lib/cmake and moved to /share/%s/cmake.", + "The /lib/cmake folder should be merged with /debug/lib/cmake and moved to /share/%s/cmake.\n", spec.name()); return LintStatus::ERROR_DETECTED; } @@ -175,9 +176,9 @@ namespace vcpkg::PostBuildLint if (!misplaced_cmake_files.empty()) { - System::println( + System::printf( System::Color::warning, - "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.", + "The following cmake files were found outside /share/%s. Please place cmake files in /share/%s.\n", spec.name(), spec.name()); Files::print_paths(misplaced_cmake_files); @@ -194,9 +195,9 @@ namespace vcpkg::PostBuildLint const fs::path lib_cmake_debug = package_dir / "debug" / "lib" / "cmake"; if (fs.exists(lib_cmake_debug)) { - System::println(System::Color::warning, - "The /debug/lib/cmake folder should be merged with /lib/cmake into /share/%s", - spec.name()); + System::printf(System::Color::warning, + "The /debug/lib/cmake folder should be merged with /lib/cmake into /share/%s\n", + spec.name()); return LintStatus::ERROR_DETECTED; } @@ -210,9 +211,9 @@ namespace vcpkg::PostBuildLint if (!dlls.empty()) { - System::println(System::Color::warning, - "\nThe following dlls were found in /lib or /debug/lib. Please move them to /bin or " - "/debug/bin, respectively."); + System::print2(System::Color::warning, + "\nThe following dlls were found in /lib or /debug/lib. Please move them to /bin or " + "/debug/bin, respectively.\n"); Files::print_paths(dlls); return LintStatus::ERROR_DETECTED; } @@ -251,18 +252,18 @@ namespace vcpkg::PostBuildLint } } - System::println(System::Color::warning, - "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright", - spec.name()); + System::printf(System::Color::warning, + "The software license must be available at ${CURRENT_PACKAGES_DIR}/share/%s/copyright\n", + spec.name()); if (potential_copyright_files.size() == 1) // if there is only one candidate, provide the cmake lines needed to place it in the proper location { const fs::path found_file = potential_copyright_files[0]; const fs::path relative_path = found_file.string().erase( 0, current_buildtrees_dir.string().size() + 1); // The +1 is needed to remove the "/" - System::println( + System::printf( "\n file(COPY ${CURRENT_BUILDTREES_DIR}/%s DESTINATION ${CURRENT_PACKAGES_DIR}/share/%s)\n" - " file(RENAME ${CURRENT_PACKAGES_DIR}/share/%s/%s ${CURRENT_PACKAGES_DIR}/share/%s/copyright)", + " file(RENAME ${CURRENT_PACKAGES_DIR}/share/%s/%s ${CURRENT_PACKAGES_DIR}/share/%s/copyright)\n", relative_path.generic_string(), spec.name(), spec.name(), @@ -271,7 +272,7 @@ namespace vcpkg::PostBuildLint } else if (potential_copyright_files.size() > 1) { - System::println(System::Color::warning, "The following files are potential copyright files:"); + System::print2(System::Color::warning, "The following files are potential copyright files:\n"); Files::print_paths(potential_copyright_files); } return LintStatus::ERROR_DETECTED; @@ -284,9 +285,9 @@ namespace vcpkg::PostBuildLint if (!exes.empty()) { - System::println( + System::print2( System::Color::warning, - "The following EXEs were found in /bin or /debug/bin. EXEs are not valid distribution targets."); + "The following EXEs were found in /bin or /debug/bin. EXEs are not valid distribution targets.\n"); Files::print_paths(exes); return LintStatus::ERROR_DETECTED; } @@ -312,9 +313,9 @@ namespace vcpkg::PostBuildLint if (!dlls_with_no_exports.empty()) { - System::println(System::Color::warning, "The following DLLs have no exports:"); + System::print2(System::Color::warning, "The following DLLs have no exports:\n"); Files::print_paths(dlls_with_no_exports); - System::println(System::Color::warning, "DLLs without any exports are likely a bug in the build script."); + System::print2(System::Color::warning, "DLLs without any exports are likely a bug in the build script.\n"); return LintStatus::ERROR_DETECTED; } @@ -346,9 +347,9 @@ namespace vcpkg::PostBuildLint if (!dlls_with_improper_uwp_bit.empty()) { - System::println(System::Color::warning, "The following DLLs do not have the App Container bit set:"); + System::print2(System::Color::warning, "The following DLLs do not have the App Container bit set:\n"); Files::print_paths(dlls_with_improper_uwp_bit); - System::println(System::Color::warning, "This bit is required for Windows Store apps."); + System::print2(System::Color::warning, "This bit is required for Windows Store apps.\n"); return LintStatus::ERROR_DETECTED; } @@ -381,13 +382,17 @@ namespace vcpkg::PostBuildLint static void print_invalid_architecture_files(const std::string& expected_architecture, std::vector<FileAndArch> binaries_with_invalid_architecture) { - System::println(System::Color::warning, "The following files were built for an incorrect architecture:"); - System::println(); + System::print2(System::Color::warning, "The following files were built for an incorrect architecture:\n\n"); for (const FileAndArch& b : binaries_with_invalid_architecture) { - System::println(" %s", b.file.generic_string()); - System::println("Expected %s, but was: %s", expected_architecture, b.actual_arch); - System::println(); + System::print2(" ", + b.file.u8string(), + "\n" + "Expected ", + expected_architecture, + ", but was: ", + b.actual_arch, + "\n\n"); } } @@ -468,8 +473,8 @@ namespace vcpkg::PostBuildLint return LintStatus::SUCCESS; } - System::println(System::Color::warning, - "DLLs should not be present in a static build, but the following DLLs were found:"); + System::print2(System::Color::warning, + "DLLs should not be present in a static build, but the following DLLs were found:\n"); Files::print_paths(dlls); return LintStatus::ERROR_DETECTED; } @@ -484,26 +489,26 @@ namespace vcpkg::PostBuildLint return LintStatus::SUCCESS; } - System::println(System::Color::warning, - "Mismatching number of debug and release binaries. Found %zd for debug but %zd for release.", - debug_count, - release_count); - System::println("Debug binaries"); + System::printf(System::Color::warning, + "Mismatching number of debug and release binaries. Found %zd for debug but %zd for release.\n", + debug_count, + release_count); + System::print2("Debug binaries\n"); Files::print_paths(debug_binaries); - System::println("Release binaries"); + System::print2("Release binaries\n"); Files::print_paths(release_binaries); if (debug_count == 0) { - System::println(System::Color::warning, "Debug binaries were not found"); + System::print2(System::Color::warning, "Debug binaries were not found\n"); } if (release_count == 0) { - System::println(System::Color::warning, "Release binaries were not found"); + System::print2(System::Color::warning, "Release binaries were not found\n"); } - System::println(); + System::print2("\n"); return LintStatus::ERROR_DETECTED; } @@ -517,11 +522,11 @@ namespace vcpkg::PostBuildLint if (lib_count == 0 && dll_count != 0) { - System::println(System::Color::warning, "Import libs were not present in %s", lib_dir.u8string()); - System::println(System::Color::warning, - "If this is intended, add the following line in the portfile:\n" - " SET(%s enabled)", - to_cmake_variable(BuildPolicy::DLLS_WITHOUT_LIBS)); + System::print2(System::Color::warning, "Import libs were not present in ", lib_dir.u8string(), "\n"); + System::printf(System::Color::warning, + "If this is intended, add the following line in the portfile:\n" + " SET(%s enabled)\n", + to_cmake_variable(BuildPolicy::DLLS_WITHOUT_LIBS)); return LintStatus::ERROR_DETECTED; } @@ -541,19 +546,21 @@ namespace vcpkg::PostBuildLint if (fs.exists(bin)) { - System::println(System::Color::warning, - R"(There should be no bin\ directory in a static build, but %s is present.)", - bin.u8string()); + System::printf(System::Color::warning, + R"(There should be no bin\ directory in a static build, but %s is present.)" + "\n", + bin.u8string()); } if (fs.exists(debug_bin)) { - System::println(System::Color::warning, - R"(There should be no debug\bin\ directory in a static build, but %s is present.)", - debug_bin.u8string()); + System::printf(System::Color::warning, + R"(There should be no debug\bin\ directory in a static build, but %s is present.)" + "\n", + debug_bin.u8string()); } - System::println( + System::print2( System::Color::warning, R"(If the creation of bin\ and/or debug\bin\ cannot be disabled, use this in the portfile to remove them)" "\n" @@ -563,7 +570,7 @@ namespace vcpkg::PostBuildLint R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin ${CURRENT_PACKAGES_DIR}/debug/bin))###" "\n" R"###( endif())###" - "\n"); + "\n\n"); return LintStatus::ERROR_DETECTED; } @@ -578,10 +585,10 @@ namespace vcpkg::PostBuildLint if (!empty_directories.empty()) { - System::println(System::Color::warning, "There should be no empty directories in %s", dir.generic_string()); - System::println("The following empty directories were found: "); + System::print2(System::Color::warning, "There should be no empty directories in ", dir.u8string(), "\n"); + System::print2("The following empty directories were found:\n"); Files::print_paths(empty_directories); - System::println( + System::print2( System::Color::warning, "If a directory should be populated but is not, this might indicate an error in the portfile.\n" "If the directories are not needed and their creation cannot be disabled, use something like this in " @@ -589,6 +596,7 @@ namespace vcpkg::PostBuildLint "\n" R"###( file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/a/dir ${CURRENT_PACKAGES_DIR}/some/other/dir))###" "\n" + "\n" "\n"); return LintStatus::ERROR_DETECTED; } @@ -635,18 +643,17 @@ namespace vcpkg::PostBuildLint if (!libs_with_invalid_crt.empty()) { - System::println(System::Color::warning, - "Expected %s crt linkage, but the following libs had invalid crt linkage:", - expected_build_type.to_string()); - System::println(); + System::printf(System::Color::warning, + "Expected %s crt linkage, but the following libs had invalid crt linkage:\n\n", + expected_build_type.to_string()); for (const BuildTypeAndFile btf : libs_with_invalid_crt) { - System::println(" %s: %s", btf.file.generic_string(), btf.build_type.to_string()); + System::printf(" %s: %s\n", btf.file.generic_string(), btf.build_type.to_string()); } - System::println(); + System::print2("\n"); - System::println(System::Color::warning, - "To inspect the lib files, use:\n dumpbin.exe /directives mylibfile.lib"); + System::print2(System::Color::warning, + "To inspect the lib files, use:\n dumpbin.exe /directives mylibfile.lib\n"); return LintStatus::ERROR_DETECTED; } @@ -686,16 +693,15 @@ namespace vcpkg::PostBuildLint if (!dlls_with_outdated_crt.empty()) { - System::println(System::Color::warning, "Detected outdated dynamic CRT in the following files:"); - System::println(); + System::print2(System::Color::warning, "Detected outdated dynamic CRT in the following files:\n\n"); for (const OutdatedDynamicCrtAndFile btf : dlls_with_outdated_crt) { - System::println(" %s: %s", btf.file.generic_string(), btf.outdated_crt.name); + System::print2(" ", btf.file.u8string(), ": ", btf.outdated_crt.name, "\n"); } - System::println(); + System::print2("\n"); - System::println(System::Color::warning, - "To inspect the dll files, use:\n dumpbin.exe /dependents mydllfile.dll"); + System::print2(System::Color::warning, + "To inspect the dll files, use:\n dumpbin.exe /dependents mydllfile.dll\n"); return LintStatus::ERROR_DETECTED; } @@ -707,8 +713,8 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> misplaced_files = fs.get_files_non_recursive(dir); Util::erase_remove_if(misplaced_files, [&fs](const fs::path& path) { const std::string filename = path.filename().generic_string(); - if (Strings::case_insensitive_ascii_equals(filename.c_str(), "CONTROL") || - Strings::case_insensitive_ascii_equals(filename.c_str(), "BUILD_INFO")) + if (Strings::case_insensitive_ascii_equals(filename, "CONTROL") || + Strings::case_insensitive_ascii_equals(filename, "BUILD_INFO")) { return true; } @@ -718,9 +724,9 @@ namespace vcpkg::PostBuildLint if (!misplaced_files.empty()) { - System::println(System::Color::warning, "The following files are placed in\n%s: ", dir.u8string()); + System::print2(System::Color::warning, "The following files are placed in\n", dir.u8string(), ":\n"); Files::print_paths(misplaced_files); - System::println(System::Color::warning, "Files cannot be present in those directories.\n"); + System::print2(System::Color::warning, "Files cannot be present in those directories.\n\n"); return LintStatus::ERROR_DETECTED; } @@ -853,19 +859,21 @@ namespace vcpkg::PostBuildLint const PreBuildInfo& pre_build_info, const BuildInfo& build_info) { - System::println("-- Performing post-build validation"); + System::print2("-- Performing post-build validation\n"); const size_t error_count = perform_all_checks_and_return_error_count(spec, paths, pre_build_info, build_info); if (error_count != 0) { const fs::path portfile = paths.ports / spec.name() / "portfile.cmake"; - System::println(System::Color::error, - "Found %u error(s). Please correct the portfile:\n %s", - error_count, - portfile.string()); + System::print2(System::Color::error, + "Found ", + error_count, + " error(s). Please correct the portfile:\n ", + portfile.u8string(), + "\n"); } - System::println("-- Performing post-build validation done"); + System::print2("-- Performing post-build validation done\n"); return error_count; } diff --git a/toolsrc/src/vcpkg/remove.cpp b/toolsrc/src/vcpkg/remove.cpp index 921a04c23..685cdfdc3 100644 --- a/toolsrc/src/vcpkg/remove.cpp +++ b/toolsrc/src/vcpkg/remove.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/commands.h> #include <vcpkg/dependencies.h> @@ -58,7 +58,8 @@ namespace vcpkg::Remove const auto status = fs.symlink_status(target, ec); if (ec) { - System::println(System::Color::error, "failed: status(%s): %s", target.u8string(), ec.message()); + System::print2( + System::Color::error, "failed: status(", target.u8string(), "): ", ec.message(), "\n"); continue; } @@ -76,22 +77,22 @@ namespace vcpkg::Remove fs.remove(target, ec); if (ec) { - System::println( - System::Color::error, "failed: remove(%s): %s", target.u8string(), ec.message()); + System::printf( + System::Color::error, "failed: remove(%s): %s\n", target.u8string(), ec.message()); } #else - System::println( - System::Color::error, "failed: remove(%s): %s", target.u8string(), ec.message()); + System::printf( + System::Color::error, "failed: remove(%s): %s\n", target.u8string(), ec.message()); #endif } } else if (!fs::stdfs::exists(status)) { - System::println(System::Color::warning, "Warning: %s: file not found", target.u8string()); + System::printf(System::Color::warning, "Warning: %s: file not found\n", target.u8string()); } else { - System::println(System::Color::warning, "Warning: %s: cannot handle file type", target.u8string()); + System::printf(System::Color::warning, "Warning: %s: cannot handle file type\n", target.u8string()); } } @@ -105,7 +106,7 @@ namespace vcpkg::Remove fs.remove(*b, ec); if (ec) { - System::println(System::Color::error, "failed: %s", ec.message()); + System::print2(System::Color::error, "failed: ", ec.message(), "\n"); } } } @@ -143,10 +144,10 @@ namespace vcpkg::Remove switch (plan_type) { case RemovePlanType::NOT_INSTALLED: - System::println("The following packages are not installed, so not removed:\n%s", as_string); + System::print2("The following packages are not installed, so not removed:\n", as_string, "\n"); continue; case RemovePlanType::REMOVE: - System::println("The following packages will be removed:\n%s", as_string); + System::print2("The following packages will be removed:\n", as_string, "\n"); continue; default: Checks::unreachable(VCPKG_LINE_INFO); } @@ -163,12 +164,12 @@ namespace vcpkg::Remove switch (action.plan_type) { case RemovePlanType::NOT_INSTALLED: - System::println(System::Color::success, "Package %s is not installed", display_name); + System::printf(System::Color::success, "Package %s is not installed\n", display_name); break; case RemovePlanType::REMOVE: - System::println("Removing package %s... ", display_name); + System::printf("Removing package %s...\n", display_name); remove_package(paths, action.spec, status_db); - System::println(System::Color::success, "Removing package %s... done", display_name); + System::printf(System::Color::success, "Removing package %s... done\n", display_name); break; case RemovePlanType::UNKNOWN: default: Checks::unreachable(VCPKG_LINE_INFO); @@ -176,11 +177,11 @@ namespace vcpkg::Remove if (purge == Purge::YES) { - System::println("Purging package %s... ", display_name); + System::printf("Purging package %s...\n", display_name); Files::Filesystem& fs = paths.get_filesystem(); std::error_code ec; fs.remove_all(paths.packages / action.spec.dir(), ec); - System::println(System::Color::success, "Purging package %s... done", display_name); + System::printf(System::Color::success, "Purging package %s... done\n", display_name); } } @@ -224,7 +225,7 @@ namespace vcpkg::Remove { if (args.command_arguments.size() != 0) { - System::println(System::Color::error, "Error: 'remove' accepts either libraries or '--outdated'"); + System::print2(System::Color::error, "Error: 'remove' accepts either libraries or '--outdated'\n"); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -235,7 +236,7 @@ namespace vcpkg::Remove if (specs.empty()) { - System::println(System::Color::success, "There are no outdated packages."); + System::print2(System::Color::success, "There are no outdated packages.\n"); Checks::exit_success(VCPKG_LINE_INFO); } } @@ -243,11 +244,12 @@ namespace vcpkg::Remove { if (args.command_arguments.size() < 1) { - System::println(System::Color::error, "Error: 'remove' accepts either libraries or '--outdated'"); + System::print2(System::Color::error, "Error: 'remove' accepts either libraries or '--outdated'\n"); Checks::exit_fail(VCPKG_LINE_INFO); } specs = Util::fmap(args.command_arguments, [&](auto&& arg) { - return Input::check_and_get_package_spec(arg, default_triplet, COMMAND_STRUCTURE.example_text); + return Input::check_and_get_package_spec( + std::string(arg), default_triplet, COMMAND_STRUCTURE.example_text); }); for (auto&& spec : specs) @@ -258,8 +260,8 @@ namespace vcpkg::Remove const bool purge_was_passed = Util::Sets::contains(options.switches, OPTION_PURGE); if (purge_was_passed && no_purge_was_passed) { - System::println(System::Color::error, "Error: cannot specify both --no-purge and --purge."); - System::print(COMMAND_STRUCTURE.example_text); + System::print2(System::Color::error, "Error: cannot specify both --no-purge and --purge.\n"); + System::print2(COMMAND_STRUCTURE.example_text); Checks::exit_fail(VCPKG_LINE_INFO); } const Purge purge = to_purge(purge_was_passed || !no_purge_was_passed); @@ -280,13 +282,13 @@ namespace vcpkg::Remove if (has_non_user_requested_packages) { - System::println(System::Color::warning, - "Additional packages (*) need to be removed to complete this operation."); + System::print2(System::Color::warning, + "Additional packages (*) need to be removed to complete this operation.\n"); if (!is_recursive) { - System::println(System::Color::warning, - "If you are sure you want to remove them, run the command with the --recurse option"); + System::print2(System::Color::warning, + "If you are sure you want to remove them, run the command with the --recurse option\n"); Checks::exit_fail(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/sourceparagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index baa8b070b..b495c5f1d 100644 --- a/toolsrc/src/vcpkg/sourceparagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -6,7 +6,8 @@ #include <vcpkg/base/checks.h> #include <vcpkg/base/expected.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/span.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> namespace vcpkg @@ -47,8 +48,12 @@ namespace vcpkg Checks::check_exit(VCPKG_LINE_INFO, error_info != nullptr); if (error_info->error) { - System::println( - System::Color::error, "Error: while loading %s: %s", error_info->name, error_info->error.message()); + System::print2(System::Color::error, + "Error: while loading ", + error_info->name, + ": ", + error_info->error.message(), + '\n'); } } @@ -57,31 +62,36 @@ namespace vcpkg { if (!error_info->extra_fields.empty()) { - System::println(System::Color::error, - "Error: There are invalid fields in the control file of %s", - error_info->name); - System::println("The following fields were not expected:\n\n %s\n", - Strings::join("\n ", error_info->extra_fields)); + System::print2(System::Color::error, + "Error: There are invalid fields in the control file of ", + error_info->name, + '\n'); + System::print2("The following fields were not expected:\n\n ", + Strings::join("\n ", error_info->extra_fields), + "\n\n"); have_remaining_fields = true; } } if (have_remaining_fields) { - System::println("This is the list of valid fields (case-sensitive): \n\n %s\n", - Strings::join("\n ", get_list_of_valid_fields())); - System::println("Different source may be available for vcpkg. Use .\\bootstrap-vcpkg.bat to update.\n"); + System::print2("This is the list of valid fields (case-sensitive): \n\n ", + Strings::join("\n ", get_list_of_valid_fields()), + "\n\n"); + System::print2("Different source may be available for vcpkg. Use .\\bootstrap-vcpkg.bat to update.\n\n"); } for (auto&& error_info : error_info_list) { if (!error_info->missing_fields.empty()) { - System::println(System::Color::error, - "Error: There are missing fields in the control file of %s", - error_info->name); - System::println("The following fields were missing:\n\n %s\n", - Strings::join("\n ", error_info->missing_fields)); + System::print2(System::Color::error, + "Error: There are missing fields in the control file of ", + error_info->name, + '\n'); + System::print2("The following fields were missing:\n\n ", + Strings::join("\n ", error_info->missing_fields), + "\n\n"); } } } diff --git a/toolsrc/src/vcpkg/tools.cpp b/toolsrc/src/vcpkg/tools.cpp index 99a2f4fb8..7232971c7 100644 --- a/toolsrc/src/vcpkg/tools.cpp +++ b/toolsrc/src/vcpkg/tools.cpp @@ -8,9 +8,10 @@ #include <vcpkg/base/downloads.h> #include <vcpkg/base/files.h> #include <vcpkg/base/optional.h> -#include <vcpkg/base/stringrange.h> #include <vcpkg/base/strings.h> -#include <vcpkg/base/system.h> +#include <vcpkg/base/stringview.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> namespace vcpkg @@ -87,15 +88,15 @@ namespace vcpkg } const std::string tool_data = - StringRange::find_exactly_one_enclosed(XML, match_tool_entry[0], "</tool>").to_string(); + StringView::find_exactly_one_enclosed(XML, match_tool_entry[0], "</tool>").to_string(); const std::string version_as_string = - StringRange::find_exactly_one_enclosed(tool_data, "<version>", "</version>").to_string(); + StringView::find_exactly_one_enclosed(tool_data, "<version>", "</version>").to_string(); const std::string exe_relative_path = - StringRange::find_exactly_one_enclosed(tool_data, "<exeRelativePath>", "</exeRelativePath>").to_string(); - const std::string url = StringRange::find_exactly_one_enclosed(tool_data, "<url>", "</url>").to_string(); + StringView::find_exactly_one_enclosed(tool_data, "<exeRelativePath>", "</exeRelativePath>").to_string(); + const std::string url = StringView::find_exactly_one_enclosed(tool_data, "<url>", "</url>").to_string(); const std::string sha512 = - StringRange::find_exactly_one_enclosed(tool_data, "<sha512>", "</sha512>").to_string(); - auto archive_name = StringRange::find_at_most_one_enclosed(tool_data, "<archiveName>", "</archiveName>"); + StringView::find_exactly_one_enclosed(tool_data, "<sha512>", "</sha512>").to_string(); + auto archive_name = StringView::find_at_most_one_enclosed(tool_data, "<archiveName>", "</archiveName>"); const Optional<std::array<int, 3>> version = parse_version_string(version_as_string); Checks::check_exit(VCPKG_LINE_INFO, @@ -172,16 +173,16 @@ namespace vcpkg tool_name, version_as_string, tool_name); - System::println("A suitable version of %s was not found (required v%s). Downloading portable %s v%s...", - tool_name, - version_as_string, - tool_name, - version_as_string); + System::printf("A suitable version of %s was not found (required v%s). Downloading portable %s v%s...\n", + tool_name, + version_as_string, + tool_name, + version_as_string); auto& fs = paths.get_filesystem(); if (!fs.exists(tool_data.download_path)) { - System::println("Downloading %s...", tool_name); - System::println(" %s -> %s", tool_data.url, tool_data.download_path.string()); + System::print2("Downloading ", tool_name, "...\n"); + System::print2(" ", tool_data.url, " -> ", tool_data.download_path.u8string(), "\n"); Downloads::download_file(fs, tool_data.url, tool_data.download_path, tool_data.sha512); } else @@ -191,7 +192,7 @@ namespace vcpkg if (tool_data.is_archive) { - System::println("Extracting %s...", tool_name); + System::print2("Extracting ", tool_name, "...\n"); Archives::extract_archive(paths, tool_data.download_path, tool_data.tool_dir_path); } else @@ -286,7 +287,7 @@ cmake version 3.10.2 CMake suite maintained and supported by Kitware (kitware.com/cmake). */ - return StringRange::find_exactly_one_enclosed(rc.output, "cmake version ", "\n").to_string(); + return StringView::find_exactly_one_enclosed(rc.output, "cmake version ", "\n").to_string(); } }; @@ -352,7 +353,7 @@ Type 'NuGet help <command>' for help on a specific command. [[[List of available commands follows]]] */ - return StringRange::find_exactly_one_enclosed(rc.output, "NuGet Version: ", "\n").to_string(); + return StringView::find_exactly_one_enclosed(rc.output, "NuGet Version: ", "\n").to_string(); } }; diff --git a/toolsrc/src/vcpkg/triplet.cpp b/toolsrc/src/vcpkg/triplet.cpp index c4ad3f690..1abfa0b39 100644 --- a/toolsrc/src/vcpkg/triplet.cpp +++ b/toolsrc/src/vcpkg/triplet.cpp @@ -43,9 +43,9 @@ namespace vcpkg bool operator!=(const Triplet& left, const Triplet& right) { return !(left == right); } - Triplet Triplet::from_canonical_name(const std::string& triplet_as_string) + Triplet Triplet::from_canonical_name(std::string&& triplet_as_string) { - std::string s(Strings::ascii_to_lowercase(triplet_as_string)); + std::string s(Strings::ascii_to_lowercase(std::move(triplet_as_string))); const auto p = g_triplet_instances.emplace(std::move(s)); return &*p.first; } @@ -53,5 +53,6 @@ namespace vcpkg const std::string& Triplet::canonical_name() const { return this->m_instance->value; } const std::string& Triplet::to_string() const { return this->canonical_name(); } + void Triplet::to_string(std::string& out) const { out.append(this->canonical_name()); } size_t Triplet::hash_code() const { return m_instance->hash; } } diff --git a/toolsrc/src/vcpkg/update.cpp b/toolsrc/src/vcpkg/update.cpp index 57259f952..344192d59 100644 --- a/toolsrc/src/vcpkg/update.cpp +++ b/toolsrc/src/vcpkg/update.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/help.h> #include <vcpkg/paragraphs.h> @@ -53,7 +53,7 @@ namespace vcpkg::Update void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { args.parse_arguments(COMMAND_STRUCTURE); - System::println("Using local portfile versions. To update the local portfiles, use `git pull`."); + System::print2("Using local portfile versions. To update the local portfiles, use `git pull`.\n"); const StatusParagraphs status_db = database_load_check(paths); @@ -64,21 +64,22 @@ namespace vcpkg::Update if (outdated_packages.empty()) { - System::println("No packages need updating."); + System::print2("No packages need updating.\n"); } else { - System::println("The following packages differ from their port versions:"); + System::print2("The following packages differ from their port versions:\n"); for (auto&& package : outdated_packages) { - System::println(" %-32s %s", package.spec, package.version_diff.to_string()); + System::printf(" %-32s %s\n", package.spec, package.version_diff.to_string()); } - System::println("\n" - "To update these packages and all dependencies, run\n" - " .\\vcpkg upgrade\n" - "\n" - "To only remove outdated packages, run\n" - " .\\vcpkg remove --outdated\n"); + System::print2("\n" + "To update these packages and all dependencies, run\n" + " .\\vcpkg upgrade\n" + "\n" + "To only remove outdated packages, run\n" + " .\\vcpkg remove --outdated\n" + "\n"); } Checks::exit_success(VCPKG_LINE_INFO); diff --git a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index 5b3cf9ef1..8565c28f9 100644 --- a/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include <vcpkg/base/system.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/commands.h> #include <vcpkg/globalstate.h> #include <vcpkg/help.h> @@ -16,7 +16,7 @@ namespace vcpkg { if (arg_begin == arg_end) { - System::println(System::Color::error, "Error: expected value after %s", option_name); + System::print2(System::Color::error, "Error: expected value after ", option_name, '\n'); Metrics::g_metrics.lock()->track_property("error", "error option name"); Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -24,7 +24,7 @@ namespace vcpkg if (option_field != nullptr) { - System::println(System::Color::error, "Error: %s specified multiple times", option_name); + System::print2(System::Color::error, "Error: ", option_name, " specified multiple times\n"); Metrics::g_metrics.lock()->track_property("error", "error option specified multiple times"); Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -37,7 +37,7 @@ namespace vcpkg { if (option_field && option_field != new_setting) { - System::println(System::Color::error, "Error: conflicting values specified for --%s", option_name); + System::print2(System::Color::error, "Error: conflicting values specified for --", option_name, '\n'); Metrics::g_metrics.lock()->track_property("error", "error conflicting switches"); Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -65,7 +65,7 @@ namespace vcpkg auto lines = fs.read_lines(fs::u8path(arg)); if (!lines.has_value()) { - System::println(System::Color::error, "Error: Could not open response file %s", arg); + System::print2(System::Color::error, "Error: Could not open response file ", arg, '\n'); Checks::exit_fail(VCPKG_LINE_INFO); } std::copy(lines.get()->begin(), lines.get()->end(), std::back_inserter(v)); @@ -199,11 +199,11 @@ namespace vcpkg { if (actual_arg_count != command_structure.minimum_arity) { - System::println(System::Color::error, - "Error: '%s' requires %u arguments, but %u were provided.", - this->command, - command_structure.minimum_arity, - actual_arg_count); + System::printf(System::Color::error, + "Error: '%s' requires %u arguments, but %u were provided.\n", + this->command, + command_structure.minimum_arity, + actual_arg_count); failed = true; } } @@ -211,20 +211,20 @@ namespace vcpkg { if (actual_arg_count < command_structure.minimum_arity) { - System::println(System::Color::error, - "Error: '%s' requires at least %u arguments, but %u were provided", - this->command, - command_structure.minimum_arity, - actual_arg_count); + System::printf(System::Color::error, + "Error: '%s' requires at least %u arguments, but %u were provided\n", + this->command, + command_structure.minimum_arity, + actual_arg_count); failed = true; } if (actual_arg_count > command_structure.maximum_arity) { - System::println(System::Color::error, - "Error: '%s' requires at most %u arguments, but %u were provided", - this->command, - command_structure.maximum_arity, - actual_arg_count); + System::printf(System::Color::error, + "Error: '%s' requires at most %u arguments, but %u were provided\n", + this->command, + command_structure.maximum_arity, + actual_arg_count); failed = true; } } @@ -238,8 +238,8 @@ namespace vcpkg if (it->second.has_value()) { // Having a string value indicates it was passed like '--a=xyz' - System::println( - System::Color::error, "Error: The option '%s' does not accept an argument.", option.name); + System::printf( + System::Color::error, "Error: The option '%s' does not accept an argument.\n", option.name); failed = true; } else @@ -258,8 +258,8 @@ namespace vcpkg if (!it->second.has_value()) { // Not having a string value indicates it was passed like '--a' - System::println( - System::Color::error, "Error: The option '%s' must be passed an argument.", option.name); + System::printf( + System::Color::error, "Error: The option '%s' must be passed an argument.\n", option.name); failed = true; } else @@ -272,12 +272,12 @@ namespace vcpkg if (!options_copy.empty()) { - System::println(System::Color::error, "Unknown option(s) for command '%s':", this->command); + System::printf(System::Color::error, "Unknown option(s) for command '%s':\n", this->command); for (auto&& option : options_copy) { - System::println(" %s", option.first); + System::print2(" ", option.first, "\n"); } - System::println(); + System::print2("\n"); failed = true; } @@ -294,21 +294,21 @@ namespace vcpkg { if (!command_structure.example_text.empty()) { - System::println("%s", command_structure.example_text); + System::print2(command_structure.example_text, "\n"); } - System::println("Options:"); + System::print2("Options:\n"); for (auto&& option : command_structure.options.switches) { - System::println(" %-40s %s", option.name, option.short_help_text); + System::printf(" %-40s %s\n", option.name, option.short_help_text); } for (auto&& option : command_structure.options.settings) { - System::println(" %-40s %s", (option.name + "=..."), option.short_help_text); + System::printf(" %-40s %s\n", (option.name + "=..."), option.short_help_text); } - System::println(" %-40s %s", "--triplet <t>", "Set the default triplet for unqualified packages"); - System::println(" %-40s %s", - "--vcpkg-root <path>", - "Specify the vcpkg directory to use instead of current directory or tool directory"); + System::printf(" %-40s %s\n", "--triplet <t>", "Set the default triplet for unqualified packages"); + System::printf(" %-40s %s\n", + "--vcpkg-root <path>", + "Specify the vcpkg directory to use instead of current directory or tool directory"); } } diff --git a/toolsrc/src/vcpkg/vcpkgpaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index 47994660c..0f99e01d3 100644 --- a/toolsrc/src/vcpkg/vcpkgpaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -152,7 +152,7 @@ namespace vcpkg const std::vector<Toolset>& vs_toolsets = this->toolsets.get_lazy([this]() { return VisualStudio::find_toolset_instances_preferred_first(*this); }); - std::vector<const Toolset*> candidates = Util::element_pointers(vs_toolsets); + std::vector<const Toolset*> candidates = Util::fmap(vs_toolsets, [](auto&& x) { return &x; }); const auto tsv = prebuildinfo.platform_toolset.get(); auto vsp = prebuildinfo.visual_studio_path.get(); if (!vsp && !default_vs_path.empty()) diff --git a/toolsrc/src/vcpkg/visualstudio.cpp b/toolsrc/src/vcpkg/visualstudio.cpp index d2fccc716..df3c70de2 100644 --- a/toolsrc/src/vcpkg/visualstudio.cpp +++ b/toolsrc/src/vcpkg/visualstudio.cpp @@ -3,7 +3,9 @@ #if defined(_WIN32) #include <vcpkg/base/sortedvector.h> -#include <vcpkg/base/stringrange.h> +#include <vcpkg/base/stringview.h> +#include <vcpkg/base/system.print.h> +#include <vcpkg/base/system.process.h> #include <vcpkg/base/util.h> #include <vcpkg/visualstudio.h> @@ -90,11 +92,11 @@ namespace vcpkg::VisualStudio code_and_output.output); const auto instance_entries = - StringRange::find_all_enclosed(code_and_output.output, "<instance>", "</instance>"); - for (const StringRange& instance : instance_entries) + StringView::find_all_enclosed(code_and_output.output, "<instance>", "</instance>"); + for (const StringView& instance : instance_entries) { auto maybe_is_prerelease = - StringRange::find_at_most_one_enclosed(instance, "<isPrerelease>", "</isPrerelease>"); + StringView::find_at_most_one_enclosed(instance, "<isPrerelease>", "</isPrerelease>"); VisualStudioInstance::ReleaseType release_type = VisualStudioInstance::ReleaseType::LEGACY; if (const auto p = maybe_is_prerelease.get()) @@ -109,9 +111,9 @@ namespace vcpkg::VisualStudio } instances.emplace_back( - StringRange::find_exactly_one_enclosed(instance, "<installationPath>", "</installationPath>") + StringView::find_exactly_one_enclosed(instance, "<installationPath>", "</installationPath>") .to_string(), - StringRange::find_exactly_one_enclosed(instance, "<installationVersion>", "</installationVersion>") + StringView::find_exactly_one_enclosed(instance, "<installationVersion>", "</installationVersion>") .to_string(), release_type); } @@ -326,23 +328,23 @@ namespace vcpkg::VisualStudio if (!excluded_toolsets.empty()) { - System::println( + System::print2( System::Color::warning, - "Warning: The following VS instances are excluded because the English language pack is unavailable."); + "Warning: The following VS instances are excluded because the English language pack is unavailable.\n"); for (const Toolset& toolset : excluded_toolsets) { - System::println(" %s", toolset.visual_studio_root_path.u8string()); + System::print2(" ", toolset.visual_studio_root_path.u8string(), '\n'); } - System::println(System::Color::warning, "Please install the English language pack."); + System::print2(System::Color::warning, "Please install the English language pack.\n"); } if (found_toolsets.empty()) { - System::println(System::Color::error, "Could not locate a complete toolset."); - System::println("The following paths were examined:"); + System::print2(System::Color::error, "Could not locate a complete toolset.\n"); + System::print2("The following paths were examined:\n"); for (const fs::path& path : paths_examined) { - System::println(" %s", path.u8string()); + System::print2(" ", path.u8string(), '\n'); } Checks::exit_fail(VCPKG_LINE_INFO); } diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 8df9b5b9d..a64eb42fd 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -210,11 +210,11 @@ <ClCompile Include="..\src\vcpkg\base\enums.cpp" />
<ClCompile Include="..\src\vcpkg\base\files.cpp" />
<ClCompile Include="..\src\vcpkg\base\hash.cpp" />
- <ClCompile Include="..\src\vcpkg\base\lineinfo.cpp" />
<ClCompile Include="..\src\vcpkg\base\machinetype.cpp" />
- <ClCompile Include="..\src\vcpkg\base\stringrange.cpp" />
<ClCompile Include="..\src\vcpkg\base\strings.cpp" />
+ <ClCompile Include="..\src\vcpkg\base\stringview.cpp" />
<ClCompile Include="..\src\vcpkg\base\system.cpp" />
+ <ClCompile Include="..\src\vcpkg\base\system.print.cpp" />
<ClCompile Include="..\src\vcpkg\binaryparagraph.cpp" />
<ClCompile Include="..\src\vcpkg\build.cpp" />
<ClCompile Include="..\src\vcpkg\commands.autocomplete.cpp" />
diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 3e0ccd885..36840c509 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -177,9 +177,6 @@ <ClCompile Include="..\src\vcpkg\base\files.cpp">
<Filter>Source Files\vcpkg\base</Filter>
</ClCompile>
- <ClCompile Include="..\src\vcpkg\base\lineinfo.cpp">
- <Filter>Source Files\vcpkg\base</Filter>
- </ClCompile>
<ClCompile Include="..\src\vcpkg\base\machinetype.cpp">
<Filter>Source Files\vcpkg\base</Filter>
</ClCompile>
@@ -201,9 +198,6 @@ <ClCompile Include="..\src\vcpkg\visualstudio.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
- <ClCompile Include="..\src\vcpkg\base\stringrange.cpp">
- <Filter>Source Files\vcpkg\base</Filter>
- </ClCompile>
<ClCompile Include="..\src\vcpkg\tools.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
@@ -216,6 +210,12 @@ <ClCompile Include="..\src\vcpkg\commands.xvsinstances.cpp">
<Filter>Source Files\vcpkg</Filter>
</ClCompile>
+ <ClCompile Include="..\src\vcpkg\base\stringview.cpp">
+ <Filter>Source Files\vcpkg\base</Filter>
+ </ClCompile>
+ <ClCompile Include="..\src\vcpkg\base\system.print.cpp">
+ <Filter>Source Files\vcpkg\base</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\pch.h">
|
