VS: Add source file property to specify Windows App deployment location

Add a VS_DEPLOYMENT_LOCATION source file property to specify where to
put files that are part of the package.  For example:

  set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "assets")

Without this, sources marked with VS_DEPLOYMENT_CONTENT cannot be
located properly.
This commit is contained in:
Gilles Khouzam 2014-12-02 13:32:45 -08:00 committed by Brad King
parent 2a224b4ce3
commit 352f246f3e
8 changed files with 45 additions and 12 deletions

View File

@ -291,6 +291,7 @@ Properties on Source Files
/prop_sf/OBJECT_OUTPUTS /prop_sf/OBJECT_OUTPUTS
/prop_sf/SYMBOLIC /prop_sf/SYMBOLIC
/prop_sf/VS_DEPLOYMENT_CONTENT /prop_sf/VS_DEPLOYMENT_CONTENT
/prop_sf/VS_DEPLOYMENT_LOCATION
/prop_sf/VS_SHADER_ENTRYPOINT /prop_sf/VS_SHADER_ENTRYPOINT
/prop_sf/VS_SHADER_MODEL /prop_sf/VS_SHADER_MODEL
/prop_sf/VS_SHADER_TYPE /prop_sf/VS_SHADER_TYPE

View File

@ -0,0 +1,8 @@
VS_DEPLOYMENT_LOCATION
----------------------
Specifies the deployment location for a content source file with a Windows
Phone or Windows Store application when built with a Visual Studio generator.
This property is only applicable when using :prop_sf:`VS_DEPLOYMENT_CONTENT`.
The value represent the path relative to the app package and applies to all
configurations.

View File

@ -159,6 +159,10 @@ Properties
to tell the Visual Studio generators to mark content for deployment to tell the Visual Studio generators to mark content for deployment
in Windows Phone and Windows Store projects. in Windows Phone and Windows Store projects.
* A :prop_sf:`VS_DEPLOYMENT_LOCATION` source file property was added
to tell the Visual Studio generators the relative location of content
marked for deployment in Windows Phone and Windows Store projects.
* The :prop_tgt:`VS_WINRT_COMPONENT` target property was created to * The :prop_tgt:`VS_WINRT_COMPONENT` target property was created to
tell Visual Studio generators to compile a shared library as a tell Visual Studio generators to compile a shared library as a
Windows Runtime (WinRT) component. Windows Runtime (WinRT) component.

View File

@ -1261,6 +1261,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
} }
std::string deployContent; std::string deployContent;
std::string deployLocation;
if(this->GlobalGenerator->TargetsWindowsPhone() || if(this->GlobalGenerator->TargetsWindowsPhone() ||
this->GlobalGenerator->TargetsWindowsStore()) this->GlobalGenerator->TargetsWindowsStore())
{ {
@ -1269,6 +1270,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
{ {
toolHasSettings = true; toolHasSettings = true;
deployContent = content; deployContent = content;
const char* location = sf->GetProperty("VS_DEPLOYMENT_LOCATION");
if(location && *location)
{
deployLocation = location;
}
} }
} }
@ -1283,6 +1290,14 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
cmGeneratorExpression ge; cmGeneratorExpression ge;
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
ge.Parse(deployContent); ge.Parse(deployContent);
// Deployment location cannot be set on a configuration basis
if(!deployLocation.empty())
{
this->WriteString("<Link>", 3);
(*this->BuildFileStream) << deployLocation
<< "\\%(FileName)%(Extension)";
this->WriteString("</Link>\n", 0);
}
for(size_t i = 0; i != configs->size(); ++i) for(size_t i = 0; i != configs->size(); ++i)
{ {
if(0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i]), "1")) if(0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i]), "1"))

View File

