Skip to content

Commit 2fcfd4b

Browse files
committed
Use vcpkg to manage depedencies instead of NuGet
There are a few advantages to using vcpkg: - There are a large number of packages available. This should mean that it's easier to add packages in the future. It also means that some existing dependencies that have been manually added (e.g. CLI11, Detours) can be used via vcpkg instead. - Packages (particularly popular ones, such as Boost) should be updated more frequently. - Although NuGet can be used to manage C++ packages, it's mainly targeted at .NET libraries. NuGet is designed to allow prebuilt binaries to be distributed, however, that can cause issues with C++ projects, as it's not feasible to provide prebuilt binaries for all combinations of compilation options (as noted in https://vcpkg.io/en/docs/about/faq.html#why-not-nuget). For example, the Boost NuGet packages that were being used (from https://github.com/sergey-shandar/getboost) were pre-built for x86/x64. That then meant that attempting to support ARM64 wasn't possible. - For dependencies that are included manually (e.g. manually included source files), using vcpkg has the advantage that the dependencies will be built once, even when rebuilding the solution. These advantages come at the cost of a slightly more complicated build process (the vcpkg submodule needs to be checked out and the instance initialized) and longer initial build times. However, these are considered to be worthwhile trade-offs. Note that vcpkg has been added as a submodule. This has been done for a few reasons: - It means that the version of vcpkg is consistent, rather than whatever version the user happens to have installed globally. That's important, as the user might have an old version of vcpkg checked out, which doesn't have the appropriate package versions. - As noted in https://vcpkg.io/en/docs/about/faq.html#how-do-i-use-different-versions-of-a-library-on-one-machine, you can only have one version of a library installed within a single instance of vcpkg. As users could have arbitrary packages and versions installed globally, it makes much more sense to have a project-specific vcpkg instance. That then avoids any conflicts with other projects. Note that explicit package versions aren't specified in vcpkg.json; instead, the baseline is used. This is the standard way of interacting with vcpkg. Package versions are effectively tied to the baseline. When the baseline is updated, the necessary packages will also be updated, with vcpkg verifying that versions within a baseline don't conflict. To compile the application, the following steps are now required first: git clone --recurse-submodules https://github.com/derceg/explorerplusplus.git cd explorerplusplus .\Explorer++\ThirdParty\vcpkg\bootstrap-vcpkg.bat The necessary packages will then be installed when starting the build.
1 parent da25ce4 commit 2fcfd4b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+217
-274
lines changed

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,9 @@ __pycache__/
287287
*.btp.cs
288288
*.btm.cs
289289
*.odx.cs
290-
*.xsd.cs
290+
*.xsd.cs
291+
292+
# Manually added entries
293+
294+
# vcpkg
295+
vcpkg_installed/

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "Explorer++/ThirdParty/vcpkg"]
2+
path = Explorer++/ThirdParty/vcpkg
3+
url = https://github.com/microsoft/vcpkg.git

Directory.Build.props

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="$(MSBuildThisFileDirectory)Explorer++\ThirdParty\vcpkg\scripts\buildsystems\msbuild\vcpkg.props" />
3+
</Project>

Directory.Build.targets

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<Project>
2+
<Import Project="$(MSBuildThisFileDirectory)Explorer++\ThirdParty\vcpkg\scripts\buildsystems\msbuild\vcpkg.targets" />
3+
</Project>

Explorer++/Detours/Detours.vcxproj

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@
9696
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
9797
</ImportGroup>
9898
<PropertyGroup Label="UserMacros" />
99+
<PropertyGroup Label="Vcpkg">
100+
<VcpkgEnabled>false</VcpkgEnabled>
101+
</PropertyGroup>
99102
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
100103
<ClCompile>
101104
<WarningLevel>Level3</WarningLevel>

Explorer++/Explorer++/Explorer++.vcxproj

