How to target the existing project to new platform

Recently, I am always asked about how to use the project on different platform or different Visual Studio version. For instance, If the project uses Windows Mobile 6 Professional SDK (ARMV4I) platform and bases on Visual Studio 2008, and you want to use it on Pocket PC 2003(ARMV4I) using Visual Studio 2005.

The easy way to achieve that is to change the project file. Following xml file illuminates the project file for CppUnitLite targeted to Windows Mobile 6 Professional SDK (ARMV4I) and based on Visual Studio 2008.

<?xml version="1.0" encoding="Windows-1252"?>
<
VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="CppUnitLite"
ProjectGUID="{A022C462-A27C-442D-999E-F36C91517D40}"
RootNamespace="CppUnitLite"
Keyword="Win32Proj"
TargetFrameworkVersion="196613"
>
<
Platforms>
<
Platform
Name="Windows Mobile 6 Professional SDK (ARMV4I)"
/>
</
Platforms>
<
ToolFiles>
</
ToolFiles>
<
Configurations>
<
Configuration
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<
Tool
Name="VCPreBuildEventTool"
/>
<
Tool
Name="VCCustomBuildTool"
/>
<
Tool
Name="VCXMLDataGeneratorTool"
/>
<
Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<
Tool
Name="VCMIDLTool"
/>
<
Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
MinimalRebuild="true"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<
Tool
Name="VCManagedResourceCompilerTool"
/>
<
Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<
Tool
Name="VCPreLinkEventTool"
/>
<
Tool
Name="VCLibrarianTool"
AdditionalOptions=" /subsystem:windowsce,5.02"
OutputFile="../Bin/CppUnitLite.lib"
/>
<
Tool
Name="VCALinkTool"
/>
<
Tool
Name="VCXDCMakeTool"
/>
<
Tool
Name="VCBscMakeTool"
/>
<
Tool
Name="VCFxCopTool"
/>
<
Tool
Name="VCCodeSignTool"
/>
<
Tool
Name="VCPostBuildEventTool"
/>
<
DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<
DebuggerTool
/>
</
Configuration>
<
Configuration
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
>
<
Tool
Name="VCPreBuildEventTool"
/>
<
Tool
Name="VCCustomBuildTool"
/>
<
Tool
Name="VCXMLDataGeneratorTool"
/>
<
Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<
Tool
Name="VCMIDLTool"
/>
<
Tool
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="2"
FavorSizeOrSpeed="2"
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_LIB;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="3"
/>
<
Tool
Name="VCManagedResourceCompilerTool"
/>
<
Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES)"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<
Tool
Name="VCPreLinkEventTool"
/>
<
Tool
Name="VCLibrarianTool"
AdditionalOptions=" /subsystem:windowsce,5.02"
OutputFile="http://www.cnblogs.com/app/sensors/Lib/CppUnitLite.lib"
/>
<
Tool
Name="VCALinkTool"
/>
<
Tool
Name="VCXDCMakeTool"
/>
<
Tool
Name="VCBscMakeTool"
/>
<
Tool
Name="VCFxCopTool"
/>
<
Tool
Name="VCCodeSignTool"
/>
<
Tool
Name="VCPostBuildEventTool"
/>
<
DeploymentTool
ForceDirty="-1"
RemoteDirectory=""
RegisterOutput="0"
AdditionalFiles=""
/>
<
DebuggerTool
/>
</
Configuration>
</
Configurations>
<
References>
</
References>
<
Files>
<
Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<
File
RelativePath=".\Failure.cpp"
>
</
File>
<
File
RelativePath=".\SimpleString.cpp"
>
</
File>
<
File
RelativePath=".\Test.cpp"
>
</
File>
<
File
RelativePath=".\TestRegistry.cpp"
>
</
File>
<
File
RelativePath=".\TestResult.cpp"
>
</
File>
</
Filter>
<
Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<
File
RelativePath=".\Failure.h"
>
</
File>
<
File
RelativePath=".\SimpleString.h"
>
</
File>
<
File
RelativePath=".\Test.h"
>
</
File>
<
File
RelativePath=".\TestHarness.h"
>
</
File>
<
File
RelativePath=".\TestRegistry.h"
>
</
File>
<
File
RelativePath=".\TestResult.h"
>
</
File>
</
Filter>
<
Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</
Filter>
<
File
RelativePath=".\ReadMe.txt"
>
</
File>
</
Files>
<
Globals>
</
Globals>
</
VisualStudioProject>

If you want to use this project on Pocket PC 2003 and use Visual Studio 2005 as the complier. Two things need to be changed for this case.

How to change

1. Change the complier version number.

<VisualStudioProject
ProjectType="Visual C++"
Version="9.00" <!-- Change the version number to 8.00 -->

 

2. Change the platform name.

<Platforms>
<
Platform
Name="Windows Mobile 6 Professional SDK (ARMV4I)" <!--ChangetheplatformnametoPocketPC2003(ARMV4).-->

Notes please, more than one spots use this platform name. All those platform names should be replaced by the new one.

How to confirm the new platform name

Right the project name and select properties. In this case, the platform name is Pocket PC 2003(ARMV4).

image

posted @ 2010-07-14 19:53  Jake Lin  阅读(937)  评论(1编辑  收藏  举报