List of all Vulkan tutorial posts is here.
In solution's directory, I have created vulkan.props file intended for storing all changes in project properties corresponding to using Vulkan SDK. Setting include directory and the additional link-time library was easy because these are shared among all configurations. But libraries directory is different for Win32 and x64 builds. There I had to use a choose construct with proper condition. The whole file is presented below.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<Choose>
<When Condition="'$(Platform)'!='x64'">
<PropertyGroup Label="UserMacros">
<VULKAN_BIN_DIR>$(VULKAN_SDK)\Bin32</VULKAN_BIN_DIR>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup Label="UserMacros">
<VULKAN_BIN_DIR>$(VULKAN_SDK)\Bin</VULKAN_BIN_DIR>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<IncludePath>$(VULKAN_SDK)\Include;$(IncludePath)</IncludePath>
<LibraryPath>$(VULKAN_BIN_DIR);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>vulkan-1.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<BuildMacro Include="VULKAN_BIN_DIR">
<Value>$(VULKAN_BIN_DIR)</Value>
<EnvironmentVariable>true</EnvironmentVariable>
</BuildMacro>
</ItemGroup>
</Project>
The $(VULKAN_SDK) is a system variable created by Vulkan SDK installer. Now, to reference Vulkan SDK I have only to add vulkan.props property file to each project once. Thanks to the choose construct my property file is working in all project configurations.
No comments:
Post a Comment