@ -86,6 +86,9 @@ if (WINDOWS_PHONE8)
elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP") elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP")
set(CONTENT_FILES ${CONTENT_FILES} set(CONTENT_FILES ${CONTENT_FILES}
${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME}
)
set(ASSET_FILES ${ASSET_FILES}
Direct3DApp1/Assets/Logo.png Direct3DApp1/Assets/Logo.png
Direct3DApp1/Assets/SmallLogo.png Direct3DApp1/Assets/SmallLogo.png
Direct3DApp1/Assets/SplashScreen.png Direct3DApp1/Assets/SplashScreen.png
@ -94,10 +97,12 @@ elseif (NOT "${PLATFORM}" STREQUAL "DESKTOP")
endif() endif()
set(RESOURCE_FILES set(RESOURCE_FILES
${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} ${CONTENT_FILES} ${DEBUG_CONTENT_FILES} ${RELEASE_CONTENT_FILES} ${ASSET_FILES}
Direct3DApp1/Direct3DApp1_TemporaryKey.pfx) Direct3DApp1/Direct3DApp1_TemporaryKey.pfx)
set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) set_property(SOURCE ${CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "Assets")
set_property(SOURCE ${DEBUG_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $<CONFIG:Debug>) set_property(SOURCE ${DEBUG_CONTENT_FILES} PROPERTY VS_DEPLOYMENT_CONTENT $<CONFIG:Debug>)
set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY set_property(SOURCE ${RELEASE_CONTENT_FILES} PROPERTY
VS_DEPLOYMENT_CONTENT $<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>) VS_DEPLOYMENT_CONTENT $<OR:$<CONFIG:Release>,$<CONFIG:RelWithDebInfo>,$<CONFIG:MinSizeRel>>)

View File

@ -4,7 +4,7 @@
<Properties> <Properties>
<DisplayName>@SHORT_NAME@</DisplayName> <DisplayName>@SHORT_NAME@</DisplayName>
<PublisherDisplayName>mgong</PublisherDisplayName> <PublisherDisplayName>mgong</PublisherDisplayName>
<Logo>StoreLogo.png</Logo> <Logo>Assets/StoreLogo.png</Logo>
</Properties> </Properties>
<Prerequisites> <Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion> <OSMinVersion>6.2.1</OSMinVersion>
@ -15,9 +15,9 @@
</Resources> </Resources>
<Applications> <Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App"> <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="@SHORT_NAME@.App">
<VisualElements DisplayName="@SHORT_NAME@" Description="@SHORT_NAME@" BackgroundColor="#336699" ForegroundText="light" Logo="Logo.png" SmallLogo="SmallLogo.png"> <VisualElements DisplayName="@SHORT_NAME@" Description="@SHORT_NAME@" BackgroundColor="#336699" ForegroundText="light" Logo="Assets/Logo.png" SmallLogo="Assets/SmallLogo.png">
<DefaultTile ShowName="allLogos" ShortName="@SHORT_NAME@" /> <DefaultTile ShowName="allLogos" ShortName="@SHORT_NAME@" />
<SplashScreen Image="SplashScreen.png" /> <SplashScreen Image="Assets/SplashScreen.png" />
</VisualElements> </VisualElements>
</Application> </Application>
</Applications> </Applications>

View File

@ -4,7 +4,7 @@
<Properties> <Properties>
<DisplayName>@SHORT_NAME@</DisplayName> <DisplayName>@SHORT_NAME@</DisplayName>
<PublisherDisplayName>mgong</PublisherDisplayName> <PublisherDisplayName>mgong</PublisherDisplayName>
<Logo>StoreLogo.png</Logo> <Logo>Assets/StoreLogo.png</Logo>
</Properties> </Properties>
<Prerequisites> <Prerequisites>
<OSMinVersion>6.3</OSMinVersion> <OSMinVersion>6.3</OSMinVersion>
@ -20,14 +20,14 @@
Description="@SHORT_NAME@" Description="@SHORT_NAME@"
BackgroundColor="#336699" BackgroundColor="#336699"
ForegroundText="light" ForegroundText="light"
Square150x150Logo="Logo.png" Square150x150Logo="Assets/Logo.png"
Square30x30Logo="SmallLogo.png"> Square30x30Logo="Assets/SmallLogo.png">
<m2:DefaultTile ShortName="@SHORT_NAME@"> <m2:DefaultTile ShortName="@SHORT_NAME@">
<m2:ShowNameOnTiles> <m2:ShowNameOnTiles>
<m2:ShowOn Tile="square150x150Logo" /> <m2:ShowOn Tile="square150x150Logo" />
</m2:ShowNameOnTiles> </m2:ShowNameOnTiles>
</m2:DefaultTile> </m2:DefaultTile>
<m2:SplashScreen Image="SplashScreen.png" /> <m2:SplashScreen Image="Assets/SplashScreen.png" />
</m2:VisualElements> </m2:VisualElements>
</Application> </Application>
</Applications> </Applications>

View File

@ -6,7 +6,7 @@
<Properties> <Properties>
<DisplayName>@SHORT_NAME@</DisplayName> <DisplayName>@SHORT_NAME@</DisplayName>
<PublisherDisplayName>mgong</PublisherDisplayName> <PublisherDisplayName>mgong</PublisherDisplayName>
<Logo>StoreLogo.png</Logo> <Logo>Assets/StoreLogo.png</Logo>
</Properties> </Properties>
<Prerequisites> <Prerequisites>
<OSMinVersion>6.3.1</OSMinVersion> <OSMinVersion>6.3.1</OSMinVersion>
@ -22,14 +22,14 @@
Description="@SHORT_NAME@" Description="@SHORT_NAME@"
BackgroundColor="#336699" BackgroundColor="#336699"
ForegroundText="light" ForegroundText="light"
Square150x150Logo="Logo.png" Square150x150Logo="Assets/Logo.png"
Square30x30Logo="SmallLogo.png"> Square30x30Logo="Assets/SmallLogo.png">
<m2:DefaultTile ShortName="@SHORT_NAME@"> <m2:DefaultTile ShortName="@SHORT_NAME@">
<m2:ShowNameOnTiles> <m2:ShowNameOnTiles>
<m2:ShowOn Tile="square150x150Logo" /> <m2:ShowOn Tile="square150x150Logo" />
</m2:ShowNameOnTiles> </m2:ShowNameOnTiles>
</m2:DefaultTile> </m2:DefaultTile>
<m2:SplashScreen Image="SplashScreen.png" /> <m2:SplashScreen Image="Assets/SplashScreen.png" />
</m2:VisualElements> </m2:VisualElements>
</Application> </Application>
</Applications> </Applications>