Skip to content

Commit

Permalink
Merge pull request libbitcoin#390 from evoskuil/master
Browse files Browse the repository at this point in the history
Update system and system-import msvc props for intrinsics.
  • Loading branch information
evoskuil authored Apr 29, 2024
2 parents ea37742 + 1d2a951 commit 3e72477
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
43 changes: 42 additions & 1 deletion builds/msvc/vs2022/libbitcoin-system.import.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@
<ItemGroup Label="BuildOptionsExtension">
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)libbitcoin-system.import.xml" />
</ItemGroup>

<!-- Options -->

<!-- These create non-portability. -->
<!-- These will compile to the target regardless of the compiling platform. -->
<!-- That will result in a crash of test/executable execution if mismatched. -->
<PropertyGroup>
<Option-avx512>false</Option-avx512>
<Option-avx2>true</Option-avx2>
<Option-sse41>true</Option-sse41>
<Option-shani>false</Option-shani>
<Option-neon>false</Option-neon>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<!-- order matters -->
<EnableEnhancedInstructionSet Condition="'$(Option-avx2)' == 'true'">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Option-avx512)' == 'true'">AdvancedVectorExtensions512</EnableEnhancedInstructionSet>
</ClCompile>
</ItemDefinitionGroup>

<!-- Messages -->

<Target Name="OptionInfo" BeforeTargets="PrepareForBuild">
<Message Text="Option-avx512 : $(Option-avx512)" Importance="high"/>
<Message Text="Option-avx2 : $(Option-avx2)" Importance="high"/>
<Message Text="Option-sse41 : $(Option-sse41)" Importance="high"/>
<Message Text="Option-shani : $(Option-shani)" Importance="high"/>
<Message Text="Option-neon : $(Option-neon)" Importance="high"/>
</Target>

<!-- Linkage -->

Expand All @@ -18,11 +48,22 @@
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\libbitcoin-system\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<!-- WITH_ICU always defined in Visual Studio builds. -->
<!-- NOMINMAX enables use of std::min/max without conflict. -->
<!-- BOOST_EXCEPTION_DISABLE must be set here to be captured by all includes. -->
<!-- WIN32_LEAN_AND_MEAN avoids inclusion of certain headers, winsock.h conflicts with boost and protocol use of winsock2.h. -->
<PreprocessorDefinitions>WITH_ICU;WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Linkage-libbitcoin-system)' == 'static' Or '$(Linkage-libbitcoin-system)' == 'ltcg'">BC_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile>
<!-- Enable use of CPU intrinsics. -->
<PreprocessorDefinitions Condition="'$(Option-avx512)' == 'true'">WITH_AVX512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-avx2)' == 'true'">WITH_AVX2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-sse41)' == 'true'">WITH_SSE41;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-shani)' == 'true'">WITH_SHANI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-neon)' == 'true'">WITH_NEON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<!-- 4099: warns about missing PDB files. -->
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Link>
<AdditionalDependencies Condition="'$(Linkage-libbitcoin-system)' != ''">libbitcoin-system.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
Expand Down
32 changes: 32 additions & 0 deletions builds/msvc/vs2022/libbitcoin-system.import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,36 @@
<EnumValue Name="ltcg" DisplayName="Static using link time compile generation (LTCG)" />
</EnumProperty>
</Rule>
<Rule Name="libbitcoin-system-options-uiextension" PageTemplate="tool" DisplayName="Bitcoin System Options" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="avx512" DisplayName="avx512" />
<Category Name="avx2" DisplayName="avx2" />
<Category Name="sse41" DisplayName="sse41" />
<Category Name="shani" DisplayName="shani" />
<Category Name="neon" DisplayName="neon" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Option-avx512" DisplayName="Enable AVX512 Intrinsics" Description="Use AVX512 intrinsics." Category="avx512">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-avx2" DisplayName="Enable AVX2 Intrinsics" Description="Use AVX2 intrinsics." Category="avx2">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-sse41" DisplayName="Enable SSE4.1 Intrinsics" Description="Use SSE4.1 intrinsics." Category="sse41">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-shani" DisplayName="Enable SHA Native Intrinsics" Description="Use SHA native intrinsics." Category="shani">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-neon" DisplayName="Enable ARM Neon Intrinsics" Description="Use ARM Neon intrinsics." Category="neon">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
</Rule>
</ProjectSchemaDefinitions>

0 comments on commit 3e72477

Please sign in to comment.