ããã«ã¡ã¯Habrããããã®èšäºã§ã¯ãMicrosoft Visual Studioæ¡åŒµæ©èœïŒããã³ä»éçã«MSBuildãïŒã®ãããã¯ãã«ããŒããããšããŸãã ãã®é åã¯éåžžã«äžååã«ææžåãããŠãããäžè¬çã«äœããã®è¬ã®ããŒã«ã§èŠãããŠããŸãã
ããããŒã°
ç§ã¯ããªãã®çµéšãæã€ããã®C ++éçºè
ã§ãããMicrosoft補åã®å€§ãã¡ã³ã§ããããŸã第äžã«ãç§ã®äž»ãªéçºããŒã«ã§ããVisual Studioã§ãã å°ãåãŸã§ã趣å³ãšããŠããã€ã¯ãã³ã³ãããŒã©ãŒã®ããã°ã©ãã³ã°ãéå§ãããã€ã¯ãããã瀟ã®ãã€ã¯ãã³ã³ãããŒã©ãŒãéžã³ãŸããã ç§ã«åããªãã£ãå¯äžã®ããšã¯ããã€ã¯ããããèªäœãæäŸããéçºããŒã«ã®äœ¿çšã§ããã ãããã®è£œåã«ã€ããŠäœãæªãããšã¯èšããŸãããäœæ¥äžã®ïŒãŸãã¯èªå®
ã®ïŒã³ã³ãã¥ãŒã¿ãŒã«ããã€ãã®IDEãã€ã³ã¹ããŒã«ããããªãã®ã§ãMicrochip XC8ã³ã³ãã€ã©ãŒãMicrosoft Visual Studioã«çµ±åãããšããã¢ã€ãã¢ãçãŸããŸããã åŸã§ããã®ã¢ã€ãã¢ã«ãã1ã€ã®ãã©ã¹ãèŠãŸãã-ç§ã®ïŒç§ã®ã ãã§ã¯ãªãïŒãããžã§ã¯ãã®å€ãã¯ãããããã³ã³ãã¥ãŒã¿ã«æ¥ç¶ããããšã«çŽæ¥ãŸãã¯éæ¥çã«æ¥ç¶ãããŠããã®ã§ãå¿çãœãããŠã§ã¢éšåãéçºããå¿
èŠããããŸã-ãããã1ã€ã®ãœãªã¥ãŒã·ã§ã³ïŒãœãªã¥ãŒã·ã§ã³ïŒã«ãã¡ãŒã ãŠã§ã¢ãããžã§ã¯ããšçµã¿åãããã®ã¯çŽ æŽãããããšã§ãã é·ãæéããããŠæãäžããåŸãç§ã¯Visual Studioã«äœããçµ±åãããããã¯ã¯äžçš®ã®ãã¯ã€ãã¹ãããã§ããããšã«æ°ä»ããŸãããéåžžã®èª¬æã¯ãªããããã°ã«ã¯ä¹ãã説æããããææªãªã®ã¯å®éã«äŸããªãããšã§ãã ããã€ãã®æ
å ±ãå°ããã€åéãã説æããäœããç解ããç§åŠçãªçªç Žã®æ¹æ³ã«åºã¥ããŠãç§ã¯åŸãç¥èãå
±æããããšã«ããŸããã è¡ããŸãããã
ã¢ã¯ã·ã§ã³ãã©ã³
ããŠããµãŒãããŒãã£ã®ã³ã³ãã€ã©ããã蟌ãã§Visual Studioã®æ©èœãæ¡åŒµããããšã«ããã®ã§ãå¯èœãªéãæ¡åŒµããŸãããã ãããè¡ãã«ã¯ãããããããšã®ãªã¹ããå®çŸ©ããŸãã
- Visual Studioã§ãããžã§ã¯ãã®ããããã£ïŒãããžã§ã¯ãããããã£ïŒã衚瀺ããå Žåãç¬èªã®ããããã£ããããŸãã
- ãããžã§ã¯ãã«å«ããããšãã§ãããã¡ã€ã«æ¡åŒµåã®ã»ãããå®çŸ©ããŸãã
- ã³ã³ãã€ã©ããªã³ã«ãªã©ãåŒã³åºãããããã«ãã«ãã·ã¹ãã ã決å®ããã®ã¯èªç¶ã§ãã
- ç¬èªã®ãããžã§ã¯ããäœæããŠãã¹ã¿ãžãªãç¬èªã®æ¡åŒµåãæã€ãã¡ã€ã«ãéãããšãã§ããããã«ããŸãã
- ãã®ã¿ã€ãã®ãããžã§ã¯ããçæãããŠã£ã¶ãŒããäœæããŸãã
ããŠããã®ãªã¹ãã®èŠä»¶ã®å°ãªããšãäžéšãå®è£
ããŠã¿ãŸãããã
ããŒã1ïŒMSBuild
çè«ããå§ããŸãããïŒ
- Microsoft Visual Studio-COMãã¯ãããžãŒäžã«å®å
šã«æ§ââç¯ããããã®ã§ã¯ãããŸããã ãããã£ãŠãããã«çŽé¢ããæºåãããå¿
èŠããããŸãã ãããåé¿ããããšããŸããã
- Microsoft Visual Studioãããžã§ã¯ãã¯ãã¹ãŠMSBuildã¹ã¯ãªããã§ãã
äžèšãèæ
®ããŠãã¹ã¿ãžãªã®æ©èœãæ¡åŒµããã«ã¯ããŸãMSBuildãšåŒã°ããã¢ã»ã³ããªã·ã¹ãã ããã€ã¹ãæ€èšããå¿
èŠããããŸãã
ããã«äºçŽããŸããããªãå€ãVIsual Studio 2010ãæå
ã«ãã£ãã®ã§ãå
šäœã®èª¬æã¯åœŒå¥³ã®ãã®ã«ãªããŸããã2012幎ãš2013幎以éã¯ã¹ã¿ãžãªã§ãã¹ãŠåãã«ãªããšæããŸãã
ã ãããã¹ã¿ãžãªãéããŠã
空ã®ãœãªã¥ãŒã·ã§ã³ãäœæãã
空ã®ãããžã§ã¯ããè¿œå
ããŸã ïŒC ++ã«ããŽãªã®ãããžã§ã¯ãã奜ããªã®ã§ãéžæããŸããïŒ
ãããžã§ã¯ããšãœãªã¥ãŒã·ã§ã³ã®äž¡æ¹ãããã¹ãããšåŒã³ãããããåããã£ã¬ã¯ããªã«é
眮ããŸããïŒããã¯å®éšã«äŸ¿å©ã§ããåŸã§èª¬æããŸãïŒ-ãããã£ãŠããã¡ã€ã«
test.slnããã³
test.vcxprojãååŸããŸã
次ã«ãã¹ã¿ãžãªãéããŠãäœããã®çš®é¡ã®ããã¹ããšãã£ã¿ãŒã䜿çšãïŒXMLæ§æã®åŒ·èª¿è¡šç€ºã䜿çšããæ¹ããã-ååãšããŠãåãã¹ã¿ãžãªãé©åã§ãããä»ã®ã€ã³ã¹ã¿ã³ã¹ã®ã¿ïŒãããã¹ããã¡ã€ã«ãšããŠ
test.vcxprojãéããŸãã
test.vcxprojã®äžèº«ãèŠãŠã¿ãŸãããïŒ
test.vcxproj<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{E1064D79-B415-4EDC-9FAC-C50E4102268B}</ProjectGuid> <RootNamespace>test</RootNamespace> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>true</UseDebugLibraries> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <UseDebugLibraries>false</UseDebugLibraries> <WholeProgramOptimization>true</WholeProgramOptimization> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup /> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <WarningLevel>Level3</WarningLevel> <Optimization>Disabled</Optimization> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <WarningLevel>Level3</WarningLevel> <Optimization>MaxSpeed</Optimization> <FunctionLevelLinking>true</FunctionLevelLinking> <IntrinsicFunctions>true</IntrinsicFunctions> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <EnableCOMDATFolding>true</EnableCOMDATFolding> <OptimizeReferences>true</OptimizeReferences> </Link> </ItemDefinitionGroup> <ItemGroup> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> </Project>
ããã§èŠãã¹ãæãéèŠãªããšïŒ
- ProjectConfigurationã¿ã°ã
- ProjectGuidã¿ã°ã
- Importã¿ã°ã§æ¥ç¶ãããŠãããã¡ã€ã«ã
ãã®ä»ã¯ãã¹ãŠå®å
šã«åé€ã§ããŸãã ãŸãããããžã§ã¯ãã®ä»®æ³ãã£ã¬ã¯ããªã
éªéã«ãªããªã
ããã« ã
test.filtersãã¡ã€ã«ãåé€ããããšãã
å§ãããŸãã
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{E1064D79-B415-4EDC-9FAC-C50E4102268B}</ProjectGuid> <RootNamespace>test</RootNamespace> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> </Project>
äžèšã®ãã¡ã€ã«ã¯ãã¹ã¿ãžãªãšMSBuildã®èŠ³ç¹ããã¯çµ¶å¯Ÿã«æå¹ã§ãããéããããçµã¿ç«ãŠãããšãã§ããŸãã
ãŸããã³ãã³ãã©ã€ã³ãããããžã§ã¯ãã®ã¢ã»ã³ããªãããã«åŠçããããšããå§ãããŸãã
- Microsoft Visual Studioã³ãã³ãããã³ãããèµ·åãã
- test.vcxprojããããã£ã¬ã¯ããªã«ç§»åããŸã
- msbuild test.vcxproj / pïŒConfiguration = Debug / pïŒPlatform = Win32ãå®è¡ããŸã
ãã®ããã»ã¹ãèªååããã¹ã¯ãªãããäœæããŠããšã©ãŒããã®ä»ã®ããšãã¢ã»ã³ããªã§ç¢ºèªããæ¹ã䟿å©ã§ãã
ããã§ããããžã§ã¯ãã®ããããã£ã®åå ãããã³äžè¬çã«ããããžã§ã¯ããã¹ã¿ãžãªãããžã§ã¯ãã«ããçç±ãç解ãå§ããŸãã ãããŠããã¹ãŠã®è¡ããããè¡ããŸãïŒ
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
ã€ã³ããŒããããã¡ã€ã«ã¯ããã£ã¬ã¯ããª
CïŒ\ Program Files \ MSBuild \ Microsoft.Cpp \ v4.0ã«ãããŸãããã¡ãããããããèŠãŠã¿ãããšãã§ããŸãããMSBuildãæ±ã£ãããšã®ãªã人ã¯äœãç解ã§ããªããšæããŸãããããç解ããããšãã欲æ±ã¯ããã«æ¶ããŠããŸããŸãã ã ããç§ã¯ãŸã ãããèŠãŠããªãããšããå§ãããŸãããªããªã ïŒèè
ãããããã«ïŒå€ãã®æéãè²»ãããŠããäœãç解ã§ããŸããã
éèŠ!!ïŒvcxprojããã³é¢é£ãã¡ã€ã«ãç·šéãããã³ã«ãã¹ã¿ãžãªãå®å
šã«åèµ·åããå¿
èŠããããŸãïŒ Visual StudioãäœãïŒã»ãšãã©ã®å Žå* .propsããã³* .targetsãã¡ã€ã«ïŒããã£ãã·ã¥ããããšãå®éšçã«ããã£ããããåçŽãªãããžã§ã¯ãã®ã¢ã³ããŒã/ãããžã§ã¯ãã®ãªããŒãã ãã§ã¯äžååã§ãïŒ ãã®ãããããšããš
vcxprojã®æšªã«
slnãã¡ã€ã«ãäœæããã®ã§ããã£ã¬ã¯ããªãå€æŽããã«åèµ·åãããšäŸ¿å©ã§ãã
ããã§ã¯ã
Importã¿ã°ã®ããè¡ãåé€ããŠãäœãèµ·ãããèŠãŠã¿ãŸãããã
ãã¡ã€ã«ã¯æ¬¡ã®ããã«ãªããŸãã
test.vcxproj <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{E1064D79-B415-4EDC-9FAC-C50E4102268B}</ProjectGuid> <RootNamespace>test</RootNamespace> </PropertyGroup> </Project>
ã¹ã¿ãžãªã§éããšããã¡ã€ã«ããŸã æå¹ã§ããããšãããããŸãã ãããããããåéããããšã¯æ©èœããŸãããç§ãã¡ã¯ã¡ãã»ãŒãžãåãåããŸãïŒ
1>ãšã©ãŒïŒãConfigurationGeneralãã«ãŒã«ããããžã§ã¯ãã«ãããŸããããããžã§ã¯ããåéããå¿
èŠã¯ãããŸãããããããã£ãŠã泚æãæã£ãŠããŸããã
ãããžã§ã¯ãã®ããããã£ã«ãããã®ãèŠãŠã¿ãŸããã-ãããŠæ¬¡ã®å³ã芳å¯ããŠãã ããïŒ
çŸäººïŒ äœåãªãã®ã¯ãã¹ãŠåé€ããŸãããããããäžè¬çãªãã®ã¯ãã¹ãŠåé€ããŸããã
ãããžã§ã¯ãã«ãã¡ã€ã«ãè¿œå ããããšããŠãæåããŸãããã¹ã¿ãžãªã¯ãšã©ãŒãè¿ããŸãã
åæ
çãªäœè« ïŒ
èªè
ã¯è³ªåããããããããŸããããã¹ã¿ãžãªã¯ã©ã®ããã«ããŠãããC ++ãããžã§ã¯ãã§ãããšå€æããŸããïŒVisual C ++ãæ瀺çã«æã
vcxprojæ¡åŒµã«ãã£ãŠåºæ¬çã§ãã ããããããã®è³ªåã¯èªè
ã«ã¯ããªã銬鹿ããŠããããã«æãããŸãããå®éã«C ++ãããžã§ã¯ãã§ã¯ãªããªã£ããããžã§ã¯ãã§é·æéå®éšããã¹ã¿ãžãªããŸã C ++ã«ãŒã«ã«åŸã£ãŠåäœããããšãããšããã¡ã€ã«æ¡åŒµåèªäœãå®å
šã«å¿ããŠããŸããŸãã ã ããã¯åãé€ããŸããããã®ã¹ããŒãªãŒã®ä»¥äžã®éšåã®ããããã§ã®ã¿ã§ãã
ãããžã§ã¯ãã¯ç©ºã§ãã å
å¡«ãå§ããŸãããã
èªè
ã¯ãããããç¬èªã®
* .propsããã³
* .targetsãã¡ã€ã«ãäœæããããšããã§ã«æšæž¬ããŠãããããããŸããããæåã¯å°ãçè«ããããŸãã
- * .propsããã³* .targetsãã¡ã€ã«ã«ã¯ã* .propsããã³* .targetsæ¡åŒµåãä»ããå¿
èŠã¯ãããŸãããããã¯ãå®éã«ã¯ã€ã³ã¯ã«ãŒããã¡ã€ã«ã®ãããªãã®ã§ãã ãã ããã¹ã¿ãžãªã®ãã²ã¢ããŒã«éåããããšã¯ãªãããã¹ãŠã®æ¡åŒµæ©èœã䜿ãæ
£ãããŸãŸã«ããŸãã
- * .propsã¯éåžžããããžã§ã¯ãã®ããããã£ãšç°å¢å€æ°ãæ
åœããŸãã
- * .targetsã¯ã¢ã»ã³ããªãæ
åœããŸã-ãããžã§ã¯ãã«è¿œå ããããã¡ã€ã«ïŒãŸãã¯ãã¡ã€ã«ã§ã¯ãªãå¯èœæ§ããããŸãïŒã®åŠçãèšè¿°ããŸã èãããããã¹ãŠã®ã¢ã¯ã·ã§ã³/ã¿ã¹ã¯ïŒã¿ã¹ã¯ïŒãããã³ã¹ããŒã ïŒProjectSchemaïŒããã³ã«ãŒã«ïŒã«ãŒã«ïŒã§å®çŸ©ããããããžã§ã¯ããã¡ã€ã«ã®ã¿ã€ãã
ãã¡ã€ã«* .targetsã
ããã«ãã¬ãŒã·ã§ã³ã«ã€ããŠã¯ãæœè±¡åãããXC8ã³ã³ãã€ã©ãMicrochipããVisual Studioã«ãã蟌ããšããç¹å®ã®ã¿ã¹ã¯ã«ç§»è¡ããããšããå§ãããŸãã XC8ã³ã³ãã€ã©ã¯ã
Microchip Webãµã€ãããããŠã³ããŒãããŠã€ã³ã¹ããŒã«ããå¿
èŠããããŸãã
äœè« ïŒäžè¬çã«ã* .propsã®ãããª* .targetsãã¡ã€ã«ã¯MSBuildèªäœã®ç¹å®ã®ãã©ã«ããŒã«ãããŸãããä»ã¯ãããè¡ããŸããã ããã¯ãæ°ããäœæãããæ¡åŒµæ©èœã®é
åžã¿ã¹ã¯ãããã³äžè¬ã«ã€ã³ã¹ããŒã©ãŒã®ã¿ã¹ã¯ã«æ¢ã«é©çšãããŠãããç§ãã¡ã®å®éšã§ã¯ããããžã§ã¯ãã®é£ã®1ã€ã®ãã£ã¬ã¯ããªã«ãã¹ãŠãä¿åããããšãæã䟿å©ã§ãã
test.vcxprojã®é£ã®ãã£ã¬ã¯ããªã«
XC8.targetsãã¡ã€ã«ãäœæããŸãã
XC8.targetsã³ã³ãã³ãïŒ
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <PropertyPageSchema Include="XC8.Items.xml"/> </ItemGroup> </Project>
ãã¡ã€ã«ãããããããã£ããŒãžïŒPropertyPageSchemaïŒã®ã¹ããŒã ã決å®ãã
XC8.Items.xmlãã¡ã€ã«ãã€ã³ã¯ã«ãŒãããããšããŠããããšã
ããããŸãã èªè
ãæšæž¬ããããã«ã
XC8.Items.xmlãã¡ã€ã«ã§ã¯ããããžã§ã¯ãã«åå ãããã¡ã€ã«ã®çš®é¡ã説æããŸãã ç¹ã«XC8ã³ã³ãã€ã©ã®å Žåããããã¯
* .cãã¡ã€ã«ã§ã
ã * .h; * .asmãªã©
ãããžã§ã¯ãã®ãã£ã¬ã¯ããªã«
XC8.Items.xmlãé
眮ããŠäœæããŸãããã
XC8.Items.xmlã³ã³ãã³ãïŒ
<?xml version="1.0" encoding="utf-8"?> <ProjectSchemaDefinitions xmlns="http://schemas.microsoft.com/build/2009/properties"> <ContentType Name="CCode" DisplayName="C Code" ItemType="Compile"> </ContentType> <ContentType Name="AsmCode" DisplayName="Asm Code" ItemType="Compile"> </ContentType> <ContentType Name="Header" DisplayName="C/C++ Header" ItemType="Include"> </ContentType> <ContentType Name="Text" DisplayName="Text file" ItemType="None"> </ContentType> <ItemType Name="Compile" DisplayName="XC8 Compiler"/> <ItemType Name="Include" DisplayName="C header"/> <ItemType Name="None" DisplayName="Does not participate in build"/> <FileExtension Name=".c" ContentType="CCode"/> <FileExtension Name=".cc" ContentType="CCode"/> <FileExtension Name=".s" ContentType="AsmCode"/> <FileExtension Name=".asm" ContentType="AsmCode"/> <FileExtension Name=".h" ContentType="Header"/> <FileExtension Name=".txt" ContentType="Text"/> </ProjectSchemaDefinitions>
ãã®ãã¡ã€ã«ã§ãããããã«ããããžã§ã¯ãã§å¿
èŠãªãã¡ã€ã«ã®çš®é¡ã決å®ããŸããã ãããŠã
FileExtensionã¿ã°ã䜿çšããŠããããã®ãã¡ã€ã«ã®æ¡åŒµå
ã決å®ããŸããã
æåŸã«
XC8.targetsããããžã§ã¯ãã«ã€ã³ããŒãããŸããããã«ã¯ã
Importã¿ã°ã䜿çšããŸã
test.vcxprojã®å
容ïŒ
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{E1064D79-B415-4EDC-9FAC-C50E4102268B}</ProjectGuid> <RootNamespace>test</RootNamespace> </PropertyGroup> <Import Project="XC8.targets" /> </Project>
ããã§ã¹ã¿ãžãªãéããæãåçŽãªãã¡ã€ã«
main.cãè¿œå ããŠã¿ãŠãã ãã
ãã¡ã€ã«ã®å
容ïŒ
main.c #include <xc.h> int main() { return 0; }
åºæ¥äžãã-ããã§ãã¡ã€ã«ãè¿œå ãããŸããã ãã¡ã€ã«ã®ããããã£ãèŠãŠã¿ãŸãããïŒ
[
ã¢ã€ãã ã¿ã€ã]ããããããŠã³ãªã¹ãã«ã
XC8.Items.xmlãã¡ã€ã«ã§æå®ããèŠçŽ ã衚瀺ãããŠããããšã
ããããŸãã
éèŠ!!ïŒXC8.Items.xmlãã¡ã€ã«å
šäœã®ã¡ã€ã³ã¿ã°ã¯ãItemTypeå±æ§ãæã€ContentTypeã§ã ã ããã¯ãä»åŸã¡ã€ã³ã¿ã€ããšããŠäœ¿çšããItemTypeå±æ§ã®å€ã§ãã
test.vcxprojãã¹ã¿ãžãªã«ä¿åããã¹ã¿ãžãªãéããŠããã®ããã¹ããèŠãŠã¿ãŸãããã
<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> <ProjectConfiguration Include="Debug|Win32"> <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectGuid>{E1064D79-B415-4EDC-9FAC-C50E4102268B}</ProjectGuid> <RootNamespace>test</RootNamespace> </PropertyGroup> <ItemGroup> <Compile Include="main.c" /> </ItemGroup> <Import Project="XC8.targets" /> </Project>
Compileã¿ã°ã§ããå¥ã®
ItemGroupã¿ã°ãå
éšã«è¿œå ããããšã
ããããŸãã ãã®ã¿ã°ã®ååã¯ã
XC8.Items.xmlãã¡ã€ã«ã®
ContentTypeã¿ã°ã®
ItemTypeå±æ§ã®å€ãšããŠæå®ãããã®ã§ãã 芪æãªãèªè
ããã§ã«æšæž¬ããããã«ããã®ã¡ã«ããºã ã䜿çšããŠãã¢ã»ã³ããªçšã®æ°ãããã¡ã€ã«ããããžã§ã¯ãã«å«ãŸããŠããŸãã
次ã«ããããžã§ã¯ãã®ããããã£ãæ±ããŸãããã ãããè¡ãã«ã¯ã
XC8.targetsã«2ã€ã®ãã¡ã€ã«ãå«ããå¿
èŠããããŸãã
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <PropertyPageSchema Include="XC8.Items.xml"/> <PropertyPageSchema Include="XC8.General.xml"> <Context>Project</Context> </PropertyPageSchema> <PropertyPageSchema Include="XC8.General.PS.xml"> <Context>PropertySheet</Context> </PropertyPageSchema> </ItemGroup> </Project>
ãããŠããã€ãã®ããã«ããããžã§ã¯ããã£ã¬ã¯ããªã«
XC8.General.xmlããã³
XC8.General.PS.xmlãã¡ã€ã«ãäœæããå¿
èŠããããŸãã
ããã«äºçŽããŸãããªã2ã€ç®ã®
XC8.General.PS.xmlãã¡ã€ã«ãå¿
èŠãªã®ããæåŸãŸã§ããããŸããã§ããã 圌ã¯ç§ãå匷ãããã¹ãŠã®è³æã«åºåžããŠããŸãããç§ãã¡ã®ãããžã§ã¯ãã«åŸã£ãŠåœåããŠã圌ãèŸããããšã«ããŸããã ãã®åé¡ã«é¢ããæ
å ±ãããå Žåã¯ãå
±æããŠãã ããã
å
容ïŒ
XC8.General.PS.xml <?xml version="1.0" encoding="utf-8"?> <Rule Name="ConfigurationGeneral" DisplayName="General" PageTemplate="generic" Description="General" xmlns="http://schemas.microsoft.com/build/2009/properties"> <Rule.Categories> <Category Name="General" DisplayName="General" Description="General" /> </Rule.Categories> <Rule.DataSource> <DataSource Persistence="ProjectFile" Label="Configuration" /> </Rule.DataSource> </Rule>
ããã§ã
XC8.General.xmlãã¡ã€ã«ãåç
§ããŠããããžã§ã¯ãã®ããããã£ãã€ãŸã[
å
šè¬ ]ããããã£ããŒãžã«ã€ããŠèª¬æããŸãã æãåºããŠãã ããããããžã§ã¯ãããã«ããããšãã«Visual Studioãããªã¯ãšã¹ããããã®ã¯ãã®ããŒãžã§ããã ãããžã§ã¯ãã®ããããã£ããŒãžã¯ã
Ruleã¿ã°ã«ãã£ãŠèšè¿°ãããŸãã
èŠåŽããã«ã
XC8.General.xmlãã¡ã€ã«ãæå®ããŠããã®æ§é ã説æããŸãã
<?xml version="1.0" encoding="utf-8"?> <Rule Name="ConfigurationGeneral" DisplayName="General" PageTemplate="generic" Description="General" SwitchPrefix="-" xmlns="http://schemas.microsoft.com/build/2009/properties"> <Rule.Categories> <Category Name="General" DisplayName="General" Description="General" /> <Category Name="ProjectDefaults" DisplayName="Project Defaults" Description="Project Defaults" /> </Rule.Categories> <Rule.DataSource> <DataSource Persistence="ProjectFile" Label="Configuration" /> </Rule.DataSource> <StringProperty Name="OutDir" DisplayName="Output Directory" Description="Specifies a relative path to the output file directory; can include environment variables." Category="General" Default="$(SolutionDir)$(Configuration)\" Subtype="folder" F1Keyword="VC.Project.VCConfiguration.OutputDirectory"> <StringProperty.DataSource> <DataSource Persistence="ProjectFile" Label="" /> </StringProperty.DataSource> </StringProperty> <StringProperty Name="IntDir" DisplayName="Intermediate Directory" Description="Specifies a relative path to the intermediate file directory; can include environment variables." Category="General" Default="$(Configuration)\" Subtype="folder" F1Keyword="VC.Project.VCConfiguration.IntermediateDirectory"> <StringProperty.DataSource> <DataSource Persistence="ProjectFile" Label="" /> </StringProperty.DataSource> </StringProperty> <StringProperty Name="TargetName" DisplayName="Target Name" Description="Specifies a file name that this project will generate." F1Keyword="VC.Project.VCConfiguration.TargetName" Category="General" Default="$(ProjectName)" > <StringProperty.DataSource> <DataSource Persistence="ProjectFile" Label="" /> </StringProperty.DataSource> </StringProperty> <StringListProperty Name="ExtensionsToDeleteOnClean" DisplayName="Extensions to Delete on Clean" Description="Semi-colon delimited wildcard specification for which files in the intermediate directory to delete on clean or rebuild." Category="General" Separator=";" F1Keyword="VC.Project.VCConfiguration.DeleteExtensionsOnClean"> <StringListProperty.DataSource> <DataSource Persistence="ProjectFile" Label="" /> </StringListProperty.DataSource> </StringListProperty> <StringProperty Name="BuildLogFile" DisplayName="Build Log File" Description="Specifies the build log file to write to when build logging is enabled." F1Keyword="VC.Project.VCConfiguration.BuildLogFile" Category="General" Default="$(ProjectDir)\$(MSBuildProjectName).log" Subtype="file"> <StringProperty.DataSource> <DataSource Persistence="ProjectFile" ItemType="BuildLog" PersistedName="Path" /> </StringProperty.DataSource> </StringProperty> <StringProperty Name="Chip" DisplayName="Select Processor" Description="This option selects the processor target for compilation. A list of available processors can be obtained by using the chipinfo option." Category="ProjectDefaults" Switch="-chip="/> <BoolProperty Name="QuietMode" DisplayName="Quiet Mode" Description="This option suppresses the Microchip copyright message, and any summary information usually printed by the compiler." Category="ProjectDefaults" Default="false" Switch="Q"/> <BoolProperty Name="VerboseMode" DisplayName="Verbose Mode" Description="This option is used to display the command lines used to invoke each of the compiler passes." Category="ProjectDefaults" Default="false" Switch="V"/> </Rule>
ãã¡ã€ã«ã¯éåžžã«èšå€§ã§ãããç§ã¯ãŸã ã¹ãã€ã©ãŒã®äžã«å
¥ããããããŸããã§ããã 圌ã¯éèŠã§ãã
ãã®ããã
Ruleã¿ã°ã«ã¯ããã€ãã®éèŠãªå±æ§ããããŸãã
- Name = "ConfigurationGeneral" -ã¹ã¿ãžãªã¯ããã®Nameå±æ§å€ãæã€ã«ãŒã«ãæ¢ããŠããŸãã ConfigurationGeneralãšããååã®ã«ãŒã«ããªãå Žåãã»ãšãã©ã®å Žå倱æããŸãã
- DisplayName = "General" -ããã¯ãããžã§ã¯ãæ§æãŠã£ã³ããŠã«è¡šç€ºãããååã§ãã奜ããªååãä»ããããšãã§ããŸãã ç§ã¯å»ããŸããããäžè¬ãã
- 説æ=ãå
šè¬ã -説æã 説æããå¿
èŠããªãããšãé¡ã£ãŠããŸãã
- SwitchPrefix = "-" -ãã®å±æ§ã¯ãã³ãã³ãããŒãã¬ãã£ãã¯ã¹ãã¢ã»ã³ããªã·ã¹ãã ã«è»¢éãããšãã«å®çŸ©ããŸãã ã³ã³ãã€ã©ããŒãã/ãã§å§ãŸããšä»®å®ããŸãïŒäŸïŒ/ Ipathã¯æ¥ç¶ãããã¡ã€ã«ã®ãã¹ãå®çŸ©ããŸãïŒ-ãã®å±æ§ã®å€ã¯ã/ãã«ãªããŸããXC8ã³ã³ãã€ã©ã§ã¯ããã¹ãŠã®ããŒã¯ã-ãã§å§ãŸããŸãã ç°ãªã圢åŒã®ããŒãããå Žåããã®å±æ§ã¯ç©ºçœã®ãŸãŸã«ãããããŸã£ããæå®ããªãããšãã§ããŸãã
- xmlns-ããã¥ã¡ã³ãå
šäœã®åäœã®å±æ§ãåå空éãªã©ãããã«å¿ããŠå€æŽããããšã¯æå³ããããŸããã
- PageTemplate-ãããžã§ã¯ãèšå®ã§ããããã£ããŒãžã®è¡šç€ºãå®çŸ©ããŸããgenericicãšããŒã«ã®ãã³ãã¬ãŒãã䜿çšããŸã -ã¹ã¯ãªãŒã³ã·ã§ããã§ãããã®éãããã¹ãŠè¡šç€ºããŸãïŒæ¬¡ã®éšåïŒã
Rule.Categoriesã¿ã°ã¯ãããããã£ããŒãžå
ã®ã«ããŽãªãå®çŸ©ããããã«äœ¿çšãããŸãã 次ã®2ã€ã®ã«ããŽãªããããŸãã
- äžè¬ -äžè¬çãªãããžã§ã¯ãèšå®-éåžžãããããçš®é¡ã®æ¹æ³ã
- ProjectDefaults -XC8ãããžã§ã¯ãã®æ©èœã®èšå®-ããã§ããŒãåŒãåºããŸãããããã¯ã³ã³ãã€ã©ãšãªã³ã«ã®äž¡æ¹ã«éä¿¡ããå¿
èŠããããŸãã
å¿
èŠã«å¿ããŠãã®ãããªã«ããŽãªãå®çŸ©ã§ããããšã¯æããã§ãã
Rule.DataSourceã¿ã°ã¯ãããããã£å€ãä¿åãããå Žæã決å®ããŸãã
ProjectFileãæå®ããŸãã-ã€ãŸã ãããžã§ã¯ããã¡ã€ã«å
ã
Persistenceå±æ§ãå€æŽããªãã£ãã®ã¯ã ãã®ãããžã§ã¯ãèªäœã®ãã¡ã€ã«ïŒãã®å Žåã¯
test.vcxprojïŒã«ãªãå Žåããããžã§ã¯ãèšå®ãã©ãã«ä¿åã§ãããæ³åã§ããŸããã
ãæ³åã®ãšãããããããã£ã®æåŸã®ã¿ã°ã¯ããããžã§ã¯ãã®ããããã£ãŠã£ã³ããŠã«è¡šç€ºãããããããã£ã§ãã
- StringPropertyã¯æååã§ãã
- StringListPropertyã¯ãæååã®ãªã¹ãã§ãã ããšãã°ãã€ã³ã¯ã«ãŒããã£ã¬ã¯ããªãäžèŠ§è¡šç€ºããããããã«ç€ºãããã«ããããžã§ã¯ãã®ã¯ãªãŒãã³ã°æã«ãã¡ã€ã«ãäžèŠ§è¡šç€ºããŸãïŒã¯ãªãŒã³ïŒã
- IntPropertyã¯æ°å€ã§ãããäœããã®çç±ã§æååã®ããã«åäœããããããã®ç¬éã¯è¬ã®ãŸãŸã§ãã
- BoolProperty-ãã©ã°ã
- EnumPropertyã¯åæåã§ããåŸã§èª¬æããŸãã ãã¡ã€ã«XC8.General.xmlã«ã¯äœããããŸããã
ããããã£ã®åºæ¬çãªå±æ§ãèæ
®ããŠãã ããã
- åå -ååã ããã¯éèŠã§ã ã¹ã¿ãžãªãã¯ã宣èšïŒ $ïŒBlaBlaBlaïŒãæã€ãã®ïŒã«åå ã§ããŸãã ãããè¡ãæ¹æ³ã«ã€ããŠã¯åŸã§èª¬æããŸãã
- DisplayNameã¯è¡šç€ºåã§ãã
- 説æ -説æã ãããžã§ã¯ãããããã£ãŠã£ã³ããŠã§ãã®ããããã£ãéžæãããŠããå Žåãäžã«è¡šç€ºãããŸãã
- ã«ããŽãª -ããããã£ã衚瀺ãããã«ããŽãªã決å®ããŸãã ãã®äŸã§ã¯ãã«ããŽãª2ïŒ Generalããã³ProjectDefaultsã§ãã
- ãµãã¿ã€ã -StringPropertyããããã£ã®ãµãã¿ã€ããå®çŸ©ããŸãã ç§ãèŠããã®ã®ãã¡-ããã¯ãã©ã«ããšãã¡ã€ã«ã§ããããã®åäœã¯ã»ãšãã©å€ãããŸããã
- F1Keyword-ãã®ããããã£ã®ãã«ããå®çŸ©ããŸãã
- ããã©ã«ã -ãã®å±æ§ã¯ãååãšããŠããã©ã«ãã§ããããã£ã®å€ã決å®ããå¿
èŠããããŸãããããã¯è¡ããŸãã-ããããããã¯åãªããã³ãã§ãïŒãããã©ãã«ãèŠã€ãããŸããïŒ ã ããã©ã«ãã®ããããã£å€ãå®çŸ©ããããã®å®å
šã«ç°ãªãã¡ã«ããºã ããããŸããããã«ã€ããŠã¯ãã¹ããŒãªãŒã®æ¬¡ã®éšåã§èª¬æããŸãã
- ã¹ã€ãã -ãã®ããããã£ã®ããŒãå®çŸ©ããŸãã æçµçã«ã Ruleã¿ã°ã®SwitchPrefixå±æ§ã«è¿œå ãããã¢ã»ã³ããªã«æž¡ãããŸãã QuietMoââdeããããã£ã®å Žåãããã¯ã-Qãã«ãªããŸã
ããããã£ãšã«ãŒã«ã«ã¯å€ãã®å±æ§ããããŸã-èªè
ã¯ã
Microsoft.Build.Framework.XamlTypes Namespaceãªã³ã¯ã§ãããã«ç²Ÿéããããšãã§ããŸãã ãã ãããããããã説æãèŠã€ãããªãããã«æºåããŠãã ããããã®ããã¥ã¡ã³ãã¯ã説æãªãã§ãäœããã®ãžã§ãã¬ãŒã¿ãŒã«ãã£ãŠèªåçã«äœæãããããã§ãã è¯ããã¥ãŒã¹ã¯ãå€ãã®å±æ§ã®ç®çãååããæããã§ããããšã§ãã
ã¹ã¿ãžãªã§ãããžã§ã¯ããéãããããžã§ã¯ãã®ããããã£ãŠã£ã³ããŠã確èªããŸã
ãããžã§ã¯ãããã«ãããããšãããšãå¥ã®ãšã©ãŒã衚瀺ãããŸãã
ãšã©ãŒMSB4057ïŒã¿ãŒã²ããã®ããã«ããã¯ãããžã§ã¯ãã«ååšããŸããã ã¯ã
buildãšãã
Targetã¿ã°ããªãããšã瀺ããŠããŸãã
ããã§ãç©èªã®æåã®éšåãç§ã¯çµãããç¹å®ã®çµæãéæããŸããã 次åã¯ã
Target ã
Taskãäœæããããã©ã«ãå€ãšã¹ã¿ãžãªãã¯ããå®çŸ©ããæ¹æ³ã説æããŸãã
ãããžã§ã¯ããã¡ã€ã«ã¯
ããããããŠã³ããŒãã§ã
ãŸããåé¡ãç 究ããããšãå¯èœã«ããè³æïŒ
MSDNïŒ
Microsoft.Build.Framework.XamlTypesåå空éãããžã§ã¯ãïŒ
vs-androidHabréã«é¢ããèšäºïŒMsBuild
ã®æå°ãããžã§ã¯ãMSDNïŒ
ãã¥ãŒããªã¢ã«ã MSBuildãããžã§ã¯ããã¡ã€ã«ããŒãããäœæãããŸããCã®ç§åŠçãªçªãæ¹æ³ïŒ\ Program Files \ MSBuild \ Microsoft.Cpp \ v4.0 \ãã£ã¬ã¯ããª