+22-54
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" />
43
<ItemGroup Label="ProjectConfigurations">
54
<ProjectConfiguration Include="Debug-LLVM|Win32">
65
<Configuration>Debug-LLVM</Configuration>
@@ -150,6 +149,27 @@
150149
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
151150
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
152151
</PropertyGroup>
152+
<PropertyGroup Label="Vcpkg">
153+
<VcpkgEnableManifest>true</VcpkgEnableManifest>
154+
</PropertyGroup>
155+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
156+
<VcpkgUseStatic>true</VcpkgUseStatic>
157+
</PropertyGroup>
158+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug-LLVM|Win32'">
159+
<VcpkgUseStatic>true</VcpkgUseStatic>
160+
</PropertyGroup>
161+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
162+
<VcpkgUseStatic>true</VcpkgUseStatic>
163+
</PropertyGroup>
164+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
165+
<VcpkgUseStatic>true</VcpkgUseStatic>
166+
</PropertyGroup>
167+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug-LLVM|x64'">
168+
<VcpkgUseStatic>true</VcpkgUseStatic>
169+
</PropertyGroup>
170+
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
171+
<VcpkgUseStatic>true</VcpkgUseStatic>
172+
</PropertyGroup>
153173
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
154174
<PreBuildEvent>
155175
<Command>
@@ -829,7 +849,6 @@
829849
<ClInclude Include="XMLSettings.h" />
830850
</ItemGroup>
831851
<ItemGroup>
832-
<None Include="packages.config" />
833852
<None Include="res\Display Window.ico" />
834853
<None Include="res\Explorer++.ico" />
835854
<None Include="res\Filtering Applied.bmp" />
@@ -880,61 +899,10 @@
880899
</ProjectReference>
881900
</ItemGroup>
882901
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
883-
<ImportGroup Label="ExtensionTargets">
884-
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" />
885-
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
886-
<Import Project="..\packages\nlohmann.json.3.10.5\build\native\nlohmann.json.targets" Condition="Exists('..\packages\nlohmann.json.3.10.5\build\native\nlohmann.json.targets')" />
887-
<Import Project="..\packages\boost.1.79.0\build\boost.targets" Condition="Exists('..\packages\boost.1.79.0\build\boost.targets')" />
888-
<Import Project="..\packages\boost_atomic-vc142.1.79.0\build\boost_atomic-vc142.targets" Condition="Exists('..\packages\boost_atomic-vc142.1.79.0\build\boost_atomic-vc142.targets')" />
889-
<Import Project="..\packages\boost_chrono-vc142.1.79.0\build\boost_chrono-vc142.targets" Condition="Exists('..\packages\boost_chrono-vc142.1.79.0\build\boost_chrono-vc142.targets')" />
890-
<Import Project="..\packages\boost_date_time-vc142.1.79.0\build\boost_date_time-vc142.targets" Condition="Exists('..\packages\boost_date_time-vc142.1.79.0\build\boost_date_time-vc142.targets')" />
891-
<Import Project="..\packages\boost_filesystem-vc142.1.79.0\build\boost_filesystem-vc142.targets" Condition="Exists('..\packages\boost_filesystem-vc142.1.79.0\build\boost_filesystem-vc142.targets')" />
892-
<Import Project="..\packages\boost_locale-vc142.1.79.0\build\boost_locale-vc142.targets" Condition="Exists('..\packages\boost_locale-vc142.1.79.0\build\boost_locale-vc142.targets')" />
893-
<Import Project="..\packages\boost_log-vc142.1.79.0\build\boost_log-vc142.targets" Condition="Exists('..\packages\boost_log-vc142.1.79.0\build\boost_log-vc142.targets')" />
894-
<Import Project="..\packages\boost_log_setup-vc142.1.79.0\build\boost_log_setup-vc142.targets" Condition="Exists('..\packages\boost_log_setup-vc142.1.79.0\build\boost_log_setup-vc142.targets')" />
895-
<Import Project="..\packages\boost_system-vc142.1.79.0\build\boost_system-vc142.targets" Condition="Exists('..\packages\boost_system-vc142.1.79.0\build\boost_system-vc142.targets')" />
896-
<Import Project="..\packages\boost_thread-vc142.1.79.0\build\boost_thread-vc142.targets" Condition="Exists('..\packages\boost_thread-vc142.1.79.0\build\boost_thread-vc142.targets')" />
897-
<Import Project="..\packages\boost_atomic-vc143.1.79.0\build\boost_atomic-vc143.targets" Condition="Exists('..\packages\boost_atomic-vc143.1.79.0\build\boost_atomic-vc143.targets')" />
898-
<Import Project="..\packages\boost_chrono-vc143.1.79.0\build\boost_chrono-vc143.targets" Condition="Exists('..\packages\boost_chrono-vc143.1.79.0\build\boost_chrono-vc143.targets')" />
899-
<Import Project="..\packages\boost_date_time-vc143.1.79.0\build\boost_date_time-vc143.targets" Condition="Exists('..\packages\boost_date_time-vc143.1.79.0\build\boost_date_time-vc143.targets')" />
900-
<Import Project="..\packages\boost_filesystem-vc143.1.79.0\build\boost_filesystem-vc143.targets" Condition="Exists('..\packages\boost_filesystem-vc143.1.79.0\build\boost_filesystem-vc143.targets')" />
901-
<Import Project="..\packages\boost_locale-vc143.1.79.0\build\boost_locale-vc143.targets" Condition="Exists('..\packages\boost_locale-vc143.1.79.0\build\boost_locale-vc143.targets')" />
902-
<Import Project="..\packages\boost_log_setup-vc143.1.79.0\build\boost_log_setup-vc143.targets" Condition="Exists('..\packages\boost_log_setup-vc143.1.79.0\build\boost_log_setup-vc143.targets')" />
903-
<Import Project="..\packages\boost_log-vc143.1.79.0\build\boost_log-vc143.targets" Condition="Exists('..\packages\boost_log-vc143.1.79.0\build\boost_log-vc143.targets')" />
904-
<Import Project="..\packages\boost_system-vc143.1.79.0\build\boost_system-vc143.targets" Condition="Exists('..\packages\boost_system-vc143.1.79.0\build\boost_system-vc143.targets')" />
905-
<Import Project="..\packages\boost_thread-vc143.1.79.0\build\boost_thread-vc143.targets" Condition="Exists('..\packages\boost_thread-vc143.1.79.0\build\boost_thread-vc143.targets')" />
906-
</ImportGroup>
902+
<ImportGroup Label="ExtensionTargets" />
907903
<ProjectExtensions>
908904
<VisualStudio>
909905
<UserProperties RESOURCE_FILE="Explorer++.rc" />
910906
</VisualStudio>
911907
</ProjectExtensions>
912-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
913-
<PropertyGroup>
914-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
915-
</PropertyGroup>
916-
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.props'))" />
917-
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.220608.4\build\native\Microsoft.Windows.CppWinRT.targets'))" />
918-
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.220201.1\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
919-
<Error Condition="!Exists('..\packages\nlohmann.json.3.10.5\build\native\nlohmann.json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\nlohmann.json.3.10.5\build\native\nlohmann.json.targets'))" />
920-
<Error Condition="!Exists('..\packages\boost.1.79.0\build\boost.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost.1.79.0\build\boost.targets'))" />
921-
<Error Condition="!Exists('..\packages\boost_atomic-vc142.1.79.0\build\boost_atomic-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_atomic-vc142.1.79.0\build\boost_atomic-vc142.targets'))" />
922-
<Error Condition="!Exists('..\packages\boost_chrono-vc142.1.79.0\build\boost_chrono-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_chrono-vc142.1.79.0\build\boost_chrono-vc142.targets'))" />
923-
<Error Condition="!Exists('..\packages\boost_date_time-vc142.1.79.0\build\boost_date_time-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_date_time-vc142.1.79.0\build\boost_date_time-vc142.targets'))" />
924-
<Error Condition="!Exists('..\packages\boost_filesystem-vc142.1.79.0\build\boost_filesystem-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_filesystem-vc142.1.79.0\build\boost_filesystem-vc142.targets'))" />
925-
<Error Condition="!Exists('..\packages\boost_locale-vc142.1.79.0\build\boost_locale-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_locale-vc142.1.79.0\build\boost_locale-vc142.targets'))" />
926-
<Error Condition="!Exists('..\packages\boost_log-vc142.1.79.0\build\boost_log-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_log-vc142.1.79.0\build\boost_log-vc142.targets'))" />
927-
<Error Condition="!Exists('..\packages\boost_log_setup-vc142.1.79.0\build\boost_log_setup-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_log_setup-vc142.1.79.0\build\boost_log_setup-vc142.targets'))" />
928-
<Error Condition="!Exists('..\packages\boost_system-vc142.1.79.0\build\boost_system-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_system-vc142.1.79.0\build\boost_system-vc142.targets'))" />
929-
<Error Condition="!Exists('..\packages\boost_thread-vc142.1.79.0\build\boost_thread-vc142.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_thread-vc142.1.79.0\build\boost_thread-vc142.targets'))" />
930-
<Error Condition="!Exists('..\packages\boost_atomic-vc143.1.79.0\build\boost_atomic-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_atomic-vc143.1.79.0\build\boost_atomic-vc143.targets'))" />
931-
<Error Condition="!Exists('..\packages\boost_chrono-vc143.1.79.0\build\boost_chrono-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_chrono-vc143.1.79.0\build\boost_chrono-vc143.targets'))" />
932-
<Error Condition="!Exists('..\packages\boost_date_time-vc143.1.79.0\build\boost_date_time-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_date_time-vc143.1.79.0\build\boost_date_time-vc143.targets'))" />
933-
<Error Condition="!Exists('..\packages\boost_filesystem-vc143.1.79.0\build\boost_filesystem-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_filesystem-vc143.1.79.0\build\boost_filesystem-vc143.targets'))" />
934-
<Error Condition="!Exists('..\packages\boost_locale-vc143.1.79.0\build\boost_locale-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_locale-vc143.1.79.0\build\boost_locale-vc143.targets'))" />
935-
<Error Condition="!Exists('..\packages\boost_log_setup-vc143.1.79.0\build\boost_log_setup-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_log_setup-vc143.1.79.0\build\boost_log_setup-vc143.targets'))" />
936-
<Error Condition="!Exists('..\packages\boost_log-vc143.1.79.0\build\boost_log-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_log-vc143.1.79.0\build\boost_log-vc143.targets'))" />
937-
<Error Condition="!Exists('..\packages\boost_system-vc143.1.79.0\build\boost_system-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_system-vc143.1.79.0\build\boost_system-vc143.targets'))" />
938-
<Error Condition="!Exists('..\packages\boost_thread-vc143.1.79.0\build\boost_thread-vc143.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\boost_thread-vc143.1.79.0\build\boost_thread-vc143.targets'))" />
939-
</Target>
940908
</Project>

Explorer++/Explorer++/Explorer++.vcxproj.filters

-1
Original file line numberDiff line numberDiff line change
@@ -1036,7 +1036,6 @@
10361036
<None Include="Version.h">
10371037
<Filter>Core</Filter>
10381038
</None>
1039-
<None Include="packages.config" />
10401039
</ItemGroup>
10411040
<ItemGroup>
10421041
<Filter Include="Resource Files">

Explorer++/Explorer++/packages.config

-25
This file was deleted.

0 commit comments

Comments
 (0)