Add and document build customization options (#779)

* Add and document build customization to exclude Zlib and OpenSSL dependencies
This commit is contained in:
John L 2023-10-03 14:21:37 -07:00 коммит произвёл GitHub
Родитель a21681e91d
Коммит b8071bdc6f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -25,7 +25,7 @@
<HCSettingsImported>true</HCSettingsImported>
</PropertyGroup>
<ItemGroup Condition="'$(ConfigurationType)'!='StaticLibrary'">
<ItemGroup Condition="'$(ConfigurationType)'!='StaticLibrary' AND '$(HCNoOpenSSL)'!='true'">
<ProjectReference Include="$(HCBuildRoot)\$(libsslName)\$(libsslName).vcxproj">
<Project Condition="'$(HCLibPlatformType)' == 'Win32' and '$(opensslToolset)' == '141'">{A5EB6BDD-DD81-4B7B-83A0-A8AE0068FC3F}</Project>
<Project Condition="'$(HCLibPlatformType)' == 'Win32' and '$(opensslToolset)' == '142'">{23104CDA-C598-4D41-B7FF-70405B2871EC}</Project>

Просмотреть файл

@ -49,6 +49,15 @@ libHttpClient provides a platform abstraction layer for HTTP and WebSocket, and
* Optionally call HCSetHttpCallPerformFunction() to do your own HTTP handling using HCHttpCallRequestGet*(), HCHttpCallResponseSet*(), and HCSettingsGet*()
* See sample CustomHttpImplWithCurl for an example of how to use this callback to make your own HTTP implementation.
## Build customization
If you are building libHttpClient from source, you can provide an hc_settings.props file with specific MSBuild properties to customize how the library gets built. When built, the libHttpClient projects look for an hc_settings.props file in any directory above the the repository root. Currently, the following build customizations are available:
* Defining HCNoWebSockets will exclude WebSocket APIs (and all their dependencies) from the libHttpClient library
* Defining HCNoZlib will exclude compression APIs and prevent libHttpClient from defining Zlib symbols within libHttpClient
* Defining HCNoOpenSSL will prevent libHttpClient from referencing our private OpenSSL projects. If this is defined, you will need to manually include your own (compatible) version of OpenSSL when linking.
An example customization file hc_settings.props.example can be found at the root of the repository.
## How to clone repo
This repo contains submodules. There are two ways to make sure you get submodules.

11
hc_settings.props.example Normal file
Просмотреть файл

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Exclude Zlib symbols from the libHttpClient lib -->
<HCNoZlib>true</HCNoZlib>
<!-- Exclude WebSocket APIs from libHttpClient lib, prevents pulling in 3rd party WebSocket dependencies -->
<HCNoWebSockets>true</HCNoWebSockets>
<!-- Prevents adding references to libHttpClient's private OpenSSL projects. Be sure to include your own OpenSSL binaries when linking -->
<HCNoOpenSSL>true</HCNoOpenSSL>
</PropertyGroup>
</Project>

Просмотреть файл

@ -32,7 +32,7 @@
<PropertyGroup>
<useWsppWebsockets>false</useWsppWebsockets>
<useWsppWebsockets Condition="'$(HCLibPlatformType)'=='Win32'">true</useWsppWebsockets>
<useWsppWebsockets Condition="'$(HCLibPlatformType)'=='Win32' and '$(HCNoWebSockets)'!='true'">true</useWsppWebsockets>
<HCLibToolset>$(PlatformToolsetVersion)</HCLibToolset>
<HCLibToolset Condition="'$(PlatformToolset)'=='v141'">141</HCLibToolset>
@ -71,6 +71,16 @@
</ProjectReference>
</ItemGroup>
<ItemDefinitionGroup Condition="'$(HCNoWebSockets)'=='true'">
<ClCompile>
<PreprocessorDefinitions>
HC_NOWEBSOCKETS;
HC_WINHTTP_WEBSOCKETS=0;
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(libHttpClientInclude)</AdditionalIncludeDirectories>