diff options
| author | Barath Kannan <barathsotd@gmail.com> | 2017-10-17 20:25:12 +1100 |
|---|---|---|
| committer | Barath Kannan <barathsotd@gmail.com> | 2017-10-17 20:25:12 +1100 |
| commit | 48128e5b4dc964a306737e829affe349d8c6956c (patch) | |
| tree | 414b608b8ad3037d0324bb77c83881c4306ef521 | |
| parent | ddc421acbc8bc9dd1d448190ac173b9d11e942dd (diff) | |
| parent | 7ed8d4f75e903fdad4c02b4e784f2f4bcb30a3b0 (diff) | |
| download | vcpkg-48128e5b4dc964a306737e829affe349d8c6956c.tar.gz vcpkg-48128e5b4dc964a306737e829affe349d8c6956c.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg into qt5_modular
| -rw-r--r-- | ports/abseil/CMakeLists.txt | 32 | ||||
| -rw-r--r-- | ports/abseil/CONTROL | 3 | ||||
| -rw-r--r-- | ports/abseil/fix-intrin.patch | 12 | ||||
| -rw-r--r-- | ports/abseil/portfile.cmake | 10 | ||||
| -rw-r--r-- | ports/antlr4/portfile.cmake | 4 | ||||
| -rw-r--r-- | ports/bond/portfile.cmake | 4 | ||||
| -rw-r--r-- | ports/butteraugli/CMakeLists.txt | 24 | ||||
| -rw-r--r-- | ports/cctz/CMakeLists.txt | 36 | ||||
| -rw-r--r-- | ports/cctz/CONTROL | 3 | ||||
| -rw-r--r-- | ports/cctz/portfile.cmake | 24 | ||||
| -rw-r--r-- | ports/celero/CONTROL | 3 | ||||
| -rw-r--r-- | ports/celero/portfile.cmake | 29 | ||||
| -rw-r--r-- | ports/eastl/CONTROL | 4 | ||||
| -rw-r--r-- | ports/eastl/portfile.cmake | 29 | ||||
| -rw-r--r-- | ports/freeimage/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | ports/gdal/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch | 70 | ||||
| -rw-r--r-- | ports/gdal/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch (renamed from ports/gdal/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch) | 25 | ||||
| -rw-r--r-- | ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch | 14 | ||||
| -rw-r--r-- | ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch | 26 | ||||
| -rw-r--r-- | ports/gdal/0003-Fix-openjpeg-include.patch | 20 | ||||
| -rw-r--r-- | ports/gdal/0004-Fix-openjpeg-include.patch | 19 | ||||
| -rw-r--r-- | ports/gdal/CONTROL | 2 | ||||
| -rw-r--r-- | ports/gdal/portfile.cmake | 23 | ||||
| -rw-r--r-- | ports/imgui/CMakeLists.txt | 43 | ||||
| -rw-r--r-- | ports/imgui/CONTROL | 4 | ||||
| -rw-r--r-- | ports/imgui/portfile.cmake | 33 | ||||
| -rw-r--r-- | ports/libidn2/CMakeLists.txt | 105 | ||||
| -rw-r--r-- | ports/libidn2/CONTROL | 4 | ||||
| -rw-r--r-- | ports/libidn2/config.h | 995 | ||||
| -rw-r--r-- | ports/libidn2/portfile.cmake | 48 | ||||
| -rw-r--r-- | ports/libidn2/string.h | 10 | ||||
| -rw-r--r-- | ports/libjpeg-turbo/portfile.cmake | 15 | ||||
| -rw-r--r-- | ports/libnice/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | ports/libtheora/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | ports/mpfr/CONTROL | 2 | ||||
| -rw-r--r-- | ports/mpfr/portfile.cmake | 8 | ||||
| -rw-r--r-- | ports/msmpi/portfile.cmake | 10 | ||||
| -rw-r--r-- | ports/openni2/CONTROL | 2 | ||||
| -rw-r--r-- | ports/openni2/portfile.cmake | 38 | ||||
| -rw-r--r-- | ports/openni2/replace_environment_variable.patch (renamed from ports/openni2/replace_environment_variable.patch.in) | 16 | ||||
| -rw-r--r-- | ports/pcl/CONTROL | 4 | ||||
| -rw-r--r-- | ports/pcl/portfile.cmake | 2 | ||||
| -rw-r--r-- | ports/shaderc/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | ports/shaderc/CMakeLists_spirv.txt | 2 | ||||
| -rw-r--r-- | ports/spatialite-tools/CONTROL | 4 | ||||
| -rw-r--r-- | ports/spatialite-tools/fix-makefiles.patch | 128 | ||||
| -rw-r--r-- | ports/spatialite-tools/portfile.cmake | 118 | ||||
| -rw-r--r-- | ports/tiny-dnn/CONTROL | 3 | ||||
| -rw-r--r-- | ports/tiny-dnn/portfile.cmake | 15 | ||||
| -rw-r--r-- | ports/vtk/CONTROL | 4 | ||||
| -rw-r--r-- | ports/vtk/FindGDAL.cmake | 127 | ||||
| -rw-r--r-- | ports/vtk/fix-find-libharu.patch | 18 | ||||
| -rw-r--r-- | ports/vtk/fix-find-mysql.patch | 10 | ||||
| -rw-r--r-- | ports/vtk/fix-find-odbc.patch | 11 | ||||
| -rw-r--r-- | ports/vtk/portfile.cmake | 162 | ||||
| -rw-r--r-- | ports/zziplib/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | scripts/buildsystems/vcpkg.cmake | 267 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_acquire_depot_tools.cmake | 2 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_configure_cmake.cmake | 108 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_download_distfile.cmake | 2 | ||||
| -rw-r--r-- | scripts/cmake/vcpkg_find_acquire_program.cmake | 17 | ||||
| -rw-r--r-- | scripts/fetchDependency.ps1 | 28 | ||||
| -rw-r--r-- | scripts/findVisualStudioInstallationInstances.ps1 | 17 | ||||
| -rw-r--r-- | scripts/getWindowsSDK.ps1 | 10 | ||||
| -rw-r--r-- | scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 | 31 | ||||
| -rw-r--r-- | scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 | 39 | ||||
| -rw-r--r-- | toolsrc/include/CStringView.h | 96 | ||||
| -rw-r--r-- | toolsrc/include/Span.h | 52 | ||||
| -rw-r--r-- | toolsrc/include/filesystem_fs.h | 16 | ||||
| -rw-r--r-- | toolsrc/include/pch.h | 26 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/checks.h (renamed from toolsrc/include/vcpkg_Checks.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/chrono.h (renamed from toolsrc/include/vcpkg_Chrono.h) | 2 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/cofffilereader.h (renamed from toolsrc/include/coff_file_reader.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/cstringview.h | 69 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/enums.h (renamed from toolsrc/include/vcpkg_Enums.h) | 4 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/expected.h (renamed from toolsrc/include/vcpkg_expected.h) | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/files.h (renamed from toolsrc/include/vcpkg_Files.h) | 32 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/graphs.h (renamed from toolsrc/include/vcpkg_Graphs.h) | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/lazy.h (renamed from toolsrc/include/lazy.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/lineinfo.h (renamed from toolsrc/include/LineInfo.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/machinetype.h (renamed from toolsrc/include/MachineType.h) | 1 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/optional.h (renamed from toolsrc/include/vcpkg_optional.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/sortedvector.h (renamed from toolsrc/include/SortedVector.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/span.h | 60 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/strings.h (renamed from toolsrc/include/vcpkg_Strings.h) | 51 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/system.h (renamed from toolsrc/include/vcpkg_System.h) | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/base/util.h (renamed from toolsrc/include/vcpkg_Util.h) | 44 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/binaryparagraph.h (renamed from toolsrc/include/BinaryParagraph.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/build.h (renamed from toolsrc/include/vcpkg_Build.h) | 27 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/commands.h | 135 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/dependencies.h (renamed from toolsrc/include/vcpkg_Dependencies.h) | 19 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/export.h | 10 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/export.ifw.h (renamed from toolsrc/include/vcpkg_Commands_Export_IFW.h) | 9 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/globalstate.h (renamed from toolsrc/include/vcpkg_GlobalState.h) | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/help.h | 19 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/input.h (renamed from toolsrc/include/vcpkg_Input.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/install.h | 71 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/metrics.h (renamed from toolsrc/include/metrics.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/packagespec.h (renamed from toolsrc/include/PackageSpec.h) | 39 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/packagespecparseresult.h (renamed from toolsrc/include/PackageSpecParseResult.h) | 5 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/paragraphparseresult.h (renamed from toolsrc/include/ParagraphParseResult.h) | 12 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/paragraphs.h (renamed from toolsrc/include/Paragraphs.h) | 14 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/parse.h (renamed from toolsrc/include/vcpkg_Parse.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/postbuildlint.buildtype.h (renamed from toolsrc/include/PostBuildLint_BuildType.h) | 6 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/postbuildlint.h (renamed from toolsrc/include/PostBuildLint.h) | 7 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/remove.h | 26 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/sourceparagraph.h (renamed from toolsrc/include/SourceParagraph.h) | 11 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraph.h (renamed from toolsrc/include/StatusParagraph.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/statusparagraphs.h (renamed from toolsrc/include/StatusParagraphs.h) | 3 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/triplet.h (renamed from toolsrc/include/triplet.h) | 11 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/update.h | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgcmdarguments.h (renamed from toolsrc/include/VcpkgCmdArguments.h) | 24 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkglib.h (renamed from toolsrc/include/vcpkglib.h) | 21 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/vcpkgpaths.h (renamed from toolsrc/include/VcpkgPaths.h) | 25 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg/versiont.h (renamed from toolsrc/include/VersionT.h) | 0 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Commands.h | 258 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Commands_Export.h | 8 | ||||
| -rw-r--r-- | toolsrc/include/vcpkg_Maps.h | 30 | ||||
| -rw-r--r-- | toolsrc/src/commands_autocomplete.cpp | 79 | ||||
| -rw-r--r-- | toolsrc/src/commands_build.cpp | 102 | ||||
| -rw-r--r-- | toolsrc/src/commands_hash.cpp | 55 | ||||
| -rw-r--r-- | toolsrc/src/tests.arguments.cpp (renamed from toolsrc/src/tests_arguments.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/tests.dependencies.cpp (renamed from toolsrc/src/tests_dependencies.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/tests.installplan.cpp (renamed from toolsrc/src/test_install_plan.cpp) | 7 | ||||
| -rw-r--r-- | toolsrc/src/tests.packagespec.cpp (renamed from toolsrc/src/tests_package_spec.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/tests.paragraph.cpp (renamed from toolsrc/src/tests_paragraph.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg.cpp | 107 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/checks.cpp (renamed from toolsrc/src/vcpkg_Checks.cpp) | 22 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/chrono.cpp (renamed from toolsrc/src/vcpkg_Chrono.cpp) | 6 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/cofffilereader.cpp (renamed from toolsrc/src/coff_file_reader.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/enums.cpp (renamed from toolsrc/src/vcpkg_Enums.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/files.cpp (renamed from toolsrc/src/vcpkg_Files.cpp) | 20 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/lineinfo.cpp (renamed from toolsrc/src/LineInfo.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/machinetype.cpp (renamed from toolsrc/src/MachineType.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/strings.cpp (renamed from toolsrc/src/vcpkg_Strings.cpp) | 55 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/system.cpp (renamed from toolsrc/src/vcpkg_System.cpp) | 182 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/binaryparagraph.cpp (renamed from toolsrc/src/BinaryParagraph.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp (renamed from toolsrc/src/vcpkg_Build.cpp) | 228 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.autocomplete.cpp | 141 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.buildexternal.cpp (renamed from toolsrc/src/commands_build_external.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.cache.cpp (renamed from toolsrc/src/commands_cache.cpp) | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.ci.cpp (renamed from toolsrc/src/commands_ci.cpp) | 26 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.contact.cpp (renamed from toolsrc/src/commands_contact.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.cpp (renamed from toolsrc/src/commands_available_commands.cpp) | 16 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.create.cpp (renamed from toolsrc/src/commands_create.cpp) | 17 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.dependinfo.cpp (renamed from toolsrc/src/commands_depends.cpp) | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.edit.cpp (renamed from toolsrc/src/commands_edit.cpp) | 62 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.env.cpp (renamed from toolsrc/src/commands_env.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.exportifw.cpp (renamed from toolsrc/src/commands_export_ifw.cpp) | 49 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.hash.cpp | 50 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.import.cpp (renamed from toolsrc/src/commands_import.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.integrate.cpp (renamed from toolsrc/src/commands_integrate.cpp) | 58 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.list.cpp (renamed from toolsrc/src/commands_list.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.owns.cpp (renamed from toolsrc/src/commands_owns.cpp) | 9 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.portsdiff.cpp (renamed from toolsrc/src/commands_portsdiff.cpp) | 67 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.search.cpp (renamed from toolsrc/src/commands_search.cpp) | 15 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/commands.version.cpp (renamed from toolsrc/src/commands_version.cpp) | 21 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/dependencies.cpp (renamed from toolsrc/src/vcpkg_Dependencies.cpp) | 35 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/export.cpp (renamed from toolsrc/src/commands_export.cpp) | 67 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/globalstate.cpp | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/help.cpp (renamed from toolsrc/src/commands_help.cpp) | 14 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/input.cpp (renamed from toolsrc/src/vcpkg_Input.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp (renamed from toolsrc/src/commands_install.cpp) | 96 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/metrics.cpp (renamed from toolsrc/src/metrics.cpp) | 74 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/packagespec.cpp (renamed from toolsrc/src/PackageSpec.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/packagespecparseresult.cpp (renamed from toolsrc/src/PackageSpecParseResult.cpp) | 5 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/paragraphparseresult.cpp (renamed from toolsrc/src/ParagraphParseResult.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/paragraphs.cpp (renamed from toolsrc/src/Paragraphs.cpp) | 10 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/parse.cpp (renamed from toolsrc/src/vcpkg_Parse.cpp) | 11 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/postbuildlint.buildtype.cpp (renamed from toolsrc/src/PostBuildLint_BuildType.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/postbuildlint.cpp (renamed from toolsrc/src/PostBuildLint.cpp) | 58 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/remove.cpp (renamed from toolsrc/src/commands_remove.cpp) | 61 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/sourceparagraph.cpp (renamed from toolsrc/src/SourceParagraph.cpp) | 56 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/statusparagraph.cpp (renamed from toolsrc/src/StatusParagraph.cpp) | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/statusparagraphs.cpp (renamed from toolsrc/src/StatusParagraphs.cpp) | 5 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/triplet.cpp (renamed from toolsrc/src/triplet.cpp) | 20 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/update.cpp (renamed from toolsrc/src/commands_update.cpp) | 12 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/vcpkgcmdarguments.cpp (renamed from toolsrc/src/VcpkgCmdArguments.cpp) | 31 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/vcpkglib.cpp (renamed from toolsrc/src/vcpkglib.cpp) | 38 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/vcpkgpaths.cpp (renamed from toolsrc/src/VcpkgPaths.cpp) | 141 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/versiont.cpp (renamed from toolsrc/src/VersionT.cpp) | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_Build_BuildPolicy.cpp | 40 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg_GlobalState.cpp | 13 | ||||
| -rw-r--r-- | toolsrc/src/vcpkgmetricsuploader.cpp (renamed from toolsrc/src/vcpkg_metrics_uploader.cpp) | 8 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj | 198 | ||||
| -rw-r--r-- | toolsrc/vcpkglib/vcpkglib.vcxproj.filters | 416 | ||||
| -rw-r--r-- | toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj | 2 | ||||
| -rw-r--r-- | toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters | 2 | ||||
| -rw-r--r-- | toolsrc/vcpkgtest/vcpkgtest.vcxproj | 10 | ||||
| -rw-r--r-- | toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters | 10 | ||||
| -rw-r--r-- | triplets/arm64-uwp.cmake | 6 |
191 files changed, 4818 insertions, 2439 deletions
diff --git a/ports/abseil/CMakeLists.txt b/ports/abseil/CMakeLists.txt index 34b69817a..4a96b3fde 100644 --- a/ports/abseil/CMakeLists.txt +++ b/ports/abseil/CMakeLists.txt @@ -1,21 +1,29 @@ cmake_minimum_required(VERSION 3.8) project(abseil CXX) -add_definitions(-DNOMINMAX) +add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) set(CMAKE_DEBUG_POSTFIX d) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -option(INSTALL_HEADERS "Install header files" ON) +if(CMAKE_BUILD_TYPE STREQUAL "Release") + option(INSTALL_HEADERS "Install header files" ON) +else() + option(INSTALL_HEADERS "Install header files" OFF) +endif() function(add_sublibrary LIB) file(GLOB_RECURSE SOURCES "absl/${LIB}/*.cc") - list(FILTER SOURCES EXCLUDE REGEX "_test") + list(FILTER SOURCES EXCLUDE REGEX "_test(_.+)?.cc$|_nonprod.cc$") file(GLOB HEADERS "absl/${LIB}/*.h") file(GLOB INTERNAL_HEADERS "absl/${LIB}/internal/*.h") if(SOURCES) - add_library(${LIB} ${SOURCES}) + if("STATIC" IN_LIST ARGN) + add_library(${LIB} STATIC ${SOURCES}) + else() + add_library(${LIB} ${SOURCES}) + endif() set_target_properties(${LIB} PROPERTIES OUTPUT_NAME "absl_${LIB}") target_include_directories(${LIB} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include>) else() @@ -49,14 +57,17 @@ function(target_link_public_libraries A) endif() endfunction() -add_sublibrary(base) -add_sublibrary(meta) add_sublibrary(algorithm) +add_sublibrary(base) add_sublibrary(container) -add_sublibrary(memory) -add_sublibrary(strings) add_sublibrary(debugging) +add_sublibrary(memory) +add_sublibrary(meta) add_sublibrary(numeric) +add_sublibrary(strings) +add_sublibrary(synchronization STATIC) +# Time must be static because there are global variables intended for export +add_sublibrary(time STATIC) add_sublibrary(types) add_sublibrary(utility) @@ -68,6 +79,11 @@ target_link_public_libraries(numeric base) target_link_public_libraries(strings base memory meta numeric) target_link_public_libraries(types base utility meta algorithm strings) target_link_public_libraries(utility base meta) +target_link_public_libraries(time base numeric) +target_link_public_libraries(synchronization base time) + +find_package(unofficial-cctz REQUIRED) +targeT_link_libraries(time PUBLIC unofficial::cctz) install( EXPORT unofficial-abseil-targets diff --git a/ports/abseil/CONTROL b/ports/abseil/CONTROL index fb37a8cae..44684b6b8 100644 --- a/ports/abseil/CONTROL +++ b/ports/abseil/CONTROL @@ -1,6 +1,7 @@ Source: abseil
-Version: 2017-09-28
+Version: 2017-10-14
Description: an open-source collection designed to augment the C++ standard library.
Abseil is an open-source collection of C++ library code designed to augment the C++ standard library. The Abseil library code is collected from Google's own C++ code base, has been extensively tested and used in production, and is the same code we depend on in our daily coding lives.
In some cases, Abseil provides pieces missing from the C++ standard; in others, Abseil provides alternatives to the standard for special needs we've found through usage in the Google code base. We denote those cases clearly within the library code we provide you.
Abseil is not meant to be a competitor to the standard library; we've just found that many of these utilities serve a purpose within our code base, and we now want to provide those resources to the C++ community as a whole.
+Build-Depends: cctz
diff --git a/ports/abseil/fix-intrin.patch b/ports/abseil/fix-intrin.patch deleted file mode 100644 index 285adde0f..000000000 --- a/ports/abseil/fix-intrin.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/absl/base/optimization.h b/absl/base/optimization.h -index db8beaf..aaaffa4 100644 ---- a/absl/base/optimization.h -+++ b/absl/base/optimization.h -@@ -46,6 +46,7 @@ - // GCC will not tail call given inline volatile assembly. - #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("") - #elif defined(_MSC_VER) -+#include <intrin.h> - // The __nop() intrinsic blocks the optimisation. - #define ABSL_BLOCK_TAIL_CALL_OPTIMIZATION() __nop() - #else diff --git a/ports/abseil/portfile.cmake b/ports/abseil/portfile.cmake index 8c9e81aa3..d74369951 100644 --- a/ports/abseil/portfile.cmake +++ b/ports/abseil/portfile.cmake @@ -10,22 +10,16 @@ message("To use from cmake:\n find_package(unofficial-abseil REQUIRED)\n link_ vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO abseil/abseil-cpp
- REF cdf20caa491f59c0a35a8d8fbec0d948e4bc7e4c
- SHA512 04889e7804b644821d0bf5d1b13f15a072e748bf0465442c64528e014c71f415544e9146c9518f9fe7bb14a295b18f293c3f7b672f6a51dba9909f3b74667fae
+ REF 1a9ba5e2e5a14413704f0c913fac53359576d3b6
+ SHA512 756e494c30324c937ca655d91afdee9acb923c7ee837a7c685441305bea2d54a75b3b21be7355abe416660984ba51ace9d234d70168fb029c601b7442397e8ff
HEAD_REF master
)
-vcpkg_apply_patches(
- SOURCE_PATH ${SOURCE_PATH}
- PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-intrin.patch"
-)
-
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
- OPTIONS_DEBUG -DINSTALL_HEADERS=OFF
)
vcpkg_install_cmake()
diff --git a/ports/antlr4/portfile.cmake b/ports/antlr4/portfile.cmake index 78266b6eb..868efcdbe 100644 --- a/ports/antlr4/portfile.cmake +++ b/ports/antlr4/portfile.cmake @@ -24,7 +24,7 @@ vcpkg_apply_patches( ${CMAKE_CURRENT_LIST_DIR}/Fix-building-in-Visual-Studio-2017.patch
)
-if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
set(DEBUG_CONFIG "Debug Static")
set(RELEASE_CONFIG "Release Static")
else()
@@ -53,7 +53,7 @@ file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${DEBUG_CONFIG file(COPY ${SOURCE_PATH}/bin/vs-2015/${TRIPLET_SYSTEM_ARCH}/${RELEASE_CONFIG}/antlr4-runtime.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
-if (${VCPKG_LIBRARY_LINKAGE} STREQUAL static)
+if (VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_PACKAGES_DIR}/include
PATCHES ${CMAKE_CURRENT_LIST_DIR}/static.patch
diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake index f3664da8c..147ebeea8 100644 --- a/ports/bond/portfile.cmake +++ b/ports/bond/portfile.cmake @@ -1,4 +1,4 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) +if (VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") message(STATUS "Warning: Dynamic building not supported yet. Building static.") set(VCPKG_LIBRARY_LINKAGE static) endif() @@ -23,7 +23,7 @@ vcpkg_extract_source_archive(${ARCHIVE}) vcpkg_extract_source_archive(${GBC_ARCHIVE} ${CURRENT_BUILDTREES_DIR}/tools/) set(FETCHED_GBC_PATH ${CURRENT_BUILDTREES_DIR}/tools/gbc-6.0.0-amd64.exe) -if (NOT EXISTS ${FETCHED_GBC_PATH}) +if (NOT EXISTS "${FETCHED_GBC_PATH}") message(FATAL_ERROR "Fetching GBC failed. Expected '${FETCHED_GBC_PATH}' to exists, but it doesn't.") endif() diff --git a/ports/butteraugli/CMakeLists.txt b/ports/butteraugli/CMakeLists.txt index 3bd8a6c37..0b5373c5a 100644 --- a/ports/butteraugli/CMakeLists.txt +++ b/ports/butteraugli/CMakeLists.txt @@ -1,29 +1,19 @@ cmake_minimum_required(VERSION 3.8.0) -project(butteraugli) +project(butteraugli CXX) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +add_compile_options(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) if(MSVC) - add_compile_options(/W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) + add_compile_options(/W3 /wd4005 /wd4996 /wd4018) endif() - - find_package(JPEG REQUIRED) find_package(PNG REQUIRED) -include_directories("." ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIRS}) - -if(BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - +include_directories(".") add_library(butteraugli_lib butteraugli/butteraugli.cc) -add_executable(butteraugli butteraugli/butteraugli_main.cc) - -target_link_libraries(butteraugli butteraugli_lib ${JPEG_LIBRARIES} ${PNG_LIBRARIES}) - - install( TARGETS butteraugli_lib RUNTIME DESTINATION bin @@ -32,6 +22,10 @@ install( ) if(NOT DISABLE_INSTALL_TOOLS) + add_executable(butteraugli butteraugli/butteraugli_main.cc) + target_include_directories(butteraugli PRIVATE ${JPEG_INCLUDE_DIR} ${PNG_INCLUDE_DIRS}) + target_link_libraries(butteraugli PRIVATE butteraugli_lib ${JPEG_LIBRARIES} ${PNG_LIBRARIES}) + install ( TARGETS butteraugli RUNTIME DESTINATION tools/butteraugli diff --git a/ports/cctz/CMakeLists.txt b/ports/cctz/CMakeLists.txt new file mode 100644 index 000000000..99322d05e --- /dev/null +++ b/ports/cctz/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.8)
+project(cctz CXX)
+
+set(CMAKE_DEBUG_POSTFIX d)
+set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+
+if(CMAKE_BUILD_TYPE STREQUAL "Release")
+ option(INSTALL_HEADERS "Install header files" ON)
+else()
+ option(INSTALL_HEADERS "Install header files" OFF)
+endif()
+
+file(GLOB SOURCES src/*.cc)
+list(FILTER SOURCES EXCLUDE REGEX "_test.cc$|benchmarks|_tool.cc$")
+
+file(GLOB HEADERS include/cctz/*.h)
+
+add_library(cctz ${SOURCES})
+target_include_directories(cctz PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
+
+if(INSTALL_HEADERS)
+ install(FILES ${HEADERS} DESTINATION "include/cctz")
+endif()
+
+install(TARGETS cctz EXPORT unofficial-cctz-targets
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
+
+install(
+ EXPORT unofficial-cctz-targets
+ FILE unofficial-cctz-config.cmake
+ NAMESPACE unofficial::
+ DESTINATION share/unofficial-cctz
+)
diff --git a/ports/cctz/CONTROL b/ports/cctz/CONTROL new file mode 100644 index 000000000..fb125fa13 --- /dev/null +++ b/ports/cctz/CONTROL @@ -0,0 +1,3 @@ +Source: cctz
+Version: v2.1
+Description: two libraries that cooperate with <chrono> to give C++ programmers all the necessary tools for computing with dates, times, and time zones in a simple and correct manner.
diff --git a/ports/cctz/portfile.cmake b/ports/cctz/portfile.cmake new file mode 100644 index 000000000..11955b365 --- /dev/null +++ b/ports/cctz/portfile.cmake @@ -0,0 +1,24 @@ +include(vcpkg_common_functions)
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO google/cctz
+ REF v2.1
+ SHA512 b6531ce64fdd8581944457cdeff7f9ff9c00958af51ddb262c74e08fcc076466c59c7bef1ce7edccc9512a7f4cb204e04581d287c4a9a684057fe39421c3fbc6
+ HEAD_REF master
+)
+
+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/unofficial-cctz)
+file(RENAME ${CURRENT_PACKAGES_DIR}/share/cctz ${CURRENT_PACKAGES_DIR}/share/unofficial-cctz)
+
+vcpkg_copy_pdbs()
+
+file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/cctz RENAME copyright)
diff --git a/ports/celero/CONTROL b/ports/celero/CONTROL new file mode 100644 index 000000000..d40c93783 --- /dev/null +++ b/ports/celero/CONTROL @@ -0,0 +1,3 @@ +Source: celero +Version: 2.1.0-1 +Description: Celero is a modern cross-platform (Windows, Linux, MacOS) Microbenchmarking library for C++. diff --git a/ports/celero/portfile.cmake b/ports/celero/portfile.cmake new file mode 100644 index 000000000..c942ca5d8 --- /dev/null +++ b/ports/celero/portfile.cmake @@ -0,0 +1,29 @@ +include(vcpkg_common_functions) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + message(STATUS "Celero currently can only be built statically") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO DigitalInBlue/Celero + REF v2.1.0 + SHA512 30563567255b09a2c810d97896839589ed99d45b6c8d075fd16d1a0068457d70195a199f5c982c84784c2e03284c1eaac565253fa72b81d9e2d4102721b80221 + HEAD_REF master +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA # Disable this option if project cannot be built with Ninja + OPTIONS + -DCELERO_ENABLE_EXPERIMENTS=OFF + -DCELERO_ENABLE_TESTS=OFF + -DCELERO_RUN_EXAMPLE_ON_BUILD=OFF +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(INSTALL ${SOURCE_PATH}/license.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/celero RENAME copyright) diff --git a/ports/eastl/CONTROL b/ports/eastl/CONTROL new file mode 100644 index 000000000..d43d7203e --- /dev/null +++ b/ports/eastl/CONTROL @@ -0,0 +1,4 @@ +Source: eastl
+Version: 3.05.08
+Description: Electronic Arts Standard Template Library.
+ It is a C++ template library of containers, algorithms, and iterators useful for runtime and tool development across multiple platforms. It is a fairly extensive and robust implementation of such a library and has an emphasis on high performance above all other considerations.
diff --git a/ports/eastl/portfile.cmake b/ports/eastl/portfile.cmake new file mode 100644 index 000000000..19fb6e51c --- /dev/null +++ b/ports/eastl/portfile.cmake @@ -0,0 +1,29 @@ +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
+ message(STATUS "Warning: Dynamic building not supported by EASTL. Building static.")
+ set(VCPKG_LIBRARY_LINKAGE static)
+endif()
+
+include(vcpkg_common_functions)
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/eastl)
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO electronicarts/EASTL
+ REF 3.05.08
+ SHA512 7b9e87d967252026a660a648688a19e7b88d4eca7f373ba7427b315103a6f8cea555a85b2ef74557cf7e8a486b847589cac4b622b4ab88cab7c0f0a22355ab66
+ HEAD_REF master
+)
+
+vcpkg_configure_cmake(
+ SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
+)
+
+vcpkg_install_cmake()
+
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+
+vcpkg_copy_pdbs()
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/eastl RENAME copyright)
+file(INSTALL ${SOURCE_PATH}/3RDPARTYLICENSES.TXT DESTINATION ${CURRENT_PACKAGES_DIR}/share/eastl)
diff --git a/ports/freeimage/CMakeLists.txt b/ports/freeimage/CMakeLists.txt index f385f508c..9f4f1677b 100644 --- a/ports/freeimage/CMakeLists.txt +++ b/ports/freeimage/CMakeLists.txt @@ -72,7 +72,7 @@ set(SRCS ${DEPRECATION_SRCS} # define (to nothing instead of _declspec(dllimport) ) the DLL_API macro. # For this purpouse we include (depending on the BUILD_SHARED_LIBS ) # the appropriate FreeImageConfig.h . -if(${BUILD_SHARED_LIBS}) +if(BUILD_SHARED_LIBS) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-dynamic.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h) else() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/FreeImageConfig-static.h ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h) @@ -81,7 +81,7 @@ list(APPEND PUBLIC_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/FreeImageConfig.h) add_library(FreeImage ${SRCS} ${PRIVATE_HEADERS} ${PUBLIC_HEADERS}) -if(${BUILD_SHARED_LIBS}) +if(BUILD_SHARED_LIBS) target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_EXPORTS) else() target_compile_definitions(FreeImage PRIVATE -DFREEIMAGE_LIB) @@ -119,7 +119,7 @@ add_library(FreeImagePlus ${CMAKE_CURRENT_SOURCE_DIR}/Wrapper/FreeImagePlus/FreeImagePlus.h ${CMAKE_CURRENT_SOURCE_DIR}/Wrapper/FreeImagePlus/FreeImagePlus.rc) -if(${BUILD_SHARED_LIBS}) +if(BUILD_SHARED_LIBS) target_compile_definitions(FreeImagePlus PRIVATE -DFIP_EXPORTS) else() target_compile_definitions(FreeImagePlus PRIVATE -DFREEIMAGE_LIB) diff --git a/ports/gdal/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch b/ports/gdal/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch deleted file mode 100644 index e29cc5b8e..000000000 --- a/ports/gdal/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 823171a129401d226ac4821fb997ce585045170c Mon Sep 17 00:00:00 2001 -From: Manuel Massing <m.massing@warped-space.de> -Date: Wed, 23 Nov 2016 23:50:12 +0100 -Subject: [PATCH] Add support for MSVC1900 (backported from GDAL2) - ---- - nmake.opt | 6 ++++++ - port/cpl_config.h.vc | 8 +++++--- - 2 files changed, 11 insertions(+), 3 deletions(-) - -diff --git a/nmake.opt b/nmake.opt -index 8900135..4d1c4fa 100644 ---- a/nmake.opt -+++ b/nmake.opt -@@ -31,6 +31,7 @@ - # Check version of Visual C++ compiler: - # nmake -f makefile.vc MSVC_VER=xxxx - # where xxxx is one of following: -+# 1900 = 14.0(2015) - # 1800 = 12.0(2013) - # 1700 = 11.0(2012) - # 1600 = 10.0(2010) -@@ -627,8 +628,13 @@ GDALLIB = $(GDAL_ROOT)/gdal.lib - !ENDIF - - !IFDEF ODBC_SUPPORTED -+!IF $(MSVC_VER) >= 1900 -+# legacy_stdio_definitions.lib : https://connect.microsoft.com/VisualStudio/feedback/details/1134693/vs-2015-ctp-5-c-vsnwprintf-s-and-other-functions-are-not-exported-in-appcrt140-dll-breaking-linkage-of-static-libraries -+ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib -+!ELSE - ODBCLIB = odbc32.lib odbccp32.lib user32.lib - !ENDIF -+!ENDIF - - !IF DEFINED(MRSID_DIR) || DEFINED(MRSID_RASTER_DIR) || DEFINED(MRSID_LIDAR_DIR) - !IF "$(MRSID_PLUGIN)" != "YES" -diff --git a/port/cpl_config.h.vc b/port/cpl_config.h.vc -index bfff8f6..fe7b82a 100644 ---- a/port/cpl_config.h.vc -+++ b/port/cpl_config.h.vc -@@ -1,5 +1,5 @@ - --/* We define this here in general so that a VC++ build will publically -+/* We define this here in general so that a VC++ build will publicly - declare STDCALL interfaces even if an application is built against it - using MinGW */ - -@@ -17,7 +17,9 @@ - #if defined(_MSC_VER) && (_MSC_VER < 1500) - # define vsnprintf _vsnprintf - #endif --#define snprintf _snprintf -+#if defined(_MSC_VER) && (_MSC_VER < 1900) -+# define snprintf _snprintf -+#endif - - #define HAVE_GETCWD 1 - /* gmt_notunix.h from GMT project also redefines getcwd. See #3138 */ -@@ -86,7 +88,7 @@ - /* Set the native cpu bit order */ - #define HOST_FILLORDER FILLORDER_LSB2MSB - --/* Define as 0 or 1 according to the floating point format suported by the -+/* Define as 0 or 1 according to the floating point format supported by the - machine */ - #define HAVE_IEEEFP 1 - --- -2.10.1.windows.1 - diff --git a/ports/gdal/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch b/ports/gdal/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch index 0ffcac5fb..7817c4a38 100644 --- a/ports/gdal/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch +++ b/ports/gdal/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch @@ -1,18 +1,8 @@ -From b25c3dc49ca1bcf9a789cf64c9fa8694e35127f0 Mon Sep 17 00:00:00 2001 -From: Manuel Massing <m.massing@warped-space.de> -Date: Sun, 27 Nov 2016 09:57:04 +0100 -Subject: [PATCH 2/2] Add variable CXX_CRT_FLAGS to allow for selection of C - runtime linkage in nmake build. - ---- - nmake.opt | 18 ++++++++++++++---- - 1 file changed, 14 insertions(+), 4 deletions(-) - diff --git a/nmake.opt b/nmake.opt -index 4d1c4fa..47c2df8 100644 +index bd5719c2d1..f6101ccd59 100644 --- a/nmake.opt +++ b/nmake.opt -@@ -125,18 +125,28 @@ CXX_PDB_FLAGS=/Zi /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb +@@ -127,18 +127,28 @@ CXX_PDB_FLAGS=/Zi /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb CXX_PDB_FLAGS= !ENDIF @@ -29,22 +19,19 @@ index 4d1c4fa..47c2df8 100644 !IFNDEF OPTFLAGS !IF $(MSVC_VER) >= 1400 !IFNDEF DEBUG --OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MD /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG +-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP /MD /EHsc /Ox /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG +OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG !ELSE --OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MD /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG +-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP /MD /EHsc /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG +OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG !ENDIF !ELSE !IFNDEF DEBUG --OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /Ox /DNDEBUG +-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /Ox /FC /DNDEBUG +OPTFLAGS= $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /GR /Ox /DNDEBUG !ELSE --OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /DDEBUG +-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /FC /DDEBUG +OPTFLAGS= $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /GR /DDEBUG !ENDIF !ENDIF #MSVC_VER !ENDIF # OPTFLAGS --- -2.10.1.windows.1 - diff --git a/ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch b/ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch new file mode 100644 index 000000000..57030b99b --- /dev/null +++ b/ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch @@ -0,0 +1,14 @@ +diff --git a/nmake.opt b/nmake.opt +index bd5719c2d1..c0ca442cbe 100644 +--- a/nmake.opt ++++ b/nmake.opt +@@ -195,6 +205,9 @@ SOFTWARNFLAGS= /wd4244 /wd4702 /wd4701 /wd4013 /wd4706 /wd4057 /wd4210 /wd4305 + # Linker debug options + !IFDEF DEBUG + LDEBUG= /debug ++!ELSEIFDEF WITH_PDB ++# Ensures that PDB is included in release DLL if so requested ++LDEBUG= /debug /opt:ref /opt:icf + !ENDIF + + # Uncomment the following if you are building for 64-bit windows diff --git a/ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch b/ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch deleted file mode 100644 index 1065a2982..000000000 --- a/ports/gdal/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9da0cb6eed442ebf3eea232cd85e26c155c963ef Mon Sep 17 00:00:00 2001 -From: Manuel Massing <m.massing@warped-space.de> -Date: Tue, 29 Nov 2016 12:43:58 +0100 -Subject: [PATCH 3/4] - Ensures inclusion of PDB in release dll if so requested - ---- - gdal/nmake.opt | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/nmake.opt b/nmake.opt -index 47c2df8..4844d22 100644 ---- a/nmake.opt -+++ b/nmake.opt -@@ -174,6 +174,9 @@ SOFTWARNFLAGS= /wd4244 /wd4702 /wd4701 /wd4013 /wd4706 /wd4057 /wd4210 /wd4305 - # Linker debug options - !IFDEF DEBUG - LDEBUG= /debug -+!ELSEIFDEF WITH_PDB -+# Ensures that PDB is included in release DLL if so requested -+LDEBUG= /debug /opt:ref /opt:icf - !ENDIF - - # Uncomment the following if you are building for 64-bit windows --- -2.10.1.windows.1 - diff --git a/ports/gdal/0003-Fix-openjpeg-include.patch b/ports/gdal/0003-Fix-openjpeg-include.patch new file mode 100644 index 000000000..4ea72690c --- /dev/null +++ b/ports/gdal/0003-Fix-openjpeg-include.patch @@ -0,0 +1,20 @@ +diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp +index 5978882bc9..72cc7b9559 100644 +--- a/frmts/openjpeg/openjpegdataset.cpp ++++ b/frmts/openjpeg/openjpegdataset.cpp +@@ -34,14 +34,8 @@ + #pragma clang diagnostic ignored "-Wdocumentation" + #endif + +-#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200 +-#include <openjpeg-2.2/openjpeg.h> +-#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100 +-#include <openjpeg-2.1/openjpeg.h> +-#else + #include <stdio.h> /* openjpeg.h needs FILE* */ +-#include <openjpeg-2.0/openjpeg.h> +-#endif ++#include <openjpeg.h> + + #ifdef __clang__ + #pragma clang diagnostic pop diff --git a/ports/gdal/0004-Fix-openjpeg-include.patch b/ports/gdal/0004-Fix-openjpeg-include.patch deleted file mode 100644 index 2865455d8..000000000 --- a/ports/gdal/0004-Fix-openjpeg-include.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp -index 1fd4f4f..417f7a8 100644 ---- a/frmts/openjpeg/openjpegdataset.cpp -+++ b/frmts/openjpeg/openjpegdataset.cpp -@@ -29,12 +29,8 @@ - - /* This file is to be used with openjpeg 2.0 */ - --#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100 --#include <openjpeg-2.1/openjpeg.h> --#else --#include <stdio.h> /* openjpeg.h needs FILE* */ --#include <openjpeg-2.0/openjpeg.h> --#endif -+#include <stdio.h> -+#include <openjpeg.h> - #include <vector> - - #include "gdaljp2abstractdataset.h" diff --git a/ports/gdal/CONTROL b/ports/gdal/CONTROL index 083a52800..b84dc29e1 100644 --- a/ports/gdal/CONTROL +++ b/ports/gdal/CONTROL @@ -1,4 +1,4 @@ Source: gdal -Version: 1.11.3-5 +Version: 2.2.2 Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data. Build-Depends: proj4, libpng, geos, sqlite3, curl, expat, libpq, libmysql, openjpeg, libwebp, libxml2, liblzma diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake index 214ec2024..9bfb92362 100644 --- a/ports/gdal/portfile.cmake +++ b/ports/gdal/portfile.cmake @@ -5,25 +5,24 @@ endif() include(vcpkg_common_functions) vcpkg_download_distfile(ARCHIVE - URLS "http://download.osgeo.org/gdal/1.11.3/gdal1113.zip" - FILENAME "gdal1113.zip" - SHA512 42feb98a54019d3b6ac54f598f299a57e117db500c662d39faa9d5f5090f03c1b8d7680242e1abd8035738edc4fc3197ae118a0ce50733691a76a5cf377bcd46 -) + URLS "http://download.osgeo.org/gdal/2.2.2/gdal222.zip" + FILENAME "gdal222.zip" + SHA512 b886238a7915c97f4acec5920dabe959d1ab15a8be0bc31ba0d05ad69d1d7d96f864faf0aa82921fa1a1b40b733744202b86f2f45ff63d6518cd18a53f3544a8 + ) # Extract source into archictecture specific directory, because GDALs' nmake based build currently does not # support out of source builds. -set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/gdal-1.11.3) -set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-1.11.3) +set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/gdal-2.2.2) +set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-2.2.2) foreach(BUILD_TYPE debug release) 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-1.11.3 + SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-2.2.2 PATCHES - ${CMAKE_CURRENT_LIST_DIR}/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch - ${CMAKE_CURRENT_LIST_DIR}/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch - ${CMAKE_CURRENT_LIST_DIR}/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch - ${CMAKE_CURRENT_LIST_DIR}/0004-Fix-openjpeg-include.patch + ${CMAKE_CURRENT_LIST_DIR}/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch + ${CMAKE_CURRENT_LIST_DIR}/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch + ${CMAKE_CURRENT_LIST_DIR}/0003-Fix-openjpeg-include.patch ) endforeach() @@ -211,7 +210,7 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static) else() file(GLOB EXE_FILES ${CURRENT_PACKAGES_DIR}/bin/*.exe) file(REMOVE ${EXE_FILES} ${CURRENT_PACKAGES_DIR}/lib/gdal.lib) - file(COPY ${SOURCE_PATH_DEBUG}/gdal111.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) + file(COPY ${SOURCE_PATH_DEBUG}/gdal202.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin) file(COPY ${SOURCE_PATH_DEBUG}/gdal_i.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib) file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/lib/gdal.lib) file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/gdald.lib) diff --git a/ports/imgui/CMakeLists.txt b/ports/imgui/CMakeLists.txt new file mode 100644 index 000000000..a4c49a337 --- /dev/null +++ b/ports/imgui/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.8) +project(imgui CXX) + +set(CMAKE_DEBUG_POSTFIX d) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +find_path(STB_INCLUDE_DIR stb_rect_pack.h stb_textedit.h stb_truetype.h) + +set(IMGUI_INCLUDES_PUBLIC + imgui.h + imconfig.h +) + +set(IMGUI_INCLUDES_PRIVATE + imgui_internal.h +) + +set(IMGUI_SOURCES + imgui.cpp + imgui_demo.cpp + imgui_draw.cpp +) + +add_library(imgui + ${IMGUI_INCLUDES_PUBLIC} + ${IMGUI_INCLUDES_PRIVATE} + ${IMGUI_SOURCES} +) + +target_include_directories(imgui PUBLIC ${STB_INCLUDE_DIR}) + +install(TARGETS imgui + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +if(NOT IMGUI_SKIP_HEADERS) + install( + FILES ${IMGUI_INCLUDES_PUBLIC} + DESTINATION include + ) +endif() diff --git a/ports/imgui/CONTROL b/ports/imgui/CONTROL new file mode 100644 index 000000000..35e041de1 --- /dev/null +++ b/ports/imgui/CONTROL @@ -0,0 +1,4 @@ +Source: imgui +Version: 1.51-1 +Build-Depends: stb +Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies. diff --git a/ports/imgui/portfile.cmake b/ports/imgui/portfile.cmake new file mode 100644 index 000000000..587a4cf19 --- /dev/null +++ b/ports/imgui/portfile.cmake @@ -0,0 +1,33 @@ +include(vcpkg_common_functions) + +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ocornut/imgui + REF v1.51 + SHA512 33aea46d0ab8419fcd4af765c9f1a88dfb1b80ad466276b655a67f40ffedabe399db6b0d76a2ece74e551928bd6f842ae3fa42998e0b1a2206157a3852e002d6 + HEAD_REF master +) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) +file(GLOB STB_HEADERS ${SOURCE_PATH}/stb_*.h) +if(STB_HEADERS) + file(REMOVE ${STB_HEADERS}) +endif() + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS_DEBUG + -DIMGUI_SKIP_HEADERS=ON +) + +vcpkg_install_cmake() +vcpkg_copy_pdbs() + +file(COPY ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/imgui) +file(RENAME ${CURRENT_PACKAGES_DIR}/share/imgui/LICENSE.txt ${CURRENT_PACKAGES_DIR}/share/imgui/copyright) diff --git a/ports/libidn2/CMakeLists.txt b/ports/libidn2/CMakeLists.txt new file mode 100644 index 000000000..9fbe1bcdd --- /dev/null +++ b/ports/libidn2/CMakeLists.txt @@ -0,0 +1,105 @@ +cmake_minimum_required(VERSION 3.8) + +project(libidn2 C) + +find_path(ICONV_INCLUDE_DIR iconv.h) +find_library(ICONV NAMES libiconv) +find_library(ICONV_CHARSET NAMES libcharset) + +set(CMAKE_DEBUG_POSTFIX "d") + +if(MSVC) + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) +endif() + +add_definitions(-DIDN2_BUILDING) + +if(NOT BUILD_SHARED_LIBS) + add_definitions(-DIDN2_STATIC) +endif() + +# List the source files +set(LIB_SRC lib/bidi.c + lib/context.c + lib/data.c + lib/decode.c + lib/error.c + lib/free.c + lib/idna.c + lib/lookup.c + lib/puny_decode.c + lib/puny_encode.c + lib/register.c + lib/tables.c + lib/tr46map.c + lib/tr46map_data.c + lib/version.c +) + +# List the libunistring source files +set(UNISTR_SRC unistring/c-ctype.c + unistring/c-strcasecmp.c + unistring/c-strncasecmp.c + unistring/malloca.c + unistring/striconveh.c + unistring/striconveha.c + unistring/uniconv/u8-conv-from-enc.c + unistring/uniconv/u8-strconv-from-enc.c + unistring/uniconv/u8-strconv-from-locale.c + unistring/uniconv/u8-strconv-to-enc.c + unistring/uniconv/u8-strconv-to-locale.c + unistring/unistr/u32-cpy.c + unistring/unistr/u32-cpy-alloc.c + unistring/unistr/u32-mbtouc-unsafe.c + unistring/unistr/u32-strlen.c + unistring/unistr/u32-to-u8.c + unistring/unistr/u32-uctomb.c + unistring/unistr/u8-check.c + unistring/unistr/u8-mblen.c + unistring/unistr/u8-mbtouc.c + unistring/unistr/u8-mbtouc-aux.c + unistring/unistr/u8-mbtouc-unsafe.c + unistring/unistr/u8-mbtouc-unsafe-aux.c + unistring/unistr/u8-mbtoucr.c + unistring/unistr/u8-prev.c + unistring/unistr/u8-strlen.c + unistring/unistr/u8-to-u32.c + unistring/unistr/u8-uctomb.c + unistring/unistr/u8-uctomb-aux.c + unistring/uninorm/canonical-decomposition.c + unistring/uninorm/composition.c + unistring/uninorm/decompose-internal.c + unistring/uninorm/decomposition-table.c + unistring/uninorm/nfc.c + unistring/uninorm/nfd.c + unistring/uninorm/u32-normalize.c + unistring/unictype/bidi_of.c + unistring/unictype/categ_M.c + unistring/unictype/categ_none.c + unistring/unictype/categ_of.c + unistring/unictype/categ_test.c + unistring/unictype/combiningclass.c + unistring/unictype/joiningtype_of.c + unistring/unictype/scripts.c +) + +# List the gnulib source files +set(GL_SRC gl/rawmemchr.c + gl/strchrnul.c + gl/strverscmp.c + gl/msvc-inval.c + gl/msvc-nothrow.c +) + +add_library(libidn2 ${LIB_SRC} ${UNISTR_SRC} ${GL_SRC}) + +target_include_directories(libidn2 PRIVATE . ./unistring ./gl ${ICONV_INCLUDE_DIR}) +target_link_libraries(libidn2 PRIVATE ${ICONV} ${ICONV_CHARSET}) + +install(TARGETS libidn2 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(FILES lib/idn2.h DESTINATION include) diff --git a/ports/libidn2/CONTROL b/ports/libidn2/CONTROL new file mode 100644 index 000000000..46e81c7bf --- /dev/null +++ b/ports/libidn2/CONTROL @@ -0,0 +1,4 @@ +Source: libidn2 +Version: 2.0.4 +Build-Depends: libiconv +Description: GNU Libidn is an implementation of the Stringprep, Punycode and IDNA 2003 specifications. Libidn's purpose is to encode and decode internationalized domain names. diff --git a/ports/libidn2/config.h b/ports/libidn2/config.h new file mode 100644 index 000000000..9e61bc8f2 --- /dev/null +++ b/ports/libidn2/config.h @@ -0,0 +1,995 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to the number of bits in type 'ptrdiff_t'. */ +/* #undef BITSIZEOF_PTRDIFF_T */ + +/* Define to the number of bits in type 'sig_atomic_t'. */ +/* #undef BITSIZEOF_SIG_ATOMIC_T */ + +/* Define to the number of bits in type 'size_t'. */ +/* #undef BITSIZEOF_SIZE_T */ + +/* Define to the number of bits in type 'wchar_t'. */ +/* #undef BITSIZEOF_WCHAR_T */ + +/* Define to the number of bits in type 'wint_t'. */ +/* #undef BITSIZEOF_WINT_T */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define to 1 if // is a file system root distinct from /. */ +/* #undef DOUBLE_SLASH_IS_DISTINCT_ROOT */ + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module fscanf shall be considered present. */ +#define GNULIB_FSCANF 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module msvc-nothrow shall be considered present. */ +#define GNULIB_MSVC_NOTHROW 1 + +/* Define to 1 if printf and friends should be labeled with attribute + "__gnu_printf__" instead of "__printf__" */ +#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module scanf shall be considered present. */ +#define GNULIB_SCANF 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module strerror shall be considered present. */ +#define GNULIB_STRERROR 1 + +/* Define to 1 when the gnulib module getdelim should be tested. */ +/* #undef GNULIB_TEST_GETDELIM */ + +/* Define to 1 when the gnulib module getline should be tested. */ +/* #undef GNULIB_TEST_GETLINE */ + +/* Define to 1 when the gnulib module malloc-posix should be tested. */ +/* #undef GNULIB_TEST_MALLOC_POSIX */ + +/* Define to 1 when the gnulib module rawmemchr should be tested. */ +/* #undef GNULIB_TEST_RAWMEMCHR */ + +/* Define to 1 when the gnulib module strchrnul should be tested. */ +/* #undef GNULIB_TEST_STRCHRNUL */ + +/* Define to 1 when the gnulib module strerror should be tested. */ +/* #undef GNULIB_TEST_STRERROR */ + +/* Define to 1 when the gnulib module strverscmp should be tested. */ +/* #undef GNULIB_TEST_STRVERSCMP */ + +/* Define to 1 when the gnulib module uninorm/u32-normalize should be tested. + */ +/* #undef GNULIB_TEST_UNINORM_U32_NORMALIZE */ + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u32-mbtouc-unsafe shall be considered + present. */ +#define GNULIB_UNISTR_U32_MBTOUC_UNSAFE 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u32-uctomb shall be considered present. */ +#define GNULIB_UNISTR_U32_UCTOMB 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-mbtouc shall be considered present. */ +#define GNULIB_UNISTR_U8_MBTOUC 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-mbtoucr shall be considered present. */ +#define GNULIB_UNISTR_U8_MBTOUCR 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-mbtouc-unsafe shall be considered + present. */ +#define GNULIB_UNISTR_U8_MBTOUC_UNSAFE 1 + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module unistr/u8-uctomb shall be considered present. */ +#define GNULIB_UNISTR_U8_UCTOMB 1 + +/* Define to 1 if you have 'alloca' after including <alloca.h>, a header that + may be supplied by this distribution. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). + */ +/* #undef HAVE_ALLOCA_H */ + +/* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +#define HAVE_DCGETTEXT 1 + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_GETC_UNLOCKED 0 + +/* Define to 1 if you have the declaration of `getdelim', and to 0 if you + don't. */ +#define HAVE_DECL_GETDELIM 0 + +/* Define to 1 if you have the declaration of `getline', and to 0 if you + don't. */ +#define HAVE_DECL_GETLINE 0 + +/* Define to 1 if you have the declaration of `program_invocation_name', and + to 0 if you don't. */ +#define HAVE_DECL_PROGRAM_INVOCATION_NAME 0 + +/* Define to 1 if you have the declaration of `program_invocation_short_name', + and to 0 if you don't. */ +#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME 0 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 0 + +/* Define to 1 if you have the declaration of `__argv', and to 0 if you don't. + */ +#define HAVE_DECL___ARGV 1 + +/* Define to 1 if you have the <dlfcn.h> header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you have the `flockfile' function. */ +/* #undef HAVE_FLOCKFILE */ + +/* Define to 1 if you have the `funlockfile' function. */ +/* #undef HAVE_FUNLOCKFILE */ + +/* Define to 1 if you have the 'getdelim' function. */ +/* #undef HAVE_GETDELIM */ + +/* Define to 1 if you have the 'getexecname' function. */ +/* #undef HAVE_GETEXECNAME */ + +/* Define to 1 if you have the 'getprogname' function. */ +/* #undef HAVE_GETPROGNAME */ + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#define HAVE_GETTEXT 1 + +/* Define if you have the iconv() function and it works. */ +#define HAVE_ICONV 1 + +/* Define to 1 if you have the <iconv.h> header file. */ +#define HAVE_ICONV_H 1 + +/* Define to 1 if the compiler supports one of the keywords 'inline', + '__inline__', '__inline' and effectively inlines functions marked as such. + */ +#define HAVE_INLINE 1 + +/* Define to 1 if you have the <inttypes.h> header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ +/* #undef HAVE_LANGINFO_CODESET */ + +/* Define if you have the libunistring library. */ +/* #undef HAVE_LIBUNISTRING */ + +/* Define to 1 if you have the <limits.h> header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if the system has the type 'long long int'. */ +#define HAVE_LONG_LONG_INT 1 + +/* Define if the 'malloc' function is POSIX compliant. */ +/* #undef HAVE_MALLOC_POSIX */ + +/* Define to 1 if you have the <memory.h> header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 on MSVC platforms that have the "invalid parameter handler" + concept. */ +#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1 + +/* Define to 1 if you have the `rawmemchr' function. */ +/* #undef HAVE_RAWMEMCHR */ + +/* Define to 1 if atoll is declared even after undefining macros. */ +#define HAVE_RAW_DECL_ATOLL 1 + +/* Define to 1 if canonicalize_file_name is declared even after undefining + macros. */ +/* #undef HAVE_RAW_DECL_CANONICALIZE_FILE_NAME */ + +/* Define to 1 if chdir is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_CHDIR */ + +/* Define to 1 if chown is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_CHOWN */ + +/* Define to 1 if dprintf is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_DPRINTF */ + +/* Define to 1 if dup is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_DUP */ + +/* Define to 1 if dup2 is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_DUP2 */ + +/* Define to 1 if dup3 is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_DUP3 */ + +/* Define to 1 if endusershell is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_ENDUSERSHELL */ + +/* Define to 1 if environ is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_ENVIRON */ + +/* Define to 1 if euidaccess is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_EUIDACCESS */ + +/* Define to 1 if faccessat is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FACCESSAT */ + +/* Define to 1 if fchdir is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FCHDIR */ + +/* Define to 1 if fchownat is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FCHOWNAT */ + +/* Define to 1 if fdatasync is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FDATASYNC */ + +/* Define to 1 if ffsl is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FFSL */ + +/* Define to 1 if ffsll is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FFSLL */ + +/* Define to 1 if fpurge is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FPURGE */ + +/* Define to 1 if fseeko is declared even after undefining macros. */ +#define HAVE_RAW_DECL_FSEEKO 1 + +/* Define to 1 if fsync is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_FSYNC */ + +/* Define to 1 if ftello is declared even after undefining macros. */ +#define HAVE_RAW_DECL_FTELLO 1 + +/* Define to 1 if ftruncate is declared even after undefining macros. */ +#define HAVE_RAW_DECL_FTRUNCATE 1 + +/* Define to 1 if getcwd is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETCWD */ + +/* Define to 1 if getdelim is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETDELIM */ + +/* Define to 1 if getdomainname is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETDOMAINNAME */ + +/* Define to 1 if getdtablesize is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETDTABLESIZE */ + +/* Define to 1 if getgroups is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETGROUPS */ + +/* Define to 1 if gethostname is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETHOSTNAME */ + +/* Define to 1 if getline is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETLINE */ + +/* Define to 1 if getloadavg is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETLOADAVG */ + +/* Define to 1 if getlogin is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETLOGIN */ + +/* Define to 1 if getlogin_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETLOGIN_R */ + +/* Define to 1 if getpagesize is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETPAGESIZE */ + +/* Define to 1 if gets is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETS */ + +/* Define to 1 if getsubopt is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETSUBOPT */ + +/* Define to 1 if getusershell is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GETUSERSHELL */ + +/* Define to 1 if grantpt is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GRANTPT */ + +/* Define to 1 if group_member is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_GROUP_MEMBER */ + +/* Define to 1 if initstate is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_INITSTATE */ + +/* Define to 1 if initstate_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_INITSTATE_R */ + +/* Define to 1 if isatty is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_ISATTY */ + +/* Define to 1 if lchown is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_LCHOWN */ + +/* Define to 1 if link is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_LINK */ + +/* Define to 1 if linkat is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_LINKAT */ + +/* Define to 1 if lseek is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_LSEEK */ + +/* Define to 1 if memmem is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MEMMEM */ + +/* Define to 1 if mempcpy is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MEMPCPY */ + +/* Define to 1 if memrchr is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MEMRCHR */ + +/* Define to 1 if mkdtemp is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MKDTEMP */ + +/* Define to 1 if mkostemp is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MKOSTEMP */ + +/* Define to 1 if mkostemps is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MKOSTEMPS */ + +/* Define to 1 if mkstemp is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MKSTEMP */ + +/* Define to 1 if mkstemps is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_MKSTEMPS */ + +/* Define to 1 if pclose is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_PCLOSE */ + +/* Define to 1 if pipe is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_PIPE */ + +/* Define to 1 if pipe2 is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_PIPE2 */ + +/* Define to 1 if popen is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_POPEN */ + +/* Define to 1 if posix_openpt is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_POSIX_OPENPT */ + +/* Define to 1 if pread is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_PREAD */ + +/* Define to 1 if ptsname is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_PTSNAME */ + +/* Define to 1 if ptsname_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_PTSNAME_R */ + +/* Define to 1 if pwrite is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_PWRITE */ + +/* Define to 1 if qsort_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_QSORT_R */ + +/* Define to 1 if random is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_RANDOM */ + +/* Define to 1 if random_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_RANDOM_R */ + +/* Define to 1 if rawmemchr is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_RAWMEMCHR */ + +/* Define to 1 if readlink is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_READLINK */ + +/* Define to 1 if readlinkat is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_READLINKAT */ + +/* Define to 1 if realpath is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_REALPATH */ + +/* Define to 1 if renameat is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_RENAMEAT */ + +/* Define to 1 if rmdir is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_RMDIR */ + +/* Define to 1 if rpmatch is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_RPMATCH */ + +/* Define to 1 if secure_getenv is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SECURE_GETENV */ + +/* Define to 1 if setenv is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SETENV */ + +/* Define to 1 if sethostname is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SETHOSTNAME */ + +/* Define to 1 if setstate is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SETSTATE */ + +/* Define to 1 if setstate_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SETSTATE_R */ + +/* Define to 1 if setusershell is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SETUSERSHELL */ + +/* Define to 1 if sleep is declared even after undefining macros. */ +#define HAVE_RAW_DECL_SLEEP 1 + +/* Define to 1 if snprintf is declared even after undefining macros. */ +#define HAVE_RAW_DECL_SNPRINTF 1 + +/* Define to 1 if srandom is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SRANDOM */ + +/* Define to 1 if srandom_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SRANDOM_R */ + +/* Define to 1 if stpcpy is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STPCPY */ + +/* Define to 1 if stpncpy is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STPNCPY */ + +/* Define to 1 if strcasestr is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRCASESTR */ + +/* Define to 1 if strchrnul is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRCHRNUL */ + +/* Define to 1 if strdup is declared even after undefining macros. */ +#define HAVE_RAW_DECL_STRDUP 1 + +/* Define to 1 if strerror_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRERROR_R */ + +/* Define to 1 if strncat is declared even after undefining macros. */ +#define HAVE_RAW_DECL_STRNCAT 1 + +/* Define to 1 if strndup is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRNDUP */ + +/* Define to 1 if strnlen is declared even after undefining macros. */ +#define HAVE_RAW_DECL_STRNLEN 1 + +/* Define to 1 if strpbrk is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRPBRK */ + +/* Define to 1 if strsep is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRSEP */ + +/* Define to 1 if strsignal is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRSIGNAL */ + +/* Define to 1 if strtod is declared even after undefining macros. */ +#define HAVE_RAW_DECL_STRTOD 1 + +/* Define to 1 if strtok_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRTOK_R */ + +/* Define to 1 if strtoll is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRTOLL */ + +/* Define to 1 if strtoull is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRTOULL */ + +/* Define to 1 if strverscmp is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_STRVERSCMP */ + +/* Define to 1 if symlink is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SYMLINK */ + +/* Define to 1 if symlinkat is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_SYMLINKAT */ + +/* Define to 1 if tmpfile is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_TMPFILE */ + +/* Define to 1 if truncate is declared even after undefining macros. */ +#define HAVE_RAW_DECL_TRUNCATE 1 + +/* Define to 1 if ttyname_r is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_TTYNAME_R */ + +/* Define to 1 if unlink is declared even after undefining macros. */ +#define HAVE_RAW_DECL_UNLINK 1 + +/* Define to 1 if unlinkat is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_UNLINKAT */ + +/* Define to 1 if unlockpt is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_UNLOCKPT */ + +/* Define to 1 if unsetenv is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_UNSETENV */ + +/* Define to 1 if usleep is declared even after undefining macros. */ +#define HAVE_RAW_DECL_USLEEP 1 + +/* Define to 1 if vdprintf is declared even after undefining macros. */ +/* #undef HAVE_RAW_DECL_VDPRINTF */ + +/* Define to 1 if vsnprintf is declared even after undefining macros. */ +#define HAVE_RAW_DECL_VSNPRINTF 1 + +/* Define to 1 if _Exit is declared even after undefining macros. */ +#define HAVE_RAW_DECL__EXIT 1 + +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_SIG_ATOMIC_T */ + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WCHAR_T */ + +/* Define to 1 if 'wint_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WINT_T */ + +/* Define to 1 if you have the <stdint.h> header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the <stdlib.h> header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchrnul' function. */ +/* #undef HAVE_STRCHRNUL */ + +/* Define to 1 if you have the `strerror_r' function. */ +/* #undef HAVE_STRERROR_R */ + +/* Define to 1 if you have the <strings.h> header file. */ +/* #undef HAVE_STRINGS_H */ + +/* Define to 1 if you have the <string.h> header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strverscmp' function. */ +/* #undef HAVE_STRVERSCMP */ + +/* Define to 1 if you have the 'symlink' function. */ +/* #undef HAVE_SYMLINK */ + +/* Define to 1 if you have the <sys/bitypes.h> header file. */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Define to 1 if you have the <sys/inttypes.h> header file. */ +/* #undef HAVE_SYS_INTTYPES_H */ + +/* Define to 1 if you have the <sys/socket.h> header file. */ +/* #undef HAVE_SYS_SOCKET_H */ + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the <sys/types.h> header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +/* #undef HAVE_UNISTD_H */ + +/* Define to 1 if the system has the type 'unsigned long long int'. */ +#define HAVE_UNSIGNED_LONG_LONG_INT 1 + +/* Define if you have a global __progname variable */ +/* #undef HAVE_VAR___PROGNAME */ + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +/* #undef HAVE_VISIBILITY */ + +/* Define to 1 if you have the <wchar.h> header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the 'wchar_t' type. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the <winsock2.h> header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define if you have the 'wint_t' type. */ +#define HAVE_WINT_T 1 + +/* Define to 1 if O_NOATIME works. */ +#define HAVE_WORKING_O_NOATIME 0 + +/* Define to 1 if O_NOFOLLOW works. */ +#define HAVE_WORKING_O_NOFOLLOW 0 + +/* Define to 1 if the system has the type `_Bool'. */ +#define HAVE__BOOL 1 + +/* Define to 1 if you have the '_set_invalid_parameter_handler' function. */ +#define HAVE__SET_INVALID_PARAMETER_HANDLER 1 + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST + +/* Define to a symbolic name denoting the flavor of iconv_open() + implementation. */ +/* #undef ICONV_FLAVOR */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ +#define MALLOC_0_IS_NONNULL 1 + +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# define __USE_MINGW_ANSI_STDIO 1 +#endif + + +/* Name of package */ +#define PACKAGE "libidn2" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "help-libidn@gnu.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libidn2" + +/* String identifying the packager of this software */ +/* #undef PACKAGE_PACKAGER */ + +/* Packager info for bug reports (URL/e-mail/...) */ +/* #undef PACKAGE_PACKAGER_BUG_REPORTS */ + +/* Packager-specific version information */ +/* #undef PACKAGE_PACKAGER_VERSION */ + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libidn2 2.0.4" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libidn2" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "https://www.gnu.org/software/libidn/#libidn2" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.0.4" + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +/* #undef PTRDIFF_T_SUFFIX */ + +/* Define to 1 if strerror(0) does not return a message implying success. */ +/* #undef REPLACE_STRERROR_0 */ + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +/* #undef SIG_ATOMIC_T_SUFFIX */ + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +/* #undef SIZE_T_SUFFIX */ + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# define _DARWIN_C_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# define __STDC_WANT_IEC_60559_BFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# define __STDC_WANT_IEC_60559_DFP_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# define __STDC_WANT_IEC_60559_TYPES_EXT__ 1 +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# define __STDC_WANT_LIB_EXT2__ 1 +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# define __STDC_WANT_MATH_SPEC_FUNCS__ 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable X/Open extensions if necessary. HP-UX 11.11 defines + mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of + whether compiling with -Ae or -D_HPUX_SOURCE=1. */ +#ifndef _XOPEN_SOURCE +/* # undef _XOPEN_SOURCE */ +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "2.0.4" + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +/* #undef WCHAR_T_SUFFIX */ + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +/* #undef WINT_T_SUFFIX */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 1 to make NetBSD features available. MINIX 3 needs this. */ +/* #undef _NETBSD_SOURCE */ + +/* The _Noreturn keyword of C11. */ +#if ! (defined _Noreturn \ + || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) +# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif + + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for 'stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* For standard stat data types on VMS. */ +#define _USE_STD_STAT 1 + +/* Define to 1 if the system <stdint.h> predates C++11. */ +/* #undef __STDC_CONSTANT_MACROS */ + +/* Define to 1 if the system <stdint.h> predates C++11. */ +/* #undef __STDC_LIMIT_MACROS */ + +/* Please see the Gnulib manual for how to use these macros. + + Suppress extern inline with HP-UX cc, as it appears to be broken; see + <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. + + Suppress extern inline with Sun C in standards-conformance mode, as it + mishandles inline functions that call each other. E.g., for 'inline void f + (void) { } inline void g (void) { f (); }', c99 incorrectly complains + 'reference to static identifier "f" in extern inline function'. + This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. + + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like <ctype.h>. For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions. This bug is known to occur on: + + OS X 10.8 and earlier; see: + http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log + + FreeBSD; see: + http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html + + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. + Assume DragonFly and FreeBSD will be similar. */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ + && (defined __header_inline \ + ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ + && ! defined __clang__) \ + : ((! defined _DONT_USE_CTYPE_INLINE_ \ + && (defined __GNUC__ || defined __cplusplus)) \ + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + && defined __GNUC__ && ! defined __cplusplus)))) +# define _GL_EXTERN_INLINE_STDHEADER_BUG +#endif +#if ((__GNUC__ \ + ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + : (199901L <= __STDC_VERSION__ \ + && !defined __HP_cc \ + && !defined __PGI \ + && !(defined __SUNPRO_C && __STDC__))) \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# define _GL_INLINE inline +# define _GL_EXTERN_INLINE extern inline +# define _GL_EXTERN_INLINE_IN_USE +#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ +# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) +# else +# define _GL_INLINE extern inline +# endif +# define _GL_EXTERN_INLINE extern +# define _GL_EXTERN_INLINE_IN_USE +#else +# define _GL_INLINE static _GL_UNUSED +# define _GL_EXTERN_INLINE static _GL_UNUSED +#endif + +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113> and + <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63877>. */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ +# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ +# define _GL_INLINE_HEADER_CONST_PRAGMA +# else +# define _GL_INLINE_HEADER_CONST_PRAGMA \ + _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") +# endif +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ + _GL_INLINE_HEADER_CONST_PRAGMA +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +#else +# define _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_END +#endif + +/* A replacement for va_copy, if needed. */ +#define gl_va_copy(a,b) ((a) = (b)) + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. + __APPLE__ && __MACH__ test for Mac OS X. + __APPLE_CC__ tests for the Apple compiler and its version. + __STDC_VERSION__ tests for the C99 mode. */ +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ +# define __GNUC_STDC_INLINE__ 1 +#endif + +/* Define to `int' if <sys/types.h> does not define. */ +/* #undef mode_t */ + +/* Define to `int' if <sys/types.h> does not define. */ +/* #undef pid_t */ + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#define restrict __restrict +/* Work around a bug in Sun C++: it does not support _Restrict or + __restrict__, even though the corresponding Sun C compiler ends up with + "#define restrict _Restrict" or "#define restrict __restrict__" in the + previous line. Perhaps some future version of Sun C++ will work with + restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +# define __restrict__ +#endif + +/* Define to `unsigned int' if <sys/types.h> does not define. */ +/* #undef size_t */ + +/* Define as a signed type of the same size as size_t. */ +#define ssize_t intptr_t + +/* Define as a marker that can be attached to declarations that might not + be used. This helps to reduce warnings, such as from + GCC -Wunused-parameter. */ +#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) +# define _GL_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_UNUSED +#endif +/* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name + is a misnomer outside of parameter lists. */ +#define _UNUSED_PARAMETER_ _GL_UNUSED + +/* gcc supports the "unused" attribute on possibly unused labels, and + g++ has since version 4.5. Note to support C++ as well as C, + _GL_UNUSED_LABEL should be used with a trailing ; */ +#if !defined __cplusplus || __GNUC__ > 4 \ + || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) +# define _GL_UNUSED_LABEL _GL_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + +/* The __pure__ attribute was added in gcc 2.96. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE /* empty */ +#endif + +/* The __const__ attribute was added in gcc 2.95. */ +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST /* empty */ +#endif + + +/* Define as a macro for copying va_list variables. */ +/* #undef va_copy */ diff --git a/ports/libidn2/portfile.cmake b/ports/libidn2/portfile.cmake new file mode 100644 index 000000000..bbe8f7bbe --- /dev/null +++ b/ports/libidn2/portfile.cmake @@ -0,0 +1,48 @@ +include(vcpkg_common_functions) + +set(IDN2_VERSION 2.0.4) +set(IDN2_FILENAME libidn2-${IDN2_VERSION}.tar.gz) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libidn2-${IDN2_VERSION}) + +vcpkg_download_distfile(ARCHIVE + URLS "http://ftp.gnu.org/gnu/libidn/${IDN2_FILENAME}" + FILENAME "${IDN2_FILENAME}" + SHA512 1e51bd4b8f8907531576291f1c2a8865d17429b4105418b4c98754eb982cd1cbb3adbeab4ec0c1c561d2dba11d876c7c09e5dc5b315c55a2c24986d7a2a3b4d2 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) + +file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h DESTINATION ${SOURCE_PATH}) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/string.h DESTINATION ${SOURCE_PATH}/gl) + +function(simple_copy_template_header FILE_PATH BASE_NAME) + if(NOT EXISTS ${FILE_PATH}/${BASE_NAME}.h) + if(EXISTS ${FILE_PATH}/${BASE_NAME}.in.h) + configure_file(${FILE_PATH}/${BASE_NAME}.in.h ${FILE_PATH}/${BASE_NAME}.h) + endif() + endif() +endfunction() + +# There seems to be no difference between source and destination files after 'configure' +# apart from auto-generated notification at the top. So why not just do a simple copy. +simple_copy_template_header(${SOURCE_PATH}/unistring uniconv) +simple_copy_template_header(${SOURCE_PATH}/unistring unictype) +simple_copy_template_header(${SOURCE_PATH}/unistring uninorm) +simple_copy_template_header(${SOURCE_PATH}/unistring unistr) +simple_copy_template_header(${SOURCE_PATH}/unistring unitypes) +simple_copy_template_header(${SOURCE_PATH}/unistring alloca) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) + +# License and man +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libidn2 RENAME copyright) +file(INSTALL ${SOURCE_PATH}/doc/libidn2.pdf DESTINATION ${CURRENT_PACKAGES_DIR}/share/libidn2) + +vcpkg_copy_pdbs() diff --git a/ports/libidn2/string.h b/ports/libidn2/string.h new file mode 100644 index 000000000..7ed5f5fdc --- /dev/null +++ b/ports/libidn2/string.h @@ -0,0 +1,10 @@ +#ifndef _GL_STRING_H +#define _GL_STRING_H + +char * strchrnul (const char *s, int c_in); +int strverscmp (const char *s1, const char *s2); +void * rawmemchr (const void *s, int c_in); + +#include <../ucrt/string.h> + +#endif /* _GL_STRING_H */ diff --git a/ports/libjpeg-turbo/portfile.cmake b/ports/libjpeg-turbo/portfile.cmake index d1138dbbf..a5d09fda2 100644 --- a/ports/libjpeg-turbo/portfile.cmake +++ b/ports/libjpeg-turbo/portfile.cmake @@ -16,12 +16,12 @@ vcpkg_find_acquire_program(NASM) get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY) set(ENV{PATH} "$ENV{PATH};${NASM_EXE_PATH}") -if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - set(BUILD_STATIC OFF) - set(NOT_BUILD_STATIC ON) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + set(ENABLE_STATIC OFF) + set(ENABLE_SHARED ON) else() - set(BUILD_STATIC ON) - set(NOT_BUILD_STATIC OFF) + set(ENABLE_STATIC ON) + set(ENABLE_SHARED OFF) endif() if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") @@ -32,9 +32,8 @@ vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS - -DENABLE_STATIC=${BUILD_STATIC} - -DENABLE_SHARED=${NOT_BUILD_STATIC} - -DWITH_CRT_DLL=ON + -DENABLE_STATIC=${ENABLE_STATIC} + -DENABLE_SHARED=${ENABLE_SHARED} -DENABLE_EXECUTABLES=OFF -DINSTALL_DOCS=OFF ${LIBJPEGTURBO_SIMD} diff --git a/ports/libnice/CMakeLists.txt b/ports/libnice/CMakeLists.txt index c631d3317..7454a0046 100644 --- a/ports/libnice/CMakeLists.txt +++ b/ports/libnice/CMakeLists.txt @@ -119,7 +119,7 @@ RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) -if (${CMAKE_BUILD_TYPE} STREQUAL "Release") +if (CMAKE_BUILD_TYPE STREQUAL "Release") install(FILES agent/address.h DESTINATION include/nice) install(FILES agent/agent.h DESTINATION include/nice) install(FILES agent/candidate.h DESTINATION include/nice) diff --git a/ports/libtheora/CMakeLists.txt b/ports/libtheora/CMakeLists.txt index 24ecbccf4..cf8799e5d 100644 --- a/ports/libtheora/CMakeLists.txt +++ b/ports/libtheora/CMakeLists.txt @@ -66,7 +66,7 @@ if(USE_X86) add_definitions(-DOC_X86_ASM) endif() -if (${BUILD_SHARED_LIBS}) +if (BUILD_SHARED_LIBS) add_definitions(-DLIBTHEORA_EXPORTS) endif() diff --git a/ports/mpfr/CONTROL b/ports/mpfr/CONTROL index 2d5d4fedd..bec54417d 100644 --- a/ports/mpfr/CONTROL +++ b/ports/mpfr/CONTROL @@ -1,4 +1,4 @@ Source: mpfr -Version: 3.1.5-1 +Version: 3.1.6 Description: The MPFR library is a C library for multiple-precision floating-point computations with correct rounding Build-Depends: mpir diff --git a/ports/mpfr/portfile.cmake b/ports/mpfr/portfile.cmake index 6a61d4038..b71aa0505 100644 --- a/ports/mpfr/portfile.cmake +++ b/ports/mpfr/portfile.cmake @@ -1,9 +1,9 @@ include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpfr-3.1.5) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/mpfr-3.1.6) vcpkg_download_distfile(ARCHIVE - URLS "http://www.mpfr.org/mpfr-current/mpfr-3.1.5.tar.xz" - FILENAME "mpfr-3.1.5.tar.xz" - SHA512 3643469b9099b31e41d6ec9158196cd1c30894030c8864ee5b1b1e91b488bccbf7c263c951b03fe9f4ae6f9d29279e157a7dfed0885467d875f107a3d964f032 + URLS "http://www.mpfr.org/mpfr-current/mpfr-3.1.6.tar.xz" + FILENAME "mpfr-3.1.6.tar.xz" + SHA512 746ee74d5026f267f74ab352d850ed30ff627d530aa840c71b24793e44875f8503946bd7399905dea2b2dd5744326254d7889337fe94cfe58d03c4066e9d8054 ) vcpkg_extract_source_archive(${ARCHIVE}) diff --git a/ports/msmpi/portfile.cmake b/ports/msmpi/portfile.cmake index ca841313e..893e6f124 100644 --- a/ports/msmpi/portfile.cmake +++ b/ports/msmpi/portfile.cmake @@ -22,7 +22,7 @@ vcpkg_get_program_files_platform_bitness(PROGRAM_FILES_PLATFORM_BITNESS) set(SYSTEM_MPIEXEC_FILEPATH "${PROGRAM_FILES_PLATFORM_BITNESS}/Microsoft MPI/Bin/mpiexec.exe") set(MSMPI_EXPECTED_FULL_VERSION "8.1.12438.1084") -if(EXISTS ${SYSTEM_MPIEXEC_FILEPATH}) +if(EXISTS "${SYSTEM_MPIEXEC_FILEPATH}") set(MPIEXEC_VERSION_LOGNAME "mpiexec-version") vcpkg_execute_required_process( COMMAND ${SYSTEM_MPIEXEC_FILEPATH} @@ -31,8 +31,8 @@ if(EXISTS ${SYSTEM_MPIEXEC_FILEPATH}) ) file(READ ${CURRENT_BUILDTREES_DIR}/${MPIEXEC_VERSION_LOGNAME}-out.log MPIEXEC_OUTPUT) - if(${MPIEXEC_OUTPUT} MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)\\]") - if(NOT ${CMAKE_MATCH_1} STREQUAL ${MSMPI_EXPECTED_FULL_VERSION}) + if(MPIEXEC_OUTPUT MATCHES "\\[Version ([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)\\]") + if(NOT CMAKE_MATCH_1 STREQUAL MSMPI_EXPECTED_FULL_VERSION) download_msmpi_redistributable_package() message(FATAL_ERROR @@ -102,7 +102,7 @@ file(INSTALL DESTINATION ${CURRENT_PACKAGES_DIR}/lib ) -if(${TRIPLET_SYSTEM_ARCH} STREQUAL "x86") +if(TRIPLET_SYSTEM_ARCH STREQUAL "x86") file(INSTALL "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib" "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib" @@ -121,7 +121,7 @@ file(INSTALL DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib ) -if(${TRIPLET_SYSTEM_ARCH} STREQUAL "x86") +if(TRIPLET_SYSTEM_ARCH STREQUAL "x86") file(INSTALL "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifes.lib" "${SOURCE_LIB_PATH}/${TRIPLET_SYSTEM_ARCH}/msmpifms.lib" diff --git a/ports/openni2/CONTROL b/ports/openni2/CONTROL index 72de4e877..b1d60d860 100644 --- a/ports/openni2/CONTROL +++ b/ports/openni2/CONTROL @@ -1,4 +1,4 @@ Source: openni2 -Version: 2.2.0.33-2 +Version: 2.2.0.33-4 Build-Depends: kinectsdk1 Description: OpenNI is open source library for access to Natural Interaction (NI) devices such as RGB-D camera. diff --git a/ports/openni2/portfile.cmake b/ports/openni2/portfile.cmake index 2e91bac3f..cc428ddb7 100644 --- a/ports/openni2/portfile.cmake +++ b/ports/openni2/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) -# - # UWP Not Support if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") message(FATAL_ERROR "Error: UWP builds are currently not supported.") @@ -28,16 +16,13 @@ endif() # Download Source Code include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/OpenNI2-2.2-beta2) -vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/OpenNI/OpenNI2/archive/2.2-beta2.zip" - FILENAME "OpenNI2-2.2-beta.zip" - SHA512 9779161493114265745c9eb8b15db95a3ed2322cd75504931d0fb7b6214d7abc8a9eb2ea5f35e309bc4d2748f015eee27ada4974a2e9568b5ecb9d98099c84e9 +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO OpenNI/OpenNI2 + REF 2.2-beta2 + SHA512 60a3a3043679f3069aea869e92dc5881328ce4393d4140ea8d089027321ac501ae27d283657214e2834d216d0d49bf4f29a4b3d3e43df27a6ed21f889cd0083f + HEAD_REF master ) -vcpkg_extract_source_archive(${ARCHIVE}) - -file(TO_NATIVE_PATH ${VCPKG_ROOT_DIR} NATIVE_VCPKG_ROOT_DIR) -configure_file("${CMAKE_CURRENT_LIST_DIR}/replace_environment_variable.patch.in" "${CMAKE_CURRENT_LIST_DIR}/replace_environment_variable.patch" @ONLY) vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} @@ -46,6 +31,17 @@ vcpkg_apply_patches( "${CMAKE_CURRENT_LIST_DIR}/replace_environment_variable.patch" ) +file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) +file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) +file(COPY ${SOURCE_PATH} DESTINATION ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) +get_filename_component(SOURCE_DIR_NAME "${SOURCE_PATH}" NAME) + +# Use fresh copy of sources for building and modification +set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${SOURCE_DIR_NAME}") + +file(TO_NATIVE_PATH ${CURRENT_INSTALLED_DIR} NATIVE_INSTALLED_DIR) +configure_file("${SOURCE_PATH}/Source/Drivers/Kinect/Kinect.vcxproj" "${SOURCE_PATH}/Source/Drivers/Kinect/Kinect.vcxproj" @ONLY) + # Build OpenNI2 vcpkg_build_msbuild( PROJECT_PATH "${SOURCE_PATH}/OpenNI.sln" diff --git a/ports/openni2/replace_environment_variable.patch.in b/ports/openni2/replace_environment_variable.patch index ac5cf017c..48978e869 100644 --- a/ports/openni2/replace_environment_variable.patch.in +++ b/ports/openni2/replace_environment_variable.patch @@ -7,7 +7,7 @@ index 08a49fe..7fd8620 100644 <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc;</AdditionalIncludeDirectories> -+ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x86-windows\include</AdditionalIncludeDirectories> ++ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_INSTALLED_DIR@\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions);_WINDOWS</PreprocessorDefinitions> <DisableLanguageExtensions>false</DisableLanguageExtensions> <TreatWarningAsError>false</TreatWarningAsError> @@ -16,7 +16,7 @@ index 08a49fe..7fd8620 100644 <GenerateDebugInformation>true</GenerateDebugInformation> <AdditionalDependencies>Kinect10.lib;XnLib.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\x86;</AdditionalLibraryDirectories> -+ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x86-windows\debug\lib</AdditionalLibraryDirectories> ++ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_INSTALLED_DIR@\debug\lib</AdditionalLibraryDirectories> <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> </Link> </ItemDefinitionGroup> @@ -25,7 +25,7 @@ index 08a49fe..7fd8620 100644 <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc;</AdditionalIncludeDirectories> -+ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x64-windows\include</AdditionalIncludeDirectories> ++ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_INSTALLED_DIR@\include</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WINDLL;%(PreprocessorDefinitions);_WINDOWS</PreprocessorDefinitions> <DisableLanguageExtensions>false</DisableLanguageExtensions> <TreatWarningAsError>false</TreatWarningAsError> @@ -34,7 +34,7 @@ index 08a49fe..7fd8620 100644 <GenerateDebugInformation>true</GenerateDebugInformation> <AdditionalDependencies>Kinect10.lib;XnLib.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\amd64;</AdditionalLibraryDirectories> -+ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x64-windows\debug\lib</AdditionalLibraryDirectories> ++ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_INSTALLED_DIR@\debug\lib</AdditionalLibraryDirectories> <IgnoreSpecificDefaultLibraries> </IgnoreSpecificDefaultLibraries> <IgnoreAllDefaultLibraries> @@ -43,7 +43,7 @@ index 08a49fe..7fd8620 100644 <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc;</AdditionalIncludeDirectories> -+ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x86-windows\include</AdditionalIncludeDirectories> ++ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_INSTALLED_DIR@\include</AdditionalIncludeDirectories> <TreatWarningAsError>false</TreatWarningAsError> </ClCompile> <Link> @@ -52,7 +52,7 @@ index 08a49fe..7fd8620 100644 <OptimizeReferences>true</OptimizeReferences> <AdditionalDependencies>Kinect10.lib;XnLib.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\x86;</AdditionalLibraryDirectories> -+ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x86-windows\lib</AdditionalLibraryDirectories> ++ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_INSTALLED_DIR@\lib</AdditionalLibraryDirectories> <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> </Link> </ItemDefinitionGroup> @@ -61,7 +61,7 @@ index 08a49fe..7fd8620 100644 <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;$(KINECTSDK10_DIR)\inc;</AdditionalIncludeDirectories> -+ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x64-windows\include</AdditionalIncludeDirectories> ++ <AdditionalIncludeDirectories>..\..\..\Include;..\..\..\ThirdParty\PSCommon\XnLib\Include;@NATIVE_INSTALLED_DIR@\include</AdditionalIncludeDirectories> <TreatWarningAsError>false</TreatWarningAsError> </ClCompile> <Link> @@ -70,7 +70,7 @@ index 08a49fe..7fd8620 100644 <OptimizeReferences>true</OptimizeReferences> <AdditionalDependencies>Kinect10.lib;XnLib.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;$(KINECTSDK10_DIR)\lib\amd64;</AdditionalLibraryDirectories> -+ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_VCPKG_ROOT_DIR@\packages\kinectsdk1_x64-windows\lib</AdditionalLibraryDirectories> ++ <AdditionalLibraryDirectories>$(SolutionDir)Bin\$(Platform)-$(Configuration)\;@NATIVE_INSTALLED_DIR@\lib</AdditionalLibraryDirectories> <TreatLinkerWarningAsErrors>true</TreatLinkerWarningAsErrors> </Link> </ItemDefinitionGroup> diff --git a/ports/pcl/CONTROL b/ports/pcl/CONTROL index e9547c8cb..d8c38a363 100644 --- a/ports/pcl/CONTROL +++ b/ports/pcl/CONTROL @@ -1,4 +1,4 @@ Source: pcl -Version: 1.8.1-1 -Build-Depends: boost, eigen3, flann, qhull, vtk, openni2, qt5 +Version: 1.8.1-2 +Build-Depends: boost, eigen3, flann, qhull, vtk, openni2, qt5, winpcap Description: Point Cloud Library (PCL) is open source library for 2D/3D image and point cloud processing. diff --git a/ports/pcl/portfile.cmake b/ports/pcl/portfile.cmake index 8010d9c70..cd5c5bedc 100644 --- a/ports/pcl/portfile.cmake +++ b/ports/pcl/portfile.cmake @@ -50,7 +50,7 @@ vcpkg_configure_cmake( -DWITH_CUDA=OFF -DWITH_LIBUSB=OFF -DWITH_OPENNI2=ON - -DWITH_PCAP=OFF + -DWITH_PCAP=ON -DWITH_PNG=OFF -DWITH_QHULL=ON -DWITH_QT=ON diff --git a/ports/shaderc/CMakeLists.txt b/ports/shaderc/CMakeLists.txt index f4e0830c6..580ffa1d1 100644 --- a/ports/shaderc/CMakeLists.txt +++ b/ports/shaderc/CMakeLists.txt @@ -1,5 +1,5 @@ option(SUFFIX_D "Add d Suffix to lib" ${SUFFIX_D})
-if(NOT ${SUFFIX_D})
+if(NOT SUFFIX_D)
find_library(GLSLANG glslang)
find_library(OSDEPENDENT OSDependent)
find_library(OGLCOMPILER OGLCompiler)
diff --git a/ports/shaderc/CMakeLists_spirv.txt b/ports/shaderc/CMakeLists_spirv.txt index 6aa738b1f..618177fa6 100644 --- a/ports/shaderc/CMakeLists_spirv.txt +++ b/ports/shaderc/CMakeLists_spirv.txt @@ -1,5 +1,5 @@ option(SUFFIX_D "Add d Suffix to lib" ${SUFFIX_D}) -if(NOT ${SUFFIX_D}) +if(NOT SUFFIX_D) find_library(SPIRVTOOLSOPT spirv-tools-opt) find_library(SPIRVTOOLS spirv-tools) ELSE() diff --git a/ports/spatialite-tools/CONTROL b/ports/spatialite-tools/CONTROL new file mode 100644 index 000000000..ecbf681c6 --- /dev/null +++ b/ports/spatialite-tools/CONTROL @@ -0,0 +1,4 @@ +Source: spatialite-tools +Version: 4.3.0 +Description: Contains spatialite.exe and other command line tools to work with SpatiaLite databases (import, export, SQL queries) +Build-Depends: sqlite3, libspatialite, geos, readosm, proj4, zlib, libiconv, expat diff --git a/ports/spatialite-tools/fix-makefiles.patch b/ports/spatialite-tools/fix-makefiles.patch new file mode 100644 index 000000000..ff6e0ad0d --- /dev/null +++ b/ports/spatialite-tools/fix-makefiles.patch @@ -0,0 +1,128 @@ +diff --git a/makefile.vc b/makefile.vc +index 33c85d2..c811e7d 100644 +--- a/makefile.vc ++++ b/makefile.vc +@@ -15,7 +15,7 @@ SPATIALITE_OSM_RAW_EXE = spatialite_osm_raw.exe + SPATIALITE_OSM_FILTER_EXE = spatialite_osm_filter.exe + SPATIALITE_GML_EXE = spatialite_gml.exe + +-CFLAGS = /nologo -IC:\OSGeo4W\include $(OPTFLAGS) ++CFLAGS = /nologo -I$(INSTALLED_ROOT)\include $(OPTFLAGS) + + default: all + +@@ -26,89 +26,58 @@ all: $(SPATIALITE_EXE) $(SHP_DOCTOR_EXE) $(SPATIALITE_TOOL_EXE) \ + $(SPATIALITE_OSM_FILTER_EXE) + + $(SPATIALITE_EXE): shell.obj +- cl shell.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib C:\OSGeo4W\lib\geos_c.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib \ +- /Fe$(SPATIALITE_EXE) ++ cl shell.obj $(LIBS_ALL) /Fe$(SPATIALITE_EXE) + if exist $(SPATIALITE_EXE).manifest mt -manifest \ + $(SPATIALITE_EXE).manifest -outputresource:$(SPATIALITE_EXE);1 + + $(EXIF_LOADER_EXE): exif_loader.obj +- cl exif_loader.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib C:\OSGeo4W\lib\geos_c.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl exif_loader.obj $(LIBS_ALL) + if exist $(EXIF_LOADER_EXE).manifest mt -manifest \ + $(EXIF_LOADER_EXE).manifest -outputresource:$(EXIF_LOADER_EXE);1 + + $(SHP_DOCTOR_EXE): shp_doctor.obj +- cl shp_doctor.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib C:\OSGeo4W\lib\geos_c.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl shp_doctor.obj $(LIBS_ALL) + if exist $(SHP_DOCTOR_EXE).manifest mt -manifest \ + $(SHP_DOCTOR_EXE).manifest -outputresource:$(SHP_DOCTOR_EXE);1 + + $(SPATIALITE_NETWORK_EXE): spatialite_network.obj +- cl spatialite_network.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl spatialite_network.obj $(LIBS_ALL) + if exist $(SPATIALITE_NETWORK_EXE).manifest mt -manifest \ + $(SPATIALITE_TOOL_EXE).manifest \ + -outputresource:$(SPATIALITE_TOOL_EXE);1 + + $(SPATIALITE_TOOL_EXE): spatialite_tool.obj +- cl spatialite_tool.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib C:\OSGeo4W\lib\geos_c.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl spatialite_tool.obj $(LIBS_ALL) + if exist $(SPATIALITE_TOOL_EXE).manifest mt -manifest \ + $(SPATIALITE_TOOL_EXE).manifest \ + -outputresource:$(SPATIALITE_TOOL_EXE);1 + + $(SPATIALITE_OSM_NET_EXE): spatialite_osm_net.obj +- cl spatialite_osm_net.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib \ +- C:\OSGeo4W\lib\readosm_i.lib \ +- C:\OSGeo4W\lib\libexpat.lib \ +- C:\OSGeo4W\lib\zlib.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl spatialite_osm_net.obj $(LIBS_ALL) + if exist $(SPATIALITE_OSM_EXE).manifest mt -manifest \ + $(SPATIALITE_OSM_EXE).manifest \ + -outputresource:$(SPATIALITE_OSM_NET_EXE);1 + + $(SPATIALITE_OSM_MAP_EXE): spatialite_osm_map.obj +- cl spatialite_osm_map.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib \ +- C:\OSGeo4W\lib\readosm_i.lib \ +- C:\OSGeo4W\lib\libexpat.lib \ +- C:\OSGeo4W\lib\zlib.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl spatialite_osm_map.obj $(LIBS_ALL) + if exist $(SPATIALITE_OSM_MAP_EXE).manifest mt -manifest \ + $(SPATIALITE_OSM_MAP_EXE).manifest \ + -outputresource:$(SPATIALITE_OSM_MAP_EXE);1 + + $(SPATIALITE_GML_EXE): spatialite_gml.obj +- cl spatialite_gml.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib \ +- C:\OSGeo4W\lib\libexpat.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl spatialite_gml.obj $(LIBS_ALL) + if exist $(SPATIALITE_GML_EXE).manifest mt -manifest \ + $(SPATIALITE_GML_EXE).manifest \ + -outputresource:$(SPATIALITE_GML_EXE);1 + + $(SPATIALITE_OSM_RAW_EXE): spatialite_osm_raw.obj +- cl spatialite_osm_raw.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib \ +- C:\OSGeo4W\lib\readosm_i.lib \ +- C:\OSGeo4W\lib\libexpat.lib \ +- C:\OSGeo4W\lib\zlib.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl spatialite_osm_raw.obj $(LIBS_ALL) + if exist $(SPATIALITE_OSM_RAW_EXE).manifest mt -manifest \ + $(SPATIALITE_OSM_RAW_EXE).manifest \ + -outputresource:$(SPATIALITE_OSM_RAW_EXE);1 + + $(SPATIALITE_OSM_FILTER_EXE): spatialite_osm_filter.obj +- cl spatialite_osm_filter.obj C:\OSGeo4W\lib\proj_i.lib \ +- C:\OSGeo4W\lib\iconv.lib \ +- C:\OSGeo4W\lib\spatialite_i.lib C:\OSGeo4W\lib\sqlite3_i.lib ++ cl spatialite_osm_filter.obj $(LIBS_ALL) + if exist $(SPATIALITE_OSM_FILTER_EXE).manifest mt -manifest \ + $(SPATIALITE_OSM_FILTER_EXE).manifest \ + -outputresource:$(SPATIALITE_OSM_FILTER_EXE);1 +diff --git a/nmake.opt b/nmake.opt +index 4f4a953..d9efecf 100644 +--- a/nmake.opt ++++ b/nmake.opt +@@ -1,8 +1,8 @@ + # Directory tree where SpatiaLite will be installed. +-INSTDIR=C:\OSGeo4W ++INSTDIR=$(INST_DIR) + + # Uncomment the first for an optimized build, or the second for debug. +-OPTFLAGS= /nologo /Ox /fp:precise /W3 /MD /D_CRT_SECURE_NO_WARNINGS \ ++OPTFLAGS= /nologo /fp:precise /W3 $(CL_FLAGS) /D_CRT_SECURE_NO_WARNINGS \ + /D_LARGE_FILE=1 /D_FILE_OFFSET_BITS=64 /D_LARGEFILE_SOURCE=1 + #OPTFLAGS= /nologo /Zi /MD /Fdspatialite.pdb + diff --git a/ports/spatialite-tools/portfile.cmake b/ports/spatialite-tools/portfile.cmake new file mode 100644 index 000000000..f42227a12 --- /dev/null +++ b/ports/spatialite-tools/portfile.cmake @@ -0,0 +1,118 @@ +include(vcpkg_common_functions) + +option(BUILD_DEBUG_TOOLS "Build debug version of tools" OFF) + +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/spatialite-tools-4.3.0) +vcpkg_download_distfile(ARCHIVE + URLS "http://www.gaia-gis.it/gaia-sins/spatialite-tools-4.3.0.tar.gz" + FILENAME "spatialite-tools-4.3.0.tar.gz" + SHA512 e1de27c1c65ff2ff0b08583113517bea74edf33fff59ad6e9c77492ea3ae87d9c0f17d7670ee6602b32eea73ad3678bb5410ef2c6fac6e213bf2e341a907db88 +) +vcpkg_extract_source_archive(${ARCHIVE}) + +find_program(NMAKE nmake) + +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-makefiles.patch +) + +set(LDIR "\"${CURRENT_INSTALLED_DIR}\"") + +if(VCPKG_CRT_LINKAGE STREQUAL dynamic) + set(CL_FLAGS_DBG "/MDd /Zi") + set(CL_FLAGS_REL "/MD /Ox") + set(GEOS_LIBS_REL "${LDIR}/lib/geos_c.lib") + set(GEOS_LIBS_DBG "${LDIR}/debug/lib/geos_c.lib") + set(LIBXML2_LIBS_REL "${LDIR}/lib/libxml2.lib") + set(LIBXML2_LIBS_DBG "${LDIR}/debug/lib/libxml2.lib") + set(SPATIALITE_LIBS_REL "${LDIR}/lib/spatialite.lib") + set(SPATIALITE_LIBS_DBG "${LDIR}/debug/lib/spatialite.lib") + set(ICONV_LIBS_REL "${LDIR}/lib/libiconv.lib") + set(ICONV_LIBS_DBG "${LDIR}/debug/lib/libiconv.lib") +else() + set(CL_FLAGS_DBG "/MTd /Zi") + set(CL_FLAGS_REL "/MT /Ox") + set(GEOS_LIBS_REL "${LDIR}/lib/libgeos_c.lib ${LDIR}/lib/libgeos.lib") + set(GEOS_LIBS_DBG "${LDIR}/debug/lib/libgeos_c.lib ${LDIR}/debug/lib/libgeos.lib") + set(LIBXML2_LIBS_REL "${LDIR}/lib/libxml2.lib ${LDIR}/lib/lzma.lib ws2_32.lib") + set(LIBXML2_LIBS_DBG "${LDIR}/debug/lib/libxml2.lib ${LDIR}/debug/lib/lzma.lib ws2_32.lib") + set(SPATIALITE_LIBS_REL "${LDIR}/lib/spatialite.lib ${LDIR}/lib/freexl.lib") + set(SPATIALITE_LIBS_DBG "${LDIR}/debug/lib/spatialite.lib ${LDIR}/debug/lib/freexl.lib") + set(ICONV_LIBS_REL "${LDIR}/lib/libiconv.lib ${LDIR}/lib/libcharset.lib") + set(ICONV_LIBS_DBG "${LDIR}/debug/lib/libiconv.lib ${LDIR}/debug/lib/libcharset.lib ") +endif() + +set(LIBS_ALL_DBG + "${ICONV_LIBS_DBG} \ + ${LDIR}/debug/lib/sqlite3.lib \ + ${SPATIALITE_LIBS_DBG} \ + ${LIBXML2_LIBS_DBG} \ + ${GEOS_LIBS_DBG} \ + ${LDIR}/debug/lib/readosm.lib \ + ${LDIR}/debug/lib/expat.lib \ + ${LDIR}/debug/lib/zlibd.lib \ + ${LDIR}/debug/lib/projd.lib" + ) +set(LIBS_ALL_REL + "${ICONV_LIBS_REL} \ + ${LDIR}/lib/sqlite3.lib \ + ${SPATIALITE_LIBS_REL} \ + ${LIBXML2_LIBS_REL} \ + ${GEOS_LIBS_REL} \ + ${LDIR}/lib/readosm.lib \ + ${LDIR}/lib/expat.lib \ + ${LDIR}/lib/zlib.lib \ + ${LDIR}/lib/proj.lib" + ) + +if(BUILD_DEBUG_TOOLS) + ################ + # Debug build + ################ + message(STATUS "Building ${TARGET_TRIPLET}-dgb") + + file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL) + vcpkg_execute_required_process( + COMMAND ${NMAKE} -f makefile.vc clean install + "INST_DIR=\"${INST_DIR_REL}\"" "INSTALLED_ROOT=${LDIR}" "CL_FLAGS=${CL_FLAGS_DBG}" "LIBS_ALL=${LIBS_ALL_DBG}" + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME nmake-build-${TARGET_TRIPLET}-debug + ) + message(STATUS "Building ${TARGET_TRIPLET}-dbg done") + set(EXE_FOLDER ${CURRENT_PACKAGES_DIR}/bin/) +else() + ################ + # Release build + ################ + message(STATUS "Building ${TARGET_TRIPLET}-rel") + + file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR_REL) + vcpkg_execute_required_process( + COMMAND ${NMAKE} -f makefile.vc clean install + "INST_DIR=\"${INST_DIR_REL}\"" "INSTALLED_ROOT=${LDIR}" "CL_FLAGS=${CL_FLAGS_REL}" "LIBS_ALL=${LIBS_ALL_REL}" + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME nmake-build-${TARGET_TRIPLET}-release + ) + message(STATUS "Building ${TARGET_TRIPLET}-rel done") + set(EXE_FOLDER ${CURRENT_PACKAGES_DIR}/bin/) +endif() + +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright) + +file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/${PORT}/) +file(GLOB EXES "${EXE_FOLDER}/*.exe") +file(COPY ${EXES} DESTINATION ${CURRENT_PACKAGES_DIR}/tools/${PORT}) +file(REMOVE ${EXES}) + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include) + +if(NOT BUILD_DEBUG_TOOLS AND VCPKG_CRT_LINKAGE STREQUAL dynamic) + vcpkg_copy_tool_dependencies(${CURRENT_PACKAGES_DIR}/tools/${PORT}) +endif() + +message(STATUS "Packaging ${TARGET_TRIPLET} done") + +# Allow empty include directory +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) diff --git a/ports/tiny-dnn/CONTROL b/ports/tiny-dnn/CONTROL new file mode 100644 index 000000000..f12cc076f --- /dev/null +++ b/ports/tiny-dnn/CONTROL @@ -0,0 +1,3 @@ +Source: tiny-dnn +Version: 2017-10-09-dd906fed8c8aff8dc837657c42f9d55f8b793b0e +Description: A C++14 implementation of deep learning. It is suitable for deep learning on limited computational resource. diff --git a/ports/tiny-dnn/portfile.cmake b/ports/tiny-dnn/portfile.cmake new file mode 100644 index 000000000..7e3baa92a --- /dev/null +++ b/ports/tiny-dnn/portfile.cmake @@ -0,0 +1,15 @@ +#header-only library +include(vcpkg_common_functions) +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO tiny-dnn/tiny-dnn + REF dd906fed8c8aff8dc837657c42f9d55f8b793b0e + SHA512 d853db7f49af1bece55337b93631c41191f3abd8287969f230330662fecc612e4e53ab789535fc6f9770ae0c8623d8e020e6036c2c804783d08f176a08c05d1b + HEAD_REF master +) + +file(INSTALL ${SOURCE_PATH}/tiny_dnn DESTINATION ${CURRENT_PACKAGES_DIR}/include) + + +file(COPY ${CURRENT_BUILDTREES_DIR}/src/tiny-dnn-dd906fed8c8aff8dc837657c42f9d55f8b793b0e/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/tiny-dnn) + file(RENAME ${CURRENT_PACKAGES_DIR}/share/tiny-dnn/LICENSE ${CURRENT_PACKAGES_DIR}/share/tiny-dnn/copyright)
\ No newline at end of file diff --git a/ports/vtk/CONTROL b/ports/vtk/CONTROL index 284ccecd3..22d1b1376 100644 --- a/ports/vtk/CONTROL +++ b/ports/vtk/CONTROL @@ -1,4 +1,4 @@ Source: vtk -Version: 8.0.0-2 +Version: 8.0.0-3 Description: Software system for 3D computer graphics, image processing, and visualization -Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi, libjpeg-turbo, proj4, lz4, libtheora +Build-Depends: zlib, libpng, tiff, libxml2, jsoncpp, glew, freetype, expat, hdf5, qt5, msmpi, libjpeg-turbo, proj4, lz4, libtheora, libharu diff --git a/ports/vtk/FindGDAL.cmake b/ports/vtk/FindGDAL.cmake new file mode 100644 index 000000000..e4f2f303b --- /dev/null +++ b/ports/vtk/FindGDAL.cmake @@ -0,0 +1,127 @@ +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying +# file Copyright.txt or https://cmake.org/licensing for details. + +#.rst: +# FindGDAL +# -------- +# +# +# +# Locate gdal +# +# This module accepts the following environment variables: +# +# :: +# +# GDAL_DIR or GDAL_ROOT - Specify the location of GDAL +# +# +# +# This module defines the following CMake variables: +# +# :: +# +# GDAL_FOUND - True if libgdal is found +# GDAL_LIBRARY - A variable pointing to the GDAL library +# GDAL_INCLUDE_DIR - Where to find the headers + +# +# $GDALDIR is an environment variable that would +# correspond to the ./configure --prefix=$GDAL_DIR +# used in building gdal. +# +# Created by Eric Wing. I'm not a gdal user, but OpenSceneGraph uses it +# for osgTerrain so I whipped this module together for completeness. +# I actually don't know the conventions or where files are typically +# placed in distros. +# Any real gdal users are encouraged to correct this (but please don't +# break the OS X framework stuff when doing so which is what usually seems +# to happen). + +# This makes the presumption that you are include gdal.h like +# +#include "gdal.h" + +find_path(GDAL_INCLUDE_DIR gdal.h + HINTS + ENV GDAL_DIR + ENV GDAL_ROOT + PATH_SUFFIXES + include/gdal + include/GDAL + include + PATHS + ~/Library/Frameworks/gdal.framework/Headers + /Library/Frameworks/gdal.framework/Headers + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt +) + +if(UNIX) + # Use gdal-config to obtain the library version (this should hopefully + # allow us to -lgdal1.x.y where x.y are correct version) + # For some reason, libgdal development packages do not contain + # libgdal.so... + find_program(GDAL_CONFIG gdal-config + HINTS + ENV GDAL_DIR + ENV GDAL_ROOT + PATH_SUFFIXES bin + PATHS + /sw # Fink + /opt/local # DarwinPorts + /opt/csw # Blastwave + /opt + ) + + if(GDAL_CONFIG) + exec_program(${GDAL_CONFIG} ARGS --libs OUTPUT_VARIABLE GDAL_CONFIG_LIBS) + if(GDAL_CONFIG_LIBS) + string(REGEX MATCHALL "-l[^ ]+" _gdal_dashl ${GDAL_CONFIG_LIBS}) + string(REPLACE "-l" "" _gdal_lib "${_gdal_dashl}") + string(REGEX MATCHALL "-L[^ ]+" _gdal_dashL ${GDAL_CONFIG_LIBS}) + string(REPLACE "-L" "" _gdal_libpath "${_gdal_dashL}") + endif() + endif() +endif() + +find_library(GDAL_LIBRARY_RELEASE + NAMES ${_gdal_lib} gdal gdal_i gdal1.5.0 gdal1.4.0 gdal1.3.2 GDAL + HINTS + ENV GDAL_DIR + ENV GDAL_ROOT + ${_gdal_libpath} + PATH_SUFFIXES lib + PATHS + /sw + /opt/local + /opt/csw + /opt + /usr/freeware +) + +find_library(GDAL_LIBRARY_DEBUG + NAMES ${_gdal_lib} gdald gdald_i gdald1.5.0 gdald1.4.0 gdald1.3.2 GDALD + HINTS + ENV GDAL_DIR + ENV GDAL_ROOT + ${_gdal_libpath} + PATH_SUFFIXES lib + PATHS + /sw + /opt/local + /opt/csw + /opt + /usr/freeware +) + +include(SelectLibraryConfigurations) +select_library_configurations(GDAL) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GDAL DEFAULT_MSG GDAL_LIBRARY GDAL_INCLUDE_DIR) + +set(GDAL_LIBRARIES ${GDAL_LIBRARY}) +set(GDAL_INCLUDE_DIRS ${GDAL_INCLUDE_DIR}) diff --git a/ports/vtk/fix-find-libharu.patch b/ports/vtk/fix-find-libharu.patch new file mode 100644 index 000000000..683f7bae6 --- /dev/null +++ b/ports/vtk/fix-find-libharu.patch @@ -0,0 +1,18 @@ +--- a/CMake/FindLibHaru.cmake Mon Jun 26 15:29:04 2017 ++++ b/CMake/FindLibHaru.cmake Wed Aug 16 09:30:12 2017 +@@ -19,9 +19,13 @@ + + find_path(LIBHARU_INCLUDE_DIR hpdf.h) + +-find_library(LIBHARU_LIBRARY NAMES hpdf) ++find_library(LIBHARU_LIBRARY_RELEASE NAMES hpdf libhpdf) ++find_library(LIBHARU_LIBRARY_DEBUG NAMES hpdfd libhpdfd) + +-# handle the QUIETLY and REQUIRED arguments and set FONTCONFIG_FOUND to TRUE if ++include(SelectLibraryConfigurations) ++select_library_configurations(LIBHARU) ++ ++# handle the QUIETLY and REQUIRED arguments and set LIBHARU_FOUND to TRUE if + # all listed variables are TRUE + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LibHaru DEFAULT_MSG diff --git a/ports/vtk/fix-find-mysql.patch b/ports/vtk/fix-find-mysql.patch new file mode 100644 index 000000000..d2f984cd5 --- /dev/null +++ b/ports/vtk/fix-find-mysql.patch @@ -0,0 +1,10 @@ +--- a/CMake/FindMySQL.cmake Mon Jun 26 15:29:04 2017 ++++ b/CMake/FindMySQL.cmake Wed Aug 16 11:21:58 2017 +@@ -28,6 +28,7 @@ + "C:/MySQL/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MySQL AB\\MySQL Server 5.0;Location]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\MySQL AB\\MySQL Server 5.0;Location]/include" ++ PATH_SUFFIXES mysql + DOC "Specify the directory containing mysql.h." + ) + diff --git a/ports/vtk/fix-find-odbc.patch b/ports/vtk/fix-find-odbc.patch new file mode 100644 index 000000000..0690ed0a9 --- /dev/null +++ b/ports/vtk/fix-find-odbc.patch @@ -0,0 +1,11 @@ +--- a/CMake/FindODBC.cmake Mon Jun 26 15:29:04 2017 ++++ b/CMake/FindODBC.cmake Wed Aug 16 12:58:11 2017 +@@ -30,7 +30,7 @@ + ) + + FIND_LIBRARY( ODBC_LIBRARY +- NAMES odbc iodbc unixodbc ++ NAMES odbc iodbc unixodbc odbc32 + PATHS + /usr/lib + /usr/lib/odbc diff --git a/ports/vtk/portfile.cmake b/ports/vtk/portfile.cmake index ff9d457f1..c5ea4c387 100644 --- a/ports/vtk/portfile.cmake +++ b/ports/vtk/portfile.cmake @@ -1,13 +1,26 @@ include(vcpkg_common_functions) +set(VTK_SHORT_VERSION "8.0") +set(VTK_LONG_VERSION "${VTK_SHORT_VERSION}.0") + vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO "Kitware/VTK" - REF "v8.0.0" + REF "v${VTK_LONG_VERSION}" SHA512 1a328f24df0b1c40c623ae80c9d49f8b27570144b10af02aeed41b90b50b8d4e0dd83d1341961f6818cde36e2cd793c578ebc95a46950cebfc518f486f249791 HEAD_REF "master" ) +# ============================================================================= +# Options: These should be set by feature-packages when they become available +set(VTK_WITH_QT ON ) # IMPORTANT: if ON make sure `qt5` is listed as dependency in the CONTROL file +set(VTK_WITH_MPI ON ) # IMPORTANT: if ON make sure `mpi` is listed as dependency in the CONTROL file +set(VTK_WITH_PYTHON OFF) # IMPORTANT: if ON make sure `python3` is listed as dependency in the CONTROL file +set(VTK_WITH_ALL_MODULES OFF) # IMPORTANT: if ON make sure `qt5`, `mpi`, `python3`, `ffmpeg`, `gdal`, `fontconfig`, + # `libmysql` and `atlmfc` are listed as dependency in the CONTROL file + +# ============================================================================= +# Apply patches to the source code vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES @@ -28,33 +41,78 @@ vcpkg_apply_patches( ${CMAKE_CURRENT_LIST_DIR}/disable-workaround-findhdf5.patch ${CMAKE_CURRENT_LIST_DIR}/fix-find-libproj4.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-find-libharu.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-find-mysql.patch + ${CMAKE_CURRENT_LIST_DIR}/fix-find-odbc.patch ) -# Remove the FindGLEW.cmake that is distributed with VTK, since it does not -# detect the debug libraries correctly. -# The default file distributed with CMake should be superior by all means. +# 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. +# For GDAL, the one distributed with CMake does not detect the debug libraries correctly, +# so we provide an own one. file(REMOVE ${SOURCE_PATH}/CMake/FindGLEW.cmake) +file(REMOVE ${SOURCE_PATH}/CMake/FindPythonLibs.cmake) +file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindGDAL.cmake DESTINATION ${SOURCE_PATH}/CMake) + +# ============================================================================= +# Collect CMake options for optional components +if(VTK_WITH_QT) + list(APPEND ADDITIONAL_OPTIONS + -DVTK_Group_Qt=ON + -DVTK_QT_VERSION=5 + -DVTK_BUILD_QT_DESIGNER_PLUGIN=OFF + ) +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 + -DVTK_PYTHON_VERSION=3 + ) +endif() + +if(VTK_WITH_ALL_MODULES) + list(APPEND ADDITIONAL_OPTIONS + -DVTK_BUILD_ALL_MODULES=ON + -DVTK_USE_TK=OFF # TCL/TK currently not included in vcpkg + # -DVTK_USE_SYSTEM_AUTOBAHN=ON + # -DVTK_USE_SYSTEM_SIX=ON + # -DVTK_USE_SYSTEM_MPI4PY=ON + # -DVTK_USE_SYSTEM_CONSTANTLY=ON + # -DVTK_USE_SYSTEM_INCREMENTAL=ON + # -DVTK_USE_SYSTEM_TWISTED=ON + # -DVTK_USE_SYSTEM_XDMF2=ON + # -DVTK_USE_SYSTEM_XDMF3=ON + # -DVTK_USE_SYSTEM_ZFP=ON + # -DVTK_USE_SYSTEM_ZOPE=ON + ) +endif() if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) list(APPEND ADDITIONAL_OPTIONS "-DVTK_EXTERNAL_HDF5_IS_SHARED=ON") endif() +# ============================================================================= +# Configure & Install vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA OPTIONS + -DVTK_Group_Imaging=ON + -DVTK_Group_Views=ON -DBUILD_TESTING=OFF -DBUILD_EXAMPLES=OFF - -DVTK_Group_MPI=ON - -DVTK_Group_Qt=ON - -DVTK_QT_VERSION=5 - -DVTK_BUILD_QT_DESIGNER_PLUGIN=OFF - # -DVTK_WRAP_PYTHON=ON - # -DVTK_PYTHON_VERSION=3 -DVTK_USE_SYSTEM_EXPAT=ON -DVTK_USE_SYSTEM_FREETYPE=ON # -DVTK_USE_SYSTEM_GL2PS=ON - # -DVTK_USE_SYSTEM_LIBHARU=ON + -DVTK_USE_SYSTEM_LIBHARU=ON -DVTK_USE_SYSTEM_JPEG=ON -DVTK_USE_SYSTEM_GLEW=ON -DVTK_USE_SYSTEM_HDF5=ON @@ -85,9 +143,29 @@ vcpkg_configure_cmake( vcpkg_install_cmake() vcpkg_copy_pdbs() +# ============================================================================= +# Fixup target files vcpkg_fixup_cmake_targets() -# For VTK vcpkg_fixup_cmake_targets is not enough: +# For some reason the references to the XDMF libraries in the target files do not end up +# correctly, so we fix them here. +if(VTK_WITH_ALL_MODULES) + file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake VTK_TARGETS_RELEASE_CONTENT) + string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}") + string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}") + string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}") + string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_RELEASE_CONTENT "${VTK_TARGETS_RELEASE_CONTENT}") + file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-release.cmake "${VTK_TARGETS_RELEASE_CONTENT}") + + file(READ ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake VTK_TARGETS_DEBUG_CONTENT) + string(REPLACE "lib/../XdmfCore.lib" "lib/XdmfCore.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}") + string(REPLACE "bin/../XdmfCore.dll" "bin/XdmfCore.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}") + string(REPLACE "lib/../vtkxdmf3.lib" "lib/vtkxdmf3.lib" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}") + string(REPLACE "bin/../vtkxdmf3.dll" "bin/vtkxdmf3.dll" VTK_TARGETS_DEBUG_CONTENT "${VTK_TARGETS_DEBUG_CONTENT}") + file(WRITE ${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets-debug.cmake "${VTK_TARGETS_DEBUG_CONTENT}") +endif() + +# For VTK `vcpkg_fixup_cmake_targets` is not enough: # Files for system third party dependencies are written to modules that # are located in the paths `share/vtk/Modules` and `debug/share/vtk/Modules`. # In the release folder, only the release libraries are referenced (e.g. "C:/vcpkg/installed/x64-windows/lib/zlib.lib"). @@ -158,8 +236,22 @@ set(SYSTEM_THIRD_PARTY_MODULES vtkpng vtktiff vtkzlib + # vtkgl2ps + vtklibharu ) +if(VTK_WITH_PYTHON OR VTK_WITH_ALL_MODULES) + list(APPEND SYSTEM_THIRD_PARTY_MODULES + vtkPython + ) +endif() + +if(VTK_WITH_ALL_MODULES) + list(APPEND SYSTEM_THIRD_PARTY_MODULES + AutobahnPython + ) +endif() + foreach(MODULE IN LISTS SYSTEM_THIRD_PARTY_MODULES) _vtk_combine_third_party_libraries("${MODULE}") endforeach() @@ -172,16 +264,45 @@ file(READ "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" VTK_TARGETS_CONTE string(REGEX REPLACE "${CURRENT_INSTALLED_DIR}/lib/[^\\.]*\\.lib" "" VTK_TARGETS_CONTENT "${VTK_TARGETS_CONTENT}") file(WRITE "${CURRENT_PACKAGES_DIR}/share/vtk/VTKTargets.cmake" "${VTK_TARGETS_CONTENT}") -# Move executable to tools directory +# ============================================================================= +# Move executable to tools directory and clean-up other directories file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/tools/vtk) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkEncodeString-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/vtkEncodeString-8.0.exe) -file(RENAME ${CURRENT_PACKAGES_DIR}/bin/vtkHashSource-8.0.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/vtkHashSource-8.0.exe) -if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkEncodeString-8.0.exe) - file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/vtkHashSource-8.0.exe) -else() - # On static builds there should be no bin directory at all +function(_vtk_move_tool TOOL_NAME) + if(EXISTS ${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}.exe) + file(RENAME ${CURRENT_PACKAGES_DIR}/bin/${TOOL_NAME}.exe ${CURRENT_PACKAGES_DIR}/tools/vtk/${TOOL_NAME}.exe) + endif() + + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/bin/${TOOL_NAME}.exe) +endfunction() + +set(VTK_TOOLS + vtkEncodeString-${VTK_SHORT_VERSION} + vtkHashSource-${VTK_SHORT_VERSION} + vtkWrapTclInit-${VTK_SHORT_VERSION} + vtkWrapTcl-${VTK_SHORT_VERSION} + vtkWrapPythonInit-${VTK_SHORT_VERSION} + vtkWrapPython-${VTK_SHORT_VERSION} + vtkWrapJava-${VTK_SHORT_VERSION} + vtkWrapHierarchy-${VTK_SHORT_VERSION} + vtkParseJava-${VTK_SHORT_VERSION} + vtkParseOGLExt-${VTK_SHORT_VERSION} + vtkpython + pvtkpython +) + +foreach(TOOL_NAME IN LISTS VTK_TOOLS) + _vtk_move_tool("${TOOL_NAME}") +endforeach() + +# ============================================================================= +# Remove other files and directories that are not valid for vcpkg +if(VTK_WITH_ALL_MODULES) + file(REMOVE ${CURRENT_PACKAGES_DIR}/XdmfConfig.cmake) + file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/XdmfConfig.cmake) +endif() + +if(VCPKG_LIBRARY_LINKAGE STREQUAL static) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin) endif() @@ -189,6 +310,7 @@ endif() file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +# ============================================================================= # Handle copyright file(COPY ${SOURCE_PATH}/Copyright.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/vtk) file(RENAME ${CURRENT_PACKAGES_DIR}/share/vtk/Copyright.txt ${CURRENT_PACKAGES_DIR}/share/vtk/copyright) diff --git a/ports/zziplib/CMakeLists.txt b/ports/zziplib/CMakeLists.txt index 7f46079e9..c99bc0ddd 100644 --- a/ports/zziplib/CMakeLists.txt +++ b/ports/zziplib/CMakeLists.txt @@ -55,7 +55,7 @@ set(SRCS zzip/dir.c add_library(zziplib ${SRCS} ${HEADERS}) -if(${BUILD_SHARED_LIBS}) +if(BUILD_SHARED_LIBS) target_compile_definitions(zziplib PRIVATE -DZZIPLIB_EXPORTS) endif() diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index d8c7ee6b8..19fc99af7 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -1,156 +1,175 @@ # Mark variables as used so cmake doesn't complain about them -set(CMAKE_TOOLCHAIN_FILE ${CMAKE_TOOLCHAIN_FILE}) -if(NOT VCPKG_TOOLCHAIN) - if(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") +mark_as_advanced(CMAKE_TOOLCHAIN_FILE) + +if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) + include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") +endif() + +if(VCPKG_TOOLCHAIN) + return() +endif() + +get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) +if( _CMAKE_IN_TRY_COMPILE ) + include( "${CMAKE_CURRENT_SOURCE_DIR}/../vcpkg.config.cmake" OPTIONAL ) +endif() + +if(VCPKG_TARGET_TRIPLET) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) +elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) +else() + if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$") + set(_VCPKG_TARGET_TRIPLET_ARCH x64) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$") + set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$") + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$") + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM") set(_VCPKG_TARGET_TRIPLET_ARCH arm) + elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017") + set(_VCPKG_TARGET_TRIPLET_ARCH x86) else() - if(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 Win64$") + find_program(_VCPKG_CL cl) + if(_VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$") set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015 ARM$") + elseif(_VCPKG_CL MATCHES "arm/cl.exe$") set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 14 2015$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 Win64$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017 ARM") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(CMAKE_GENERATOR MATCHES "^Visual Studio 15 2017") + elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$") set(_VCPKG_TARGET_TRIPLET_ARCH x86) else() - find_program(_VCPKG_CL cl) - if(_VCPKG_CL MATCHES "amd64/cl.exe$" OR _VCPKG_CL MATCHES "x64/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH x64) - elseif(_VCPKG_CL MATCHES "arm/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH arm) - elseif(_VCPKG_CL MATCHES "bin/cl.exe$" OR _VCPKG_CL MATCHES "x86/cl.exe$") - set(_VCPKG_TARGET_TRIPLET_ARCH x86) - else() - message(FATAL_ERROR "Unable to determine target architecture.") - endif() + message(FATAL_ERROR "Unable to determine target architecture.") endif() endif() +endif() - if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") - set(_VCPKG_TARGET_TRIPLET_PLAT uwp) - else() - set(_VCPKG_TARGET_TRIPLET_PLAT windows) - endif() +if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" OR CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone") + set(_VCPKG_TARGET_TRIPLET_PLAT uwp) +else() + set(_VCPKG_TARGET_TRIPLET_PLAT windows) +endif() - set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)") - set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR}) +set(VCPKG_TARGET_TRIPLET ${_VCPKG_TARGET_TRIPLET_ARCH}-${_VCPKG_TARGET_TRIPLET_PLAT} CACHE STRING "Vcpkg target triplet (ex. x86-windows)") +set(_VCPKG_TOOLCHAIN_DIR ${CMAKE_CURRENT_LIST_DIR}) - #Detect .vcpkg-root to figure VCPKG_ROOT_DIR - SET(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) - while(IS_DIRECTORY ${_VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") - get_filename_component(_VCPKG_ROOT_DIR_TEMP ${_VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) - if (_VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive - message(FATAL_ERROR "Could not find .vcpkg-root") - else() - SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) - endif() - endwhile() - set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE}) - set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed) - - if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE) - list(APPEND CMAKE_PREFIX_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug - ) - list(APPEND CMAKE_LIBRARY_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link - ) +# Detect .vcpkg-root to figure VCPKG_ROOT_DIR +set(_VCPKG_ROOT_DIR_CANDIDATE ${CMAKE_CURRENT_LIST_DIR}) +while(IS_DIRECTORY ${_VCPKG_ROOT_DIR_CANDIDATE} AND NOT EXISTS "${_VCPKG_ROOT_DIR_CANDIDATE}/.vcpkg-root") + get_filename_component(_VCPKG_ROOT_DIR_TEMP ${_VCPKG_ROOT_DIR_CANDIDATE} DIRECTORY) + if (_VCPKG_ROOT_DIR_TEMP STREQUAL _VCPKG_ROOT_DIR_CANDIDATE) # If unchanged, we have reached the root of the drive + message(FATAL_ERROR "Could not find .vcpkg-root") + else() + SET(_VCPKG_ROOT_DIR_CANDIDATE ${_VCPKG_ROOT_DIR_TEMP}) endif() +endwhile() +set(_VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR_CANDIDATE}) +set(_VCPKG_INSTALLED_DIR ${_VCPKG_ROOT_DIR}/installed) + +if(CMAKE_BUILD_TYPE MATCHES "^Debug$" OR NOT DEFINED CMAKE_BUILD_TYPE) list(APPEND CMAKE_PREFIX_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug ) list(APPEND CMAKE_LIBRARY_PATH - ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/manual-link ) +endif() +list(APPEND CMAKE_PREFIX_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} +) +list(APPEND CMAKE_LIBRARY_PATH + ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/manual-link +) - set(Boost_COMPILER "-vc140") +set(Boost_COMPILER "-vc140") - if (NOT DEFINED CMAKE_SYSTEM_VERSION) - include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake) - # This is used as an implicit parameter for vcpkg_get_windows_sdk - set(VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR}) - vcpkg_get_windows_sdk(WINDOWS_SDK_VERSION) - unset(VCPKG_ROOT_DIR) - set(CMAKE_SYSTEM_VERSION ${WINDOWS_SDK_VERSION}) - endif() +if (NOT DEFINED CMAKE_SYSTEM_VERSION) + include(${_VCPKG_ROOT_DIR}/scripts/cmake/vcpkg_get_windows_sdk.cmake) + # This is used as an implicit parameter for vcpkg_get_windows_sdk + set(VCPKG_ROOT_DIR ${_VCPKG_ROOT_DIR}) + vcpkg_get_windows_sdk(WINDOWS_SDK_VERSION) + unset(VCPKG_ROOT_DIR) + set(CMAKE_SYSTEM_VERSION ${WINDOWS_SDK_VERSION} CACHE STRING "Windows SDK version") +endif() - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) - set(CMAKE_SYSTEM_IGNORE_PATH - "${_programfiles}/OpenSSL" - "${_programfiles}/OpenSSL-Win32" - "${_programfiles}/OpenSSL-Win64" - "${_programfiles}/OpenSSL-Win32/lib/VC" - "${_programfiles}/OpenSSL-Win64/lib/VC" - "${_programfiles}/OpenSSL-Win32/lib/VC/static" - "${_programfiles}/OpenSSL-Win64/lib/VC/static" - "C:/OpenSSL/" - "C:/OpenSSL-Win32/" - "C:/OpenSSL-Win64/" - "C:/OpenSSL-Win32/lib/VC" - "C:/OpenSSL-Win64/lib/VC" - "C:/OpenSSL-Win32/lib/VC/static" - "C:/OpenSSL-Win64/lib/VC/static" - ) +file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) +set(CMAKE_SYSTEM_IGNORE_PATH + "${_programfiles}/OpenSSL" + "${_programfiles}/OpenSSL-Win32" + "${_programfiles}/OpenSSL-Win64" + "${_programfiles}/OpenSSL-Win32/lib/VC" + "${_programfiles}/OpenSSL-Win64/lib/VC" + "${_programfiles}/OpenSSL-Win32/lib/VC/static" + "${_programfiles}/OpenSSL-Win64/lib/VC/static" + "C:/OpenSSL/" + "C:/OpenSSL-Win32/" + "C:/OpenSSL-Win64/" + "C:/OpenSSL-Win32/lib/VC" + "C:/OpenSSL-Win64/lib/VC" + "C:/OpenSSL-Win32/lib/VC/static" + "C:/OpenSSL-Win64/lib/VC/static" +) - set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) - file(GLOB _VCPKG_TOOLS_DIRS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*) - foreach(_VCPKG_TOOLS_DIR ${_VCPKG_TOOLS_DIRS}) - if(IS_DIRECTORY ${_VCPKG_TOOLS_DIR}) - set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_TOOLS_DIR}) - endif() - endforeach() - - option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON) - function(add_executable name) - _add_executable(${ARGV}) - list(FIND ARGV "IMPORTED" IMPORTED_IDX) - list(FIND ARGV "ALIAS" ALIAS_IDX) - if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) - if(VCPKG_APPLOCAL_DEPS) - add_custom_command(TARGET ${name} POST_BUILD - COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 - -targetBinary $<TARGET_FILE:${name}> - -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin" - -OutVariable out - ) - endif() - set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) - set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) - endif() - endfunction() - - function(add_library name) - _add_library(${ARGV}) - list(FIND ARGV "IMPORTED" IMPORTED_IDX) - list(FIND ARGV "INTERFACE" INTERFACE_IDX) - list(FIND ARGV "ALIAS" ALIAS_IDX) - if(IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) - set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) - set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) - endif() - endfunction() +set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools) +file(GLOB _VCPKG_TOOLS_DIRS ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*) +foreach(_VCPKG_TOOLS_DIR ${_VCPKG_TOOLS_DIRS}) + if(IS_DIRECTORY ${_VCPKG_TOOLS_DIR}) + set(CMAKE_PROGRAM_PATH ${CMAKE_PROGRAM_PATH} ${_VCPKG_TOOLS_DIR}) + endif() +endforeach() - macro(find_package name) - if(name STREQUAL "Boost") - unset(Boost_USE_STATIC_LIBS) +option(VCPKG_APPLOCAL_DEPS "Automatically copy dependencies into the output directory for executables." ON) +function(add_executable name) + _add_executable(${ARGV}) + list(FIND ARGV "IMPORTED" IMPORTED_IDX) + list(FIND ARGV "ALIAS" ALIAS_IDX) + if(IMPORTED_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) + if(VCPKG_APPLOCAL_DEPS) + add_custom_command(TARGET ${name} POST_BUILD + COMMAND powershell -noprofile -executionpolicy Bypass -file ${_VCPKG_TOOLCHAIN_DIR}/msbuild/applocal.ps1 + -targetBinary $<TARGET_FILE:${name}> + -installedDir "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$<CONFIG:Debug>:/debug>/bin" + -OutVariable out + ) endif() - _find_package(${ARGV}) - endmacro() + set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) + set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) + endif() +endfunction() - set(VCPKG_TOOLCHAIN ON) -endif() +function(add_library name) + _add_library(${ARGV}) + list(FIND ARGV "IMPORTED" IMPORTED_IDX) + list(FIND ARGV "INTERFACE" INTERFACE_IDX) + list(FIND ARGV "ALIAS" ALIAS_IDX) + if(IMPORTED_IDX EQUAL -1 AND INTERFACE_IDX EQUAL -1 AND ALIAS_IDX EQUAL -1) + set_target_properties(${name} PROPERTIES VS_USER_PROPS do_not_import_user.props) + set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled false) + endif() +endfunction() + +macro(find_package name) + if(name STREQUAL "Boost") + unset(Boost_USE_STATIC_LIBS) + endif() + _find_package(${ARGV}) +endmacro() -set(_UNUSED ${CMAKE_TOOLCHAIN_FILE}) +set(VCPKG_TOOLCHAIN ON) set(_UNUSED ${CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION}) set(_UNUSED ${CMAKE_EXPORT_NO_PACKAGE_REGISTRY}) set(_UNUSED ${CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY}) set(_UNUSED ${CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY}) set(_UNUSED ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP}) + +if(NOT _CMAKE_IN_TRY_COMPILE) + file(TO_CMAKE_PATH "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" _chainload_file) + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/vcpkg.config.cmake" + "set(VCPKG_TARGET_TRIPLET \"${VCPKG_TARGET_TRIPLET}\" CACHE STRING \"\")\n" + "set(VCPKG_APPLOCAL_DEPS \"${VCPKG_APPLOCAL_DEPS}\" CACHE STRING \"\")\n" + "set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE \"${_chainload_file}\" CACHE STRING \"\")\n") +endif()
\ No newline at end of file diff --git a/scripts/cmake/vcpkg_acquire_depot_tools.cmake b/scripts/cmake/vcpkg_acquire_depot_tools.cmake index 1cc375725..009ba40f1 100644 --- a/scripts/cmake/vcpkg_acquire_depot_tools.cmake +++ b/scripts/cmake/vcpkg_acquire_depot_tools.cmake @@ -26,7 +26,7 @@ function(vcpkg_acquire_depot_tools PATH_TO_ROOT_OUT) set(download_success 1) endif() - if (NOT ${download_success}) + if (NOT download_success) message(FATAL_ERROR "\n" " Failed to download file.\n" diff --git a/scripts/cmake/vcpkg_configure_cmake.cmake b/scripts/cmake/vcpkg_configure_cmake.cmake index fe8c97c52..b979245aa 100644 --- a/scripts/cmake/vcpkg_configure_cmake.cmake +++ b/scripts/cmake/vcpkg_configure_cmake.cmake @@ -61,31 +61,39 @@ function(vcpkg_configure_cmake) set(GENERATOR ${_csc_GENERATOR}) elseif(_csc_PREFER_NINJA AND NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND NOT _csc_HOST_ARCHITECTURE STREQUAL "x86") set(GENERATOR "Ninja") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 ARM") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 Win64") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v140") set(GENERATOR "Visual Studio 14 2015 ARM") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 Win64") - elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 ARM") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore" AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + set(ARCH "ARM64") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 Win64") - elseif(TRIPLET_SYSTEM_ARCH MATCHES "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") set(GENERATOR "Visual Studio 15 2017 ARM") + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64" AND VCPKG_PLATFORM_TOOLSET MATCHES "v141") + set(GENERATOR "Visual Studio 15 2017") + set(ARCH "ARM64") + else() + message(FATAL_ERROR "Unable to determine appropriate generator for: ${VCPKG_CMAKE_SYSTEM_NAME}-${VCPKG_TARGET_ARCHITECTURE}-${VCPKG_PLATFORM_TOOLSET}") endif() # If we use Ninja, make sure it's on PATH @@ -98,15 +106,18 @@ function(vcpkg_configure_cmake) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg) if(DEFINED VCPKG_CMAKE_SYSTEM_NAME) - list(APPEND _csc_OPTIONS -DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}) + list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}") endif() if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION) - list(APPEND _csc_OPTIONS -DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}) + list(APPEND _csc_OPTIONS "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}") endif() - if(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + + if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=ON) - elseif(DEFINED VCPKG_LIBRARY_LINKAGE AND VCPKG_LIBRARY_LINKAGE STREQUAL static) + elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static") list(APPEND _csc_OPTIONS -DBUILD_SHARED_LIBS=OFF) + else() + message(FATAL_ERROR "Invalid setting for VCPKG_LIBRARY_LINKAGE: \"${VCPKG_LIBRARY_LINKAGE}\". It must be \"static\" or \"dynamic\"") endif() if((NOT DEFINED VCPKG_CXX_FLAGS_DEBUG AND NOT DEFINED VCPKG_C_FLAGS_DEBUG) OR @@ -125,10 +136,45 @@ function(vcpkg_configure_cmake) message(FATAL_ERROR "You must set both the VCPKG_CXX_FLAGS and VCPKG_C_FLAGS") endif() + if(VCPKG_CHAINLOAD_TOOLCHAIN_FILE) + list(APPEND _csc_OPTIONS "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}") + else() + set(VCPKG_CXX_FLAGS " /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP ${VCPKG_CXX_FLAGS}") + set(VCPKG_C_FLAGS " /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ${VCPKG_C_FLAGS}") + if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") + list(APPEND _csc_OPTIONS_DEBUG + "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" + "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" + ) + list(APPEND _csc_OPTIONS_RELEASE + "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" + "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" + ) + elseif(VCPKG_CRT_LINKAGE STREQUAL "static") + list(APPEND _csc_OPTIONS_DEBUG + "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" + "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" + ) + list(APPEND _csc_OPTIONS_RELEASE + "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" + "-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" + ) + else() + message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"") + endif() + + list(APPEND _csc_OPTIONS_RELEASE + "-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" + "-DCMAKE_EXE_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" + ) + list(APPEND _csc_OPTIONS + "-DCMAKE_CXX_FLAGS=${VCPKG_CXX_FLAGS}" + "-DCMAKE_C_FLAGS=${VCPKG_C_FLAGS}" + ) + endif() + list(APPEND _csc_OPTIONS "-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}" - "-DCMAKE_CXX_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" - "-DCMAKE_C_FLAGS= /DWIN32 /D_WINDOWS /W3 /utf-8 /MP ${VCPKG_C_FLAGS}" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" @@ -139,32 +185,12 @@ function(vcpkg_configure_cmake) "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" ) - if(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL dynamic) - list(APPEND _csc_OPTIONS_DEBUG - "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" - "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MDd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" - ) - list(APPEND _csc_OPTIONS_RELEASE - "-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" - "-DCMAKE_C_FLAGS_RELEASE=/MD /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" - ) - - elseif(DEFINED VCPKG_CRT_LINKAGE AND VCPKG_CRT_LINKAGE STREQUAL static) - list(APPEND _csc_OPTIONS_DEBUG - "-DCMAKE_CXX_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" - "-DCMAKE_C_FLAGS_DEBUG=/D_DEBUG /MTd /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" - ) - list(APPEND _csc_OPTIONS_RELEASE - "-DCMAKE_CXX_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" - "-DCMAKE_C_FLAGS_RELEASE=/MT /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" + if(DEFINED ARCH) + list(APPEND _csc_OPTIONS + "-A${ARCH}" ) endif() - list(APPEND _csc_OPTIONS_RELEASE - "-DCMAKE_SHARED_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" - "-DCMAKE_EXE_LINKER_FLAGS_RELEASE=/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS}" - ) - message(STATUS "Configuring ${TARGET_TRIPLET}-rel") file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel) vcpkg_execute_required_process( diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake index 006570195..b8acfc823 100644 --- a/scripts/cmake/vcpkg_download_distfile.cmake +++ b/scripts/cmake/vcpkg_download_distfile.cmake @@ -78,7 +78,7 @@ function(vcpkg_download_distfile VAR) endif() endforeach(url) - if (NOT ${download_success}) + if (NOT download_success) message(FATAL_ERROR "\n" " Failed to download file.\n" diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake index 3c6dfae08..b81675c13 100644 --- a/scripts/cmake/vcpkg_find_acquire_program.cmake +++ b/scripts/cmake/vcpkg_find_acquire_program.cmake @@ -34,7 +34,8 @@ ## * [openssl](https://github.com/Microsoft/vcpkg/blob/master/ports/openssl/portfile.cmake) ## * [qt5](https://github.com/Microsoft/vcpkg/blob/master/ports/qt5/portfile.cmake) function(vcpkg_find_acquire_program VAR) - if(${VAR} AND NOT ${VAR} MATCHES "-NOTFOUND") + set(EXPANDED_VAR ${${VAR}}) + if(EXPANDED_VAR) return() endif() @@ -100,11 +101,11 @@ function(vcpkg_find_acquire_program VAR) set(HASH 556f95f7566fe23704d136239e4cf5e2a26f939ab43b44145c91b70d031a088d553e5c21301f1242a2295dcde3143b356211f0108c68e65eef8572407618326d) elseif(VAR MATCHES "NINJA") set(PROGNAME ninja) - set(SUBDIR "ninja-1.7.2") + set(SUBDIR "ninja-1.8.2") set(PATHS ${DOWNLOADS}/tools/ninja/${SUBDIR}) - set(URL "https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip") - set(ARCHIVE "ninja-win.zip") - set(HASH cccab9281b274c564f9ad77a2115be1f19be67d7b2ee14a55d1db1b27f3b68db8e76076e4f804b61eb8e573e26a8ecc9985675a8dcf03fd7a77b7f57234f1393) + set(URL "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip") + set(ARCHIVE "ninja-1.8.2-win.zip") + set(HASH 9b9ce248240665fcd6404b989f3b3c27ed9682838225e6dc9b67b551774f251e4ff8a207504f941e7c811e7a8be1945e7bcb94472a335ef15e23a0200a32e6d5) elseif(VAR MATCHES "MESON") set(PROGNAME meson) set(REQUIRED_INTERPRETER PYTHON3) @@ -162,7 +163,7 @@ function(vcpkg_find_acquire_program VAR) endmacro() do_find() - if(${VAR} MATCHES "-NOTFOUND") + if("${${VAR}}" MATCHES "-NOTFOUND") file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE} EXPECTED_HASH SHA512=${HASH} SHOW_PROGRESS @@ -173,7 +174,7 @@ function(vcpkg_find_acquire_program VAR) else() get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT) string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION) - if(${ARCHIVE_EXTENSION} STREQUAL ".msi") + if(ARCHIVE_EXTENSION STREQUAL ".msi") file(TO_NATIVE_PATH "${DOWNLOADS}/${ARCHIVE}" ARCHIVE_NATIVE_PATH) file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" DESTINATION_NATIVE_PATH) execute_process( @@ -191,5 +192,5 @@ function(vcpkg_find_acquire_program VAR) do_find() endif() - set(${VAR} ${${VAR}} PARENT_SCOPE) + set(${VAR} "${${VAR}}" PARENT_SCOPE) endfunction() diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index 665376baf..773ebeac4 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -36,17 +36,19 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) New-Item -ItemType directory -Path $downloadDir | Out-Null } + $WC = New-Object System.Net.WebClient + $ProxyAuth = !$WC.Proxy.IsBypassed($url) + if ($ProxyAuth) + { + $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) + $WC.Proxy.Credentials=$ProxyCred + } + if (($PSVersionTable.PSEdition -ne "Core") -and ($Dependency -ne "git")) # git fails with BITS { try { - $WC = New-Object System.Net.WebClient - $ProxyAuth = !$WC.Proxy.IsBypassed($url) - If($ProxyAuth){ - $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" - $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") - $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) - } - Start-BitsTransfer -Source $url -Destination $downloadPath -ErrorAction Stop } catch [System.Exception] { @@ -60,7 +62,7 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) if (!(Test-Path $downloadPath)) { Write-Verbose("Downloading $Dependency...") - (New-Object System.Net.WebClient).DownloadFile($url, $downloadPath) + $WC.DownloadFile($url, $downloadPath) } } @@ -126,11 +128,11 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) } elseif($Dependency -eq "vswhere") { - $requiredVersion = "2.1.4" - $downloadVersion = "2.1.4" - $url = "https://github.com/Microsoft/vswhere/releases/download/2.1.4/vswhere.exe" + $requiredVersion = "2.2.3" + $downloadVersion = "2.2.3" + $url = "https://github.com/Microsoft/vswhere/releases/download/2.2.3/vswhere.exe" $downloadPath = "$downloadsDir\vswhere-$downloadVersion\vswhere.exe" - $expectedDownloadedFileHash = "548fb9dfeed59bc4ddcce739a5729e9c8dd5932cd60ff6f74727ee069e7da458" + $expectedDownloadedFileHash = "5f19066ac91635ad17d33fe0f79fc63c672a46f98c0358589a90163bcb2733e8" $executableFromDownload = $downloadPath $extractionType = $ExtractionType_NO_EXTRACTION_REQUIRED } diff --git a/scripts/findVisualStudioInstallationInstances.ps1 b/scripts/findVisualStudioInstallationInstances.ps1 index 8c67ef6d6..8a2adca10 100644 --- a/scripts/findVisualStudioInstallationInstances.ps1 +++ b/scripts/findVisualStudioInstallationInstances.ps1 @@ -6,7 +6,7 @@ param( $scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition $vswhereExe = & $scriptsDir\fetchDependency.ps1 "vswhere" -$output = & $vswhereExe -prerelease -legacy -format xml +$output = & $vswhereExe -prerelease -legacy -products * -format xml [xml]$asXml = $output $results = New-Object System.Collections.ArrayList @@ -32,6 +32,21 @@ foreach ($instance in $asXml.instances.instance) $results.Add("${releaseType}::${installationVersion}::${installationPath}") > $null } +# If nothing is found, attempt to find VS2015 Build Tools (not detected by vswhere.exe) +if ($results.Count -eq 0) +{ + $programFiles = & $scriptsDir\getProgramFiles32bit.ps1 + $installationPath = "$programFiles\Microsoft Visual Studio 14.0" + $clExe = "$installationPath\VC\bin\cl.exe" + $vcvarsallbat = "$installationPath\VC\vcvarsall.bat" + + if ((Test-Path $clExe) -And (Test-Path $vcvarsallbat)) + { + return "PreferenceWeight1::Legacy::14.0::$installationPath" + } +} + + $results.Sort() $results.Reverse() diff --git a/scripts/getWindowsSDK.ps1 b/scripts/getWindowsSDK.ps1 index 8ef26a436..ed2fd11c7 100644 --- a/scripts/getWindowsSDK.ps1 +++ b/scripts/getWindowsSDK.ps1 @@ -19,6 +19,11 @@ $validInstances = New-Object System.Collections.ArrayList # Windows 10 SDK function CheckWindows10SDK($path) { + if ($path -eq $null) + { + return + } + $folder = (Join-Path $path "Include") if (!(Test-Path $folder)) { @@ -64,6 +69,11 @@ CheckWindows10SDK("${env:ProgramFiles(x86)}\Windows Kits\10") # Windows 8.1 SDK function CheckWindows81SDK($path) { + if ($path -eq $null) + { + return + } + $folder = "$path\Include" if (!(Test-Path $folder)) { diff --git a/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 new file mode 100644 index 000000000..3fb94fe7d --- /dev/null +++ b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psd1 @@ -0,0 +1,31 @@ +@{
+
+# Script module or binary module file associated with this manifest.
+ModuleToProcess = 'posh-vcpkg.psm1'
+
+# Version number of this module.
+ModuleVersion = '0.0.1'
+
+# ID used to uniquely identify this module
+GUID = '948f02ab-fc99-4a53-8335-b6556eef129b'
+
+# Minimum version of the Windows PowerShell engine required by this module
+PowerShellVersion = '5.0'
+
+FunctionsToExport = @('TabExpansion')
+CmdletsToExport = @()
+VariablesToExport = @()
+AliasesToExport = @()
+
+# Private data to pass to the module specified in RootModule/ModuleToProcess.
+# This may also contain a PSData hashtable with additional module metadata used by PowerShell.
+PrivateData =
+@{
+ PSData =
+ @{
+ # Tags applied to this module. These help with module discovery in online galleries.
+ Tags = @('vcpkg', 'tab', 'tab-completion', 'tab-expansion', 'tabexpansion')
+ }
+}
+
+}
diff --git a/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 new file mode 100644 index 000000000..25ef99609 --- /dev/null +++ b/scripts/posh-vcpkg/0.0.1/posh-vcpkg.psm1 @@ -0,0 +1,39 @@ +param()
+
+if (Get-Module posh-vcpkg) { return }
+
+if ($PSVersionTable.PSVersion.Major -lt 5) {
+ Write-Warning ("posh-vcpkg does not support PowerShell versions before 5.0.")
+ return
+}
+
+if (Test-Path Function:\TabExpansion) {
+ Rename-Item Function:\TabExpansion VcpkgTabExpansionBackup
+}
+
+function TabExpansion($line, $lastWord) {
+ $lastBlock = [regex]::Split($line, '[|;]')[-1].TrimStart()
+
+ switch -regex ($lastBlock) {
+ "^(?<vcpkgexe>(\./|\.\\|)vcpkg(\.exe|)) (?<remaining>.*)$"
+ {
+ & $matches['vcpkgexe'] autocomplete $matches['remaining']
+ return
+ }
+
+ # Fall back on existing tab expansion
+ default {
+ if (Test-Path Function:\VcpkgTabExpansionBackup) {
+ VcpkgTabExpansionBackup $line $lastWord
+ }
+ }
+ }
+}
+
+$exportModuleMemberParams = @{
+ Function = @(
+ 'TabExpansion'
+ )
+}
+
+Export-ModuleMember @exportModuleMemberParams
diff --git a/toolsrc/include/CStringView.h b/toolsrc/include/CStringView.h deleted file mode 100644 index c1810b4f1..000000000 --- a/toolsrc/include/CStringView.h +++ /dev/null @@ -1,96 +0,0 @@ -#pragma once -#include <string> - -namespace vcpkg -{ - template<class CharType> - struct BasicCStringView - { - constexpr BasicCStringView() : cstr(nullptr) {} - constexpr BasicCStringView(const CharType* cstr) : cstr(cstr) {} - constexpr BasicCStringView(const BasicCStringView&) = default; - BasicCStringView(const std::basic_string<CharType>& str) : cstr(str.c_str()) {} - - constexpr const CharType* c_str() const { return cstr; } - - private: - const CharType* cstr; - }; - - namespace details - { - inline bool vcpkg_strcmp(const char* l, const char* r) { return strcmp(l, r) == 0; } - inline bool vcpkg_strcmp(const wchar_t* l, const wchar_t* r) { return wcscmp(l, r) == 0; } - } - - template<class CharType> - bool operator==(const BasicCStringView<CharType>& l, const BasicCStringView<CharType>& r) - { - return details::vcpkg_strcmp(l.c_str(), r.c_str()); - } - - template<class CharType> - bool operator==(const CharType* l, const BasicCStringView<CharType>& r) - { - return details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator==(const BasicCStringView<CharType>& r, const CharType* l) - { - return details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator==(const std::basic_string<CharType>& l, const BasicCStringView<CharType>& r) - { - return l == r.c_str(); - } - - template<class CharType> - bool operator==(const BasicCStringView<CharType>& r, const std::basic_string<CharType>& l) - { - return l == r.c_str(); - } - - // notequals - template<class CharType> - bool operator!=(const BasicCStringView<CharType>& l, const BasicCStringView<CharType>& r) - { - return !details::vcpkg_strcmp(l.c_str(), r.c_str()); - } - - template<class CharType> - bool operator!=(const CharType* l, const BasicCStringView<CharType>& r) - { - return !details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator!=(const BasicCStringView<CharType>& r, const CharType* l) - { - return !details::vcpkg_strcmp(l, r.c_str()); - } - - template<class CharType> - bool operator!=(const BasicCStringView<CharType>& r, const std::basic_string<CharType>& l) - { - return l != r.c_str(); - } - - template<class CharType> - bool operator!=(const std::basic_string<CharType>& l, const BasicCStringView<CharType>& r) - { - return l != r.c_str(); - } - - using CStringView = BasicCStringView<char>; - using CWStringView = BasicCStringView<wchar_t>; - - inline const char* to_printf_arg(const CStringView string_view) { return string_view.c_str(); } - - inline const wchar_t* to_wprintf_arg(const CWStringView string_view) { return string_view.c_str(); } - - static_assert(sizeof(CStringView) == sizeof(void*), "CStringView must be a simple wrapper around char*"); - static_assert(sizeof(CWStringView) == sizeof(void*), "CWStringView must be a simple wrapper around wchar_t*"); -} diff --git a/toolsrc/include/Span.h b/toolsrc/include/Span.h deleted file mode 100644 index a43e8f992..000000000 --- a/toolsrc/include/Span.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once
-
-#include <array>
-#include <cstddef>
-#include <initializer_list>
-#include <vector>
-
-template<class T>
-struct Span
-{
-public:
- using element_type = T;
- using pointer = T*;
- using reference = T&;
- using iterator = T*;
-
- constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
- constexpr Span(std::nullptr_t) noexcept : Span() {}
- constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
- constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
- constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
-
- template<size_t N>
- constexpr Span(T (&arr)[N]) noexcept : Span(arr, 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()) {}
-
- 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 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()};
-}
diff --git a/toolsrc/include/filesystem_fs.h b/toolsrc/include/filesystem_fs.h deleted file mode 100644 index 0651ebf25..000000000 --- a/toolsrc/include/filesystem_fs.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include <filesystem> - -namespace fs -{ - namespace stdfs = std::experimental::filesystem; - - using stdfs::path; - using stdfs::copy_options; - using stdfs::file_status; - - inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } - inline bool is_directory(file_status s) { return stdfs::is_directory(s); } - inline bool status_known(file_status s) { return stdfs::status_known(s); } -}
\ No newline at end of file diff --git a/toolsrc/include/pch.h b/toolsrc/include/pch.h index 0f34063f8..5c31fbbd1 100644 --- a/toolsrc/include/pch.h +++ b/toolsrc/include/pch.h @@ -1,10 +1,22 @@ #pragma once +#if defined(_WIN32) #define NOMINMAX #define WIN32_LEAN_AND_MEAN + #pragma warning(suppress : 4768) #include <windows.h> +#pragma warning(suppress : 4768) +#include <Shlobj.h> + +#include <process.h> +#include <shellapi.h> +#include <winhttp.h> +#else +#include <unistd.h> +#endif + #include <algorithm> #include <array> #include <atomic> @@ -15,7 +27,12 @@ #include <cstdarg> #include <cstddef> #include <cstdint> +#if defined(_WIN32) #include <filesystem> +#else +#include <experimental/filesystem> +#endif +#include <cstring> #include <fstream> #include <functional> #include <iomanip> @@ -24,22 +41,17 @@ #include <map> #include <memory> #include <mutex> -#include <process.h> #include <regex> #include <set> -#include <shellapi.h> -#pragma warning(push) -#pragma warning(disable : 4768) -#include <Shlobj.h> -#pragma warning(pop) #include <stdexcept> #include <string> #include <sys/timeb.h> +#include <sys/types.h> #include <system_error> +#include <thread> #include <time.h> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> -#include <winhttp.h> diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg/base/checks.h index ce486ac19..fb162c897 100644 --- a/toolsrc/include/vcpkg_Checks.h +++ b/toolsrc/include/vcpkg/base/checks.h @@ -1,7 +1,8 @@ #pragma once -#include "LineInfo.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/lineinfo.h> +#include <vcpkg/base/strings.h> namespace vcpkg::Checks { diff --git a/toolsrc/include/vcpkg_Chrono.h b/toolsrc/include/vcpkg/base/chrono.h index c14019ff9..b525852f2 100644 --- a/toolsrc/include/vcpkg_Chrono.h +++ b/toolsrc/include/vcpkg/base/chrono.h @@ -3,7 +3,7 @@ #include <chrono> #include <string> -namespace vcpkg +namespace vcpkg::Chrono { class ElapsedTime { diff --git a/toolsrc/include/coff_file_reader.h b/toolsrc/include/vcpkg/base/cofffilereader.h index 7287211a1..ad2cc7b12 100644 --- a/toolsrc/include/coff_file_reader.h +++ b/toolsrc/include/vcpkg/base/cofffilereader.h @@ -1,6 +1,8 @@ #pragma once -#include "MachineType.h" -#include "filesystem_fs.h" + +#include <vcpkg/base/files.h> +#include <vcpkg/base/machinetype.h> + #include <vector> namespace vcpkg::CoffFileReader diff --git a/toolsrc/include/vcpkg/base/cstringview.h b/toolsrc/include/vcpkg/base/cstringview.h new file mode 100644 index 000000000..342455402 --- /dev/null +++ b/toolsrc/include/vcpkg/base/cstringview.h @@ -0,0 +1,69 @@ +#pragma once + +#include <string.h> +#include <string> + +namespace vcpkg +{ + struct CStringView + { + constexpr CStringView() : cstr(nullptr) {} + constexpr CStringView(const char* cstr) : cstr(cstr) {} + constexpr CStringView(const CStringView&) = default; + CStringView(const std::string& str) : cstr(str.c_str()) {} + + constexpr const char* c_str() const { return cstr; } + + private: + const char* cstr; + }; + + struct CWStringView + { + constexpr CWStringView() : cstr(nullptr) {} + constexpr CWStringView(const wchar_t* cstr) : cstr(cstr) {} + constexpr CWStringView(const CWStringView&) = default; + CWStringView(const std::wstring& str) : cstr(str.c_str()) {} + + constexpr const wchar_t* c_str() const { return cstr; } + + private: + const wchar_t* cstr; + }; + + namespace details + { + inline bool vcpkg_strcmp(const char* l, const char* r) { return strcmp(l, r) == 0; } + } + + inline bool operator==(const CStringView& l, const CStringView& r) + { + return details::vcpkg_strcmp(l.c_str(), r.c_str()); + } + + inline bool operator==(const char* l, const CStringView& r) { return details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator==(const CStringView& r, const char* l) { return details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator==(const std::string& l, const CStringView& r) { return l == r.c_str(); } + + inline bool operator==(const CStringView& r, const std::string& l) { return l == r.c_str(); } + + // notequals + inline bool operator!=(const CStringView& l, const CStringView& r) + { + return !details::vcpkg_strcmp(l.c_str(), r.c_str()); + } + + inline bool operator!=(const char* l, const CStringView& r) { return !details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator!=(const CStringView& r, const char* l) { return !details::vcpkg_strcmp(l, r.c_str()); } + + inline bool operator!=(const CStringView& r, const std::string& l) { return l != r.c_str(); } + + inline bool operator!=(const std::string& l, const CStringView& r) { return l != r.c_str(); } + + inline const char* to_printf_arg(const CStringView string_view) { return string_view.c_str(); } + + static_assert(sizeof(CStringView) == sizeof(void*), "CStringView must be a simple wrapper around char*"); +} diff --git a/toolsrc/include/vcpkg_Enums.h b/toolsrc/include/vcpkg/base/enums.h index c75feaa1f..6eca2cfe1 100644 --- a/toolsrc/include/vcpkg_Enums.h +++ b/toolsrc/include/vcpkg/base/enums.h @@ -1,5 +1,7 @@ #pragma once -#include "LineInfo.h" + +#include <vcpkg/base/lineinfo.h> + #include <string> namespace vcpkg::Enums diff --git a/toolsrc/include/vcpkg_expected.h b/toolsrc/include/vcpkg/base/expected.h index 9637ec087..b3b81ae81 100644 --- a/toolsrc/include/vcpkg_expected.h +++ b/toolsrc/include/vcpkg/base/expected.h @@ -1,6 +1,7 @@ #pragma once -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> + #include <system_error> namespace vcpkg @@ -32,7 +33,7 @@ namespace vcpkg ErrorHolder() = default; ErrorHolder(const std::error_code& err) : m_err(err) {} - constexpr bool has_error() const { return bool(m_err); } + bool has_error() const { return bool(m_err); } const std::error_code& error() const { return m_err; } std::error_code& error() { return m_err; } @@ -71,13 +72,13 @@ namespace vcpkg return std::move(this->m_t); } - const T& value_or_exit(const LineInfo& line_info) const & + const T& value_or_exit(const LineInfo& line_info) const& { exit_if_error(line_info); return this->m_t; } - const S& error() const & { return this->m_s.error(); } + const S& error() const& { return this->m_s.error(); } S&& error() && { return std::move(this->m_s.error()); } diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg/base/files.h index 855e8ea45..63cf3c6fd 100644 --- a/toolsrc/include/vcpkg_Files.h +++ b/toolsrc/include/vcpkg/base/files.h @@ -1,11 +1,29 @@ #pragma once -#include "filesystem_fs.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> + +#if defined(_WIN32) +#include <filesystem> +#else +#include <experimental/filesystem> +#endif + +namespace fs +{ + namespace stdfs = std::experimental::filesystem; + + using stdfs::copy_options; + using stdfs::file_status; + using stdfs::path; + + inline bool is_regular_file(file_status s) { return stdfs::is_regular_file(s); } + inline bool is_directory(file_status s) { return stdfs::is_directory(s); } + inline bool status_known(file_status s) { return stdfs::status_known(s); } +} namespace vcpkg::Files { - __interface Filesystem + struct Filesystem { virtual Expected<std::string> read_contents(const fs::path& file_path) const = 0; virtual Expected<std::vector<std::string>> read_lines(const fs::path& file_path) const = 0; @@ -26,8 +44,10 @@ namespace vcpkg::Files virtual bool create_directory(const fs::path& path, std::error_code& ec) = 0; virtual bool create_directories(const fs::path& path, std::error_code& ec) = 0; virtual void copy(const fs::path& oldpath, const fs::path& newpath, fs::copy_options opts) = 0; - virtual bool copy_file( - const fs::path& oldpath, const fs::path& newpath, fs::copy_options opts, std::error_code& ec) = 0; + virtual bool copy_file(const fs::path& oldpath, + const fs::path& newpath, + fs::copy_options opts, + std::error_code& ec) = 0; virtual fs::file_status status(const fs::path& path, std::error_code& ec) const = 0; }; @@ -39,5 +59,5 @@ namespace vcpkg::Files void print_paths(const std::vector<fs::path>& paths); - std::vector<fs::path> find_from_PATH(const std::wstring& name); + std::vector<fs::path> find_from_PATH(const std::string& name); } diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg/base/graphs.h index 13c0a7136..b585d2bb9 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg/base/graphs.h @@ -3,6 +3,8 @@ #include <unordered_map> #include <unordered_set> +#include <vcpkg/base/checks.h> + namespace vcpkg::Graphs { enum class ExplorationStatus @@ -18,11 +20,11 @@ namespace vcpkg::Graphs }; template<class V, class U> - __interface AdjacencyProvider + struct AdjacencyProvider { - std::vector<V> adjacency_list(const U& vertex) const; + virtual std::vector<V> adjacency_list(const U& vertex) const = 0; - U load_vertex_data(const V& vertex) const; + virtual U load_vertex_data(const V& vertex) const = 0; }; template<class V, class U> diff --git a/toolsrc/include/lazy.h b/toolsrc/include/vcpkg/base/lazy.h index 58c11c002..58c11c002 100644 --- a/toolsrc/include/lazy.h +++ b/toolsrc/include/vcpkg/base/lazy.h diff --git a/toolsrc/include/LineInfo.h b/toolsrc/include/vcpkg/base/lineinfo.h index 62973462a..62973462a 100644 --- a/toolsrc/include/LineInfo.h +++ b/toolsrc/include/vcpkg/base/lineinfo.h diff --git a/toolsrc/include/MachineType.h b/toolsrc/include/vcpkg/base/machinetype.h index 6f61bbd53..b85cdbb0b 100644 --- a/toolsrc/include/MachineType.h +++ b/toolsrc/include/vcpkg/base/machinetype.h @@ -1,4 +1,5 @@ #pragma once + #include <cstdint> namespace vcpkg diff --git a/toolsrc/include/vcpkg_optional.h b/toolsrc/include/vcpkg/base/optional.h index 31a2d3e88..ff7a210c7 100644 --- a/toolsrc/include/vcpkg_optional.h +++ b/toolsrc/include/vcpkg/base/optional.h @@ -1,5 +1,6 @@ #pragma once -#include "vcpkg_Checks.h" + +#include <vcpkg/base/checks.h> namespace vcpkg { @@ -29,7 +30,7 @@ namespace vcpkg return std::move(this->m_t); } - const T& value_or_exit(const LineInfo& line_info) const & + const T& value_or_exit(const LineInfo& line_info) const& { this->exit_if_null(line_info); return this->m_t; @@ -40,7 +41,7 @@ namespace vcpkg constexpr bool has_value() const { return m_is_present; } template<class U> - T value_or(U&& default_value) const & + T value_or(U&& default_value) const& { return bool(*this) ? this->m_t : static_cast<T>(std::forward<U>(default_value)); } diff --git a/toolsrc/include/SortedVector.h b/toolsrc/include/vcpkg/base/sortedvector.h index 62808cc2f..62808cc2f 100644 --- a/toolsrc/include/SortedVector.h +++ b/toolsrc/include/vcpkg/base/sortedvector.h diff --git a/toolsrc/include/vcpkg/base/span.h b/toolsrc/include/vcpkg/base/span.h new file mode 100644 index 000000000..6be546351 --- /dev/null +++ b/toolsrc/include/vcpkg/base/span.h @@ -0,0 +1,60 @@ +#pragma once
+
+#include <array>
+#include <cstddef>
+#include <initializer_list>
+#include <vector>
+
+namespace vcpkg
+{
+ template<class T>
+ struct Span
+ {
+ public:
+ using element_type = T;
+ using pointer = T*;
+ using reference = T&;
+ using iterator = T*;
+
+ constexpr Span() noexcept : m_ptr(nullptr), m_count(0) {}
+ constexpr Span(std::nullptr_t) noexcept : Span() {}
+ constexpr Span(T* ptr, size_t count) noexcept : m_ptr(ptr), m_count(count) {}
+ constexpr Span(T* ptr_begin, T* ptr_end) noexcept : m_ptr(ptr_begin), m_count(ptr_end - ptr_begin) {}
+ constexpr Span(std::initializer_list<T> l) noexcept : m_ptr(l.begin()), m_count(l.size()) {}
+
+ template<size_t N>
+ constexpr Span(T (&arr)[N]) noexcept : Span(arr, N)
+ {
+ }
+
+ template<size_t N>
+ constexpr Span(const std::array<std::remove_const_t<T>, N>& arr) noexcept : Span(arr.data(), arr.size())
+ {
+ }
+
+ 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()) {}
+
+ 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 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()};
+ }
+}
\ No newline at end of file diff --git a/toolsrc/include/vcpkg_Strings.h b/toolsrc/include/vcpkg/base/strings.h index c44ce2b99..d263e3b6b 100644 --- a/toolsrc/include/vcpkg_Strings.h +++ b/toolsrc/include/vcpkg/base/strings.h @@ -1,6 +1,7 @@ #pragma once -#include "CStringView.h" +#include <vcpkg/base/cstringview.h> + #include <vector> namespace vcpkg::Strings::details @@ -15,30 +16,17 @@ namespace vcpkg::Strings::details inline const char* to_printf_arg(const char* s) { return s; } - inline int to_printf_arg(const int s) { return s; } - - inline long long to_printf_arg(const long long s) { return s; } - - inline unsigned long to_printf_arg(const unsigned long s) { return s; } - - inline size_t to_printf_arg(const size_t s) { return s; } - - inline double to_printf_arg(const double s) { return s; } + template<class T, class = std::enable_if_t<std::is_arithmetic<T>::value>> + T to_printf_arg(T s) + { + return s; + } std::string format_internal(const char* fmtstr, ...); - - inline const wchar_t* to_wprintf_arg(const std::wstring& s) { return s.c_str(); } - - inline const wchar_t* to_wprintf_arg(const wchar_t* s) { return s; } - - std::wstring wformat_internal(const wchar_t* fmtstr, ...); } namespace vcpkg::Strings { - static constexpr const char* EMPTY = ""; - static constexpr const wchar_t* WEMPTY = L""; - template<class... Args> std::string format(const char* fmtstr, const Args&... args) { @@ -46,39 +34,32 @@ namespace vcpkg::Strings return details::format_internal(fmtstr, to_printf_arg(to_printf_arg(args))...); } - template<class... Args> - std::wstring wformat(const wchar_t* fmtstr, const Args&... args) - { - using vcpkg::Strings::details::to_wprintf_arg; - return details::wformat_internal(fmtstr, to_wprintf_arg(to_wprintf_arg(args))...); - } - - std::wstring to_utf16(const CStringView s); + std::wstring to_utf16(const CStringView& s); - std::string to_utf8(const CWStringView w); + std::string to_utf8(const CWStringView& w); std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern); bool case_insensitive_ascii_contains(const std::string& s, const std::string& pattern); - int case_insensitive_ascii_compare(const CStringView left, const CStringView right); + bool case_insensitive_ascii_equals(const CStringView left, const CStringView right); std::string ascii_to_lowercase(const std::string& input); bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern); - template<class Container, class Transformer, class CharType> - std::basic_string<CharType> join(const CharType* delimiter, const Container& v, Transformer transformer) + template<class Container, class Transformer> + std::string join(const char* delimiter, const Container& v, Transformer transformer) { const auto begin = v.begin(); const auto end = v.end(); if (begin == end) { - return std::basic_string<CharType>(); + return std::string(); } - std::basic_string<CharType> output; + std::string output; output.append(transformer(*begin)); for (auto it = std::next(begin); it != end; ++it) { @@ -88,8 +69,8 @@ namespace vcpkg::Strings return output; } - template<class Container, class CharType> - std::basic_string<CharType> join(const CharType* delimiter, const Container& v) + template<class Container> + std::string join(const char* delimiter, const Container& v) { using Element = decltype(*v.begin()); return join(delimiter, v, [](const Element& x) -> const Element& { return x; }); diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg/base/system.h index 65f80ae6d..b396ef293 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg/base/system.h @@ -1,9 +1,8 @@ #pragma once -#include "filesystem_fs.h" -#include "vcpkg_Strings.h" -#include "vcpkg_optional.h" -#include <Windows.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/strings.h> namespace vcpkg::System { @@ -17,13 +16,13 @@ namespace vcpkg::System std::string output; }; - int cmd_execute_clean(const CWStringView cmd_line); + int cmd_execute_clean(const CStringView cmd_line); - int cmd_execute(const CWStringView cmd_line); + int cmd_execute(const CStringView cmd_line); - ExitCodeAndOutput cmd_execute_and_capture_output(const CWStringView cmd_line); + ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line); - std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args = Strings::WEMPTY); + std::string create_powershell_script_cmd(const fs::path& script_path, const CStringView args = ""); enum class Color { @@ -62,9 +61,9 @@ namespace vcpkg::System return System::println(c, Strings::format(messageTemplate, messageArg1, messageArgs...)); } - Optional<std::wstring> get_environment_variable(const CWStringView varname) noexcept; + Optional<std::string> get_environment_variable(const CStringView varname) noexcept; - Optional<std::wstring> get_registry_string(HKEY base, const CWStringView subkey, const CWStringView valuename); + Optional<std::string> get_registry_string(void* base_hkey, const CStringView subkey, const CStringView valuename); enum class CPUArchitecture { @@ -74,7 +73,7 @@ namespace vcpkg::System ARM64, }; - Optional<CPUArchitecture> to_cpu_architecture(CStringView arch); + Optional<CPUArchitecture> to_cpu_architecture(const CStringView& arch); CPUArchitecture get_host_processor(); diff --git a/toolsrc/include/vcpkg_Util.h b/toolsrc/include/vcpkg/base/util.h index facb7dd26..d5db6b6ee 100644 --- a/toolsrc/include/vcpkg_Util.h +++ b/toolsrc/include/vcpkg/base/util.h @@ -1,5 +1,6 @@ #pragma once +#include <algorithm> #include <map> #include <mutex> #include <utility> @@ -7,6 +8,18 @@ namespace vcpkg::Util { + template<class Container> + using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>; + + namespace Vectors + { + template<class Container, class T = ElementT<Container>> + void concatenate(std::vector<T>* augend, const Container& addend) + { + augend->insert(augend->end(), addend.begin(), addend.end()); + } + } + template<class Cont, class Func> using FmapOut = decltype(std::declval<Func>()(*begin(std::declval<Cont>()))); @@ -56,20 +69,21 @@ namespace vcpkg::Util } template<class Container, class V> - auto find(const Container& cont, V&& v) + auto find(Container&& cont, V&& v) { - return std::find(cont.cbegin(), cont.cend(), v); + using std::begin; + using std::end; + return std::find(begin(cont), end(cont), v); } template<class Container, class Pred> - auto find_if(const Container& cont, Pred pred) + auto find_if(Container&& cont, Pred pred) { - return std::find_if(cont.cbegin(), cont.cend(), pred); + using std::begin; + using std::end; + return std::find_if(begin(cont), end(cont), pred); } - template<class Container> - using ElementT = std::remove_reference_t<decltype(*begin(std::declval<Container>()))>; - template<class Container, class T = ElementT<Container>> std::vector<T*> element_pointers(Container&& cont) { @@ -77,13 +91,15 @@ namespace vcpkg::Util } template<class Container, class Pred> - auto find_if_not(const Container& cont, Pred pred) + auto find_if_not(Container&& cont, Pred pred) { - return std::find_if_not(cont.cbegin(), cont.cend(), pred); + using std::begin; + using std::end; + return std::find_if_not(begin(cont), end(cont), pred); } template<class K, class V, class Container, class Func> - void group_by(const Container& cont, std::map<K, std::vector<const V*>>* output, Func f) + void group_by(const Container& cont, std::map<K, std::vector<const V*>>* output, Func&& f) { for (const V& element : cont) { @@ -92,6 +108,12 @@ namespace vcpkg::Util } } + template<class AssocContainer, class K = std::decay_t<decltype(begin(std::declval<AssocContainer>())->first)>> + std::vector<K> extract_keys(AssocContainer&& input_map) + { + return fmap(input_map, [](auto&& p) { return p.first; }); + } + struct MoveOnlyBase { MoveOnlyBase() = default; @@ -141,4 +163,4 @@ namespace vcpkg::Util std::unique_lock<std::mutex> m_lock; T& m_ptr; }; -}
\ No newline at end of file +} diff --git a/toolsrc/include/BinaryParagraph.h b/toolsrc/include/vcpkg/binaryparagraph.h index 61e03343a..7eb50a6d7 100644 --- a/toolsrc/include/BinaryParagraph.h +++ b/toolsrc/include/vcpkg/binaryparagraph.h @@ -1,7 +1,8 @@ #pragma once -#include "PackageSpec.h" -#include "SourceParagraph.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/sourceparagraph.h> + #include <unordered_map> namespace vcpkg diff --git a/toolsrc/include/vcpkg_Build.h b/toolsrc/include/vcpkg/build.h index 5ba675757..774e25922 100644 --- a/toolsrc/include/vcpkg_Build.h +++ b/toolsrc/include/vcpkg/build.h @@ -1,11 +1,14 @@ #pragma once -#include "CStringView.h" -#include "PackageSpec.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Files.h" -#include "vcpkg_optional.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/triplet.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/optional.h> #include <array> #include <map> @@ -13,6 +16,16 @@ namespace vcpkg::Build { + namespace Command + { + void perform_and_exit(const FullPackageSpec& full_spec, + const fs::path& port_dir, + const std::unordered_set<std::string>& options, + const VcpkgPaths& paths); + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + enum class UseHeadVersion { NO = 0, @@ -83,7 +96,7 @@ namespace vcpkg::Build Optional<fs::path> visual_studio_path; }; - std::wstring make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset); + std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset); struct ExtendedBuildResult { diff --git a/toolsrc/include/vcpkg/commands.h b/toolsrc/include/vcpkg/commands.h new file mode 100644 index 000000000..e00812c98 --- /dev/null +++ b/toolsrc/include/vcpkg/commands.h @@ -0,0 +1,135 @@ +#pragma once + +#include <vcpkg/build.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <array> + +namespace vcpkg::Commands +{ + using CommandTypeA = void (*)(const VcpkgCmdArguments& args, + const VcpkgPaths& paths, + const Triplet& default_triplet); + using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + using CommandTypeC = void (*)(const VcpkgCmdArguments& args); + + namespace BuildExternal + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace CI + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace Env + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + } + + namespace Create + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Edit + { + extern const CommandStructure COMMAND_STRUCTURE; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace DependInfo + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Search + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace List + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Owns + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Cache + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Import + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Integrate + { + extern const char* const INTEGRATE_COMMAND_HELPSTRING; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace PortsDiff + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Autocomplete + { + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + } + + namespace Version + { + const std::string& version(); + void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); + void perform_and_exit(const VcpkgCmdArguments& args); + } + + namespace Contact + { + const std::string& email(); + void perform_and_exit(const VcpkgCmdArguments& args); + } + + namespace Hash + { + void perform_and_exit(const VcpkgCmdArguments& args); + } + + template<class T> + struct PackageNameAndFunction + { + std::string name; + T function; + }; + + Span<const PackageNameAndFunction<CommandTypeA>> get_available_commands_type_a(); + Span<const PackageNameAndFunction<CommandTypeB>> get_available_commands_type_b(); + Span<const PackageNameAndFunction<CommandTypeC>> get_available_commands_type_c(); + + template<typename T> + T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands) + { + for (const PackageNameAndFunction<T>& cmd : available_commands) + { + if (cmd.name == command_name) + { + return cmd.function; + } + } + + // not found + return nullptr; + } +} diff --git a/toolsrc/include/vcpkg_Dependencies.h b/toolsrc/include/vcpkg/dependencies.h index d67122e48..585338ae2 100644 --- a/toolsrc/include/vcpkg_Dependencies.h +++ b/toolsrc/include/vcpkg/dependencies.h @@ -1,10 +1,12 @@ #pragma once -#include "PackageSpec.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Graphs.h" -#include "vcpkg_Util.h" -#include "vcpkg_optional.h" + +#include <vcpkg/base/graphs.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/util.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgpaths.h> + #include <vector> namespace vcpkg::Dependencies @@ -113,7 +115,10 @@ namespace vcpkg::Dependencies RequestType request_type; }; - __interface PortFileProvider { virtual const SourceControlFile& get_control_file(const std::string& spec) const; }; + struct PortFileProvider + { + virtual const SourceControlFile& get_control_file(const std::string& spec) const = 0; + }; struct MapPortFile : Util::ResourceBase, PortFileProvider { diff --git a/toolsrc/include/vcpkg/export.h b/toolsrc/include/vcpkg/export.h new file mode 100644 index 000000000..f3285e187 --- /dev/null +++ b/toolsrc/include/vcpkg/export.h @@ -0,0 +1,10 @@ +#pragma once + +#include <vcpkg/vcpkgpaths.h> + +namespace vcpkg::Export +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + + void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths); +} diff --git a/toolsrc/include/vcpkg_Commands_Export_IFW.h b/toolsrc/include/vcpkg/export.ifw.h index 7bee45eaf..d28a4436d 100644 --- a/toolsrc/include/vcpkg_Commands_Export_IFW.h +++ b/toolsrc/include/vcpkg/export.ifw.h @@ -1,13 +1,14 @@ #pragma once -#include "VcpkgPaths.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vcpkg/base/files.h> #include <string> #include <vector> -namespace vcpkg::Commands::Export::IFW +namespace vcpkg::Export::IFW { struct Options { diff --git a/toolsrc/include/vcpkg_GlobalState.h b/toolsrc/include/vcpkg/globalstate.h index 6522a25bf..7cea361cf 100644 --- a/toolsrc/include/vcpkg_GlobalState.h +++ b/toolsrc/include/vcpkg/globalstate.h @@ -1,15 +1,15 @@ #pragma once -#include <atomic> +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/util.h> -#include "vcpkg_Chrono.h" -#include "vcpkg_Util.h" +#include <atomic> namespace vcpkg { struct GlobalState { - static Util::LockGuarded<ElapsedTime> timer; + static Util::LockGuarded<Chrono::ElapsedTime> timer; static std::atomic<bool> debugging; static std::atomic<bool> feature_packages; diff --git a/toolsrc/include/vcpkg/help.h b/toolsrc/include/vcpkg/help.h new file mode 100644 index 000000000..39ad6912d --- /dev/null +++ b/toolsrc/include/vcpkg/help.h @@ -0,0 +1,19 @@ +#pragma once + +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <string> + +namespace vcpkg::Help +{ + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); + + void help_topic_valid_triplet(const VcpkgPaths& paths); + + void print_usage(); + + void print_example(const std::string& command_and_arguments); + + std::string create_example_string(const std::string& command_and_arguments); +} diff --git a/toolsrc/include/vcpkg_Input.h b/toolsrc/include/vcpkg/input.h index fa568207a..621139427 100644 --- a/toolsrc/include/vcpkg_Input.h +++ b/toolsrc/include/vcpkg/input.h @@ -1,5 +1,6 @@ #pragma once -#include "PackageSpec.h" + +#include <vcpkg/packagespec.h> namespace vcpkg::Input { diff --git a/toolsrc/include/vcpkg/install.h b/toolsrc/include/vcpkg/install.h new file mode 100644 index 000000000..db6055f4f --- /dev/null +++ b/toolsrc/include/vcpkg/install.h @@ -0,0 +1,71 @@ +#pragma once + +#include <vcpkg/build.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +#include <vector> + +namespace vcpkg::Install +{ + enum class KeepGoing + { + NO = 0, + YES + }; + + inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; } + + enum class PrintSummary + { + NO = 0, + YES + }; + + inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; } + + struct InstallDir + { + static InstallDir from_destination_root(const fs::path& destination_root, + const std::string& destination_subdirectory, + const fs::path& listfile); + + private: + fs::path m_destination; + std::string m_destination_subdirectory; + fs::path m_listfile; + + public: + const fs::path& destination() const; + const std::string& destination_subdirectory() const; + const fs::path& listfile() const; + }; + + Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths, + const Dependencies::InstallPlanAction& action, + const Build::BuildPackageOptions& install_plan_options, + StatusParagraphs& status_db); + + enum class InstallResult + { + FILE_CONFLICTS, + SUCCESS, + }; + + void install_files_and_write_listfile(Files::Filesystem& fs, const fs::path& source_dir, const InstallDir& dirs); + InstallResult install_package(const VcpkgPaths& paths, + const BinaryControlFile& binary_paragraph, + StatusParagraphs* status_db); + + void perform_and_exit_ex(const std::vector<Dependencies::AnyAction>& action_plan, + const Build::BuildPackageOptions& install_plan_options, + const KeepGoing keep_going, + const PrintSummary print_summary, + const VcpkgPaths& paths, + StatusParagraphs& status_db); + + extern const CommandStructure COMMAND_STRUCTURE; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); +} diff --git a/toolsrc/include/metrics.h b/toolsrc/include/vcpkg/metrics.h index 8eae426de..f73c636cf 100644 --- a/toolsrc/include/metrics.h +++ b/toolsrc/include/vcpkg/metrics.h @@ -1,8 +1,8 @@ #pragma once -#include <string> +#include <vcpkg/base/util.h> -#include "vcpkg_Util.h" +#include <string> namespace vcpkg::Metrics { @@ -15,7 +15,6 @@ namespace vcpkg::Metrics void track_metric(const std::string& name, double value); void track_property(const std::string& name, const std::string& value); - void track_property(const std::string& name, const std::wstring& value); void upload(const std::string& payload); void flush(); @@ -23,6 +22,6 @@ namespace vcpkg::Metrics extern Util::LockGuarded<Metrics> g_metrics; - std::wstring get_SQM_user(); + std::string get_SQM_user(); bool get_compiled_metrics_enabled(); } diff --git a/toolsrc/include/PackageSpec.h b/toolsrc/include/vcpkg/packagespec.h index c5ce767f9..60c99782e 100644 --- a/toolsrc/include/PackageSpec.h +++ b/toolsrc/include/vcpkg/packagespec.h @@ -1,8 +1,8 @@ #pragma once -#include "PackageSpecParseResult.h" -#include "Triplet.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> +#include <vcpkg/packagespecparseresult.h> +#include <vcpkg/triplet.h> namespace vcpkg { @@ -76,20 +76,23 @@ namespace vcpkg bool operator!=(const PackageSpec& left, const PackageSpec& right); } -template<> -struct std::hash<vcpkg::PackageSpec> +namespace std { - size_t operator()(const vcpkg::PackageSpec& value) const + template<> + struct hash<vcpkg::PackageSpec> { - size_t hash = 17; - hash = hash * 31 + std::hash<std::string>()(value.name()); - hash = hash * 31 + std::hash<vcpkg::Triplet>()(value.triplet()); - return hash; - } -}; - -template<> -struct std::equal_to<vcpkg::PackageSpec> -{ - bool operator()(const vcpkg::PackageSpec& left, const vcpkg::PackageSpec& right) const { return left == right; } -}; + size_t operator()(const vcpkg::PackageSpec& value) const + { + size_t hash = 17; + hash = hash * 31 + std::hash<std::string>()(value.name()); + hash = hash * 31 + std::hash<vcpkg::Triplet>()(value.triplet()); + return hash; + } + }; + + template<> + struct equal_to<vcpkg::PackageSpec> + { + bool operator()(const vcpkg::PackageSpec& left, const vcpkg::PackageSpec& right) const { return left == right; } + }; +} diff --git a/toolsrc/include/PackageSpecParseResult.h b/toolsrc/include/vcpkg/packagespecparseresult.h index 1462b8073..dd91c9a67 100644 --- a/toolsrc/include/PackageSpecParseResult.h +++ b/toolsrc/include/vcpkg/packagespecparseresult.h @@ -1,6 +1,7 @@ #pragma once -#include "vcpkg_expected.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/expected.h> namespace vcpkg { @@ -19,7 +20,7 @@ namespace vcpkg ErrorHolder() : m_err(PackageSpecParseResult::SUCCESS) {} ErrorHolder(PackageSpecParseResult err) : m_err(err) {} - constexpr bool has_error() const { return m_err != PackageSpecParseResult::SUCCESS; } + bool has_error() const { return m_err != PackageSpecParseResult::SUCCESS; } const PackageSpecParseResult& error() const { return m_err; } PackageSpecParseResult& error() { return m_err; } diff --git a/toolsrc/include/ParagraphParseResult.h b/toolsrc/include/vcpkg/paragraphparseresult.h index eaa7e6327..558715bbc 100644 --- a/toolsrc/include/ParagraphParseResult.h +++ b/toolsrc/include/vcpkg/paragraphparseresult.h @@ -1,4 +1,5 @@ #pragma once + #include <system_error> namespace vcpkg @@ -25,8 +26,11 @@ namespace vcpkg ParagraphParseResult to_paragraph_parse_result(std::error_code ec); } -// Enable implicit conversion to std::error_code -template<> -struct std::is_error_code_enum<vcpkg::ParagraphParseResult> : ::std::true_type +namespace std { -}; + // Enable implicit conversion to std::error_code + template<> + struct is_error_code_enum<vcpkg::ParagraphParseResult> : ::std::true_type + { + }; +}
\ No newline at end of file diff --git a/toolsrc/include/Paragraphs.h b/toolsrc/include/vcpkg/paragraphs.h index aae46f7da..c8dbea646 100644 --- a/toolsrc/include/Paragraphs.h +++ b/toolsrc/include/vcpkg/paragraphs.h @@ -1,13 +1,13 @@ #pragma once -#include <map> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/parse.h> +#include <vcpkg/vcpkgpaths.h> +#include <vcpkg/versiont.h> + +#include <vcpkg/base/expected.h> -#include "BinaryParagraph.h" -#include "VcpkgPaths.h" -#include "VersionT.h" -#include "filesystem_fs.h" -#include "vcpkg_Parse.h" -#include "vcpkg_expected.h" +#include <map> namespace vcpkg::Paragraphs { diff --git a/toolsrc/include/vcpkg_Parse.h b/toolsrc/include/vcpkg/parse.h index 2dda033b3..4b33e302e 100644 --- a/toolsrc/include/vcpkg_Parse.h +++ b/toolsrc/include/vcpkg/parse.h @@ -1,11 +1,11 @@ #pragma once +#include <vcpkg/base/expected.h> +#include <vcpkg/base/optional.h> + #include <memory> #include <unordered_map> -#include "vcpkg_expected.h" -#include "vcpkg_optional.h" - namespace vcpkg::Parse { struct ParseControlErrorInfo diff --git a/toolsrc/include/PostBuildLint_BuildType.h b/toolsrc/include/vcpkg/postbuildlint.buildtype.h index 38ad3084e..ff651fd7a 100644 --- a/toolsrc/include/PostBuildLint_BuildType.h +++ b/toolsrc/include/vcpkg/postbuildlint.buildtype.h @@ -1,6 +1,8 @@ #pragma once -#include "CStringView.h" -#include "vcpkg_Build.h" + +#include <vcpkg/base/cstringview.h> +#include <vcpkg/build.h> + #include <array> #include <regex> diff --git a/toolsrc/include/PostBuildLint.h b/toolsrc/include/vcpkg/postbuildlint.h index 69fafc9f7..5dcfeb8df 100644 --- a/toolsrc/include/PostBuildLint.h +++ b/toolsrc/include/vcpkg/postbuildlint.h @@ -1,7 +1,8 @@ #pragma once -#include "PackageSpec.h" -#include "VcpkgPaths.h" -#include "vcpkg_Build.h" + +#include <vcpkg/build.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg::PostBuildLint { diff --git a/toolsrc/include/vcpkg/remove.h b/toolsrc/include/vcpkg/remove.h new file mode 100644 index 000000000..6d8a3ebe9 --- /dev/null +++ b/toolsrc/include/vcpkg/remove.h @@ -0,0 +1,26 @@ +#pragma once + +#include <vcpkg/dependencies.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> + +namespace vcpkg::Remove +{ + enum class Purge + { + NO = 0, + YES + }; + + inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; } + + void perform_remove_plan_action(const VcpkgPaths& paths, + const Dependencies::RemovePlanAction& action, + const Purge purge, + StatusParagraphs& status_db); + + extern const CommandStructure COMMAND_STRUCTURE; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); + void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); +} diff --git a/toolsrc/include/SourceParagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h index ccf9faf4f..dcbbc1c3b 100644 --- a/toolsrc/include/SourceParagraph.h +++ b/toolsrc/include/vcpkg/sourceparagraph.h @@ -1,10 +1,11 @@ #pragma once -#include "PackageSpec.h" -#include "Span.h" -#include "vcpkg_Parse.h" -#include "vcpkg_System.h" -#include "vcpkg_expected.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/parse.h> + +#include <vcpkg/base/expected.h> +#include <vcpkg/base/span.h> +#include <vcpkg/base/system.h> #include <string> #include <vector> diff --git a/toolsrc/include/StatusParagraph.h b/toolsrc/include/vcpkg/statusparagraph.h index b56533d65..ca84b1bb7 100644 --- a/toolsrc/include/StatusParagraph.h +++ b/toolsrc/include/vcpkg/statusparagraph.h @@ -1,6 +1,7 @@ #pragma once -#include "BinaryParagraph.h" +#include <vcpkg/binaryparagraph.h> + #include <unordered_map> namespace vcpkg diff --git a/toolsrc/include/StatusParagraphs.h b/toolsrc/include/vcpkg/statusparagraphs.h index 1a9ee6a03..c2f3b7b8e 100644 --- a/toolsrc/include/StatusParagraphs.h +++ b/toolsrc/include/vcpkg/statusparagraphs.h @@ -1,5 +1,6 @@ #pragma once -#include "StatusParagraph.h" +#include <vcpkg/statusparagraph.h> + #include <iterator> #include <memory> diff --git a/toolsrc/include/triplet.h b/toolsrc/include/vcpkg/triplet.h index 46a52f8e6..50d731593 100644 --- a/toolsrc/include/triplet.h +++ b/toolsrc/include/vcpkg/triplet.h @@ -36,8 +36,11 @@ namespace vcpkg bool operator!=(const Triplet& left, const Triplet& right); } -template<> -struct std::hash<vcpkg::Triplet> +namespace std { - size_t operator()(const vcpkg::Triplet& t) const { return t.hash_code(); } -}; + template<> + struct hash<vcpkg::Triplet> + { + size_t operator()(const vcpkg::Triplet& t) const { return t.hash_code(); } + }; +}
\ No newline at end of file diff --git a/toolsrc/include/vcpkg/update.h b/toolsrc/include/vcpkg/update.h new file mode 100644 index 000000000..e7303d1b0 --- /dev/null +++ b/toolsrc/include/vcpkg/update.h @@ -0,0 +1,21 @@ +#pragma once + +#include <vcpkg/packagespec.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgcmdarguments.h> +#include <vcpkg/vcpkgpaths.h> +#include <vcpkg/versiont.h> + +namespace vcpkg::Update +{ + struct OutdatedPackage + { + static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right); + + PackageSpec spec; + VersionDiff version_diff; + }; + + std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db); + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); +}
\ No newline at end of file diff --git a/toolsrc/include/VcpkgCmdArguments.h b/toolsrc/include/vcpkg/vcpkgcmdarguments.h index 0de5747b1..d9895f4b8 100644 --- a/toolsrc/include/VcpkgCmdArguments.h +++ b/toolsrc/include/vcpkg/vcpkgcmdarguments.h @@ -1,6 +1,9 @@ #pragma once -#include "vcpkg_optional.h" +#include <vcpkg/base/cstringview.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/span.h> + #include <memory> #include <unordered_map> #include <unordered_set> @@ -16,7 +19,11 @@ namespace vcpkg struct VcpkgCmdArguments { +#if defined(_WIN32) static VcpkgCmdArguments create_from_command_line(const int argc, const wchar_t* const* const argv); +#else + static VcpkgCmdArguments create_from_command_line(const int argc, const char* const* const argv); +#endif static VcpkgCmdArguments create_from_arg_sequence(const std::string* arg_begin, const std::string* arg_end); std::unique_ptr<std::string> vcpkg_root_dir; @@ -46,4 +53,19 @@ namespace vcpkg private: std::unordered_map<std::string, Optional<std::string>> optional_command_arguments; }; + + struct VcpkgPaths; + + struct CommandStructure + { + CStringView example_text; + + size_t minimum_arity; + size_t maximum_arity; + + Span<const std::string> switches; + Span<const std::string> settings; + + std::vector<std::string> (*valid_arguments)(const VcpkgPaths& paths); + }; } diff --git a/toolsrc/include/vcpkglib.h b/toolsrc/include/vcpkg/vcpkglib.h index 0bb75f9b5..9a7fdb861 100644 --- a/toolsrc/include/vcpkglib.h +++ b/toolsrc/include/vcpkg/vcpkglib.h @@ -1,8 +1,8 @@ #pragma once -#include "SortedVector.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" +#include <vcpkg/base/sortedvector.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg { @@ -22,17 +22,16 @@ namespace vcpkg struct CMakeVariable { - CMakeVariable(const CWStringView varname, const wchar_t* varvalue); - CMakeVariable(const CWStringView varname, const std::string& varvalue); - CMakeVariable(const CWStringView varname, const std::wstring& varvalue); - CMakeVariable(const CWStringView varname, const fs::path& path); + CMakeVariable(const CStringView varname, const char* varvalue); + CMakeVariable(const CStringView varname, const std::string& varvalue); + CMakeVariable(const CStringView varname, const fs::path& path); - std::wstring s; + std::string s; }; - std::wstring make_cmake_cmd(const fs::path& cmake_exe, - const fs::path& cmake_script, - const std::vector<CMakeVariable>& pass_variables); + std::string make_cmake_cmd(const fs::path& cmake_exe, + const fs::path& cmake_script, + const std::vector<CMakeVariable>& pass_variables); std::string shorten_text(const std::string& desc, size_t length); } // namespace vcpkg diff --git a/toolsrc/include/VcpkgPaths.h b/toolsrc/include/vcpkg/vcpkgpaths.h index d4640fba2..781dabd1a 100644 --- a/toolsrc/include/VcpkgPaths.h +++ b/toolsrc/include/vcpkg/vcpkgpaths.h @@ -1,16 +1,17 @@ #pragma once -#include "BinaryParagraph.h" -#include "Lazy.h" -#include "PackageSpec.h" -#include "filesystem_fs.h" -#include "vcpkg_Files.h" -#include "vcpkg_expected.h" + +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/packagespec.h> + +#include <vcpkg/base/expected.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/lazy.h> namespace vcpkg { struct ToolsetArchOption { - CWStringView name; + CStringView name; System::CPUArchitecture host_arch; System::CPUArchitecture target_arch; }; @@ -20,8 +21,8 @@ namespace vcpkg fs::path visual_studio_root_path; fs::path dumpbin; fs::path vcvarsall; - std::vector<std::wstring> vcvarsall_options; - CWStringView version; + std::vector<std::string> vcvarsall_options; + CStringView version; std::vector<ToolsetArchOption> supported_architectures; }; @@ -35,6 +36,7 @@ namespace vcpkg fs::path build_info_file_path(const PackageSpec& spec) const; fs::path listfile_path(const BinaryParagraph& pgh) const; + const std::vector<std::string>& get_available_triplets() const; bool is_valid_triplet(const Triplet& t) const; fs::path root; @@ -67,12 +69,13 @@ namespace vcpkg /// <remarks> /// Valid version strings are "v140", "v141", and "". Empty string gets the latest. /// </remarks> - const Toolset& VcpkgPaths::get_toolset(const Optional<std::string>& toolset_version, - const Optional<fs::path>& visual_studio_path) const; + const Toolset& get_toolset(const Optional<std::string>& toolset_version, + const Optional<fs::path>& visual_studio_path) const; Files::Filesystem& get_filesystem() const; private: + Lazy<std::vector<std::string>> available_triplets; Lazy<fs::path> cmake_exe; Lazy<fs::path> git_exe; Lazy<fs::path> nuget_exe; diff --git a/toolsrc/include/VersionT.h b/toolsrc/include/vcpkg/versiont.h index 67efd8da3..67efd8da3 100644 --- a/toolsrc/include/VersionT.h +++ b/toolsrc/include/vcpkg/versiont.h diff --git a/toolsrc/include/vcpkg_Commands.h b/toolsrc/include/vcpkg_Commands.h deleted file mode 100644 index 7cfa2760e..000000000 --- a/toolsrc/include/vcpkg_Commands.h +++ /dev/null @@ -1,258 +0,0 @@ -#pragma once - -#include "StatusParagraphs.h" -#include "VcpkgCmdArguments.h" -#include "VcpkgPaths.h" -#include "VersionT.h" -#include "vcpkg_Build.h" -#include "vcpkg_Dependencies.h" -#include <array> - -namespace vcpkg::Commands -{ - using CommandTypeA = void (*)(const VcpkgCmdArguments& args, - const VcpkgPaths& paths, - const Triplet& default_triplet); - using CommandTypeB = void (*)(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - using CommandTypeC = void (*)(const VcpkgCmdArguments& args); - - namespace BuildCommand - { - void perform_and_exit(const FullPackageSpec& full_spec, - const fs::path& port_dir, - const std::unordered_set<std::string>& options, - const VcpkgPaths& paths); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace BuildExternal - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Install - { - enum class KeepGoing - { - NO = 0, - YES - }; - - inline KeepGoing to_keep_going(const bool value) { return value ? KeepGoing::YES : KeepGoing::NO; } - - enum class PrintSummary - { - NO = 0, - YES - }; - - inline PrintSummary to_print_summary(const bool value) { return value ? PrintSummary::YES : PrintSummary::NO; } - - struct InstallDir - { - static InstallDir from_destination_root(const fs::path& destination_root, - const std::string& destination_subdirectory, - const fs::path& listfile); - - private: - fs::path m_destination; - std::string m_destination_subdirectory; - fs::path m_listfile; - - public: - const fs::path& destination() const; - const std::string& destination_subdirectory() const; - const fs::path& listfile() const; - }; - - Build::BuildResult perform_install_plan_action(const VcpkgPaths& paths, - const Dependencies::InstallPlanAction& action, - const Build::BuildPackageOptions& install_plan_options, - StatusParagraphs& status_db); - - enum class InstallResult - { - FILE_CONFLICTS, - SUCCESS, - }; - - void install_files_and_write_listfile(Files::Filesystem& fs, - const fs::path& source_dir, - const InstallDir& dirs); - InstallResult install_package(const VcpkgPaths& paths, - const BinaryControlFile& binary_paragraph, - StatusParagraphs* status_db); - - void perform_and_exit(const std::vector<Dependencies::AnyAction>& action_plan, - const Build::BuildPackageOptions& install_plan_options, - const KeepGoing keep_going, - const PrintSummary print_summary, - const VcpkgPaths& paths, - StatusParagraphs& status_db); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Export - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace CI - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Remove - { - enum class Purge - { - NO = 0, - YES - }; - - inline Purge to_purge(const bool value) { return value ? Purge::YES : Purge::NO; } - - void perform_remove_plan_action(const VcpkgPaths& paths, - const Dependencies::RemovePlanAction& action, - const Purge purge, - StatusParagraphs& status_db); - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - void remove_package(const VcpkgPaths& paths, const PackageSpec& spec, StatusParagraphs* status_db); - } - - namespace Update - { - struct OutdatedPackage - { - static bool compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right); - - PackageSpec spec; - VersionDiff version_diff; - }; - - std::vector<OutdatedPackage> find_outdated_packages(const VcpkgPaths& paths, const StatusParagraphs& status_db); - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Env - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet); - } - - namespace Create - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Edit - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace DependInfo - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Search - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace List - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Owns - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Cache - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Import - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Integrate - { - extern const char* const INTEGRATE_COMMAND_HELPSTRING; - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace PortsDiff - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Autocomplete - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - } - - namespace Help - { - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths); - - void help_topic_valid_triplet(const VcpkgPaths& paths); - - void print_usage(); - - void print_example(const std::string& command_and_arguments); - - std::string create_example_string(const std::string& command_and_arguments); - } - - namespace Version - { - const std::string& version(); - void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths); - void perform_and_exit(const VcpkgCmdArguments& args); - } - - namespace Contact - { - const std::string& email(); - void perform_and_exit(const VcpkgCmdArguments& args); - } - - namespace Hash - { - void perform_and_exit(const VcpkgCmdArguments& args); - } - - template<class T> - struct PackageNameAndFunction - { - std::string name; - T function; - }; - - const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a(); - const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b(); - const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c(); - - template<typename T> - T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands) - { - for (const PackageNameAndFunction<T>& cmd : available_commands) - { - if (cmd.name == command_name) - { - return cmd.function; - } - } - - // not found - return nullptr; - } -} diff --git a/toolsrc/include/vcpkg_Commands_Export.h b/toolsrc/include/vcpkg_Commands_Export.h deleted file mode 100644 index 6e698c1b4..000000000 --- a/toolsrc/include/vcpkg_Commands_Export.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -#include "VcpkgPaths.h" - -namespace vcpkg::Commands::Export -{ - void export_integration_files(const fs::path& raw_exported_dir_path, const VcpkgPaths& paths); -} diff --git a/toolsrc/include/vcpkg_Maps.h b/toolsrc/include/vcpkg_Maps.h deleted file mode 100644 index aadd81c2b..000000000 --- a/toolsrc/include/vcpkg_Maps.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include <map> -#include <unordered_map> -#include <unordered_set> - -namespace vcpkg::Maps -{ - template<typename K, typename V> - std::vector<K> extract_keys(const std::unordered_map<K, V>& input_map) - { - std::vector<K> key_set; - for (auto const& element : input_map) - { - key_set.push_back(element.first); - } - return key_set; - } - - template<typename K, typename V> - std::vector<K> extract_keys(const std::map<K, V>& input_map) - { - std::vector<K> key_set; - for (auto const& element : input_map) - { - key_set.push_back(element.first); - } - return key_set; - } -} diff --git a/toolsrc/src/commands_autocomplete.cpp b/toolsrc/src/commands_autocomplete.cpp deleted file mode 100644 index 3963f904b..000000000 --- a/toolsrc/src/commands_autocomplete.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include "pch.h" - -#include "Paragraphs.h" -#include "SortedVector.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Maps.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" - -namespace vcpkg::Commands::Autocomplete -{ - std::vector<std::string> autocomplete_install( - const std::vector<std::unique_ptr<SourceControlFile>>& source_paragraphs, const std::string& start_with) - { - std::vector<std::string> results; - const auto& istartswith = Strings::case_insensitive_ascii_starts_with; - - for (const auto& source_control_file : source_paragraphs) - { - auto&& sp = *source_control_file->core_paragraph; - - if (istartswith(sp.name, start_with)) - { - results.push_back(sp.name); - } - } - return results; - } - - std::vector<std::string> autocomplete_remove(std::vector<StatusParagraph*> installed_packages, - const std::string& start_with) - { - std::vector<std::string> results; - const auto& istartswith = Strings::case_insensitive_ascii_starts_with; - - for (const auto& installed_package : installed_packages) - { - auto sp = installed_package->package.displayname(); - - if (istartswith(sp, start_with)) - { - results.push_back(sp); - } - } - return results; - } - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) - { - static const std::string EXAMPLE = - Strings::format("The argument should be a command line to autocomplete.\n%s", - Commands::Help::create_example_string("autocomplete install z")); - - args.check_min_arg_count(1, EXAMPLE); - args.check_max_arg_count(2, EXAMPLE); - args.check_and_get_optional_command_arguments({}); - - const std::string requested_command = args.command_arguments.at(0); - const std::string start_with = - args.command_arguments.size() > 1 ? args.command_arguments.at(1) : Strings::EMPTY; - std::vector<std::string> results; - if (requested_command == "install") - { - auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); - auto& source_paragraphs = sources_and_errors.paragraphs; - - results = autocomplete_install(source_paragraphs, start_with); - } - else if (requested_command == "remove") - { - const StatusParagraphs status_db = database_load_check(paths); - std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_db); - results = autocomplete_remove(installed_packages, start_with); - } - - System::println(Strings::join(" ", results)); - Checks::exit_success(VCPKG_LINE_INFO); - } -} diff --git a/toolsrc/src/commands_build.cpp b/toolsrc/src/commands_build.cpp deleted file mode 100644 index a69958058..000000000 --- a/toolsrc/src/commands_build.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "pch.h" - -#include "Paragraphs.h" -#include "PostBuildLint.h" -#include "StatusParagraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Enums.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" - -using vcpkg::Build::BuildResult; -using vcpkg::Parse::ParseControlErrorInfo; -using vcpkg::Parse::ParseExpected; - -namespace vcpkg::Commands::BuildCommand -{ - using Dependencies::InstallPlanAction; - using Dependencies::InstallPlanType; - - static const std::string OPTION_CHECKS_ONLY = "--checks-only"; - - void perform_and_exit(const FullPackageSpec& full_spec, - const fs::path& port_dir, - const std::unordered_set<std::string>& options, - const VcpkgPaths& paths) - { - const PackageSpec& spec = full_spec.package_spec; - if (options.find(OPTION_CHECKS_ONLY) != options.end()) - { - const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet()); - const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); - const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info); - Checks::check_exit(VCPKG_LINE_INFO, error_count == 0); - Checks::exit_success(VCPKG_LINE_INFO); - } - - const ParseExpected<SourceControlFile> source_control_file = - Paragraphs::try_load_port(paths.get_filesystem(), port_dir); - - if (!source_control_file.has_value()) - { - print_error_message(source_control_file.error()); - Checks::exit_fail(VCPKG_LINE_INFO); - } - - for (const std::string& str : full_spec.features) - { - System::println("%s \n", str); - } - const auto& scf = source_control_file.value_or_exit(VCPKG_LINE_INFO); - Checks::check_exit(VCPKG_LINE_INFO, - spec.name() == scf->core_paragraph->name, - "The Name: field inside the CONTROL does not match the port directory: '%s' != '%s'", - scf->core_paragraph->name, - spec.name()); - - const StatusParagraphs status_db = database_load_check(paths); - const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES}; - - const Build::BuildPackageConfig build_config{ - *scf->core_paragraph, spec.triplet(), paths.port_dir(spec), build_package_options}; - - const auto result = Build::build_package(paths, build_config, status_db); - 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(); - for (const auto& p : result.unmet_dependencies) - { - System::println(" %s", p); - } - System::println(); - Checks::exit_fail(VCPKG_LINE_INFO); - } - - 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)); - Checks::exit_fail(VCPKG_LINE_INFO); - } - - Checks::exit_success(VCPKG_LINE_INFO); - } - - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) - { - static const std::string EXAMPLE = Commands::Help::create_example_string("build zlib:x64-windows"); - // Build only takes a single package and all dependencies must already be installed - args.check_exact_arg_count(1, EXAMPLE); - const std::string command_argument = args.command_arguments.at(0); - const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, EXAMPLE); - Input::check_triplet(spec.package_spec.triplet(), paths); - const std::unordered_set<std::string> options = - args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY}); - perform_and_exit(spec, paths.port_dir(spec.package_spec), options, paths); - } -} diff --git a/toolsrc/src/commands_hash.cpp b/toolsrc/src/commands_hash.cpp deleted file mode 100644 index b3211b9f8..000000000 --- a/toolsrc/src/commands_hash.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "pch.h" - -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" - -namespace vcpkg::Commands::Hash -{ - static void do_file_hash(fs::path const& path, std::wstring const& hash_type) - { - const auto cmd_line = Strings::wformat(LR"(CertUtil.exe -hashfile "%s" %s)", path.c_str(), hash_type); - const auto ec_data = System::cmd_execute_and_capture_output(cmd_line); - Checks::check_exit( - VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", Strings::to_utf8(cmd_line)); - - std::string const& output = ec_data.output; - - const auto start = output.find_first_of("\r\n"); - Checks::check_exit(VCPKG_LINE_INFO, - start != std::string::npos, - "Unexpected output format from command: %s", - Strings::to_utf8(cmd_line)); - - const auto end = output.find_first_of("\r\n", start + 1); - Checks::check_exit(VCPKG_LINE_INFO, - end != std::string::npos, - "Unexpected output format from command: %s", - Strings::to_utf8(cmd_line)); - - auto hash = output.substr(start, end - start); - Util::erase_remove_if(hash, isspace); - System::println(hash); - } - - void perform_and_exit(const VcpkgCmdArguments& args) - { - static const std::string EXAMPLE = - Strings::format("The argument should be a file path\n%s", - Commands::Help::create_example_string("hash boost_1_62_0.tar.bz2")); - args.check_min_arg_count(1, EXAMPLE); - args.check_max_arg_count(2, EXAMPLE); - args.check_and_get_optional_command_arguments({}); - - if (args.command_arguments.size() == 1) - { - do_file_hash(args.command_arguments[0], L"SHA512"); - } - if (args.command_arguments.size() == 2) - { - do_file_hash(args.command_arguments[0], Strings::to_utf16(args.command_arguments[1])); - } - - Checks::exit_success(VCPKG_LINE_INFO); - } -} diff --git a/toolsrc/src/tests_arguments.cpp b/toolsrc/src/tests.arguments.cpp index 14b3c3d4f..25bf0f085 100644 --- a/toolsrc/src/tests_arguments.cpp +++ b/toolsrc/src/tests.arguments.cpp @@ -1,5 +1,5 @@ -#include "CppUnitTest.h"
-#include "VcpkgCmdArguments.h"
+#include <CppUnitTest.h>
+#include <vcpkg/vcpkgcmdarguments.h>
#pragma comment(lib, "version")
#pragma comment(lib, "winhttp")
diff --git a/toolsrc/src/tests_dependencies.cpp b/toolsrc/src/tests.dependencies.cpp index 6a6981d73..3f6e0dd10 100644 --- a/toolsrc/src/tests_dependencies.cpp +++ b/toolsrc/src/tests.dependencies.cpp @@ -1,6 +1,6 @@ -#include "CppUnitTest.h" -#include "SourceParagraph.h" -#include "Triplet.h" +#include <CppUnitTest.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/triplet.h> #pragma comment(lib, "version") #pragma comment(lib, "winhttp") diff --git a/toolsrc/src/test_install_plan.cpp b/toolsrc/src/tests.installplan.cpp index 6c9311264..120009db5 100644 --- a/toolsrc/src/test_install_plan.cpp +++ b/toolsrc/src/tests.installplan.cpp @@ -1,6 +1,7 @@ -#include "CppUnitTest.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Util.h" +#include <CppUnitTest.h> +#include <vcpkg/dependencies.h> + +#include <vcpkg/base/util.h> using namespace Microsoft::VisualStudio::CppUnitTestFramework; diff --git a/toolsrc/src/tests_package_spec.cpp b/toolsrc/src/tests.packagespec.cpp index a6b9d5b13..cb5c41af0 100644 --- a/toolsrc/src/tests_package_spec.cpp +++ b/toolsrc/src/tests.packagespec.cpp @@ -1,7 +1,8 @@ -#include "BinaryParagraph.h" -#include "CppUnitTest.h" -#include "Paragraphs.h" -#include "vcpkg_Strings.h" +#include <CppUnitTest.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/paragraphs.h> + +#include <vcpkg/base/strings.h> #pragma comment(lib, "version") #pragma comment(lib, "winhttp") diff --git a/toolsrc/src/tests_paragraph.cpp b/toolsrc/src/tests.paragraph.cpp index 47a07e12d..d9301abd0 100644 --- a/toolsrc/src/tests_paragraph.cpp +++ b/toolsrc/src/tests.paragraph.cpp @@ -1,7 +1,8 @@ -#include "BinaryParagraph.h" -#include "CppUnitTest.h" -#include "Paragraphs.h" -#include "vcpkg_Strings.h" +#include <CppUnitTest.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/paragraphs.h> + +#include <vcpkg/base/strings.h> #pragma comment(lib, "version") #pragma comment(lib, "winhttp") diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 706c641fb..b4c2d0fe2 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -1,30 +1,40 @@ +#if defined(_WIN32) #define WIN32_LEAN_AND_MEAN #include <Windows.h> -#include "Paragraphs.h" -#include "metrics.h" -#include "vcpkg_Chrono.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_Input.h" -#include "vcpkg_Strings.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" #pragma warning(push) #pragma warning(disable : 4768) #include <Shlobj.h> #pragma warning(pop) +#else +#include <unistd.h> +#endif + +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> + #include <cassert> #include <fstream> #include <memory> +#pragma comment(lib, "ole32") +#pragma comment(lib, "shell32") + using namespace vcpkg; void invalid_command(const std::string& cmd) { System::println(System::Color::error, "invalid command: %s", cmd); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -33,13 +43,26 @@ static void inner(const VcpkgCmdArguments& args) Metrics::g_metrics.lock()->track_property("command", args.command); if (args.command.empty()) { - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } - if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_c())) + static const auto find_command = [&](auto&& commands) { + auto it = Util::find_if(commands, [&](auto&& commandc) { + return Strings::case_insensitive_ascii_equals(commandc.name, args.command); + }); + using std::end; + if (it != end(commands)) + { + return &*it; + } + else + return static_cast<decltype(&*it)>(nullptr); + }; + + if (const auto command_function = find_command(Commands::get_available_commands_type_c())) { - return command_function(args); + return command_function->function(args); } fs::path vcpkg_root_dir; @@ -49,15 +72,21 @@ static void inner(const VcpkgCmdArguments& args) } else { - const Optional<std::wstring> vcpkg_root_dir_env = System::get_environment_variable(L"VCPKG_ROOT"); + const auto vcpkg_root_dir_env = System::get_environment_variable("VCPKG_ROOT"); if (const auto v = vcpkg_root_dir_env.get()) { vcpkg_root_dir = fs::stdfs::absolute(*v); } else { - vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up( - fs::stdfs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); + const fs::path current_path = fs::stdfs::current_path(); + vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up(current_path, ".vcpkg-root"); + + if (vcpkg_root_dir.empty()) + { + vcpkg_root_dir = Files::get_real_filesystem().find_file_recursively_up( + fs::stdfs::absolute(System::get_exe_path_of_current_process()), ".vcpkg-root"); + } } } @@ -70,13 +99,22 @@ static void inner(const VcpkgCmdArguments& args) vcpkg_root_dir.string(), expected_paths.error().message()); const VcpkgPaths paths = expected_paths.value_or_exit(VCPKG_LINE_INFO); + +#if defined(_WIN32) const int exit_code = _wchdir(paths.root.c_str()); +#else + const int exit_code = chdir(paths.root.c_str()); +#endif Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Changing the working dir failed"); - Commands::Version::warn_if_vcpkg_version_mismatch(paths); - if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_b())) + if (args.command != "autocomplete") + { + Commands::Version::warn_if_vcpkg_version_mismatch(paths); + } + + if (const auto command_function = find_command(Commands::get_available_commands_type_b())) { - return command_function(args, paths); + return command_function->function(args, paths); } Triplet default_triplet; @@ -86,11 +124,10 @@ static void inner(const VcpkgCmdArguments& args) } else { - const Optional<std::wstring> vcpkg_default_triplet_env = - System::get_environment_variable(L"VCPKG_DEFAULT_TRIPLET"); + const auto vcpkg_default_triplet_env = System::get_environment_variable("VCPKG_DEFAULT_TRIPLET"); if (const auto v = vcpkg_default_triplet_env.get()) { - default_triplet = Triplet::from_canonical_name(Strings::to_utf8(*v)); + default_triplet = Triplet::from_canonical_name(*v); } else { @@ -100,9 +137,9 @@ static void inner(const VcpkgCmdArguments& args) Input::check_triplet(default_triplet, paths); - if (const auto command_function = Commands::find(args.command, Commands::get_available_commands_type_a())) + if (const auto command_function = find_command(Commands::get_available_commands_type_a())) { - return command_function(args, paths, default_triplet); + return command_function->function(args, paths, default_triplet); } return invalid_command(args.command); @@ -110,6 +147,7 @@ static void inner(const VcpkgCmdArguments& args) static void load_config() { +#if defined(_WIN32) fs::path localappdata; { // Config path in AppDataLocal @@ -169,6 +207,7 @@ static void load_config() catch (...) { } +#endif } static std::string trim_path_from_command_line(const std::string& full_command_line) @@ -192,24 +231,32 @@ static std::string trim_path_from_command_line(const std::string& full_command_l return std::string(it, full_command_line.cend()); } +#if defined(_WIN32) int wmain(const int argc, const wchar_t* const* const argv) +#else +int main(const int argc, const char* const* const argv) +#endif { if (argc == 0) std::abort(); + *GlobalState::timer.lock() = Chrono::ElapsedTime::create_started(); + +#if defined(_WIN32) GlobalState::g_init_console_cp = GetConsoleCP(); GlobalState::g_init_console_output_cp = GetConsoleOutputCP(); SetConsoleCP(65001); SetConsoleOutputCP(65001); - *GlobalState::timer.lock() = ElapsedTime::create_started(); - const std::string trimmed_command_line = trim_path_from_command_line(Strings::to_utf8(GetCommandLineW())); +#endif { auto locked_metrics = Metrics::g_metrics.lock(); locked_metrics->track_property("version", Commands::Version::version()); +#if defined(_WIN32) locked_metrics->track_property("cmdline", trimmed_command_line); +#endif } load_config(); Metrics::g_metrics.lock()->track_property("sqmuser", Metrics::get_SQM_user()); @@ -258,6 +305,12 @@ int wmain(const int argc, const wchar_t* const* const argv) exc_msg); fflush(stdout); for (int x = 0; x < argc; ++x) + { +#if defined(_WIN32) System::println("%s|", Strings::to_utf8(argv[x])); +#else + System::println("%s|", argv[x]); +#endif + } fflush(stdout); } diff --git a/toolsrc/src/vcpkg_Checks.cpp b/toolsrc/src/vcpkg/base/checks.cpp index e7c9046a4..ed28d6e2b 100644 --- a/toolsrc/src/vcpkg_Checks.cpp +++ b/toolsrc/src/vcpkg/base/checks.cpp @@ -1,10 +1,10 @@ #include "pch.h" -#include "metrics.h" -#include "vcpkg_Checks.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/globalstate.h> +#include <vcpkg/metrics.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/system.h> namespace vcpkg::Checks { @@ -17,14 +17,21 @@ namespace vcpkg::Checks GlobalState::debugging = false; metrics->flush(); +#if defined(_WIN32) SetConsoleCP(GlobalState::g_init_console_cp); SetConsoleOutputCP(GlobalState::g_init_console_output_cp); +#endif fflush(nullptr); +#if defined(_WIN32) ::TerminateProcess(::GetCurrentProcess(), exit_code); +#else + ::exit(exit_code); +#endif } +#if defined(_WIN32) static BOOL ctrl_handler(DWORD fdw_ctrl_type) { { @@ -39,6 +46,9 @@ namespace vcpkg::Checks { SetConsoleCtrlHandler(reinterpret_cast<PHANDLER_ROUTINE>(ctrl_handler), TRUE); } +#else + void register_console_ctrl_handler() {} +#endif [[noreturn]] void unreachable(const LineInfo& line_info) { @@ -67,7 +77,7 @@ namespace vcpkg::Checks { if (!expression) { - exit_with_message(line_info, Strings::EMPTY); + exit_with_message(line_info, ""); } } diff --git a/toolsrc/src/vcpkg_Chrono.cpp b/toolsrc/src/vcpkg/base/chrono.cpp index d96f30987..5d28909fc 100644 --- a/toolsrc/src/vcpkg_Chrono.cpp +++ b/toolsrc/src/vcpkg/base/chrono.cpp @@ -1,9 +1,9 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Chrono.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/chrono.h> -namespace vcpkg +namespace vcpkg::Chrono { static std::string format_time_userfriendly(const std::chrono::nanoseconds& nanos) { diff --git a/toolsrc/src/coff_file_reader.cpp b/toolsrc/src/vcpkg/base/cofffilereader.cpp index bb3a6cefd..1927e0b5e 100644 --- a/toolsrc/src/coff_file_reader.cpp +++ b/toolsrc/src/vcpkg/base/cofffilereader.cpp @@ -1,12 +1,13 @@ #include "pch.h" -#include "coff_file_reader.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/cofffilereader.h> using namespace std; namespace vcpkg::CoffFileReader { +#if defined(_WIN32) template<class T> static T reinterpret_bytes(const char* data) { @@ -24,7 +25,7 @@ namespace vcpkg::CoffFileReader template<class T> static T peek_value_from_stream(fstream& fs) { - const fpos_t original_pos = fs.tellg().seekpos(); + const std::streampos original_pos = fs.tellg(); T data; fs.read(reinterpret_cast<char*>(&data), sizeof data); fs.seekg(original_pos); @@ -305,4 +306,8 @@ namespace vcpkg::CoffFileReader return {std::vector<MachineType>(machine_types.cbegin(), machine_types.cend())}; } +#else + DllInfo read_dll(const fs::path& path) { exit(-1); } + LibInfo read_lib(const fs::path& path) { exit(-1); } +#endif } diff --git a/toolsrc/src/vcpkg_Enums.cpp b/toolsrc/src/vcpkg/base/enums.cpp index 51ba9d5dc..aa124f3aa 100644 --- a/toolsrc/src/vcpkg_Enums.cpp +++ b/toolsrc/src/vcpkg/base/enums.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Enums.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/enums.h> namespace vcpkg::Enums { diff --git a/toolsrc/src/vcpkg_Files.cpp b/toolsrc/src/vcpkg/base/files.cpp index ad1fcebc6..6e43debb1 100644 --- a/toolsrc/src/vcpkg_Files.cpp +++ b/toolsrc/src/vcpkg/base/files.cpp @@ -1,9 +1,8 @@ #include "pch.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include <thread> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> namespace vcpkg::Files { @@ -164,7 +163,12 @@ namespace vcpkg::Files virtual void write_contents(const fs::path& file_path, const std::string& data) override { FILE* f = nullptr; +#if defined(_WIN32) auto ec = _wfopen_s(&f, file_path.native().c_str(), L"wb"); +#else + f = fopen(file_path.native().c_str(), "wb"); + int ec = f != nullptr ? 0 : 1; +#endif Checks::check_exit( VCPKG_LINE_INFO, ec == 0, "Error: Could not open file for writing: %s", file_path.u8string().c_str()); auto count = fwrite(data.data(), sizeof(data[0]), data.size(), f); @@ -195,9 +199,13 @@ namespace vcpkg::Files System::println(); } - std::vector<fs::path> find_from_PATH(const std::wstring& name) + std::vector<fs::path> find_from_PATH(const std::string& name) { - const std::wstring cmd = Strings::wformat(L"where.exe %s", name); +#if defined(_WIN32) + const std::string cmd = Strings::format("where.exe %s", name); +#else + const std::string cmd = Strings::format("which %s", name); +#endif auto out = System::cmd_execute_and_capture_output(cmd); if (out.exit_code != 0) { diff --git a/toolsrc/src/LineInfo.cpp b/toolsrc/src/vcpkg/base/lineinfo.cpp index d1bf9a4b1..7435ed666 100644 --- a/toolsrc/src/LineInfo.cpp +++ b/toolsrc/src/vcpkg/base/lineinfo.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "LineInfo.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/lineinfo.h> +#include <vcpkg/base/strings.h> namespace vcpkg { diff --git a/toolsrc/src/MachineType.cpp b/toolsrc/src/vcpkg/base/machinetype.cpp index af6378c88..2b7bd5e3a 100644 --- a/toolsrc/src/MachineType.cpp +++ b/toolsrc/src/vcpkg/base/machinetype.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "MachineType.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/machinetype.h> namespace vcpkg { diff --git a/toolsrc/src/vcpkg_Strings.cpp b/toolsrc/src/vcpkg/base/strings.cpp index bbe6b29cd..af41eed9a 100644 --- a/toolsrc/src/vcpkg_Strings.cpp +++ b/toolsrc/src/vcpkg/base/strings.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Strings.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/util.h> namespace vcpkg::Strings::details { @@ -37,31 +37,8 @@ namespace vcpkg::Strings::details #if defined(_WIN32) _vsnprintf_s_l(&output.at(0), output.size() + 1, output.size(), fmtstr, c_locale(), args); #else - vsnprintf(&output.at(0), output.size() + 1, fmtstr, args); -#endif - va_end(args); - - return output; - } - - std::wstring wformat_internal(const wchar_t* fmtstr, ...) - { - va_list args; va_start(args, fmtstr); - -#if defined(_WIN32) - const int sz = _vscwprintf_l(fmtstr, c_locale(), args); -#else - const int sz = vswprintf(nullptr, 0, fmtstr, args); -#endif - Checks::check_exit(VCPKG_LINE_INFO, sz > 0); - - std::wstring output(sz, L'\0'); - -#if defined(_WIN32) - _vsnwprintf_s_l(&output.at(0), output.size() + 1, output.size(), fmtstr, c_locale(), args); -#else - vswprintf(&output.at(0), output.size() + 1, fmtstr, args); + auto res = vsnprintf(&output.at(0), output.size() + 1, fmtstr, args); #endif va_end(args); @@ -71,22 +48,30 @@ namespace vcpkg::Strings::details namespace vcpkg::Strings { - std::wstring to_utf16(const CStringView s) + std::wstring to_utf16(const CStringView& s) { +#if defined(_WIN32) const int size = MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, nullptr, 0); std::wstring output; output.resize(size - 1); MultiByteToWideChar(CP_UTF8, 0, s.c_str(), -1, output.data(), size - 1); return output; +#else + Checks::unreachable(VCPKG_LINE_INFO); +#endif } - std::string to_utf8(const CWStringView w) + std::string to_utf8(const CWStringView& w) { +#if defined(_WIN32) const int size = WideCharToMultiByte(CP_UTF8, 0, w.c_str(), -1, nullptr, 0, nullptr, nullptr); std::string output; output.resize(size - 1); WideCharToMultiByte(CP_UTF8, 0, w.c_str(), -1, output.data(), size - 1, nullptr, nullptr); return output; +#else + Checks::unreachable(VCPKG_LINE_INFO); +#endif } std::string::const_iterator case_insensitive_ascii_find(const std::string& s, const std::string& pattern) @@ -104,9 +89,13 @@ namespace vcpkg::Strings return case_insensitive_ascii_find(s, pattern) != s.end(); } - int case_insensitive_ascii_compare(const CStringView left, const CStringView right) + bool case_insensitive_ascii_equals(const CStringView left, const CStringView right) { - return _stricmp(left.c_str(), right.c_str()); +#if defined(_WIN32) + return _stricmp(left.c_str(), right.c_str()) == 0; +#else + return strcasecmp(left.c_str(), right.c_str()) == 0; +#endif } std::string ascii_to_lowercase(const std::string& input) @@ -118,7 +107,11 @@ namespace vcpkg::Strings bool case_insensitive_ascii_starts_with(const std::string& s, const std::string& pattern) { +#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 } void trim(std::string* s) diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg/base/system.cpp index 3b4c440d8..b04f79414 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg/base/system.cpp @@ -1,9 +1,12 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/system.h> +#include <vcpkg/globalstate.h> + +#include <time.h> + +#pragma comment(lib, "Advapi32") namespace vcpkg::System { @@ -12,35 +15,46 @@ namespace vcpkg::System using std::chrono::system_clock; std::time_t now_time = system_clock::to_time_t(system_clock::now()); tm parts; +#if defined(_WIN32) localtime_s(&parts, &now_time); +#else + parts = *localtime(&now_time); +#endif return parts; } fs::path get_exe_path_of_current_process() { +#if defined(_WIN32) wchar_t buf[_MAX_PATH]; const int bytes = GetModuleFileNameW(nullptr, buf, _MAX_PATH); if (bytes == 0) std::abort(); return fs::path(buf, buf + bytes); +#else + std::array<char, 1024 * 4> buf; + auto written = readlink("/proc/self/exe", buf.data(), buf.size()); + Checks::check_exit(VCPKG_LINE_INFO, written != -1, "Could not determine current executable path."); + return fs::path(buf.data(), buf.data() + written); +#endif } - Optional<CPUArchitecture> to_cpu_architecture(CStringView arch) + Optional<CPUArchitecture> to_cpu_architecture(const CStringView& arch) { - if (Strings::case_insensitive_ascii_compare(arch, "x86") == 0) return CPUArchitecture::X86; - if (Strings::case_insensitive_ascii_compare(arch, "x64") == 0) return CPUArchitecture::X64; - if (Strings::case_insensitive_ascii_compare(arch, "amd64") == 0) return CPUArchitecture::X64; - if (Strings::case_insensitive_ascii_compare(arch, "arm") == 0) return CPUArchitecture::ARM; - if (Strings::case_insensitive_ascii_compare(arch, "arm64") == 0) return CPUArchitecture::ARM64; + if (Strings::case_insensitive_ascii_equals(arch, "x86")) return CPUArchitecture::X86; + if (Strings::case_insensitive_ascii_equals(arch, "x64")) return CPUArchitecture::X64; + if (Strings::case_insensitive_ascii_equals(arch, "amd64")) return CPUArchitecture::X64; + if (Strings::case_insensitive_ascii_equals(arch, "arm")) return CPUArchitecture::ARM; + if (Strings::case_insensitive_ascii_equals(arch, "arm64")) return CPUArchitecture::ARM64; return nullopt; } CPUArchitecture get_host_processor() { - auto w6432 = get_environment_variable(L"PROCESSOR_ARCHITEW6432"); - if (const auto p = w6432.get()) return to_cpu_architecture(Strings::to_utf8(*p)).value_or_exit(VCPKG_LINE_INFO); + auto w6432 = get_environment_variable("PROCESSOR_ARCHITEW6432"); + if (const auto p = w6432.get()) return to_cpu_architecture(*p).value_or_exit(VCPKG_LINE_INFO); - const auto procarch = get_environment_variable(L"PROCESSOR_ARCHITECTURE").value_or_exit(VCPKG_LINE_INFO); - return to_cpu_architecture(Strings::to_utf8(procarch)).value_or_exit(VCPKG_LINE_INFO); + const auto procarch = get_environment_variable("PROCESSOR_ARCHITECTURE").value_or_exit(VCPKG_LINE_INFO); + return to_cpu_architecture(procarch).value_or_exit(VCPKG_LINE_INFO); } std::vector<CPUArchitecture> get_supported_host_architectures() @@ -57,12 +71,13 @@ namespace vcpkg::System return supported_architectures; } - int cmd_execute_clean(const CWStringView cmd_line) + int cmd_execute_clean(const CStringView cmd_line) { - static const std::wstring SYSTEM_ROOT = get_environment_variable(L"SystemRoot").value_or_exit(VCPKG_LINE_INFO); - static const std::wstring SYSTEM_32 = SYSTEM_ROOT + LR"(\system32)"; - static const std::wstring NEW_PATH = Strings::wformat( - LR"(Path=%s;%s;%s\Wbem;%s\WindowsPowerShell\v1.0\)", SYSTEM_32, SYSTEM_ROOT, SYSTEM_32, SYSTEM_32); +#if defined(_WIN32) + static const std::string SYSTEM_ROOT = get_environment_variable("SystemRoot").value_or_exit(VCPKG_LINE_INFO); + static const std::string SYSTEM_32 = SYSTEM_ROOT + R"(\system32)"; + static const std::string NEW_PATH = Strings::format( + R"(Path=%s;%s;%s\Wbem;%s\WindowsPowerShell\v1.0\)", SYSTEM_32, SYSTEM_ROOT, SYSTEM_32, SYSTEM_32); std::vector<std::wstring> env_wstrings = { L"ALLUSERSPROFILE", @@ -106,6 +121,8 @@ namespace vcpkg::System L"HTTPS_PROXY", // Enables find_package(CUDA) in CMake L"CUDA_PATH", + // Environmental variable generated automatically by CUDA after installation + L"NVCUDASAMPLES_ROOT", }; // Flush stdout before launching external process @@ -115,17 +132,17 @@ namespace vcpkg::System for (auto&& env_wstring : env_wstrings) { - const Optional<std::wstring> value = System::get_environment_variable(env_wstring); + const Optional<std::string> value = System::get_environment_variable(Strings::to_utf8(env_wstring)); const auto v = value.get(); if (!v || v->empty()) continue; env_cstr.append(env_wstring); env_cstr.push_back(L'='); - env_cstr.append(*v); + env_cstr.append(Strings::to_utf16(*v)); env_cstr.push_back(L'\0'); } - env_cstr.append(NEW_PATH); + env_cstr.append(Strings::to_utf16(NEW_PATH)); env_cstr.push_back(L'\0'); STARTUPINFOW startup_info; @@ -136,10 +153,10 @@ namespace vcpkg::System memset(&process_info, 0, sizeof(PROCESS_INFORMATION)); // Basically we are wrapping it in quotes - std::wstring actual_cmd_line = Strings::wformat(LR"###(cmd.exe /c "%s")###", cmd_line); - Debug::println("CreateProcessW(%s)", Strings::to_utf8(actual_cmd_line)); + const std::string actual_cmd_line = Strings::format(R"###(cmd.exe /c "%s")###", cmd_line); + Debug::println("CreateProcessW(%s)", actual_cmd_line); bool succeeded = TRUE == CreateProcessW(nullptr, - actual_cmd_line.data(), + Strings::to_utf16(actual_cmd_line).data(), nullptr, nullptr, FALSE, @@ -161,18 +178,28 @@ namespace vcpkg::System Debug::println("CreateProcessW() returned %lu", exit_code); return static_cast<int>(exit_code); +#else + fflush(nullptr); + return system(cmd_line.c_str()); +#endif } - int cmd_execute(const CWStringView cmd_line) + int cmd_execute(const CStringView cmd_line) { // Flush stdout before launching external process fflush(nullptr); // Basically we are wrapping it in quotes - const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s")###", cmd_line); - Debug::println("_wsystem(%s)", Strings::to_utf8(actual_cmd_line)); - const int exit_code = _wsystem(actual_cmd_line.c_str()); + const std::string& actual_cmd_line = Strings::format(R"###("%s")###", cmd_line); +#if defined(_WIN32) + Debug::println("_wsystem(%s)", actual_cmd_line); + const int exit_code = _wsystem(Strings::to_utf16(actual_cmd_line).c_str()); Debug::println("_wsystem() returned %d", exit_code); +#else + Debug::println("_system(%s)", actual_cmd_line); + const int exit_code = system(actual_cmd_line.c_str()); + Debug::println("_system() returned %d", exit_code); +#endif return exit_code; } @@ -187,17 +214,18 @@ namespace vcpkg::System } } - ExitCodeAndOutput cmd_execute_and_capture_output(const CWStringView cmd_line) + ExitCodeAndOutput cmd_execute_and_capture_output(const CStringView cmd_line) { // Flush stdout before launching external process fflush(stdout); - const std::wstring& actual_cmd_line = Strings::wformat(LR"###("%s 2>&1")###", cmd_line); +#if defined(_WIN32) + const auto actual_cmd_line = Strings::format(R"###("%s 2>&1")###", cmd_line); - Debug::println("_wpopen(%s)", Strings::to_utf8(actual_cmd_line)); + Debug::println("_wpopen(%s)", actual_cmd_line); std::wstring output; wchar_t buf[1024]; - const auto pipe = _wpopen(actual_cmd_line.c_str(), L"r"); + const auto pipe = _wpopen(Strings::to_utf16(actual_cmd_line).c_str(), L"r"); if (pipe == nullptr) { return {1, Strings::to_utf8(output)}; @@ -215,27 +243,52 @@ namespace vcpkg::System Debug::println("_pclose() returned %d", ec); remove_byte_order_marks(&output); return {ec, Strings::to_utf8(output)}; +#else + const auto actual_cmd_line = Strings::format(R"###(%s 2>&1)###", cmd_line); + + Debug::println("popen(%s)", actual_cmd_line); + std::string output; + char buf[1024]; + const auto pipe = popen(actual_cmd_line.c_str(), "r"); + if (pipe == nullptr) + { + return {1, output}; + } + while (fgets(buf, 1024, pipe)) + { + output.append(buf); + } + if (!feof(pipe)) + { + return {1, output}; + } + + const auto ec = pclose(pipe); + Debug::println("pclose() returned %d", ec); + return {ec, output}; +#endif } - std::wstring create_powershell_script_cmd(const fs::path& script_path, const CWStringView args) + std::string create_powershell_script_cmd(const fs::path& script_path, const CStringView args) { // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - return Strings::wformat( - LR"(powershell -NoProfile -ExecutionPolicy Bypass -Command "& {& '%s' %s}")", script_path.native(), args); + return Strings::format( + R"(powershell -NoProfile -ExecutionPolicy Bypass -Command "& {& '%s' %s}")", script_path.u8string(), args); } - void println() { println(Strings::EMPTY); } + void println() { putchar('\n'); } void print(const CStringView message) { fputs(message.c_str(), stdout); } void println(const CStringView message) { print(message); - putchar('\n'); + 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{}; @@ -245,67 +298,90 @@ namespace vcpkg::System 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); - putchar('\n'); + println(); } - Optional<std::wstring> get_environment_variable(const CWStringView varname) noexcept + Optional<std::string> get_environment_variable(const CStringView varname) noexcept { - const auto sz = GetEnvironmentVariableW(varname.c_str(), nullptr, 0); +#if defined(_WIN32) + const auto w_varname = Strings::to_utf16(varname); + const auto sz = GetEnvironmentVariableW(w_varname.c_str(), nullptr, 0); if (sz == 0) return nullopt; std::wstring ret(sz, L'\0'); Checks::check_exit(VCPKG_LINE_INFO, MAXDWORD >= ret.size()); - const auto sz2 = GetEnvironmentVariableW(varname.c_str(), ret.data(), static_cast<DWORD>(ret.size())); + const auto sz2 = GetEnvironmentVariableW(w_varname.c_str(), ret.data(), static_cast<DWORD>(ret.size())); Checks::check_exit(VCPKG_LINE_INFO, sz2 + 1 == sz); ret.pop_back(); - return ret; + return Strings::to_utf8(ret); +#else + auto v = getenv(varname.c_str()); + if (!v) return nullopt; + return std::string(v); +#endif } - static bool is_string_keytype(DWORD hkey_type) +#if defined(_WIN32) + static bool is_string_keytype(const DWORD hkey_type) { return hkey_type == REG_SZ || hkey_type == REG_MULTI_SZ || hkey_type == REG_EXPAND_SZ; } - Optional<std::wstring> get_registry_string(HKEY base, const CWStringView sub_key, const CWStringView valuename) + Optional<std::string> get_registry_string(void* base_hkey, const CStringView sub_key, const CStringView valuename) { HKEY k = nullptr; - const LSTATUS ec = RegOpenKeyExW(base, sub_key.c_str(), NULL, KEY_READ, &k); + 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; DWORD dw_buffer_size = 0; DWORD dw_type = 0; - auto rc = RegQueryValueExW(k, valuename.c_str(), nullptr, &dw_type, nullptr, &dw_buffer_size); + auto rc = + RegQueryValueExW(k, Strings::to_utf16(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, valuename.c_str(), nullptr, &dw_type, reinterpret_cast<LPBYTE>(ret.data()), &dw_buffer_size); + rc = RegQueryValueExW(k, + Strings::to_utf16(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 ret; + return Strings::to_utf8(ret); + } +#else + Optional<std::string> get_registry_string(void* base_hkey, const CStringView sub_key, const CStringView valuename) + { + return nullopt; } +#endif static const fs::path& get_program_files() { - static const fs::path PATH = System::get_environment_variable(L"PROGRAMFILES").value_or_exit(VCPKG_LINE_INFO); + static const fs::path PATH = System::get_environment_variable("PROGRAMFILES").value_or_exit(VCPKG_LINE_INFO); return PATH; } const fs::path& get_program_files_32_bit() { static const fs::path PATH = []() -> fs::path { - auto value = System::get_environment_variable(L"ProgramFiles(x86)"); + auto value = System::get_environment_variable("ProgramFiles(x86)"); if (auto v = value.get()) { return std::move(*v); @@ -318,7 +394,7 @@ namespace vcpkg::System const fs::path& get_program_files_platform_bitness() { static const fs::path PATH = []() -> fs::path { - auto value = System::get_environment_variable(L"ProgramW6432"); + auto value = System::get_environment_variable("ProgramW6432"); if (auto v = value.get()) { return std::move(*v); diff --git a/toolsrc/src/BinaryParagraph.cpp b/toolsrc/src/vcpkg/binaryparagraph.cpp index 1504912ab..3a493eb4c 100644 --- a/toolsrc/src/BinaryParagraph.cpp +++ b/toolsrc/src/vcpkg/binaryparagraph.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "BinaryParagraph.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Parse.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/parse.h> namespace vcpkg { @@ -80,10 +80,10 @@ namespace vcpkg BinaryParagraph::BinaryParagraph(const SourceParagraph& spgh, const FeatureParagraph& fpgh, const Triplet& triplet) { this->spec = PackageSpec::from_name_and_triplet(spgh.name, triplet).value_or_exit(VCPKG_LINE_INFO); - this->version = Strings::EMPTY; + this->version = ""; this->feature = fpgh.name; this->description = fpgh.description; - this->maintainer = Strings::EMPTY; + this->maintainer = ""; this->depends = filter_dependencies(fpgh.depends, triplet); } diff --git a/toolsrc/src/vcpkg_Build.cpp b/toolsrc/src/vcpkg/build.cpp index 9be20629d..cf16c8f9c 100644 --- a/toolsrc/src/vcpkg_Build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -1,20 +1,150 @@ #include "pch.h" -#include "Paragraphs.h" -#include "PostBuildLint.h" -#include "metrics.h" -#include "vcpkg_Build.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Chrono.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Enums.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkg_optional.h" -#include "vcpkglib.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/enums.h> +#include <vcpkg/base/optional.h> +#include <vcpkg/base/system.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/postbuildlint.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkglib.h> + +using vcpkg::Build::BuildResult; +using vcpkg::Parse::ParseControlErrorInfo; +using vcpkg::Parse::ParseExpected; + +namespace vcpkg::Build::Command +{ + using Dependencies::InstallPlanAction; + using Dependencies::InstallPlanType; + + static const std::string OPTION_CHECKS_ONLY = "--checks-only"; + + void perform_and_exit(const FullPackageSpec& full_spec, + const fs::path& port_dir, + const std::unordered_set<std::string>& options, + const VcpkgPaths& paths) + { + const PackageSpec& spec = full_spec.package_spec; + if (options.find(OPTION_CHECKS_ONLY) != options.end()) + { + const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, spec.triplet()); + const auto build_info = Build::read_build_info(paths.get_filesystem(), paths.build_info_file_path(spec)); + const size_t error_count = PostBuildLint::perform_all_checks(spec, paths, pre_build_info, build_info); + Checks::check_exit(VCPKG_LINE_INFO, error_count == 0); + Checks::exit_success(VCPKG_LINE_INFO); + } + + const ParseExpected<SourceControlFile> source_control_file = + Paragraphs::try_load_port(paths.get_filesystem(), port_dir); + + if (!source_control_file.has_value()) + { + print_error_message(source_control_file.error()); + Checks::exit_fail(VCPKG_LINE_INFO); + } + + for (const std::string& str : full_spec.features) + { + System::println("%s \n", str); + } + const auto& scf = source_control_file.value_or_exit(VCPKG_LINE_INFO); + Checks::check_exit(VCPKG_LINE_INFO, + spec.name() == scf->core_paragraph->name, + "The Name: field inside the CONTROL does not match the port directory: '%s' != '%s'", + scf->core_paragraph->name, + spec.name()); + + const StatusParagraphs status_db = database_load_check(paths); + const Build::BuildPackageOptions build_package_options{Build::UseHeadVersion::NO, Build::AllowDownloads::YES}; + + const Build::BuildPackageConfig build_config{ + *scf->core_paragraph, spec.triplet(), paths.port_dir(spec), build_package_options}; + + const auto build_timer = Chrono::ElapsedTime::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()); + + 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(); + for (const auto& p : result.unmet_dependencies) + { + System::println(" %s", p); + } + System::println(); + Checks::exit_fail(VCPKG_LINE_INFO); + } + + 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)); + Checks::exit_fail(VCPKG_LINE_INFO); + } + + Checks::exit_success(VCPKG_LINE_INFO); + } + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + { + static const std::string EXAMPLE = Help::create_example_string("build zlib:x64-windows"); + // Build only takes a single package and all dependencies must already be installed + args.check_exact_arg_count(1, EXAMPLE); + const std::string command_argument = args.command_arguments.at(0); + const FullPackageSpec spec = Input::check_and_get_full_package_spec(command_argument, default_triplet, EXAMPLE); + Input::check_triplet(spec.package_spec.triplet(), paths); + const std::unordered_set<std::string> options = + args.check_and_get_optional_command_arguments({OPTION_CHECKS_ONLY}); + perform_and_exit(spec, paths.port_dir(spec.package_spec), options, paths); + } +} namespace vcpkg::Build { + static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; + static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; + static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; + static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; + static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; + + const std::string& to_string(BuildPolicy policy) + { + switch (policy) + { + case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE; + case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; + case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT; + case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; + case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } + + CStringView to_cmake_variable(BuildPolicy policy) + { + switch (policy) + { + case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE"; + case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; + case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT"; + case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER"; + case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; + default: Checks::unreachable(VCPKG_LINE_INFO); + } + } + Optional<LinkageType> to_linkage_type(const std::string& str) { if (str == "dynamic") return LinkageType::DYNAMIC; @@ -28,16 +158,16 @@ namespace vcpkg::Build static const std::string LIBRARY_LINKAGE = "LibraryLinkage"; } - CWStringView to_vcvarsall_target(const std::string& cmake_system_name) + CStringView to_vcvarsall_target(const std::string& cmake_system_name) { - if (cmake_system_name == Strings::EMPTY) return Strings::WEMPTY; - if (cmake_system_name == "Windows") return Strings::WEMPTY; - if (cmake_system_name == "WindowsStore") return L"store"; + if (cmake_system_name.empty()) return ""; + if (cmake_system_name == "Windows") return ""; + if (cmake_system_name == "WindowsStore") return "store"; Checks::exit_with_message(VCPKG_LINE_INFO, "Unsupported vcvarsall target %s", cmake_system_name); } - CWStringView to_vcvarsall_toolchain(const std::string& target_architecture, const Toolset& toolset) + CStringView to_vcvarsall_toolchain(const std::string& target_architecture, const Toolset& toolset) { auto maybe_target_arch = System::to_cpu_architecture(target_architecture); Checks::check_exit( @@ -56,23 +186,23 @@ namespace vcpkg::Build Checks::exit_with_message(VCPKG_LINE_INFO, "Unsupported toolchain combination %s", target_architecture); } - std::wstring make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset) + std::string make_build_env_cmd(const PreBuildInfo& pre_build_info, const Toolset& toolset) { - const wchar_t* tonull = L" >nul"; + const char* tonull = " >nul"; if (GlobalState::debugging) { - tonull = Strings::WEMPTY; + tonull = ""; } const auto arch = to_vcvarsall_toolchain(pre_build_info.target_architecture, toolset); const auto target = to_vcvarsall_target(pre_build_info.cmake_system_name); - return Strings::wformat(LR"("%s" %s %s %s %s 2>&1)", - toolset.vcvarsall.native(), - Strings::join(L" ", toolset.vcvarsall_options), - arch, - target, - tonull); + return Strings::format(R"("%s" %s %s %s %s 2>&1)", + toolset.vcvarsall.u8string(), + Strings::join(" ", toolset.vcvarsall_options), + arch, + target, + tonull); } static void create_binary_feature_control_file(const SourceParagraph& source_paragraph, @@ -138,8 +268,6 @@ namespace vcpkg::Build const fs::path ports_cmake_script_path = paths.ports_cmake; const auto pre_build_info = PreBuildInfo::from_triplet_file(paths, triplet); - const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset, pre_build_info.visual_studio_path); - const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset); std::string features; if (GlobalState::feature_packages) @@ -157,24 +285,28 @@ namespace vcpkg::Build } } - const std::wstring cmd_launch_cmake = make_cmake_cmd( + const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset, pre_build_info.visual_studio_path); + + const std::string cmd_launch_cmake = make_cmake_cmd( cmake_exe_path, ports_cmake_script_path, { - {L"CMD", L"BUILD"}, - {L"PORT", config.src.name}, - {L"CURRENT_PORT_DIR", config.port_dir / "/."}, - {L"TARGET_TRIPLET", triplet.canonical_name()}, - {L"VCPKG_PLATFORM_TOOLSET", toolset.version.c_str()}, - {L"VCPKG_USE_HEAD_VERSION", to_bool(config.build_package_options.use_head_version) ? L"1" : L"0"}, - {L"_VCPKG_NO_DOWNLOADS", !to_bool(config.build_package_options.allow_downloads) ? L"1" : L"0"}, - {L"GIT", git_exe_path}, - {L"FEATURES", features}, + {"CMD", "BUILD"}, + {"PORT", config.src.name}, + {"CURRENT_PORT_DIR", config.port_dir / "/."}, + {"TARGET_TRIPLET", triplet.canonical_name()}, + {"VCPKG_PLATFORM_TOOLSET", toolset.version.c_str()}, + {"VCPKG_USE_HEAD_VERSION", to_bool(config.build_package_options.use_head_version) ? "1" : "0"}, + {"_VCPKG_NO_DOWNLOADS", !to_bool(config.build_package_options.allow_downloads) ? "1" : "0"}, + {"GIT", git_exe_path}, + {"FEATURES", features}, }); - const std::wstring command = Strings::wformat(LR"(%s && %s)", cmd_set_environment, cmd_launch_cmake); + std::string command; + const auto cmd_set_environment = make_build_env_cmd(pre_build_info, toolset); + command = Strings::format(R"(%s && %s)", cmd_set_environment, cmd_launch_cmake); - const ElapsedTime timer = ElapsedTime::create_started(); + const auto timer = Chrono::ElapsedTime::create_started(); const int return_code = System::cmd_execute_clean(command); const auto buildtimeus = timer.microseconds(); @@ -334,14 +466,12 @@ namespace vcpkg::Build const fs::path ports_cmake_script_path = paths.scripts / "get_triplet_environment.cmake"; const fs::path triplet_file_path = paths.triplets / (triplet.canonical_name() + ".cmake"); - const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe_path, - ports_cmake_script_path, - { - {L"CMAKE_TRIPLET_FILE", triplet_file_path}, - }); - - const std::wstring command = Strings::wformat(LR"(%s)", cmd_launch_cmake); - const auto ec_data = System::cmd_execute_and_capture_output(command); + const auto cmd_launch_cmake = make_cmake_cmd(cmake_exe_path, + ports_cmake_script_path, + { + {"CMAKE_TRIPLET_FILE", triplet_file_path}, + }); + const auto ec_data = System::cmd_execute_and_capture_output(cmd_launch_cmake); Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0); const std::vector<std::string> lines = Strings::split(ec_data.output, "\n"); @@ -364,7 +494,7 @@ namespace vcpkg::Build const bool variable_with_no_value = s.size() == 1; const std::string variable_name = s.at(0); - const std::string variable_value = variable_with_no_value ? Strings::EMPTY : s.at(1); + const std::string variable_value = variable_with_no_value ? "" : s.at(1); if (variable_name == "VCPKG_TARGET_ARCHITECTURE") { diff --git a/toolsrc/src/vcpkg/commands.autocomplete.cpp b/toolsrc/src/vcpkg/commands.autocomplete.cpp new file mode 100644 index 000000000..addb9edaf --- /dev/null +++ b/toolsrc/src/vcpkg/commands.autocomplete.cpp @@ -0,0 +1,141 @@ +#include "pch.h" + +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/install.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/remove.h> +#include <vcpkg/vcpkglib.h> + +namespace vcpkg::Commands::Autocomplete +{ + [[noreturn]] static void output_sorted_results_and_exit(const LineInfo& line_info, + std::vector<std::string>&& results) + { + const SortedVector<std::string> sorted_results(results); + System::println(Strings::join("\n", sorted_results)); + + Checks::exit_success(line_info); + } + + std::vector<std::string> combine_port_with_triplets(const std::string& port, + const std::vector<std::string>& triplets) + { + return Util::fmap(triplets, + [&](const std::string& triplet) { return Strings::format("%s:%s", port, triplet); }); + } + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + { + Metrics::g_metrics.lock()->set_send_metrics(false); + const std::string to_autocomplete = Strings::join(" ", args.command_arguments); + const std::vector<std::string> tokens = Strings::split(to_autocomplete, " "); + + std::smatch match; + + // Handles vcpkg <command> + if (std::regex_match(to_autocomplete, match, std::regex{R"###(^(\S*)$)###"})) + { + const std::string requested_command = match[1].str(); + + std::vector<std::string> valid_commands = { + "install", + "search", + "remove", + "list", + "update", + "hash", + "help", + "integrate", + "export", + "edit", + "create", + "owns", + "cache", + "version", + "contact", + }; + + Util::unstable_keep_if(valid_commands, [&](const std::string& s) { + return Strings::case_insensitive_ascii_starts_with(s, requested_command); + }); + + output_sorted_results_and_exit(VCPKG_LINE_INFO, std::move(valid_commands)); + } + + // Handles vcpkg install package:<triplet> + if (std::regex_match(to_autocomplete, match, std::regex{R"###(^install(.*|)\s([^:]+):(\S*)$)###"})) + { + const auto port_name = match[2].str(); + const auto triplet_prefix = match[3].str(); + + auto maybe_port = Paragraphs::try_load_port(paths.get_filesystem(), paths.port_dir(port_name)); + if (maybe_port.error()) + { + Checks::exit_success(VCPKG_LINE_INFO); + } + + std::vector<std::string> triplets = paths.get_available_triplets(); + Util::unstable_keep_if(triplets, [&](const std::string& s) { + return Strings::case_insensitive_ascii_starts_with(s, triplet_prefix); + }); + + auto result = combine_port_with_triplets(port_name, triplets); + + output_sorted_results_and_exit(VCPKG_LINE_INFO, std::move(result)); + } + + struct CommandEntry + { + constexpr CommandEntry(const CStringView& name, const CStringView& regex, const CommandStructure& structure) + : name(name), regex(regex), structure(structure) + { + } + + CStringView name; + CStringView regex; + const CommandStructure& structure; + }; + + static constexpr CommandEntry COMMANDS[] = { + CommandEntry{"install", R"###(^install\s(.*\s|)(\S*)$)###", Install::COMMAND_STRUCTURE}, + CommandEntry{"install", R"###(^install\s(.*\s|)(\S*)$)###", Install::COMMAND_STRUCTURE}, + CommandEntry{"edit", R"###(^edit\s(.*\s|)(\S*)$)###", Edit::COMMAND_STRUCTURE}, + CommandEntry{"remove", R"###(^remove\s(.*\s|)(\S*)$)###", Remove::COMMAND_STRUCTURE}, + }; + + for (auto&& command : COMMANDS) + { + if (std::regex_match(to_autocomplete, match, std::regex{command.regex.c_str()})) + { + const auto prefix = match[2].str(); + std::vector<std::string> results; + + if (Strings::case_insensitive_ascii_starts_with(prefix, "-")) + { + results = Util::fmap(command.structure.switches, [](auto&& s) -> std::string { return s; }); + } + else + { + results = command.structure.valid_arguments(paths); + } + + Util::unstable_keep_if(results, [&](const std::string& s) { + return Strings::case_insensitive_ascii_starts_with(s, prefix); + }); + + if (command.name == "install" && results.size() == 1) + { + const auto port_at_each_triplet = + combine_port_with_triplets(results[0], paths.get_available_triplets()); + Util::Vectors::concatenate(&results, port_at_each_triplet); + } + + output_sorted_results_and_exit(VCPKG_LINE_INFO, std::move(results)); + } + } + + Checks::exit_success(VCPKG_LINE_INFO); + } +} diff --git a/toolsrc/src/commands_build_external.cpp b/toolsrc/src/vcpkg/commands.buildexternal.cpp index 7e85f2250..3991beb62 100644 --- a/toolsrc/src/commands_build_external.cpp +++ b/toolsrc/src/vcpkg/commands.buildexternal.cpp @@ -1,14 +1,16 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Input.h" +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> namespace vcpkg::Commands::BuildExternal { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { static const std::string EXAMPLE = - Commands::Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); + Help::create_example_string(R"(build_external zlib2 C:\path\to\dir\with\controlfile\)"); args.check_exact_arg_count(2, EXAMPLE); const FullPackageSpec spec = Input::check_and_get_full_package_spec(args.command_arguments.at(0), default_triplet, EXAMPLE); @@ -16,6 +18,6 @@ namespace vcpkg::Commands::BuildExternal const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({}); const fs::path port_dir = args.command_arguments.at(1); - BuildCommand::perform_and_exit(spec, port_dir, options, paths); + Build::Command::perform_and_exit(spec, port_dir, options, paths); } } diff --git a/toolsrc/src/commands_cache.cpp b/toolsrc/src/vcpkg/commands.cache.cpp index 5b65b197f..77f0a20f6 100644 --- a/toolsrc/src/commands_cache.cpp +++ b/toolsrc/src/vcpkg/commands.cache.cpp @@ -1,10 +1,11 @@ #include "pch.h" -#include "BinaryParagraph.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/binaryparagraph.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> namespace vcpkg::Commands::Cache { @@ -29,7 +30,7 @@ namespace vcpkg::Commands::Cache { static const std::string EXAMPLE = Strings::format( "The argument should be a substring to search for, or no argument to display all cached libraries.\n%s", - Commands::Help::create_example_string("cache png")); + Help::create_example_string("cache png")); args.check_max_arg_count(1, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_ci.cpp b/toolsrc/src/vcpkg/commands.ci.cpp index 75ff65556..1c98d1d83 100644 --- a/toolsrc/src/commands_ci.cpp +++ b/toolsrc/src/vcpkg/commands.ci.cpp @@ -1,15 +1,17 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Build.h" -#include "vcpkg_Chrono.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/chrono.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/install.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::CI { @@ -30,7 +32,7 @@ namespace vcpkg::Commands::CI void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { - static const std::string EXAMPLE = Commands::Help::create_example_string("ci x64-windows"); + static const std::string EXAMPLE = Help::create_example_string("ci x64-windows"); args.check_max_arg_count(1, EXAMPLE); const Triplet triplet = args.command_arguments.size() == 1 ? Triplet::from_canonical_name(args.command_arguments.at(0)) @@ -52,7 +54,7 @@ namespace vcpkg::Commands::CI return Dependencies::AnyAction(std::move(install_action)); }); - Install::perform_and_exit( + Install::perform_and_exit_ex( action_plan, install_plan_options, Install::KeepGoing::YES, Install::PrintSummary::YES, paths, status_db); Checks::exit_success(VCPKG_LINE_INFO); diff --git a/toolsrc/src/commands_contact.cpp b/toolsrc/src/vcpkg/commands.contact.cpp index 8374350ee..421b8a230 100644 --- a/toolsrc/src/commands_contact.cpp +++ b/toolsrc/src/vcpkg/commands.contact.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> namespace vcpkg::Commands::Contact { diff --git a/toolsrc/src/commands_available_commands.cpp b/toolsrc/src/vcpkg/commands.cpp index d3280e6d7..9d969ea28 100644 --- a/toolsrc/src/commands_available_commands.cpp +++ b/toolsrc/src/vcpkg/commands.cpp @@ -1,16 +1,22 @@ #include "pch.h" -#include "vcpkg_Commands.h" +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/export.h> +#include <vcpkg/help.h> +#include <vcpkg/install.h> +#include <vcpkg/remove.h> +#include <vcpkg/update.h> namespace vcpkg::Commands { - const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a() + Span<const PackageNameAndFunction<CommandTypeA>> get_available_commands_type_a() { static std::vector<PackageNameAndFunction<CommandTypeA>> t = { {"install", &Install::perform_and_exit}, {"ci", &CI::perform_and_exit}, {"remove", &Remove::perform_and_exit}, - {"build", &BuildCommand::perform_and_exit}, + {"build", &Build::Command::perform_and_exit}, {"env", &Env::perform_and_exit}, {"build-external", &BuildExternal::perform_and_exit}, {"export", &Export::perform_and_exit}, @@ -18,7 +24,7 @@ namespace vcpkg::Commands return t; } - const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b() + Span<const PackageNameAndFunction<CommandTypeB>> get_available_commands_type_b() { static std::vector<PackageNameAndFunction<CommandTypeB>> t = { {"/?", &Help::perform_and_exit}, @@ -38,7 +44,7 @@ namespace vcpkg::Commands return t; } - const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c() + Span<const PackageNameAndFunction<CommandTypeC>> get_available_commands_type_c() { static std::vector<PackageNameAndFunction<CommandTypeC>> t = { {"version", &Version::perform_and_exit}, diff --git a/toolsrc/src/commands_create.cpp b/toolsrc/src/vcpkg/commands.create.cpp index 6898f7399..85763f25e 100644 --- a/toolsrc/src/commands_create.cpp +++ b/toolsrc/src/vcpkg/commands.create.cpp @@ -1,15 +1,16 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::Create { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = Commands::Help::create_example_string( + static const std::string EXAMPLE = Help::create_example_string( R"###(create zlib2 http://zlib.net/zlib1211.zip "zlib1211-2.zip")###"); args.check_max_arg_count(3, EXAMPLE); args.check_min_arg_count(2, EXAMPLE); @@ -19,7 +20,7 @@ namespace vcpkg::Commands::Create const fs::path& cmake_exe = paths.get_cmake_exe(); - std::vector<CMakeVariable> cmake_args{{L"CMD", L"CREATE"}, {L"PORT", port_name}, {L"URL", url}}; + std::vector<CMakeVariable> cmake_args{{"CMD", "CREATE"}, {"PORT", port_name}, {"URL", url}}; if (args.command_arguments.size() >= 3) { @@ -29,10 +30,10 @@ namespace vcpkg::Commands::Create R"(Filename cannot contain invalid chars %s, but was %s)", Files::FILESYSTEM_INVALID_CHARACTERS, zip_file_name); - cmake_args.push_back({L"FILENAME", zip_file_name}); + cmake_args.push_back({"FILENAME", zip_file_name}); } - const std::wstring cmd_launch_cmake = make_cmake_cmd(cmake_exe, paths.ports_cmake, cmake_args); + const std::string cmd_launch_cmake = make_cmake_cmd(cmake_exe, paths.ports_cmake, cmake_args); Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute_clean(cmd_launch_cmake)); } } diff --git a/toolsrc/src/commands_depends.cpp b/toolsrc/src/vcpkg/commands.dependinfo.cpp index 17cd9c881..89c7e0c7f 100644 --- a/toolsrc/src/commands_depends.cpp +++ b/toolsrc/src/vcpkg/commands.dependinfo.cpp @@ -1,16 +1,17 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Strings.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/strings.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> namespace vcpkg::Commands::DependInfo { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = Commands::Help::create_example_string(R"###(depend-info [pat])###"); + static const std::string EXAMPLE = Help::create_example_string(R"###(depend-info [pat])###"); args.check_max_arg_count(1, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp index 823c87534..668ec9b1a 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/vcpkg/commands.edit.cpp @@ -1,24 +1,26 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> namespace vcpkg::Commands::Edit { static std::vector<fs::path> find_from_registry() { - static const std::array<const wchar_t*, 3> REGKEYS = { - LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1)", - LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", + static const std::array<const char*, 3> REGKEYS = { + R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", + R"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1)", + R"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", }; std::vector<fs::path> output; +#if defined(_WIN32) for (auto&& keypath : REGKEYS) { - const Optional<std::wstring> code_installpath = - System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation"); + const Optional<std::string> code_installpath = + System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, "InstallLocation"); if (const auto c = code_installpath.get()) { const fs::path install_path = fs::path(*c); @@ -26,19 +28,42 @@ namespace vcpkg::Commands::Edit output.push_back(install_path / "Code.exe"); } } +#endif return output; } - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + static const std::string OPTION_BUILDTREES = "--buildtrees"; + + static const std::array<std::string, 1> SWITCHES = { + OPTION_BUILDTREES, + }; + static const std::array<std::string, 0> SETTINGS; + + static std::vector<std::string> valid_arguments(const VcpkgPaths& paths) { - static const std::string OPTION_BUILDTREES = "--buildtrees"; + auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); + + return Util::fmap(sources_and_errors.paragraphs, + [](auto&& pgh) -> std::string { return pgh->core_paragraph->name; }); + } + + const CommandStructure COMMAND_STRUCTURE = { + "edit zlib", + 1, + 1, + SWITCHES, + SETTINGS, + &valid_arguments, + }; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) + { static const fs::path VS_CODE_INSIDERS = fs::path{"Microsoft VS Code Insiders"} / "Code - Insiders.exe"; static const fs::path VS_CODE = fs::path{"Microsoft VS Code"} / "Code.exe"; auto& fs = paths.get_filesystem(); - static const std::string EXAMPLE = Commands::Help::create_example_string("edit zlib"); + static const std::string EXAMPLE = Help::create_example_string("edit zlib"); args.check_exact_arg_count(1, EXAMPLE); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_BUILDTREES}); @@ -48,7 +73,7 @@ namespace vcpkg::Commands::Edit Checks::check_exit(VCPKG_LINE_INFO, fs.is_directory(portpath), R"(Could not find port named "%s")", port_name); std::vector<fs::path> candidate_paths; - const std::vector<fs::path> from_path = Files::find_from_PATH(L"EDITOR"); + const std::vector<fs::path> from_path = Files::find_from_PATH("EDITOR"); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); candidate_paths.push_back(System::get_program_files_platform_bitness() / VS_CODE_INSIDERS); candidate_paths.push_back(System::get_program_files_32_bit() / VS_CODE_INSIDERS); @@ -74,13 +99,16 @@ namespace vcpkg::Commands::Edit { const auto buildtrees_current_dir = paths.buildtrees / port_name; - const std::wstring cmd_line = - Strings::wformat(LR"("%s" "%s" -n)", env_editor, buildtrees_current_dir.native()); + const auto cmd_line = + Strings::format(R"("%s" "%s" -n)", env_editor.u8string(), buildtrees_current_dir.u8string()); Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmd_line)); } - const std::wstring cmd_line = Strings::wformat( - LR"("%s" "%s" "%s" -n)", env_editor, portpath.native(), (portpath / "portfile.cmake").native()); + const auto cmd_line = Strings::format( + R"("%s" "%s" "%s" -n)", + env_editor.u8string(), + portpath.u8string(), + (portpath / "portfile.cmake").u8string()); Checks::exit_with_code(VCPKG_LINE_INFO, System::cmd_execute(cmd_line)); } } diff --git a/toolsrc/src/commands_env.cpp b/toolsrc/src/vcpkg/commands.env.cpp index 6dad3e882..9f8ae5207 100644 --- a/toolsrc/src/commands_env.cpp +++ b/toolsrc/src/vcpkg/commands.env.cpp @@ -1,20 +1,21 @@ #include "pch.h" -#include "vcpkg_Build.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> namespace vcpkg::Commands::Env { void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { - static const std::string EXAMPLE = Commands::Help::create_example_string(R"(env --Triplet x64-windows)"); + static const std::string EXAMPLE = Help::create_example_string(R"(env --triplet x64-windows)"); args.check_exact_arg_count(0, EXAMPLE); args.check_and_get_optional_command_arguments({}); const auto pre_build_info = Build::PreBuildInfo::from_triplet_file(paths, default_triplet); const Toolset& toolset = paths.get_toolset(pre_build_info.platform_toolset, pre_build_info.visual_studio_path); - System::cmd_execute_clean(Build::make_build_env_cmd(pre_build_info, toolset) + L" && cmd"); + System::cmd_execute_clean(Build::make_build_env_cmd(pre_build_info, toolset) + " && cmd"); Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/commands_export_ifw.cpp b/toolsrc/src/vcpkg/commands.exportifw.cpp index 191dbb763..682267acb 100644 --- a/toolsrc/src/commands_export_ifw.cpp +++ b/toolsrc/src/vcpkg/commands.exportifw.cpp @@ -1,10 +1,11 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Commands_Export.h" -#include "vcpkg_Commands_Export_IFW.h" +#include <vcpkg/commands.h> +#include <vcpkg/export.h> +#include <vcpkg/export.ifw.h> +#include <vcpkg/install.h> -namespace vcpkg::Commands::Export::IFW +namespace vcpkg::Export::IFW { using Dependencies::ExportPlanAction; using Dependencies::ExportPlanType; @@ -26,6 +27,14 @@ namespace vcpkg::Commands::Export::IFW return date_time_as_string; } + std::string safe_rich_from_plain_text(const std::string& text) + { + // match standalone ampersand, no HTML number or name + std::regex standalone_ampersand(R"###(&(?!(#[0-9]+|\w+);))###"); + + return std::regex_replace(text, standalone_ampersand, "&"); + } + fs::path get_packages_dir_path(const std::string& export_id, const Options& ifw_options, const VcpkgPaths& paths) { return ifw_options.maybe_packages_dir_path.has_value() @@ -156,7 +165,7 @@ namespace vcpkg::Commands::Export::IFW </Package> )###", action.spec.name(), - binary_paragraph.description, + safe_rich_from_plain_text(binary_paragraph.description), binary_paragraph.version, create_release_date())); } @@ -341,10 +350,10 @@ namespace vcpkg::Commands::Export::IFW Checks::check_exit( VCPKG_LINE_INFO, !ec, "Could not remove outdated repository directory %s", repository_dir.generic_string()); - const std::wstring cmd_line = Strings::wformat(LR"("%s" --packages "%s" "%s" > nul)", - repogen_exe.native(), - packages_dir.native(), - repository_dir.native()); + const auto cmd_line = Strings::format(R"("%s" --packages "%s" "%s" > nul)", + repogen_exe.u8string(), + packages_dir.u8string(), + repository_dir.u8string()); const int exit_code = System::cmd_execute_clean(cmd_line); Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: IFW repository generating failed"); @@ -362,24 +371,24 @@ namespace vcpkg::Commands::Export::IFW System::println("Generating installer %s...", installer_file.generic_string()); - std::wstring cmd_line; + std::string cmd_line; std::string ifw_repo_url = ifw_options.maybe_repository_url.value_or(""); if (!ifw_repo_url.empty()) { - cmd_line = Strings::wformat(LR"("%s" --online-only --config "%s" --repository "%s" "%s" > nul)", - binarycreator_exe.native(), - config_file.native(), - repository_dir.native(), - installer_file.native()); + cmd_line = Strings::format(R"("%s" --online-only --config "%s" --repository "%s" "%s" > nul)", + binarycreator_exe.u8string(), + config_file.u8string(), + repository_dir.u8string(), + installer_file.u8string()); } else { - cmd_line = Strings::wformat(LR"("%s" --config "%s" --packages "%s" "%s" > nul)", - binarycreator_exe.native(), - config_file.native(), - packages_dir.native(), - installer_file.native()); + cmd_line = Strings::format(R"("%s" --config "%s" --packages "%s" "%s" > nul)", + binarycreator_exe.u8string(), + config_file.u8string(), + packages_dir.u8string(), + installer_file.u8string()); } const int exit_code = System::cmd_execute_clean(cmd_line); diff --git a/toolsrc/src/vcpkg/commands.hash.cpp b/toolsrc/src/vcpkg/commands.hash.cpp new file mode 100644 index 000000000..4bc58b509 --- /dev/null +++ b/toolsrc/src/vcpkg/commands.hash.cpp @@ -0,0 +1,50 @@ +#include "pch.h" + +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> + +namespace vcpkg::Commands::Hash +{ + static void do_file_hash(fs::path const& path, std::string const& hash_type) + { + const auto cmd_line = Strings::format(R"(CertUtil.exe -hashfile "%s" %s)", path.u8string().c_str(), hash_type); + const auto ec_data = System::cmd_execute_and_capture_output(cmd_line); + Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", cmd_line); + + std::string const& output = ec_data.output; + + const auto start = output.find_first_of("\r\n"); + Checks::check_exit( + VCPKG_LINE_INFO, start != std::string::npos, "Unexpected output format from command: %s", cmd_line); + + const auto end = output.find_first_of("\r\n", start + 1); + Checks::check_exit( + VCPKG_LINE_INFO, end != std::string::npos, "Unexpected output format from command: %s", cmd_line); + + auto hash = output.substr(start, end - start); + Util::erase_remove_if(hash, isspace); + System::println(hash); + } + + void perform_and_exit(const VcpkgCmdArguments& args) + { + static const std::string EXAMPLE = Strings::format("The argument should be a file path\n%s", + Help::create_example_string("hash boost_1_62_0.tar.bz2")); + args.check_min_arg_count(1, EXAMPLE); + args.check_max_arg_count(2, EXAMPLE); + args.check_and_get_optional_command_arguments({}); + + if (args.command_arguments.size() == 1) + { + do_file_hash(args.command_arguments[0], "SHA512"); + } + if (args.command_arguments.size() == 2) + { + do_file_hash(args.command_arguments[0], args.command_arguments[1]); + } + + Checks::exit_success(VCPKG_LINE_INFO); + } +} diff --git a/toolsrc/src/commands_import.cpp b/toolsrc/src/vcpkg/commands.import.cpp index 412a03d7f..119aee022 100644 --- a/toolsrc/src/commands_import.cpp +++ b/toolsrc/src/vcpkg/commands.import.cpp @@ -1,9 +1,10 @@ #include "pch.h" -#include "Paragraphs.h" -#include "StatusParagraph.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" +#include <vcpkg/base/files.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/statusparagraph.h> namespace vcpkg::Commands::Import { @@ -93,7 +94,7 @@ namespace vcpkg::Commands::Import void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = Commands::Help::create_example_string( + static const std::string EXAMPLE = Help::create_example_string( R"(import C:\path\to\CONTROLfile C:\path\to\includedir C:\path\to\projectdir)"); args.check_exact_arg_count(3, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/vcpkg/commands.integrate.cpp index fd2f11294..0d185476e 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/vcpkg/commands.integrate.cpp @@ -1,19 +1,13 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> namespace vcpkg::Commands::Integrate { - static const std::array<fs::path, 2> OLD_SYSTEM_TARGET_FILES = { - System::get_program_files_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets", - System::get_program_files_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets"}; - static const fs::path SYSTEM_WIDE_TARGETS_FILE = - System::get_program_files_32_bit() / "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props"; - static std::string create_appdata_targets_shortcut(const std::string& target_path) noexcept { return Strings::format(R"###( @@ -111,6 +105,7 @@ namespace vcpkg::Commands::Integrate NO }; +#if defined(_WIN32) static ElevationPromptChoice elevated_cmd_execute(const std::string& param) { SHELLEXECUTEINFOW sh_ex_info = {0}; @@ -138,16 +133,29 @@ namespace vcpkg::Commands::Integrate CloseHandle(sh_ex_info.hProcess); return ElevationPromptChoice::YES; } +#endif +#if defined(_WIN32) static fs::path get_appdata_targets_path() { static const fs::path LOCAL_APP_DATA = - fs::path(System::get_environment_variable(L"LOCALAPPDATA").value_or_exit(VCPKG_LINE_INFO)); + fs::path(System::get_environment_variable("LOCALAPPDATA").value_or_exit(VCPKG_LINE_INFO)); return LOCAL_APP_DATA / "vcpkg" / "vcpkg.user.targets"; } +#endif +#if defined(_WIN32) static void integrate_install(const VcpkgPaths& paths) { + static const std::array<fs::path, 2> OLD_SYSTEM_TARGET_FILES = { + System::get_program_files_32_bit() / + "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets", + System::get_program_files_32_bit() / + "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets"}; + static const fs::path SYSTEM_WIDE_TARGETS_FILE = + System::get_program_files_32_bit() / + "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props"; + auto& fs = paths.get_filesystem(); // TODO: This block of code should eventually be removed @@ -230,13 +238,14 @@ namespace vcpkg::Commands::Integrate } System::println(System::Color::success, "Applied user-wide integration for this vcpkg root."); const fs::path cmake_toolchain = paths.buildsystems / "vcpkg.cmake"; - System::println("\n" - "All MSBuild C++ projects can now #include any installed libraries.\n" - "Linking will be handled automatically.\n" - "Installing new libraries will make them instantly available.\n" - "\n" - "CMake projects should use -DCMAKE_TOOLCHAIN_FILE=%s", - cmake_toolchain.generic_string()); + System::println( + 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()); Checks::exit_success(VCPKG_LINE_INFO); } @@ -261,6 +270,7 @@ namespace vcpkg::Commands::Integrate Checks::exit_success(VCPKG_LINE_INFO); } +#endif static void integrate_project(const VcpkgPaths& paths) { @@ -285,10 +295,10 @@ namespace vcpkg::Commands::Integrate fs.write_contents(nuspec_file_path, create_nuspec_file_contents(paths.root, nuget_id, nupkg_version)); // Using all forward slashes for the command line - const std::wstring cmd_line = Strings::wformat(LR"("%s" pack -OutputDirectory "%s" "%s" > nul)", - nuget_exe.native(), - buildsystems_dir.native(), - nuspec_file_path.native()); + const std::string cmd_line = Strings::format(R"("%s" pack -OutputDirectory "%s" "%s" > nul)", + nuget_exe.u8string(), + buildsystems_dir.u8string(), + nuspec_file_path.u8string()); const int exit_code = System::cmd_execute_clean(cmd_line); @@ -324,6 +334,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console args.check_exact_arg_count(1, EXAMPLE); args.check_and_get_optional_command_arguments({}); +#if defined(_WIN32) if (args.command_arguments[0] == "install") { return integrate_install(paths); @@ -336,6 +347,7 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console { return integrate_project(paths); } +#endif Checks::exit_with_message(VCPKG_LINE_INFO, "Unknown parameter %s for integrate", args.command_arguments[0]); } diff --git a/toolsrc/src/commands_list.cpp b/toolsrc/src/vcpkg/commands.list.cpp index 640885860..d0e8e00b4 100644 --- a/toolsrc/src/commands_list.cpp +++ b/toolsrc/src/vcpkg/commands.list.cpp @@ -1,8 +1,9 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::List { @@ -27,7 +28,7 @@ namespace vcpkg::Commands::List { static const std::string EXAMPLE = Strings::format( "The argument should be a substring to search for, or no argument to display all installed libraries.\n%s", - Commands::Help::create_example_string("list png")); + Help::create_example_string("list png")); args.check_max_arg_count(1, EXAMPLE); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_FULLDESC}); diff --git a/toolsrc/src/commands_owns.cpp b/toolsrc/src/vcpkg/commands.owns.cpp index 718a0277f..69079e829 100644 --- a/toolsrc/src/commands_owns.cpp +++ b/toolsrc/src/vcpkg/commands.owns.cpp @@ -1,8 +1,9 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::Owns { @@ -26,7 +27,7 @@ namespace vcpkg::Commands::Owns void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { static const std::string EXAMPLE = Strings::format("The argument should be a pattern to search for. %s", - Commands::Help::create_example_string("owns zlib.dll")); + Help::create_example_string("owns zlib.dll")); args.check_exact_arg_count(1, EXAMPLE); args.check_and_get_optional_command_arguments({}); diff --git a/toolsrc/src/commands_portsdiff.cpp b/toolsrc/src/vcpkg/commands.portsdiff.cpp index 2334b2270..a8c043751 100644 --- a/toolsrc/src/commands_portsdiff.cpp +++ b/toolsrc/src/vcpkg/commands.portsdiff.cpp @@ -1,10 +1,12 @@ #include "pch.h" -#include "Paragraphs.h" -#include "SortedVector.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Maps.h" -#include "vcpkg_System.h" +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> + +#include <vcpkg/base/sortedvector.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> namespace vcpkg::Commands::PortsDiff { @@ -73,28 +75,28 @@ namespace vcpkg::Commands::PortsDiff } static std::map<std::string, VersionT> read_ports_from_commit(const VcpkgPaths& paths, - const std::wstring& git_commit_id) + const std::string& git_commit_id) { std::error_code ec; auto& fs = paths.get_filesystem(); const fs::path& git_exe = paths.get_git_exe(); const fs::path dot_git_dir = paths.root / ".git"; - const std::wstring ports_dir_name_as_string = paths.ports.filename().native(); + const std::string ports_dir_name_as_string = paths.ports.filename().u8string(); const fs::path temp_checkout_path = - paths.root / Strings::wformat(L"%s-%s", ports_dir_name_as_string, git_commit_id); + paths.root / Strings::format("%s-%s", ports_dir_name_as_string, git_commit_id); fs.create_directory(temp_checkout_path, ec); - const std::wstring checkout_this_dir = - Strings::wformat(LR"(.\%s)", ports_dir_name_as_string); // Must be relative to the root of the repository - - const std::wstring cmd = - Strings::wformat(LR"("%s" --git-dir="%s" --work-tree="%s" checkout %s -f -q -- %s %s & "%s" reset >NUL)", - git_exe.native(), - dot_git_dir.native(), - temp_checkout_path.native(), - git_commit_id, - checkout_this_dir, - L".vcpkg-root", - git_exe.native()); + const auto checkout_this_dir = + Strings::format(R"(.\%s)", ports_dir_name_as_string); // Must be relative to the root of the repository + + const std::string cmd = + Strings::format(R"("%s" --git-dir="%s" --work-tree="%s" checkout %s -f -q -- %s %s & "%s" reset >NUL)", + git_exe.u8string(), + dot_git_dir.u8string(), + temp_checkout_path.u8string(), + git_commit_id, + checkout_this_dir, + ".vcpkg-root", + git_exe.u8string()); System::cmd_execute_clean(cmd); const std::map<std::string, VersionT> names_and_versions = Paragraphs::load_all_port_names_and_versions( paths.get_filesystem(), temp_checkout_path / ports_dir_name_as_string); @@ -102,32 +104,29 @@ namespace vcpkg::Commands::PortsDiff return names_and_versions; } - static void check_commit_exists(const fs::path& git_exe, const std::wstring& git_commit_id) + static void check_commit_exists(const fs::path& git_exe, const std::string& git_commit_id) { static const std::string VALID_COMMIT_OUTPUT = "commit\n"; - const std::wstring cmd = Strings::wformat(LR"("%s" cat-file -t %s)", git_exe.native(), git_commit_id); + const auto cmd = Strings::format(R"("%s" cat-file -t %s)", git_exe.u8string(), git_commit_id); const System::ExitCodeAndOutput output = System::cmd_execute_and_capture_output(cmd); - Checks::check_exit(VCPKG_LINE_INFO, - output.output == VALID_COMMIT_OUTPUT, - "Invalid commit id %s", - Strings::to_utf8(git_commit_id)); + Checks::check_exit( + VCPKG_LINE_INFO, output.output == VALID_COMMIT_OUTPUT, "Invalid commit id %s", git_commit_id); } void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) { - static const std::string EXAMPLE = - Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", - Commands::Help::create_example_string("portsdiff mybranchname")); + static const std::string EXAMPLE = Strings::format("The argument should be a branch/tag/hash to checkout.\n%s", + Help::create_example_string("portsdiff mybranchname")); args.check_min_arg_count(1, EXAMPLE); args.check_max_arg_count(2, EXAMPLE); args.check_and_get_optional_command_arguments({}); const fs::path& git_exe = paths.get_git_exe(); - const std::wstring git_commit_id_for_previous_snapshot = Strings::to_utf16(args.command_arguments.at(0)); - const std::wstring git_commit_id_for_current_snapshot = - args.command_arguments.size() < 2 ? L"HEAD" : Strings::to_utf16(args.command_arguments.at(1)); + const std::string git_commit_id_for_previous_snapshot = args.command_arguments.at(0); + const std::string git_commit_id_for_current_snapshot = + args.command_arguments.size() < 2 ? "HEAD" : args.command_arguments.at(1); check_commit_exists(git_exe, git_commit_id_for_current_snapshot); check_commit_exists(git_exe, git_commit_id_for_previous_snapshot); @@ -138,8 +137,8 @@ namespace vcpkg::Commands::PortsDiff read_ports_from_commit(paths, git_commit_id_for_previous_snapshot); // Already sorted, so set_difference can work on std::vector too - const std::vector<std::string> current_ports = Maps::extract_keys(current_names_and_versions); - const std::vector<std::string> previous_ports = Maps::extract_keys(previous_names_and_versions); + const std::vector<std::string> current_ports = Util::extract_keys(current_names_and_versions); + const std::vector<std::string> previous_ports = Util::extract_keys(previous_names_and_versions); const SetElementPresence<std::string> setp = SetElementPresence<std::string>::create(current_ports, previous_ports); diff --git a/toolsrc/src/commands_search.cpp b/toolsrc/src/vcpkg/commands.search.cpp index d35a546c4..3ba8707de 100644 --- a/toolsrc/src/commands_search.cpp +++ b/toolsrc/src/vcpkg/commands.search.cpp @@ -1,11 +1,12 @@ #include "pch.h" -#include "Paragraphs.h" -#include "SourceParagraph.h" -#include "vcpkg_Commands.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg::Commands::Search { @@ -82,7 +83,7 @@ namespace vcpkg::Commands::Search { static const std::string EXAMPLE = Strings::format( "The argument should be a substring to search for, or no argument to display all libraries.\n%s", - Commands::Help::create_example_string("search png")); + Help::create_example_string("search png")); args.check_max_arg_count(1, EXAMPLE); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments({OPTION_GRAPH, OPTION_FULLDESC}); diff --git a/toolsrc/src/commands_version.cpp b/toolsrc/src/vcpkg/commands.version.cpp index 5744ea9ef..403c355b5 100644 --- a/toolsrc/src/commands_version.cpp +++ b/toolsrc/src/vcpkg/commands.version.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "metrics.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/metrics.h> #define STRINGIFY(...) #__VA_ARGS__ #define MACRO_TO_STRING(X) STRINGIFY(X) @@ -20,20 +20,29 @@ namespace vcpkg::Commands::Version #ifndef NDEBUG + std::string("-debug") #endif - + std::string(Metrics::get_compiled_metrics_enabled() ? Strings::EMPTY : "-external"); + + std::string(Metrics::get_compiled_metrics_enabled() ? "" : "-external"); return S_VERSION; } + static int scan3(const char* input, const char* pattern, int* a, int* b, int* c) + { +#if defined(_WIN32) + return sscanf_s(input, pattern, a, b, c); +#else + return sscanf(input, pattern, a, b, c); +#endif + } + void warn_if_vcpkg_version_mismatch(const VcpkgPaths& paths) { auto version_file = paths.get_filesystem().read_contents(paths.root / "toolsrc" / "VERSION.txt"); if (const auto version_contents = version_file.get()) { int maj1, min1, rev1; - const auto num1 = sscanf_s(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1); + const auto num1 = scan3(version_contents->c_str(), "\"%d.%d.%d\"", &maj1, &min1, &rev1); int maj2, min2, rev2; - const auto num2 = sscanf_s(Version::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2); + const auto num2 = scan3(Version::version().c_str(), "%d.%d.%d-", &maj2, &min2, &rev2); if (num1 == 3 && num2 == 3) { diff --git a/toolsrc/src/vcpkg_Dependencies.cpp b/toolsrc/src/vcpkg/dependencies.cpp index 8dd60a2eb..02b2ec785 100644 --- a/toolsrc/src/vcpkg_Dependencies.cpp +++ b/toolsrc/src/vcpkg/dependencies.cpp @@ -1,15 +1,15 @@ #include "pch.h" -#include "PackageSpec.h" -#include "Paragraphs.h" -#include "StatusParagraphs.h" -#include "VcpkgPaths.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" -#include "vcpkg_Graphs.h" -#include "vcpkg_Strings.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/graphs.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/util.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/statusparagraphs.h> +#include <vcpkg/vcpkglib.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg::Dependencies { @@ -43,14 +43,17 @@ namespace vcpkg::Dependencies bool operator==(const ClusterPtr& l, const ClusterPtr& r) { return l.ptr == r.ptr; } } -template<> -struct std::hash<vcpkg::Dependencies::ClusterPtr> +namespace std { - size_t operator()(const vcpkg::Dependencies::ClusterPtr& value) const + template<> + struct hash<vcpkg::Dependencies::ClusterPtr> { - return std::hash<vcpkg::PackageSpec>()(value.ptr->spec); - } -}; + size_t operator()(const vcpkg::Dependencies::ClusterPtr& value) const + { + return std::hash<vcpkg::PackageSpec>()(value.ptr->spec); + } + }; +} namespace vcpkg::Dependencies { diff --git a/toolsrc/src/commands_export.cpp b/toolsrc/src/vcpkg/export.cpp index 20838f5a5..5e27d4126 100644 --- a/toolsrc/src/commands_export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -1,16 +1,19 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Commands_Export_IFW.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/export.ifw.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/install.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> + #include <regex> -namespace vcpkg::Commands::Export +namespace vcpkg::Export { using Dependencies::ExportPlanAction; using Dependencies::ExportPlanType; @@ -134,11 +137,10 @@ namespace vcpkg::Commands::Export fs.write_contents(nuspec_file_path, nuspec_file_content); // -NoDefaultExcludes is needed for ".vcpkg-root" - const std::wstring cmd_line = - Strings::wformat(LR"("%s" pack -OutputDirectory "%s" "%s" -NoDefaultExcludes > nul)", - nuget_exe.native(), - output_dir.native(), - nuspec_file_path.native()); + const auto cmd_line = Strings::format(R"("%s" pack -OutputDirectory "%s" "%s" -NoDefaultExcludes > nul)", + nuget_exe.u8string(), + output_dir.u8string(), + nuspec_file_path.u8string()); const int exit_code = System::cmd_execute_clean(cmd_line); Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: NuGet package creation failed"); @@ -157,25 +159,25 @@ namespace vcpkg::Commands::Export constexpr ArchiveFormat() = delete; - constexpr ArchiveFormat(BackingEnum backing_enum, const wchar_t* extension, const wchar_t* cmake_option) + constexpr ArchiveFormat(BackingEnum backing_enum, const char* extension, const char* cmake_option) : backing_enum(backing_enum), m_extension(extension), m_cmake_option(cmake_option) { } constexpr operator BackingEnum() const { return backing_enum; } - constexpr CWStringView extension() const { return this->m_extension; } - constexpr CWStringView cmake_option() const { return this->m_cmake_option; } + constexpr CStringView extension() const { return this->m_extension; } + constexpr CStringView cmake_option() const { return this->m_cmake_option; } private: BackingEnum backing_enum; - const wchar_t* m_extension; - const wchar_t* m_cmake_option; + const char* m_extension; + const char* m_cmake_option; }; namespace ArchiveFormatC { - constexpr const ArchiveFormat ZIP(ArchiveFormat::BackingEnum::ZIP, L"zip", L"zip"); - constexpr const ArchiveFormat SEVEN_ZIP(ArchiveFormat::BackingEnum::SEVEN_ZIP, L"7z", L"7zip"); + constexpr const ArchiveFormat ZIP(ArchiveFormat::BackingEnum::ZIP, "zip", "zip"); + constexpr const ArchiveFormat SEVEN_ZIP(ArchiveFormat::BackingEnum::SEVEN_ZIP, "7z", "7zip"); } static fs::path do_archive_export(const VcpkgPaths& paths, @@ -185,17 +187,17 @@ namespace vcpkg::Commands::Export { const fs::path& cmake_exe = paths.get_cmake_exe(); - const std::wstring exported_dir_filename = raw_exported_dir.filename().native(); - const std::wstring exported_archive_filename = - Strings::wformat(L"%s.%s", exported_dir_filename, format.extension()); + const std::string exported_dir_filename = raw_exported_dir.filename().u8string(); + const std::string exported_archive_filename = + Strings::format("%s.%s", exported_dir_filename, format.extension()); const fs::path exported_archive_path = (output_dir / exported_archive_filename); // -NoDefaultExcludes is needed for ".vcpkg-root" - const std::wstring cmd_line = Strings::wformat(LR"("%s" -E tar "cf" "%s" --format=%s -- "%s")", - cmake_exe.native(), - exported_archive_path.native(), - format.cmake_option(), - raw_exported_dir.native()); + const auto cmd_line = Strings::format(R"("%s" -E tar "cf" "%s" --format=%s -- "%s")", + cmake_exe.u8string(), + exported_archive_path.u8string(), + format.cmake_option(), + raw_exported_dir.u8string()); const int exit_code = System::cmd_execute_clean(cmd_line); Checks::check_exit( @@ -273,8 +275,7 @@ namespace vcpkg::Commands::Export static const std::string OPTION_IFW_INSTALLER_FILE_PATH = "--ifw-installer-file-path"; // input sanitization - static const std::string EXAMPLE = - Commands::Help::create_example_string("export zlib zlib:x64-windows boost --nuget"); + static const std::string EXAMPLE = Help::create_example_string("export zlib zlib:x64-windows boost --nuget"); args.check_min_arg_count(1, EXAMPLE); ret.specs = Util::fmap(args.command_arguments, [&](auto&& arg) { @@ -359,13 +360,13 @@ namespace vcpkg::Commands::Export static void print_next_step_info(const fs::path& prefix) { const fs::path cmake_toolchain = prefix / "scripts" / "buildsystems" / "vcpkg.cmake"; - const CMakeVariable cmake_variable = CMakeVariable(L"CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string()); + const CMakeVariable cmake_variable = CMakeVariable("CMAKE_TOOLCHAIN_FILE", cmake_toolchain.generic_string()); System::println("\n" "To use the exported libraries in CMake projects use:" "\n" " %s" "\n", - Strings::to_utf8(cmake_variable.s)); + cmake_variable.s); }; static void handle_raw_based_export(Span<const ExportPlanAction> export_plan, diff --git a/toolsrc/src/vcpkg/globalstate.cpp b/toolsrc/src/vcpkg/globalstate.cpp new file mode 100644 index 000000000..43230fa4b --- /dev/null +++ b/toolsrc/src/vcpkg/globalstate.cpp @@ -0,0 +1,13 @@ +#include "pch.h" + +#include <vcpkg/globalstate.h> + +namespace vcpkg +{ + Util::LockGuarded<Chrono::ElapsedTime> GlobalState::timer; + std::atomic<bool> GlobalState::debugging(false); + std::atomic<bool> GlobalState::feature_packages(false); + + std::atomic<int> GlobalState::g_init_console_cp(0); + std::atomic<int> GlobalState::g_init_console_output_cp(0); +} diff --git a/toolsrc/src/commands_help.cpp b/toolsrc/src/vcpkg/help.cpp index a12f9003d..2a0578211 100644 --- a/toolsrc/src/commands_help.cpp +++ b/toolsrc/src/vcpkg/help.cpp @@ -1,9 +1,9 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> -namespace vcpkg::Commands::Help +namespace vcpkg::Help { void help_topics() { @@ -16,9 +16,9 @@ namespace vcpkg::Commands::Help void help_topic_valid_triplet(const VcpkgPaths& paths) { System::println("Available architecture triplets:"); - for (auto&& path : paths.get_filesystem().get_files_non_recursive(paths.triplets)) + for (auto&& triplet : paths.get_available_triplets()) { - System::println(" %s", path.stem().filename().string()); + System::println(" %s", triplet); } } @@ -75,7 +75,7 @@ namespace vcpkg::Commands::Help " (default: %%VCPKG_ROOT%%)\n" "\n" "For more help (including examples) see the accompanying README.md.", - Integrate::INTEGRATE_COMMAND_HELPSTRING); + Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING); } std::string create_example_string(const std::string& command_and_arguments) @@ -114,7 +114,7 @@ namespace vcpkg::Commands::Help { System::print("Commands:\n" "%s", - Integrate::INTEGRATE_COMMAND_HELPSTRING); + Commands::Integrate::INTEGRATE_COMMAND_HELPSTRING); } else if (topic == "topics") { diff --git a/toolsrc/src/vcpkg_Input.cpp b/toolsrc/src/vcpkg/input.cpp index f1cac9632..aee0fac7f 100644 --- a/toolsrc/src/vcpkg_Input.cpp +++ b/toolsrc/src/vcpkg/input.cpp @@ -1,9 +1,10 @@ #include "pch.h" -#include "metrics.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/metrics.h> namespace vcpkg::Input { @@ -30,7 +31,7 @@ namespace vcpkg::Input { System::println(System::Color::error, "Error: invalid triplet: %s", t); Metrics::g_metrics.lock()->track_property("error", "invalid triplet: " + t.to_string()); - Commands::Help::help_topic_valid_triplet(paths); + Help::help_topic_valid_triplet(paths); Checks::exit_fail(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/commands_install.cpp b/toolsrc/src/vcpkg/install.cpp index d815332fe..adbd8c943 100644 --- a/toolsrc/src/commands_install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -1,18 +1,21 @@ #include "pch.h" -#include "Paragraphs.h" -#include "metrics.h" -#include "vcpkg_Build.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Files.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" - -namespace vcpkg::Commands::Install +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/build.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/install.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/remove.h> +#include <vcpkg/vcpkglib.h> + +namespace vcpkg::Install { using namespace Dependencies; @@ -67,9 +70,8 @@ namespace vcpkg::Commands::Install } const std::string filename = file.filename().generic_string(); - if (fs::is_regular_file(status) && - (Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") == 0 || - Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO") == 0)) + if (fs::is_regular_file(status) && (Strings::case_insensitive_ascii_equals(filename.c_str(), "CONTROL") || + Strings::case_insensitive_ascii_equals(filename.c_str(), "BUILD_INFO"))) { // Do not copy the control file continue; @@ -142,7 +144,7 @@ namespace vcpkg::Commands::Install continue; } - output.insert(output.end(), t.files.begin(), t.files.end()); + Util::Vectors::concatenate(&output, t.files); } std::sort(output.begin(), output.end()); @@ -442,22 +444,22 @@ namespace vcpkg::Commands::Install } } - void perform_and_exit(const std::vector<AnyAction>& action_plan, - const Build::BuildPackageOptions& install_plan_options, - const KeepGoing keep_going, - const PrintSummary print_summary, - const VcpkgPaths& paths, - StatusParagraphs& status_db) + void perform_and_exit_ex(const std::vector<AnyAction>& action_plan, + const Build::BuildPackageOptions& install_plan_options, + const KeepGoing keep_going, + const PrintSummary print_summary, + const VcpkgPaths& paths, + StatusParagraphs& status_db) { std::vector<BuildResult> results; std::vector<std::string> timing; - const ElapsedTime timer = ElapsedTime::create_started(); + const auto timer = Chrono::ElapsedTime::create_started(); size_t counter = 0; const size_t package_count = action_plan.size(); for (const auto& action : action_plan) { - const ElapsedTime build_timer = ElapsedTime::create_started(); + const auto build_timer = Chrono::ElapsedTime::create_started(); counter++; const std::string display_name = action.spec().to_string(); @@ -522,17 +524,42 @@ namespace vcpkg::Commands::Install Checks::exit_success(VCPKG_LINE_INFO); } - void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + static const std::string OPTION_DRY_RUN = "--dry-run"; + static const std::string OPTION_USE_HEAD_VERSION = "--head"; + static const std::string OPTION_NO_DOWNLOADS = "--no-downloads"; + static const std::string OPTION_RECURSE = "--recurse"; + static const std::string OPTION_KEEP_GOING = "--keep-going"; + + static const std::array<std::string, 5> INSTALL_SWITCHES = { + OPTION_DRY_RUN, + OPTION_USE_HEAD_VERSION, + OPTION_NO_DOWNLOADS, + OPTION_RECURSE, + OPTION_KEEP_GOING, + }; + static const std::array<std::string, 0> INSTALL_SETTINGS; + + static std::vector<std::string> valid_arguments(const VcpkgPaths& paths) { - static const std::string OPTION_DRY_RUN = "--dry-run"; - static const std::string OPTION_USE_HEAD_VERSION = "--head"; - static const std::string OPTION_NO_DOWNLOADS = "--no-downloads"; - static const std::string OPTION_RECURSE = "--recurse"; - static const std::string OPTION_KEEP_GOING = "--keep-going"; + auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports); + + return Util::fmap(sources_and_errors.paragraphs, + [](auto&& pgh) -> std::string { return pgh->core_paragraph->name; }); + } + const CommandStructure COMMAND_STRUCTURE = { + "install zlib zlib:x64-windows curl boost", + 1, + SIZE_MAX, + INSTALL_SWITCHES, + INSTALL_SETTINGS, + &valid_arguments, + }; + + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) + { // input sanitization - static const std::string EXAMPLE = - Commands::Help::create_example_string("install zlib zlib:x64-windows curl boost"); + static const std::string EXAMPLE = Help::create_example_string("install zlib zlib:x64-windows curl boost"); args.check_min_arg_count(1, EXAMPLE); const std::vector<FullPackageSpec> specs = Util::fmap(args.command_arguments, [&](auto&& arg) { @@ -556,6 +583,7 @@ namespace vcpkg::Commands::Install const bool no_downloads = options.find(OPTION_NO_DOWNLOADS) != options.cend(); const bool is_recursive = options.find(OPTION_RECURSE) != options.cend(); const KeepGoing keep_going = to_keep_going(options.find(OPTION_KEEP_GOING) != options.cend()); + const PrintSummary print_summary = to_print_summary(keep_going == KeepGoing::YES); // create the plan StatusParagraphs status_db = database_load_check(paths); @@ -606,7 +634,7 @@ namespace vcpkg::Commands::Install Checks::exit_success(VCPKG_LINE_INFO); } - perform_and_exit(action_plan, install_plan_options, keep_going, PrintSummary::NO, paths, status_db); + perform_and_exit_ex(action_plan, install_plan_options, keep_going, print_summary, paths, status_db); Checks::exit_success(VCPKG_LINE_INFO); } diff --git a/toolsrc/src/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp index 8a0050bfc..8f2575886 100644 --- a/toolsrc/src/metrics.cpp +++ b/toolsrc/src/vcpkg/metrics.cpp @@ -1,10 +1,13 @@ #include "pch.h" -#include "filesystem_fs.h" -#include "metrics.h" -#include "vcpkg_Files.h" -#include "vcpkg_Strings.h" -#include "vcpkg_System.h" +#include <vcpkg/metrics.h> + +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/system.h> + +#pragma comment(lib, "version") +#pragma comment(lib, "winhttp") namespace vcpkg::Metrics { @@ -16,6 +19,7 @@ namespace vcpkg::Metrics std::array<char, 80> date; date.fill(0); +#if defined(_WIN32) struct _timeb timebuffer; _ftime_s(&timebuffer); @@ -23,10 +27,17 @@ namespace vcpkg::Metrics const int milli = timebuffer.millitm; const errno_t err = gmtime_s(&newtime, &now); + if (err) { - return Strings::EMPTY; + return ""; } +#else + time_t now; + time(&now); + gmtime_r(&now, &newtime); + const int milli = 0; +#endif strftime(&date[0], date.size(), "%Y-%m-%dT%H:%M:%S", &newtime); return std::string(&date[0]) + "." + std::to_string(milli) + "Z"; @@ -118,6 +129,7 @@ namespace vcpkg::Metrics static std::string get_os_version_string() { +#if defined(_WIN32) std::wstring path; path.resize(MAX_PATH); const auto n = GetSystemDirectoryW(&path[0], static_cast<UINT>(path.size())); @@ -125,16 +137,16 @@ namespace vcpkg::Metrics path += L"\\kernel32.dll"; const auto versz = GetFileVersionInfoSizeW(path.c_str(), nullptr); - if (versz == 0) return Strings::EMPTY; + if (versz == 0) return ""; std::vector<char> verbuf; verbuf.resize(versz); - if (!GetFileVersionInfoW(path.c_str(), 0, static_cast<DWORD>(verbuf.size()), &verbuf[0])) return Strings::EMPTY; + if (!GetFileVersionInfoW(path.c_str(), 0, static_cast<DWORD>(verbuf.size()), &verbuf[0])) return ""; void* rootblock; UINT rootblocksize; - if (!VerQueryValueW(&verbuf[0], L"\\", &rootblock, &rootblocksize)) return Strings::EMPTY; + if (!VerQueryValueW(&verbuf[0], L"\\", &rootblock, &rootblocksize)) return ""; auto rootblock_ffi = static_cast<VS_FIXEDFILEINFO*>(rootblock); @@ -142,6 +154,9 @@ namespace vcpkg::Metrics static_cast<int>(HIWORD(rootblock_ffi->dwProductVersionMS)), static_cast<int>(LOWORD(rootblock_ffi->dwProductVersionMS)), static_cast<int>(HIWORD(rootblock_ffi->dwProductVersionLS))); +#else + return "unknown"; +#endif } struct MetricMessage @@ -218,11 +233,15 @@ namespace vcpkg::Metrics bool get_compiled_metrics_enabled() { return DISABLE_METRICS == 0; } - std::wstring get_SQM_user() + std::string get_SQM_user() { +#if defined(_WIN32) auto hkcu_sqmclient = - System::get_registry_string(HKEY_CURRENT_USER, LR"(Software\Microsoft\SQMClient)", L"UserId"); - return hkcu_sqmclient.value_or(L"{}"); + System::get_registry_string(HKEY_CURRENT_USER, R"(Software\Microsoft\SQMClient)", "UserId"); + return hkcu_sqmclient.value_or("{}"); +#else + return "{}"; +#endif } void Metrics::set_user_information(const std::string& user_id, const std::string& first_use_time) @@ -243,17 +262,6 @@ namespace vcpkg::Metrics void Metrics::track_metric(const std::string& name, double value) { g_metricmessage.track_metric(name, value); } - void Metrics::track_property(const std::string& name, const std::wstring& value) - { - // Note: this is not valid UTF-16 -> UTF-8, it just yields a close enough approximation for our purposes. - std::string converted_value; - converted_value.resize(value.size()); - std::transform( - value.begin(), value.end(), converted_value.begin(), [](wchar_t ch) { return static_cast<char>(ch); }); - - g_metricmessage.track_property(name, converted_value); - } - void Metrics::track_property(const std::string& name, const std::string& value) { g_metricmessage.track_property(name, value); @@ -261,6 +269,7 @@ namespace vcpkg::Metrics void Metrics::upload(const std::string& payload) { +#if defined(_WIN32) HINTERNET connect = nullptr, request = nullptr; BOOL results = FALSE; @@ -341,18 +350,12 @@ namespace vcpkg::Metrics if (request) WinHttpCloseHandle(request); if (connect) WinHttpCloseHandle(connect); if (session) WinHttpCloseHandle(session); - } - - static fs::path get_bindir() - { - wchar_t buf[_MAX_PATH]; - const int bytes = GetModuleFileNameW(nullptr, buf, _MAX_PATH); - if (bytes == 0) std::abort(); - return fs::path(buf, buf + bytes); +#endif } void Metrics::flush() { +#if defined(_WIN32) const std::string payload = g_metricmessage.format_event_data_template(); if (g_should_print_metrics) std::cerr << payload << "\n"; if (!g_should_send_metrics) return; @@ -370,14 +373,14 @@ namespace vcpkg::Metrics if (true) { const fs::path exe_path = [&fs]() -> fs::path { - auto vcpkgdir = get_bindir().parent_path(); + auto vcpkgdir = System::get_exe_path_of_current_process().parent_path(); auto path = vcpkgdir / "vcpkgmetricsuploader.exe"; if (fs.exists(path)) return path; path = vcpkgdir / "scripts" / "vcpkgmetricsuploader.exe"; if (fs.exists(path)) return path; - return Strings::WEMPTY; + return ""; }(); std::error_code ec; @@ -388,8 +391,9 @@ namespace vcpkg::Metrics const fs::path vcpkg_metrics_txt_path = temp_folder_path / ("vcpkg" + generate_random_UUID() + ".txt"); fs.write_contents(vcpkg_metrics_txt_path, payload); - const std::wstring cmd_line = - Strings::wformat(L"start %s %s", temp_folder_path_exe.native(), vcpkg_metrics_txt_path.native()); + const std::string cmd_line = + Strings::format("start %s %s", temp_folder_path_exe.u8string(), vcpkg_metrics_txt_path.u8string()); System::cmd_execute_clean(cmd_line); +#endif } } diff --git a/toolsrc/src/PackageSpec.cpp b/toolsrc/src/vcpkg/packagespec.cpp index 890de8899..6e40d70f5 100644 --- a/toolsrc/src/PackageSpec.cpp +++ b/toolsrc/src/vcpkg/packagespec.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "PackageSpec.h" -#include "vcpkg_Parse.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/util.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/parse.h> using vcpkg::Parse::parse_comma_list; @@ -38,7 +38,7 @@ namespace vcpkg for (auto&& feature : spec->features) f_specs.push_back(FeatureSpec{pspec, feature}); - if (spec->features.empty()) f_specs.push_back(FeatureSpec{pspec, Strings::EMPTY}); + if (spec->features.empty()) f_specs.push_back(FeatureSpec{pspec, ""}); } else { @@ -56,7 +56,7 @@ namespace vcpkg std::vector<FeatureSpec> ret; for (auto&& spec : specs) { - ret.emplace_back(spec.package_spec, Strings::EMPTY); + ret.emplace_back(spec.package_spec, ""); for (auto&& feature : spec.features) ret.emplace_back(spec.package_spec, feature); } diff --git a/toolsrc/src/PackageSpecParseResult.cpp b/toolsrc/src/vcpkg/packagespecparseresult.cpp index 838c788ba..b12bd12d0 100644 --- a/toolsrc/src/PackageSpecParseResult.cpp +++ b/toolsrc/src/vcpkg/packagespecparseresult.cpp @@ -1,7 +1,8 @@ #include "pch.h" -#include "PackageSpecParseResult.h" -#include "vcpkg_Checks.h" +#include <vcpkg/packagespecparseresult.h> + +#include <vcpkg/base/checks.h> namespace vcpkg { diff --git a/toolsrc/src/ParagraphParseResult.cpp b/toolsrc/src/vcpkg/paragraphparseresult.cpp index 5c8c1d59d..920a4b16b 100644 --- a/toolsrc/src/ParagraphParseResult.cpp +++ b/toolsrc/src/vcpkg/paragraphparseresult.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "ParagraphParseResult.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/paragraphparseresult.h> namespace vcpkg { diff --git a/toolsrc/src/Paragraphs.cpp b/toolsrc/src/vcpkg/paragraphs.cpp index 6a6f191df..b93de190c 100644 --- a/toolsrc/src/Paragraphs.cpp +++ b/toolsrc/src/vcpkg/paragraphs.cpp @@ -1,10 +1,10 @@ #include "pch.h" -#include "ParagraphParseResult.h" -#include "Paragraphs.h" -#include "vcpkg_Files.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/util.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/paragraphparseresult.h> +#include <vcpkg/paragraphs.h> using namespace vcpkg::Parse; diff --git a/toolsrc/src/vcpkg_Parse.cpp b/toolsrc/src/vcpkg/parse.cpp index e671a1a05..c2670f561 100644 --- a/toolsrc/src/vcpkg_Parse.cpp +++ b/toolsrc/src/vcpkg/parse.cpp @@ -1,8 +1,9 @@ #include "pch.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Maps.h" -#include "vcpkg_Parse.h" +#include <vcpkg/parse.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/util.h> namespace vcpkg::Parse { @@ -30,7 +31,7 @@ namespace vcpkg::Parse } std::string ParagraphParser::optional_field(const std::string& fieldname) const { - return remove_field(&fields, fieldname).value_or(Strings::EMPTY); + return remove_field(&fields, fieldname).value_or(""); } std::unique_ptr<ParseControlErrorInfo> ParagraphParser::error_info(const std::string& name) const { @@ -38,7 +39,7 @@ namespace vcpkg::Parse { auto err = std::make_unique<ParseControlErrorInfo>(); err->name = name; - err->extra_fields = Maps::extract_keys(fields); + err->extra_fields = Util::extract_keys(fields); err->missing_fields = std::move(missing_fields); return err; } diff --git a/toolsrc/src/PostBuildLint_BuildType.cpp b/toolsrc/src/vcpkg/postbuildlint.buildtype.cpp index 649f0ccca..2baaddb5e 100644 --- a/toolsrc/src/PostBuildLint_BuildType.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.buildtype.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "PostBuildLint_BuildType.h" -#include "vcpkg_Checks.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/postbuildlint.buildtype.h> namespace vcpkg::PostBuildLint { diff --git a/toolsrc/src/PostBuildLint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index a0699e15c..0063f8d98 100644 --- a/toolsrc/src/PostBuildLint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -1,14 +1,14 @@ #include "pch.h" -#include "PackageSpec.h" -#include "PostBuildLint.h" -#include "PostBuildLint_BuildType.h" -#include "VcpkgPaths.h" -#include "coff_file_reader.h" -#include "vcpkg_Build.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" +#include <vcpkg/base/cofffilereader.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/build.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/postbuildlint.buildtype.h> +#include <vcpkg/postbuildlint.h> +#include <vcpkg/vcpkgpaths.h> using vcpkg::Build::BuildInfo; using vcpkg::Build::BuildPolicy; @@ -284,13 +284,10 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> dlls_with_no_exports; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = - Strings::wformat(LR"("%s" /exports "%s")", dumpbin_exe.native(), dll.native()); + const std::string cmd_line = + Strings::format(R"("%s" /exports "%s")", dumpbin_exe.u8string(), dll.u8string()); System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line); - Checks::check_exit(VCPKG_LINE_INFO, - ec_data.exit_code == 0, - "Running command:\n %s\n failed", - Strings::to_utf8(cmd_line)); + Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", cmd_line); if (ec_data.output.find("ordinal hint RVA name") == std::string::npos) { @@ -321,13 +318,10 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> dlls_with_improper_uwp_bit; for (const fs::path& dll : dlls) { - const std::wstring cmd_line = - Strings::wformat(LR"("%s" /headers "%s")", dumpbin_exe.native(), dll.native()); + const std::string cmd_line = + Strings::format(R"("%s" /headers "%s")", dumpbin_exe.u8string(), dll.u8string()); System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line); - Checks::check_exit(VCPKG_LINE_INFO, - ec_data.exit_code == 0, - "Running command:\n %s\n failed", - Strings::to_utf8(cmd_line)); + Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", cmd_line); if (ec_data.output.find("App Container") == std::string::npos) { @@ -361,6 +355,7 @@ namespace vcpkg::PostBuildLint case MachineType::I386: return "x86"; case MachineType::ARM: case MachineType::ARMNT: return "arm"; + case MachineType::ARM64: return "arm64"; default: return "Machine Type Code = " + std::to_string(static_cast<uint16_t>(machine_type)); } } @@ -598,13 +593,10 @@ namespace vcpkg::PostBuildLint for (const fs::path& lib : libs) { - const std::wstring cmd_line = - Strings::wformat(LR"("%s" /directives "%s")", dumpbin_exe.native(), lib.native()); + const std::string cmd_line = + Strings::format(R"("%s" /directives "%s")", dumpbin_exe.u8string(), lib.u8string()); System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line); - Checks::check_exit(VCPKG_LINE_INFO, - ec_data.exit_code == 0, - "Running command:\n %s\n failed", - Strings::to_utf8(cmd_line)); + Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", cmd_line); for (const BuildType& bad_build_type : bad_build_types) { @@ -654,13 +646,9 @@ namespace vcpkg::PostBuildLint for (const fs::path& dll : dlls) { - const std::wstring cmd_line = - Strings::wformat(LR"("%s" /dependents "%s")", dumpbin_exe.native(), dll.native()); + const auto cmd_line = Strings::format(R"("%s" /dependents "%s")", dumpbin_exe.u8string(), dll.u8string()); System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd_line); - Checks::check_exit(VCPKG_LINE_INFO, - ec_data.exit_code == 0, - "Running command:\n %s\n failed", - Strings::to_utf8(cmd_line)); + Checks::check_exit(VCPKG_LINE_INFO, ec_data.exit_code == 0, "Running command:\n %s\n failed", cmd_line); for (const OutdatedDynamicCrt& outdated_crt : get_outdated_dynamic_crts("v141")) { @@ -695,8 +683,8 @@ namespace vcpkg::PostBuildLint std::vector<fs::path> misplaced_files = fs.get_files_non_recursive(dir); Util::unstable_keep_if(misplaced_files, [&fs](const fs::path& path) { const std::string filename = path.filename().generic_string(); - if (Strings::case_insensitive_ascii_compare(filename.c_str(), "CONTROL") == 0 || - Strings::case_insensitive_ascii_compare(filename.c_str(), "BUILD_INFO") == 0) + if (Strings::case_insensitive_ascii_equals(filename.c_str(), "CONTROL") || + Strings::case_insensitive_ascii_equals(filename.c_str(), "BUILD_INFO")) return false; return !fs.is_directory(path); }); diff --git a/toolsrc/src/commands_remove.cpp b/toolsrc/src/vcpkg/remove.cpp index a9f1b2564..2ec32855a 100644 --- a/toolsrc/src/commands_remove.cpp +++ b/toolsrc/src/vcpkg/remove.cpp @@ -1,13 +1,16 @@ #include "pch.h" -#include "vcpkg_Commands.h" -#include "vcpkg_Dependencies.h" -#include "vcpkg_Input.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" - -namespace vcpkg::Commands::Remove +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/commands.h> +#include <vcpkg/dependencies.h> +#include <vcpkg/help.h> +#include <vcpkg/input.h> +#include <vcpkg/remove.h> +#include <vcpkg/update.h> +#include <vcpkg/vcpkglib.h> + +namespace vcpkg::Remove { using Dependencies::RemovePlanAction; using Dependencies::RemovePlanType; @@ -18,7 +21,7 @@ namespace vcpkg::Commands::Remove { auto& fs = paths.get_filesystem(); auto spghs = status_db->find_all(spec.name(), spec.triplet()); - const auto core_pkg = **status_db->find(spec.name(), spec.triplet(), Strings::EMPTY); + const auto core_pkg = **status_db->find(spec.name(), spec.triplet(), ""); for (auto&& spgh : spghs) { @@ -160,15 +163,41 @@ namespace vcpkg::Commands::Remove } } + static const std::string OPTION_PURGE = "--purge"; + static const std::string OPTION_NO_PURGE = "--no-purge"; + static const std::string OPTION_RECURSE = "--recurse"; + static const std::string OPTION_DRY_RUN = "--dry-run"; + static const std::string OPTION_OUTDATED = "--outdated"; + + static const std::array<std::string, 5> REMOVE_SWITCHES = { + OPTION_PURGE, + OPTION_NO_PURGE, + OPTION_RECURSE, + OPTION_DRY_RUN, + OPTION_OUTDATED, + }; + static const std::array<std::string, 0> REMOVE_SETTINGS; + + static std::vector<std::string> valid_arguments(const VcpkgPaths& paths) + { + const StatusParagraphs status_db = database_load_check(paths); + const std::vector<StatusParagraph*> installed_packages = get_installed_ports(status_db); + + return Util::fmap(installed_packages, [](auto&& pgh) -> std::string { return pgh->package.spec.to_string(); }); + } + + const CommandStructure COMMAND_STRUCTURE = { + "remove zlib zlib:x64-windows curl boost", + 1, + SIZE_MAX, + REMOVE_SWITCHES, + REMOVE_SETTINGS, + &valid_arguments, + }; + void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths, const Triplet& default_triplet) { - static const std::string OPTION_PURGE = "--purge"; - static const std::string OPTION_NO_PURGE = "--no-purge"; - static const std::string OPTION_RECURSE = "--recurse"; - static const std::string OPTION_DRY_RUN = "--dry-run"; - static const std::string OPTION_OUTDATED = "--outdated"; - static const std::string EXAMPLE = - Commands::Help::create_example_string("remove zlib zlib:x64-windows curl boost"); + static const std::string EXAMPLE = Help::create_example_string("remove zlib zlib:x64-windows curl boost"); const std::unordered_set<std::string> options = args.check_and_get_optional_command_arguments( {OPTION_PURGE, OPTION_NO_PURGE, OPTION_RECURSE, OPTION_DRY_RUN, OPTION_OUTDATED}); diff --git a/toolsrc/src/SourceParagraph.cpp b/toolsrc/src/vcpkg/sourceparagraph.cpp index 0f1a38d19..2a9480538 100644 --- a/toolsrc/src/SourceParagraph.cpp +++ b/toolsrc/src/vcpkg/sourceparagraph.cpp @@ -1,19 +1,19 @@ #include "pch.h" -#include "PackageSpec.h" -#include "SourceParagraph.h" -#include "Triplet.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Maps.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkg_expected.h" +#include <vcpkg/packagespec.h> +#include <vcpkg/sourceparagraph.h> +#include <vcpkg/triplet.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/expected.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> namespace vcpkg { using namespace vcpkg::Parse; - namespace Fields + namespace SourceParagraphFields { static const std::string BUILD_DEPENDS = "Build-Depends"; static const std::string DEFAULTFEATURES = "Default-Features"; @@ -28,11 +28,11 @@ namespace vcpkg static Span<const std::string> get_list_of_valid_fields() { static const std::string valid_fields[] = { - Fields::SOURCE, - Fields::VERSION, - Fields::DESCRIPTION, - Fields::MAINTAINER, - Fields::BUILD_DEPENDS, + SourceParagraphFields::SOURCE, + SourceParagraphFields::VERSION, + SourceParagraphFields::DESCRIPTION, + SourceParagraphFields::MAINTAINER, + SourceParagraphFields::BUILD_DEPENDS, }; return valid_fields; @@ -92,14 +92,15 @@ namespace vcpkg auto spgh = std::make_unique<SourceParagraph>(); - parser.required_field(Fields::SOURCE, spgh->name); - parser.required_field(Fields::VERSION, spgh->version); + parser.required_field(SourceParagraphFields::SOURCE, spgh->name); + parser.required_field(SourceParagraphFields::VERSION, spgh->version); - spgh->description = parser.optional_field(Fields::DESCRIPTION); - spgh->maintainer = parser.optional_field(Fields::MAINTAINER); - spgh->depends = expand_qualified_dependencies(parse_comma_list(parser.optional_field(Fields::BUILD_DEPENDS))); - spgh->supports = parse_comma_list(parser.optional_field(Fields::SUPPORTS)); - spgh->default_features = parse_comma_list(parser.optional_field(Fields::DEFAULTFEATURES)); + spgh->description = parser.optional_field(SourceParagraphFields::DESCRIPTION); + spgh->maintainer = parser.optional_field(SourceParagraphFields::MAINTAINER); + spgh->depends = expand_qualified_dependencies( + parse_comma_list(parser.optional_field(SourceParagraphFields::BUILD_DEPENDS))); + spgh->supports = parse_comma_list(parser.optional_field(SourceParagraphFields::SUPPORTS)); + spgh->default_features = parse_comma_list(parser.optional_field(SourceParagraphFields::DEFAULTFEATURES)); auto err = parser.error_info(spgh->name); if (err) @@ -114,10 +115,11 @@ namespace vcpkg auto fpgh = std::make_unique<FeatureParagraph>(); - parser.required_field(Fields::FEATURE, fpgh->name); - parser.required_field(Fields::DESCRIPTION, fpgh->description); + parser.required_field(SourceParagraphFields::FEATURE, fpgh->name); + parser.required_field(SourceParagraphFields::DESCRIPTION, fpgh->description); - fpgh->depends = expand_qualified_dependencies(parse_comma_list(parser.optional_field(Fields::BUILD_DEPENDS))); + fpgh->depends = expand_qualified_dependencies( + parse_comma_list(parser.optional_field(SourceParagraphFields::BUILD_DEPENDS))); auto err = parser.error_info(fpgh->name); if (err) @@ -176,11 +178,11 @@ namespace vcpkg return Strings::format("%s[%s]", this->depend.name, features); } - std::vector<Dependency> vcpkg::expand_qualified_dependencies(const std::vector<std::string>& depends) + std::vector<Dependency> expand_qualified_dependencies(const std::vector<std::string>& depends) { return Util::fmap(depends, [&](const std::string& depend_string) -> Dependency { auto pos = depend_string.find(' '); - if (pos == std::string::npos) return Dependency::parse_dependency(depend_string, Strings::EMPTY); + if (pos == std::string::npos) return Dependency::parse_dependency(depend_string, ""); // expect of the form "\w+ \[\w+\]" Dependency dep; @@ -188,7 +190,7 @@ namespace vcpkg if (depend_string.c_str()[pos + 1] != '(' || depend_string[depend_string.size() - 1] != ')') { // Error, but for now just slurp the entire string. - return Dependency::parse_dependency(depend_string, Strings::EMPTY); + return Dependency::parse_dependency(depend_string, ""); } dep.qualifier = depend_string.substr(pos + 2, depend_string.size() - pos - 3); return dep; diff --git a/toolsrc/src/StatusParagraph.cpp b/toolsrc/src/vcpkg/statusparagraph.cpp index f8ae293c2..5f00825e1 100644 --- a/toolsrc/src/StatusParagraph.cpp +++ b/toolsrc/src/vcpkg/statusparagraph.cpp @@ -1,6 +1,6 @@ #include "pch.h" -#include "StatusParagraph.h" +#include <vcpkg/statusparagraph.h> using namespace vcpkg::Parse; diff --git a/toolsrc/src/StatusParagraphs.cpp b/toolsrc/src/vcpkg/statusparagraphs.cpp index aaba95eb9..647ed6d3f 100644 --- a/toolsrc/src/StatusParagraphs.cpp +++ b/toolsrc/src/vcpkg/statusparagraphs.cpp @@ -1,8 +1,7 @@ #include "pch.h" -#include "StatusParagraphs.h" -#include "vcpkg_Checks.h" -#include <algorithm> +#include <vcpkg/base/checks.h> +#include <vcpkg/statusparagraphs.h> namespace vcpkg { diff --git a/toolsrc/src/triplet.cpp b/toolsrc/src/vcpkg/triplet.cpp index 3b56da02a..4cba1523d 100644 --- a/toolsrc/src/triplet.cpp +++ b/toolsrc/src/vcpkg/triplet.cpp @@ -1,8 +1,8 @@ #include "pch.h" -#include "Triplet.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/checks.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/triplet.h> namespace vcpkg { @@ -18,11 +18,14 @@ namespace vcpkg const TripletInstance Triplet::DEFAULT_INSTANCE({}); } -template<> -struct std::hash<vcpkg::TripletInstance> +namespace std { - size_t operator()(const vcpkg::TripletInstance& t) const { return t.hash; } -}; + template<> + struct hash<vcpkg::TripletInstance> + { + size_t operator()(const vcpkg::TripletInstance& t) const { return t.hash; } + }; +} namespace vcpkg { @@ -41,9 +44,6 @@ namespace vcpkg Triplet Triplet::from_canonical_name(const std::string& triplet_as_string) { std::string s(Strings::ascii_to_lowercase(triplet_as_string)); - const auto it = std::find(s.cbegin(), s.cend(), '-'); - Checks::check_exit(VCPKG_LINE_INFO, it != s.cend(), "Invalid triplet: %s", triplet_as_string); - const auto p = g_triplet_instances.emplace(std::move(s)); return &*p.first; } diff --git a/toolsrc/src/commands_update.cpp b/toolsrc/src/vcpkg/update.cpp index 71ea4b063..168949bc1 100644 --- a/toolsrc/src/commands_update.cpp +++ b/toolsrc/src/vcpkg/update.cpp @@ -1,11 +1,13 @@ #include "pch.h" -#include "Paragraphs.h" -#include "vcpkg_Commands.h" -#include "vcpkg_System.h" -#include "vcpkglib.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/help.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/update.h> +#include <vcpkg/vcpkglib.h> -namespace vcpkg::Commands::Update +namespace vcpkg::Update { bool OutdatedPackage::compare_by_name(const OutdatedPackage& left, const OutdatedPackage& right) { diff --git a/toolsrc/src/VcpkgCmdArguments.cpp b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp index cb261930e..209f6a3f2 100644 --- a/toolsrc/src/VcpkgCmdArguments.cpp +++ b/toolsrc/src/vcpkg/vcpkgcmdarguments.cpp @@ -1,10 +1,11 @@ #include "pch.h" -#include "VcpkgCmdArguments.h" -#include "metrics.h" -#include "vcpkg_Commands.h" -#include "vcpkg_GlobalState.h" -#include "vcpkg_System.h" +#include <vcpkg/base/system.h> +#include <vcpkg/commands.h> +#include <vcpkg/globalstate.h> +#include <vcpkg/help.h> +#include <vcpkg/metrics.h> +#include <vcpkg/vcpkgcmdarguments.h> namespace vcpkg { @@ -17,7 +18,7 @@ namespace vcpkg { System::println(System::Color::error, "Error: expected value after %s", option_name); Metrics::g_metrics.lock()->track_property("error", "error option name"); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -25,7 +26,7 @@ namespace vcpkg { System::println(System::Color::error, "Error: %s specified multiple times", option_name); Metrics::g_metrics.lock()->track_property("error", "error option specified multiple times"); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -38,18 +39,26 @@ namespace vcpkg { System::println(System::Color::error, "Error: conflicting values specified for --%s", option_name); Metrics::g_metrics.lock()->track_property("error", "error conflicting switches"); - Commands::Help::print_usage(); + Help::print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); } option_field = new_setting; } +#if defined(_WIN32) VcpkgCmdArguments VcpkgCmdArguments::create_from_command_line(const int argc, const wchar_t* const* const argv) +#else + VcpkgCmdArguments VcpkgCmdArguments::create_from_command_line(const int argc, const char* const* const argv) +#endif { std::vector<std::string> v; for (int i = 1; i < argc; ++i) { +#if defined(_WIN32) v.push_back(Strings::to_utf8(argv[i])); +#else + v.push_back(argv[i]); +#endif } return VcpkgCmdArguments::create_from_arg_sequence(v.data(), v.data() + v.size()); @@ -222,17 +231,17 @@ namespace vcpkg void VcpkgCmdArguments::check_max_arg_count(const size_t expected_arg_count) const { - return check_max_arg_count(expected_arg_count, Strings::EMPTY); + return check_max_arg_count(expected_arg_count, ""); } void VcpkgCmdArguments::check_min_arg_count(const size_t expected_arg_count) const { - return check_min_arg_count(expected_arg_count, Strings::EMPTY); + return check_min_arg_count(expected_arg_count, ""); } void VcpkgCmdArguments::check_exact_arg_count(const size_t expected_arg_count) const { - return check_exact_arg_count(expected_arg_count, Strings::EMPTY); + return check_exact_arg_count(expected_arg_count, ""); } void VcpkgCmdArguments::check_max_arg_count(const size_t expected_arg_count, const std::string& example_text) const diff --git a/toolsrc/src/vcpkglib.cpp b/toolsrc/src/vcpkg/vcpkglib.cpp index 5cdafdbc8..38b130f6f 100644 --- a/toolsrc/src/vcpkglib.cpp +++ b/toolsrc/src/vcpkg/vcpkglib.cpp @@ -1,11 +1,11 @@ #include "pch.h" -#include "Paragraphs.h" -#include "metrics.h" -#include "vcpkg_Files.h" -#include "vcpkg_Strings.h" -#include "vcpkg_Util.h" -#include "vcpkglib.h" +#include <vcpkg/base/files.h> +#include <vcpkg/base/strings.h> +#include <vcpkg/base/util.h> +#include <vcpkg/metrics.h> +#include <vcpkg/paragraphs.h> +#include <vcpkg/vcpkglib.h> namespace vcpkg { @@ -212,30 +212,26 @@ namespace vcpkg return installed_files; } - CMakeVariable::CMakeVariable(const CWStringView varname, const wchar_t* varvalue) - : s(Strings::wformat(LR"("-D%s=%s")", varname, varvalue)) + CMakeVariable::CMakeVariable(const CStringView varname, const char* varvalue) + : s(Strings::format(R"("-D%s=%s")", varname, varvalue)) { } - CMakeVariable::CMakeVariable(const CWStringView varname, const std::string& varvalue) - : CMakeVariable(varname, Strings::to_utf16(varvalue).c_str()) - { - } - CMakeVariable::CMakeVariable(const CWStringView varname, const std::wstring& varvalue) + CMakeVariable::CMakeVariable(const CStringView varname, const std::string& varvalue) : CMakeVariable(varname, varvalue.c_str()) { } - CMakeVariable::CMakeVariable(const CWStringView varname, const fs::path& path) - : CMakeVariable(varname, path.generic_wstring()) + CMakeVariable::CMakeVariable(const CStringView varname, const fs::path& path) + : CMakeVariable(varname, path.generic_u8string()) { } - std::wstring make_cmake_cmd(const fs::path& cmake_exe, - const fs::path& cmake_script, - const std::vector<CMakeVariable>& pass_variables) + std::string make_cmake_cmd(const fs::path& cmake_exe, + const fs::path& cmake_script, + const std::vector<CMakeVariable>& pass_variables) { - const std::wstring cmd_cmake_pass_variables = Strings::join(L" ", pass_variables, [](auto&& v) { return v.s; }); - return Strings::wformat( - LR"("%s" %s -P "%s")", cmake_exe.native(), cmd_cmake_pass_variables, cmake_script.generic_wstring()); + const std::string cmd_cmake_pass_variables = Strings::join(" ", pass_variables, [](auto&& v) { return v.s; }); + return Strings::format( + R"("%s" %s -P "%s")", cmake_exe.u8string(), cmd_cmake_pass_variables, cmake_script.generic_u8string()); } std::string shorten_text(const std::string& desc, size_t length) diff --git a/toolsrc/src/VcpkgPaths.cpp b/toolsrc/src/vcpkg/vcpkgpaths.cpp index d14002e47..90f9cb00b 100644 --- a/toolsrc/src/VcpkgPaths.cpp +++ b/toolsrc/src/vcpkg/vcpkgpaths.cpp @@ -1,25 +1,25 @@ #include "pch.h" -#include "PackageSpec.h" -#include "VcpkgPaths.h" -#include "metrics.h" -#include "vcpkg_Files.h" -#include "vcpkg_System.h" -#include "vcpkg_Util.h" -#include "vcpkg_expected.h" +#include <vcpkg/base/expected.h> +#include <vcpkg/base/files.h> +#include <vcpkg/base/system.h> +#include <vcpkg/base/util.h> +#include <vcpkg/metrics.h> +#include <vcpkg/packagespec.h> +#include <vcpkg/vcpkgpaths.h> namespace vcpkg { - static constexpr CWStringView V_120 = L"v120"; - static constexpr CWStringView V_140 = L"v140"; - static constexpr CWStringView V_141 = L"v141"; + static constexpr CStringView V_120 = "v120"; + static constexpr CStringView V_140 = "v140"; + static constexpr CStringView V_141 = "v141"; - static bool exists_and_has_equal_or_greater_version(const std::wstring& version_cmd, + static bool exists_and_has_equal_or_greater_version(const std::string& version_cmd, const std::array<int, 3>& expected_version) { static const std::regex RE(R"###((\d+)\.(\d+)\.(\d+))###"); - const auto rc = System::cmd_execute_and_capture_output(Strings::wformat(LR"(%s)", version_cmd)); + const auto rc = System::cmd_execute_and_capture_output(Strings::format(R"(%s)", version_cmd)); if (rc.exit_code != 0) { return false; @@ -46,11 +46,11 @@ namespace vcpkg } static Optional<fs::path> find_if_has_equal_or_greater_version(const std::vector<fs::path>& candidate_paths, - const std::wstring& version_check_arguments, + const std::string& version_check_arguments, const std::array<int, 3>& expected_version) { auto it = Util::find_if(candidate_paths, [&](const fs::path& p) { - const std::wstring cmd = Strings::wformat(LR"("%s" %s)", p.native(), version_check_arguments); + const std::string cmd = Strings::format(R"("%s" %s)", p.u8string(), version_check_arguments); return exists_and_has_equal_or_greater_version(cmd, expected_version); }); @@ -63,27 +63,26 @@ namespace vcpkg } static fs::path fetch_dependency(const fs::path& scripts_folder, - const std::wstring& tool_name, + const std::string& tool_name, const fs::path& expected_downloaded_path, const std::array<int, 3>& version) { - const std::string tool_name_utf8 = Strings::to_utf8(tool_name); const std::string version_as_string = Strings::format("%d.%d.%d", version[0], version[1], version[2]); System::println("A suitable version of %s was not found (required v%s). Downloading portable %s v%s...", - tool_name_utf8, + tool_name, version_as_string, - tool_name_utf8, + tool_name, version_as_string); const fs::path script = scripts_folder / "fetchDependency.ps1"; const auto install_cmd = - System::create_powershell_script_cmd(script, Strings::wformat(L"-Dependency %s", tool_name)); + System::create_powershell_script_cmd(script, Strings::format("-Dependency %s", tool_name)); const System::ExitCodeAndOutput rc = System::cmd_execute_and_capture_output(install_cmd); if (rc.exit_code) { System::println(System::Color::error, "Launching powershell failed or was denied when trying to fetch %s version %s.\n" "(No sufficient installed version was found)", - tool_name_utf8, + tool_name, version_as_string); { auto locked_metrics = Metrics::g_metrics.lock(); @@ -107,16 +106,18 @@ namespace vcpkg static fs::path get_cmake_path(const fs::path& downloads_folder, const fs::path& scripts_folder) { static constexpr std::array<int, 3> EXPECTED_VERSION = {3, 9, 3}; - static const std::wstring VERSION_CHECK_ARGUMENTS = L"--version"; + static const std::string VERSION_CHECK_ARGUMENTS = "--version"; const fs::path downloaded_copy = downloads_folder / "cmake-3.9.3-win32-x86" / "bin" / "cmake.exe"; - const std::vector<fs::path> from_path = Files::find_from_PATH(L"cmake"); + const std::vector<fs::path> from_path = Files::find_from_PATH("cmake"); std::vector<fs::path> candidate_paths; candidate_paths.push_back(downloaded_copy); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); +#if defined(_WIN32) candidate_paths.push_back(System::get_program_files_platform_bitness() / "CMake" / "bin" / "cmake.exe"); candidate_paths.push_back(System::get_program_files_32_bit() / "CMake" / "bin"); +#endif const Optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, EXPECTED_VERSION); @@ -125,43 +126,44 @@ namespace vcpkg return *p; } - return fetch_dependency(scripts_folder, L"cmake", downloaded_copy, EXPECTED_VERSION); + return fetch_dependency(scripts_folder, "cmake", downloaded_copy, EXPECTED_VERSION); } fs::path get_nuget_path(const fs::path& downloads_folder, const fs::path& scripts_folder) { static constexpr std::array<int, 3> EXPECTED_VERSION = {4, 3, 0}; - static const std::wstring VERSION_CHECK_ARGUMENTS = Strings::WEMPTY; const fs::path downloaded_copy = downloads_folder / "nuget-4.3.0" / "nuget.exe"; - const std::vector<fs::path> from_path = Files::find_from_PATH(L"nuget"); + const std::vector<fs::path> from_path = Files::find_from_PATH("nuget"); std::vector<fs::path> candidate_paths; candidate_paths.push_back(downloaded_copy); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); - auto path = find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, EXPECTED_VERSION); + auto path = find_if_has_equal_or_greater_version(candidate_paths, "", EXPECTED_VERSION); if (const auto p = path.get()) { return *p; } - return fetch_dependency(scripts_folder, L"nuget", downloaded_copy, EXPECTED_VERSION); + return fetch_dependency(scripts_folder, "nuget", downloaded_copy, EXPECTED_VERSION); } fs::path get_git_path(const fs::path& downloads_folder, const fs::path& scripts_folder) { static constexpr std::array<int, 3> EXPECTED_VERSION = {2, 14, 1}; - static const std::wstring VERSION_CHECK_ARGUMENTS = L"--version"; + static const std::string VERSION_CHECK_ARGUMENTS = "--version"; const fs::path downloaded_copy = downloads_folder / "MinGit-2.14.1-32-bit" / "cmd" / "git.exe"; - const std::vector<fs::path> from_path = Files::find_from_PATH(L"git"); + const std::vector<fs::path> from_path = Files::find_from_PATH("git"); std::vector<fs::path> candidate_paths; candidate_paths.push_back(downloaded_copy); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); +#if defined(_WIN32) candidate_paths.push_back(System::get_program_files_platform_bitness() / "git" / "cmd" / "git.exe"); candidate_paths.push_back(System::get_program_files_32_bit() / "git" / "cmd" / "git.exe"); +#endif const Optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, VERSION_CHECK_ARGUMENTS, EXPECTED_VERSION); @@ -170,13 +172,13 @@ namespace vcpkg return *p; } - return fetch_dependency(scripts_folder, L"git", downloaded_copy, EXPECTED_VERSION); + return fetch_dependency(scripts_folder, "git", downloaded_copy, EXPECTED_VERSION); } static fs::path get_ifw_installerbase_path(const fs::path& downloads_folder, const fs::path& scripts_folder) { static constexpr std::array<int, 3> EXPECTED_VERSION = {3, 1, 81}; - static const std::wstring VERSION_CHECK_ARGUMENTS = L"--framework-version"; + static const std::string VERSION_CHECK_ARGUMENTS = "--framework-version"; const fs::path downloaded_copy = downloads_folder / "QtInstallerFramework-win-x86" / "bin" / "installerbase.exe"; @@ -184,11 +186,11 @@ namespace vcpkg std::vector<fs::path> candidate_paths; candidate_paths.push_back(downloaded_copy); // TODO: Uncomment later - // const std::vector<fs::path> from_path = Files::find_from_PATH(L"installerbase"); + // const std::vector<fs::path> from_path = Files::find_from_PATH("installerbase"); // candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); - // candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" / + // candidate_paths.push_back(fs::path(System::get_environment_variable("HOMEDRIVE").value_or("C:")) / "Qt" / // "Tools" / "QtInstallerFramework" / "3.1" / "bin" / "installerbase.exe"); - // candidate_paths.push_back(fs::path(System::get_environment_variable(L"HOMEDRIVE").value_or("C:")) / "Qt" / + // candidate_paths.push_back(fs::path(System::get_environment_variable("HOMEDRIVE").value_or("C:")) / "Qt" / // "QtIFW-3.1.0" / "bin" / "installerbase.exe"); const Optional<fs::path> path = @@ -198,7 +200,7 @@ namespace vcpkg return *p; } - return fetch_dependency(scripts_folder, L"installerbase", downloaded_copy, EXPECTED_VERSION); + return fetch_dependency(scripts_folder, "installerbase", downloaded_copy, EXPECTED_VERSION); } Expected<VcpkgPaths> VcpkgPaths::create(const fs::path& vcpkg_root_dir) @@ -255,18 +257,25 @@ namespace vcpkg return this->vcpkg_dir_info / (pgh.fullstem() + ".list"); } - bool VcpkgPaths::is_valid_triplet(const Triplet& t) const + const std::vector<std::string>& VcpkgPaths::get_available_triplets() const { - for (auto&& path : get_filesystem().get_files_non_recursive(this->triplets)) - { - const std::string triplet_file_name = path.stem().generic_u8string(); - if (t.canonical_name() == triplet_file_name) // TODO: fuzzy compare + return this->available_triplets.get_lazy([this]() -> std::vector<std::string> { + + std::vector<std::string> output; + for (auto&& path : this->get_filesystem().get_files_non_recursive(this->triplets)) { - // t.value = triplet_file_name; // NOTE: uncomment when implementing fuzzy compare - return true; + output.push_back(path.stem().filename().string()); } - } - return false; + + return output; + }); + } + + bool VcpkgPaths::is_valid_triplet(const Triplet& t) const + { + auto it = Util::find_if(this->get_available_triplets(), + [&](auto&& available_triplet) { return t.canonical_name() == available_triplet; }); + return it != this->get_available_triplets().cend(); } const fs::path& VcpkgPaths::get_cmake_exe() const @@ -315,7 +324,7 @@ namespace vcpkg static std::vector<VisualStudioInstance> get_visual_studio_instances(const VcpkgPaths& paths) { const fs::path script = paths.scripts / "findVisualStudioInstallationInstances.ps1"; - const std::wstring cmd = System::create_powershell_script_cmd(script); + const std::string cmd = System::create_powershell_script_cmd(script); const System::ExitCodeAndOutput ec_data = System::cmd_execute_and_capture_output(cmd); Checks::check_exit( VCPKG_LINE_INFO, ec_data.exit_code == 0, "Could not run script to detect Visual Studio instances"); @@ -363,17 +372,21 @@ namespace vcpkg // Get all supported architectures std::vector<ToolsetArchOption> supported_architectures; if (fs.exists(vcvarsall_dir / "vcvars32.bat")) - supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); + supported_architectures.push_back({"x86", CPU::X86, CPU::X86}); if (fs.exists(vcvarsall_dir / "vcvars64.bat")) - supported_architectures.push_back({L"amd64", CPU::X64, CPU::X64}); + supported_architectures.push_back({"amd64", CPU::X64, CPU::X64}); if (fs.exists(vcvarsall_dir / "vcvarsx86_amd64.bat")) - supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + supported_architectures.push_back({"x86_amd64", CPU::X86, CPU::X64}); if (fs.exists(vcvarsall_dir / "vcvarsx86_arm.bat")) - supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + supported_architectures.push_back({"x86_arm", CPU::X86, CPU::ARM}); + if (fs.exists(vcvarsall_dir / "vcvarsx86_arm64.bat")) + supported_architectures.push_back({"x86_arm64", CPU::X86, CPU::ARM64}); if (fs.exists(vcvarsall_dir / "vcvarsamd64_x86.bat")) - supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + supported_architectures.push_back({"amd64_x86", CPU::X64, CPU::X86}); if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm.bat")) - supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); + supported_architectures.push_back({"amd64_arm", CPU::X64, CPU::ARM}); + if (fs.exists(vcvarsall_dir / "vcvarsamd64_arm64.bat")) + supported_architectures.push_back({"amd64_arm64", CPU::X64, CPU::ARM64}); // Locate the "best" MSVC toolchain version const fs::path msvc_path = vc_dir / "Tools" / "MSVC"; @@ -401,7 +414,7 @@ namespace vcpkg found_toolsets.push_back(Toolset{vs_instance.root_path, dumpbin_path, vcvarsall_bat, - {L"-vcvars_ver=14.0"}, + {"-vcvars_ver=14.0"}, V_140, supported_architectures}); } @@ -426,17 +439,17 @@ namespace vcpkg const fs::path vs2015_bin_dir = vcvarsall_bat.parent_path() / "bin"; std::vector<ToolsetArchOption> supported_architectures; if (fs.exists(vs2015_bin_dir / "vcvars32.bat")) - supported_architectures.push_back({L"x86", CPU::X86, CPU::X86}); + supported_architectures.push_back({"x86", CPU::X86, CPU::X86}); if (fs.exists(vs2015_bin_dir / "amd64\\vcvars64.bat")) - supported_architectures.push_back({L"x64", CPU::X64, CPU::X64}); + supported_architectures.push_back({"x64", CPU::X64, CPU::X64}); if (fs.exists(vs2015_bin_dir / "x86_amd64\\vcvarsx86_amd64.bat")) - supported_architectures.push_back({L"x86_amd64", CPU::X86, CPU::X64}); + supported_architectures.push_back({"x86_amd64", CPU::X86, CPU::X64}); if (fs.exists(vs2015_bin_dir / "x86_arm\\vcvarsx86_arm.bat")) - supported_architectures.push_back({L"x86_arm", CPU::X86, CPU::ARM}); + supported_architectures.push_back({"x86_arm", CPU::X86, CPU::ARM}); if (fs.exists(vs2015_bin_dir / "amd64_x86\\vcvarsamd64_x86.bat")) - supported_architectures.push_back({L"amd64_x86", CPU::X64, CPU::X86}); + supported_architectures.push_back({"amd64_x86", CPU::X64, CPU::X86}); if (fs.exists(vs2015_bin_dir / "amd64_arm\\vcvarsamd64_arm.bat")) - supported_architectures.push_back({L"amd64_arm", CPU::X64, CPU::ARM}); + supported_architectures.push_back({"amd64_arm", CPU::X64, CPU::ARM}); if (fs.exists(vs2015_dumpbin_exe)) { @@ -478,15 +491,12 @@ namespace vcpkg if (tsv && vsp) { - const std::wstring w_toolset_version = Strings::to_utf16(*tsv); - const fs::path vs_root_path = *vsp; - Util::stable_keep_if(candidates, [&](const Toolset* t) { - return w_toolset_version == t->version && vs_root_path == t->visual_studio_root_path; - }); + Util::stable_keep_if( + candidates, [&](const Toolset* t) { return *tsv == t->version && *vsp == t->visual_studio_root_path; }); Checks::check_exit(VCPKG_LINE_INFO, !candidates.empty(), "Could not find Visual Studio instace at %s with %s toolset.", - vs_root_path.generic_string(), + vsp->u8string(), *tsv); Checks::check_exit(VCPKG_LINE_INFO, candidates.size() == 1); @@ -495,8 +505,7 @@ namespace vcpkg if (tsv) { - const std::wstring w_toolset_version = Strings::to_utf16(*tsv); - Util::stable_keep_if(candidates, [&](const Toolset* t) { return w_toolset_version == t->version; }); + Util::stable_keep_if(candidates, [&](const Toolset* t) { return *tsv == t->version; }); Checks::check_exit( VCPKG_LINE_INFO, !candidates.empty(), "Could not find Visual Studio instace with %s toolset.", *tsv); } diff --git a/toolsrc/src/VersionT.cpp b/toolsrc/src/vcpkg/versiont.cpp index 738d2ce88..1c52d674a 100644 --- a/toolsrc/src/VersionT.cpp +++ b/toolsrc/src/vcpkg/versiont.cpp @@ -1,7 +1,7 @@ #include "pch.h" -#include "VersionT.h" -#include "vcpkg_Strings.h" +#include <vcpkg/base/strings.h> +#include <vcpkg/versiont.h> namespace vcpkg { diff --git a/toolsrc/src/vcpkg_Build_BuildPolicy.cpp b/toolsrc/src/vcpkg_Build_BuildPolicy.cpp deleted file mode 100644 index b3bb778dc..000000000 --- a/toolsrc/src/vcpkg_Build_BuildPolicy.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "pch.h" - -#include "vcpkg_Build.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Enums.h" - -namespace vcpkg::Build -{ - static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage"; - static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs"; - static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT"; - static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder"; - static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt"; - - const std::string& to_string(BuildPolicy policy) - { - switch (policy) - { - case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE; - case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS; - case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT; - case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER; - case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - } - - CStringView to_cmake_variable(BuildPolicy policy) - { - switch (policy) - { - case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE"; - case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS"; - case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT"; - case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER"; - case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT"; - default: Checks::unreachable(VCPKG_LINE_INFO); - } - } -} diff --git a/toolsrc/src/vcpkg_GlobalState.cpp b/toolsrc/src/vcpkg_GlobalState.cpp deleted file mode 100644 index 2221222c0..000000000 --- a/toolsrc/src/vcpkg_GlobalState.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "pch.h" - -#include "vcpkg_GlobalState.h" - -namespace vcpkg -{ - Util::LockGuarded<ElapsedTime> GlobalState::timer; - std::atomic<bool> GlobalState::debugging = false; - std::atomic<bool> GlobalState::feature_packages = false; - - std::atomic<int> GlobalState::g_init_console_cp = 0; - std::atomic<int> GlobalState::g_init_console_output_cp = 0; -} diff --git a/toolsrc/src/vcpkg_metrics_uploader.cpp b/toolsrc/src/vcpkgmetricsuploader.cpp index cef4f4756..2239fe750 100644 --- a/toolsrc/src/vcpkg_metrics_uploader.cpp +++ b/toolsrc/src/vcpkgmetricsuploader.cpp @@ -1,6 +1,8 @@ -#include "metrics.h" -#include "vcpkg_Checks.h" -#include "vcpkg_Files.h" +#include <vcpkg/metrics.h> + +#include <vcpkg/base/checks.h> +#include <vcpkg/base/files.h> + #include <Windows.h> using namespace vcpkg; diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj b/toolsrc/vcpkglib/vcpkglib.vcxproj index 3bb945e85..ae332e015 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj @@ -136,114 +136,114 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="..\include\BinaryParagraph.h" /> - <ClInclude Include="..\include\CStringView.h" /> - <ClInclude Include="..\include\lazy.h" /> - <ClInclude Include="..\include\LineInfo.h" /> - <ClInclude Include="..\include\ParagraphParseResult.h" /> - <ClInclude Include="..\include\PostBuildLint_BuildType.h" /> - <ClInclude Include="..\include\Span.h" /> - <ClInclude Include="..\include\vcpkg_Build.h" /> - <ClInclude Include="..\include\coff_file_reader.h" /> - <ClInclude Include="..\include\vcpkg_expected.h" /> - <ClInclude Include="..\include\filesystem_fs.h" /> - <ClInclude Include="..\include\SortedVector.h" /> - <ClInclude Include="..\include\MachineType.h" /> - <ClInclude Include="..\include\metrics.h" /> - <ClInclude Include="..\include\PackageSpec.h" /> - <ClInclude Include="..\include\PackageSpecParseResult.h" /> - <ClInclude Include="..\include\Paragraphs.h" /> <ClInclude Include="..\include\pch.h" /> - <ClInclude Include="..\include\PostBuildLint.h" /> - <ClInclude Include="..\include\SourceParagraph.h" /> - <ClInclude Include="..\include\StatusParagraph.h" /> - <ClInclude Include="..\include\StatusParagraphs.h" /> - <ClInclude Include="..\include\vcpkg_Chrono.h" /> - <ClInclude Include="..\include\triplet.h" /> - <ClInclude Include="..\include\vcpkglib.h" /> - <ClInclude Include="..\include\vcpkg_GlobalState.h" /> - <ClInclude Include="..\include\vcpkg_Parse.h" /> - <ClInclude Include="..\include\vcpkg_Checks.h" /> - <ClInclude Include="..\include\VcpkgCmdArguments.h" /> - <ClInclude Include="..\include\vcpkg_Commands.h" /> - <ClInclude Include="..\include\vcpkg_Commands_Export.h" /> - <ClInclude Include="..\include\vcpkg_Commands_Export_IFW.h" /> - <ClInclude Include="..\include\vcpkg_Dependencies.h" /> - <ClInclude Include="..\include\vcpkg_Enums.h" /> - <ClInclude Include="..\include\vcpkg_Files.h" /> - <ClInclude Include="..\include\vcpkg_Graphs.h" /> - <ClInclude Include="..\include\vcpkg_Input.h" /> - <ClInclude Include="..\include\vcpkg_Maps.h" /> - <ClInclude Include="..\include\vcpkg_optional.h" /> - <ClInclude Include="..\include\VcpkgPaths.h" /> - <ClInclude Include="..\include\vcpkg_Strings.h" /> - <ClInclude Include="..\include\vcpkg_System.h" /> - <ClInclude Include="..\include\vcpkg_Util.h" /> - <ClInclude Include="..\include\VersionT.h" /> + <ClInclude Include="..\include\vcpkg\base\checks.h" /> + <ClInclude Include="..\include\vcpkg\base\chrono.h" /> + <ClInclude Include="..\include\vcpkg\base\cofffilereader.h" /> + <ClInclude Include="..\include\vcpkg\base\cstringview.h" /> + <ClInclude Include="..\include\vcpkg\base\enums.h" /> + <ClInclude Include="..\include\vcpkg\base\expected.h" /> + <ClInclude Include="..\include\vcpkg\base\files.h" /> + <ClInclude Include="..\include\vcpkg\base\graphs.h" /> + <ClInclude Include="..\include\vcpkg\base\lazy.h" /> + <ClInclude Include="..\include\vcpkg\base\lineinfo.h" /> + <ClInclude Include="..\include\vcpkg\base\machinetype.h" /> + <ClInclude Include="..\include\vcpkg\base\optional.h" /> + <ClInclude Include="..\include\vcpkg\base\sortedvector.h" /> + <ClInclude Include="..\include\vcpkg\base\span.h" /> + <ClInclude Include="..\include\vcpkg\base\strings.h" /> + <ClInclude Include="..\include\vcpkg\base\system.h" /> + <ClInclude Include="..\include\vcpkg\base\util.h" /> + <ClInclude Include="..\include\vcpkg\binaryparagraph.h" /> + <ClInclude Include="..\include\vcpkg\build.h" /> + <ClInclude Include="..\include\vcpkg\commands.h" /> + <ClInclude Include="..\include\vcpkg\dependencies.h" /> + <ClInclude Include="..\include\vcpkg\export.h" /> + <ClInclude Include="..\include\vcpkg\export.ifw.h" /> + <ClInclude Include="..\include\vcpkg\globalstate.h" /> + <ClInclude Include="..\include\vcpkg\help.h" /> + <ClInclude Include="..\include\vcpkg\input.h" /> + <ClInclude Include="..\include\vcpkg\install.h" /> + <ClInclude Include="..\include\vcpkg\metrics.h" /> + <ClInclude Include="..\include\vcpkg\packagespec.h" /> + <ClInclude Include="..\include\vcpkg\packagespecparseresult.h" /> + <ClInclude Include="..\include\vcpkg\paragraphparseresult.h" /> + <ClInclude Include="..\include\vcpkg\paragraphs.h" /> + <ClInclude Include="..\include\vcpkg\parse.h" /> + <ClInclude Include="..\include\vcpkg\postbuildlint.h" /> + <ClInclude Include="..\include\vcpkg\postbuildlint.buildtype.h" /> + <ClInclude Include="..\include\vcpkg\remove.h" /> + <ClInclude Include="..\include\vcpkg\sourceparagraph.h" /> + <ClInclude Include="..\include\vcpkg\statusparagraph.h" /> + <ClInclude Include="..\include\vcpkg\statusparagraphs.h" /> + <ClInclude Include="..\include\vcpkg\triplet.h" /> + <ClInclude Include="..\include\vcpkg\update.h" /> + <ClInclude Include="..\include\vcpkg\vcpkgcmdarguments.h" /> + <ClInclude Include="..\include\vcpkg\vcpkglib.h" /> + <ClInclude Include="..\include\vcpkg\vcpkgpaths.h" /> + <ClInclude Include="..\include\vcpkg\versiont.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\BinaryParagraph.cpp" /> - <ClCompile Include="..\src\commands_autocomplete.cpp" /> - <ClCompile Include="..\src\commands_ci.cpp" /> - <ClCompile Include="..\src\commands_depends.cpp" /> - <ClCompile Include="..\src\commands_env.cpp" /> - <ClCompile Include="..\src\commands_export.cpp" /> - <ClCompile Include="..\src\commands_export_ifw.cpp" /> - <ClCompile Include="..\src\LineInfo.cpp" /> - <ClCompile Include="..\src\ParagraphParseResult.cpp" /> - <ClCompile Include="..\src\vcpkg_Build.cpp" /> - <ClCompile Include="..\src\vcpkg_Build_BuildPolicy.cpp" /> - <ClCompile Include="..\src\coff_file_reader.cpp" /> - <ClCompile Include="..\src\commands_available_commands.cpp" /> - <ClCompile Include="..\src\commands_build.cpp" /> - <ClCompile Include="..\src\commands_build_external.cpp" /> - <ClCompile Include="..\src\commands_cache.cpp" /> - <ClCompile Include="..\src\commands_contact.cpp" /> - <ClCompile Include="..\src\commands_create.cpp" /> - <ClCompile Include="..\src\commands_edit.cpp" /> - <ClCompile Include="..\src\commands_hash.cpp" /> - <ClCompile Include="..\src\commands_help.cpp" /> - <ClCompile Include="..\src\commands_import.cpp" /> - <ClCompile Include="..\src\commands_install.cpp" /> - <ClCompile Include="..\src\commands_integrate.cpp" /> - <ClCompile Include="..\src\commands_list.cpp" /> - <ClCompile Include="..\src\commands_owns.cpp" /> - <ClCompile Include="..\src\commands_portsdiff.cpp" /> - <ClCompile Include="..\src\commands_remove.cpp" /> - <ClCompile Include="..\src\commands_search.cpp" /> - <ClCompile Include="..\src\commands_update.cpp" /> - <ClCompile Include="..\src\commands_version.cpp" /> - <ClCompile Include="..\src\MachineType.cpp" /> - <ClCompile Include="..\src\metrics.cpp" /> <ClCompile Include="..\src\pch.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> </ClCompile> - <ClCompile Include="..\src\PostBuildLint.cpp" /> - <ClCompile Include="..\src\PostBuildLint_BuildType.cpp" /> - <ClCompile Include="..\src\vcpkg_Chrono.cpp" /> - <ClCompile Include="..\src\vcpkglib.cpp" /> - <ClCompile Include="..\src\PackageSpec.cpp" /> - <ClCompile Include="..\src\PackageSpecParseResult.cpp" /> - <ClCompile Include="..\src\Paragraphs.cpp" /> - <ClCompile Include="..\src\SourceParagraph.cpp" /> - <ClCompile Include="..\src\StatusParagraph.cpp" /> - <ClCompile Include="..\src\StatusParagraphs.cpp" /> - <ClCompile Include="..\src\triplet.cpp" /> - <ClCompile Include="..\src\vcpkg_GlobalState.cpp" /> - <ClCompile Include="..\src\vcpkg_Parse.cpp" /> - <ClCompile Include="..\src\vcpkg_Checks.cpp" /> - <ClCompile Include="..\src\VcpkgCmdArguments.cpp" /> - <ClCompile Include="..\src\vcpkg_Dependencies.cpp" /> - <ClCompile Include="..\src\vcpkg_Enums.cpp" /> - <ClCompile Include="..\src\vcpkg_Files.cpp" /> - <ClCompile Include="..\src\vcpkg_Input.cpp" /> - <ClCompile Include="..\src\VcpkgPaths.cpp" /> - <ClCompile Include="..\src\vcpkg_Strings.cpp" /> - <ClCompile Include="..\src\vcpkg_System.cpp" /> - <ClCompile Include="..\src\VersionT.cpp" /> + <ClCompile Include="..\src\vcpkg\base\checks.cpp" /> + <ClCompile Include="..\src\vcpkg\base\chrono.cpp" /> + <ClCompile Include="..\src\vcpkg\base\cofffilereader.cpp" /> + <ClCompile Include="..\src\vcpkg\base\enums.cpp" /> + <ClCompile Include="..\src\vcpkg\base\files.cpp" /> + <ClCompile Include="..\src\vcpkg\base\lineinfo.cpp" /> + <ClCompile Include="..\src\vcpkg\base\machinetype.cpp" /> + <ClCompile Include="..\src\vcpkg\base\strings.cpp" /> + <ClCompile Include="..\src\vcpkg\base\system.cpp" /> + <ClCompile Include="..\src\vcpkg\binaryparagraph.cpp" /> + <ClCompile Include="..\src\vcpkg\build.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.autocomplete.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.buildexternal.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.cache.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.ci.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.contact.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.create.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.dependinfo.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.edit.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.env.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.exportifw.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.hash.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.import.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.integrate.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.list.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.owns.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.portsdiff.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.search.cpp" /> + <ClCompile Include="..\src\vcpkg\commands.version.cpp" /> + <ClCompile Include="..\src\vcpkg\dependencies.cpp" /> + <ClCompile Include="..\src\vcpkg\export.cpp" /> + <ClCompile Include="..\src\vcpkg\globalstate.cpp" /> + <ClCompile Include="..\src\vcpkg\help.cpp" /> + <ClCompile Include="..\src\vcpkg\input.cpp" /> + <ClCompile Include="..\src\vcpkg\install.cpp" /> + <ClCompile Include="..\src\vcpkg\metrics.cpp" /> + <ClCompile Include="..\src\vcpkg\packagespec.cpp" /> + <ClCompile Include="..\src\vcpkg\packagespecparseresult.cpp" /> + <ClCompile Include="..\src\vcpkg\paragraphparseresult.cpp" /> + <ClCompile Include="..\src\vcpkg\paragraphs.cpp" /> + <ClCompile Include="..\src\vcpkg\parse.cpp" /> + <ClCompile Include="..\src\vcpkg\postbuildlint.buildtype.cpp" /> + <ClCompile Include="..\src\vcpkg\postbuildlint.cpp" /> + <ClCompile Include="..\src\vcpkg\remove.cpp" /> + <ClCompile Include="..\src\vcpkg\sourceparagraph.cpp" /> + <ClCompile Include="..\src\vcpkg\statusparagraph.cpp" /> + <ClCompile Include="..\src\vcpkg\statusparagraphs.cpp" /> + <ClCompile Include="..\src\vcpkg\triplet.cpp" /> + <ClCompile Include="..\src\vcpkg\update.cpp" /> + <ClCompile Include="..\src\vcpkg\vcpkgcmdarguments.cpp" /> + <ClCompile Include="..\src\vcpkg\vcpkglib.cpp" /> + <ClCompile Include="..\src\vcpkg\vcpkgpaths.cpp" /> + <ClCompile Include="..\src\vcpkg\versiont.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters index 918f83b0a..e902bffbb 100644 --- a/toolsrc/vcpkglib/vcpkglib.vcxproj.filters +++ b/toolsrc/vcpkglib/vcpkglib.vcxproj.filters @@ -13,312 +13,324 @@ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> </Filter> + <Filter Include="Header Files\vcpkg"> + <UniqueIdentifier>{69f6b6e6-5ac4-4419-a256-b8a6b0392720}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\vcpkg\base"> + <UniqueIdentifier>{4a229410-0d09-4dab-953b-f434d6483f96}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\vcpkg"> + <UniqueIdentifier>{75592043-ab63-4905-beee-568a6ab8bf93}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\vcpkg\base"> + <UniqueIdentifier>{fa1f10e7-58d2-4f7c-ac26-a979baa70061}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\SourceParagraph.cpp"> + <ClCompile Include="..\src\pch.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\BinaryParagraph.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\binaryparagraph.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\StatusParagraph.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\build.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\StatusParagraphs.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.autocomplete.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\triplet.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.buildexternal.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\Paragraphs.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.cache.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\metrics.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.ci.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Input.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.contact.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\coff_file_reader.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_available_commands.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.create.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_build.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.dependinfo.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_build_external.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.edit.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_cache.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.env.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_contact.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.exportifw.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_create.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.hash.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_edit.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.import.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_hash.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.integrate.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_help.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.list.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_import.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.owns.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_install.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.portsdiff.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_integrate.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.search.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_list.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\commands.version.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_owns.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\dependencies.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_portsdiff.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\export.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_remove.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\globalstate.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_search.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\help.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_update.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\input.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_version.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\install.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\MachineType.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\metrics.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Dependencies.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\packagespec.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkglib.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\packagespecparseresult.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_System.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\paragraphparseresult.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Checks.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\paragraphs.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Files.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\parse.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Strings.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\postbuildlint.buildtype.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\pch.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\postbuildlint.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PostBuildLint.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\remove.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PostBuildLint_BuildType.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\sourceparagraph.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Enums.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\statusparagraph.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_ci.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\statusparagraphs.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Chrono.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\triplet.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\LineInfo.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\update.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\commands_env.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\vcpkgcmdarguments.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PackageSpec.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\vcpkglib.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\PackageSpecParseResult.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\vcpkgpaths.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\ParagraphParseResult.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\versiont.cpp"> + <Filter>Source Files\vcpkg</Filter> </ClCompile> - <ClCompile Include="..\src\VcpkgCmdArguments.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\checks.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\VcpkgPaths.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\chrono.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\commands_depends.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\cofffilereader.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\commands_export.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\enums.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\commands_export_ifw.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\files.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\VersionT.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\vcpkg_Build.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\lineinfo.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Build_BuildPolicy.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\machinetype.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\vcpkg_Parse.cpp"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\src\vcpkg_GlobalState.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\strings.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> - <ClCompile Include="..\src\commands_autocomplete.cpp"> - <Filter>Source Files</Filter> + <ClCompile Include="..\src\vcpkg\base\system.cpp"> + <Filter>Source Files\vcpkg\base</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\include\SourceParagraph.h"> + <ClInclude Include="..\include\pch.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\include\BinaryParagraph.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\files.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\StatusParagraph.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\checks.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\StatusParagraphs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\chrono.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\triplet.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\cofffilereader.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\Paragraphs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\cstringview.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\metrics.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\enums.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Input.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\expected.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\coff_file_reader.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\graphs.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\filesystem_fs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\lazy.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\MachineType.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\lineinfo.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Commands.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\machinetype.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Commands_Export.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\optional.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Commands_Export_IFW.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\sortedvector.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Dependencies.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\span.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkglib.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\strings.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Checks.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\system.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Files.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\base\util.h"> + <Filter>Header Files\vcpkg\base</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Graphs.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\binaryparagraph.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Maps.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\build.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Strings.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\commands.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_System.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\dependencies.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\pch.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\export.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_optional.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\globalstate.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PostBuildLint.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\help.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Enums.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\input.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Chrono.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\install.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\lazy.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\metrics.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\LineInfo.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\packagespec.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_expected.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\packagespecparseresult.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Util.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\paragraphparseresult.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\SortedVector.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\paragraphs.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\CStringView.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\parse.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PackageSpec.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\postbuildlint.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PackageSpecParseResult.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\remove.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\ParagraphParseResult.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\sourceparagraph.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\VcpkgCmdArguments.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\statusparagraph.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\VersionT.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\statusparagraphs.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\VcpkgPaths.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\triplet.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Build.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\update.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\PostBuildLint_BuildType.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\vcpkgcmdarguments.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\Span.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\vcpkglib.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_Parse.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\vcpkgpaths.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> - <ClInclude Include="..\include\vcpkg_GlobalState.h"> - <Filter>Header Files</Filter> + <ClInclude Include="..\include\vcpkg\versiont.h"> + <Filter>Header Files\vcpkg</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg\postbuildlint.buildtype.h"> + <Filter>Header Files\vcpkg</Filter> + </ClInclude> + <ClInclude Include="..\include\vcpkg\export.ifw.h"> + <Filter>Header Files\vcpkg</Filter> </ClInclude> </ItemGroup> </Project>
\ No newline at end of file diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj index 472d74e30..4b59c5ace 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj @@ -131,7 +131,7 @@ </Link> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\src\vcpkg_metrics_uploader.cpp" /> + <ClCompile Include="..\src\vcpkgmetricsuploader.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj"> diff --git a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters index a50df7250..847921000 100644 --- a/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters +++ b/toolsrc/vcpkgmetricsuploader/vcpkgmetricsuploader.vcxproj.filters @@ -15,7 +15,7 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\vcpkg_metrics_uploader.cpp"> + <ClCompile Include="..\src\vcpkgmetricsuploader.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj b/toolsrc/vcpkgtest/vcpkgtest.vcxproj index 041e74d31..d25748124 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj @@ -19,11 +19,11 @@ </ProjectConfiguration> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\tests_arguments.cpp" /> - <ClCompile Include="..\src\tests_dependencies.cpp" /> - <ClCompile Include="..\src\tests_package_spec.cpp" /> - <ClCompile Include="..\src\tests_paragraph.cpp" /> - <ClCompile Include="..\src\test_install_plan.cpp" /> + <ClCompile Include="..\src\tests.arguments.cpp" /> + <ClCompile Include="..\src\tests.dependencies.cpp" /> + <ClCompile Include="..\src\tests.packagespec.cpp" /> + <ClCompile Include="..\src\tests.paragraph.cpp" /> + <ClCompile Include="..\src\tests.installplan.cpp" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\vcpkglib\vcpkglib.vcxproj"> diff --git a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters index b31dbd951..42691c614 100644 --- a/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters +++ b/toolsrc/vcpkgtest/vcpkgtest.vcxproj.filters @@ -15,19 +15,19 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\src\tests_paragraph.cpp"> + <ClCompile Include="..\src\tests.installplan.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\tests_dependencies.cpp"> + <ClCompile Include="..\src\tests.arguments.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\tests_arguments.cpp"> + <ClCompile Include="..\src\tests.dependencies.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\test_install_plan.cpp"> + <ClCompile Include="..\src\tests.packagespec.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\src\tests_package_spec.cpp"> + <ClCompile Include="..\src\tests.paragraph.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/triplets/arm64-uwp.cmake b/triplets/arm64-uwp.cmake new file mode 100644 index 000000000..b37c34e87 --- /dev/null +++ b/triplets/arm64-uwp.cmake @@ -0,0 +1,6 @@ +set(VCPKG_TARGET_ARCHITECTURE arm64) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) + +set(VCPKG_CMAKE_SYSTEM_NAME WindowsStore) +set(VCPKG_CMAKE_SYSTEM_VERSION 10.0) |
