anx.framework/build/ANX.Framework.build
Konstantin Koch 8287c54432 Included the Visual Studio extension and made the necessary changes to make it run.
Replaced the old VS templates with ones that offer more flexiblity.
Started replacing the Content Project for the samples with our custom project type.
Inlcuded a basic not yet working AssimpImporter.
2015-04-08 14:50:03 +02:00

656 lines
26 KiB
Plaintext

<project xmlns="http://nant.sf.net/release/0.91/nant.xsd" name="ANX.Framework Build" default="build" basedir="./">
<property name="build.platform" value="Any CPU" />
<property name="build.solution_dir" value="../" />
<property name="build.dir" value="${path::get-full-path('../bin')}" />
<property name="build.dir.base" value="${build.dir}" />
<property name="build.dir.tools" value="${build.dir}/tools" />
<property name="project.anx.path" value="../ANX.Framework" />
<property name="project.anx.name" value="ANX.Framework" />
<property name="project.anx.extended" value="false" unless="${property::exists('project.anx.extended')}" />
<property name="project.anx.directives" value="" unless="${property::exists('project.anx.directives')}" />
<property name="project.anxcontent.path" value="../ANX.Framework.ContentPipeline" />
<property name="project.anxcontent.name" value="ANX.Framework.ContentPipeline" />
<!-- dont change the following flags... set 'em by calling the appropriate target -->
<property name="build.configuration" value="Release" />
<property name="project.anx.build_env" value="VS2010" />
<property name="project.anx.platform" value="Windows" />
<property name="project.anx.windows" value="true" />
<property name="project.anx.linux" value="false" />
<property name="project.anx.psvita" value="false" />
<property name="project.anx.metro" value="false" />
<property name="project.anx.winrt" value="false" />
<property name="xna.installed" value="false" />
<property name="xnasdk.installed" value="false" />
<target name="clean" description="Cleans all targets.">
<delete>
<fileset>
<include name="${build.dir}/**" />
<include name="${build.dir.base}/**" />
<include name="${build.dir.tools}/**" />
<include name="${build.solution_dir}/**/obj/**" />
<include name="${build.dir}/samples/**/**" />
<include name="${build.dir}/${build.configuration}/installer/**" />
<include name="${project.anx.path}/obj/**" />
<include name="${project.anxcontent.path}/obj/**" />
</fileset>
</delete>
</target>
<target name="debug">
<property name="build.configuration" value="Debug" />
</target>
<target name="VS2010">
<property name="project.anx.build_env" value="VS2010" />
</target>
<target name="VS2012">
<property name="project.anx.build_env" value="VS2012" />
</target>
<target name="VS2013">
<property name="project.anx.build_env" value="VS2013" />
</target>
<target name="windows">
<property name="project.anx.windows" value="true" />
<property name="project.anx.platform" value="Windows" />
</target>
<target name="linux">
<property name="project.anx.linux" value="true" />
<property name="project.anx.platform" value="Linux" />
<property name="project.anx.directives" value="${project.anx.directives} LINUX MONO" />
<property name="build.dir.base" value="${build.dir}/${project.anx.platform}" />
<call target="generate_project_files" />
</target>
<target name="psvita">
<property name="project.anx.psvita" value="true" />
<property name="project.anx.platform" value="PS Vita" />
<property name="build.dir.base" value="${build.dir}/${project.anx.platform}" />
<call target="generate_project_files" />
</target>
<target name="metro">
<property name="project.anx.metro" value="true" />
<property name="project.anx.platform" value="Windows 8 / Metro" />
<property name="build.platform" value="x86" />
<property name="build.dir.base" value="${build.dir}/ModernUI" />
<property name="project.anx.directives" value="${project.anx.directives} WINDOWSMETRO" />
<call target="generate_project_files" />
</target>
<target name="winrt">
<property name="project.anx.metro" value="true" />
<property name="project.anx.winrt" value="true" />
<property name="project.anx.platform" value="Windows 8 / Metro / WinRT" />
<property name="build.platform" value="ARM" />
<property name="build.dir.base" value="${build.dir}/WinRT" />
<property name="project.anx.directives" value="${project.anx.directives} WINDOWSMETRO ARM WINRT" />
<call target="generate_project_files" />
</target>
<target name="build" depends="check_xna">
<echo message="===================================================" />
<echo message="ANX.Framework build script" />
<echo message="===================================================" />
<echo message="" />
<echo message="Build environment : ${project.anx.build_env}" />
<echo message="Build configuration : ${build.configuration}" />
<echo message="Target platform : ${project.anx.platform}" />
<echo message="Target build dir : ${build.dir.base}" />
<echo message="" />
<echo message="XNA runtime installed : ${xna.installed}" />
<echo message="XNA game studio installed: ${xnasdk.installed}" />
<echo message="" />
<if test="${project.anx.extended}">
<property name="project.anx.directives" value="${project.anx.directives} XNAEXT" />
</if>
<echo message="Compiler directives: ${project.anx.directives}" />
<call target="tools" />
<call target="generate_stock_shaders" />
<call target="anx" />
<call target="content_pipeline" />
<call target="inputsystem" />
<call target="soundsystem" />
<call target="rendersystem" />
<call target="platformsystem" />
<call target="samples" />
<if test="${project.anx.platform == 'Windows' or project.anx.platform == 'Linux'}">
<call target="templates_VS2010"/>
</if>
<if test="${project.anx.platform == 'Windows' and project.anx.build_env == 'VS2012'}">
<call target="VSExtension2012"/>
</if>
<call target="collect_xsd" />
</target>
<target name="check_xna" description="checks if the XNA framework is installed" unless="${target::has-executed('check_xna')}">
<property name="xna32" value="0" />
<property name="xna64" value="0" />
<property name="xnasdk32" value="0" />
<property name="xnasdk64" value="0" />
<readregistry property="xna32" key="Software\Microsoft\XNA\Framework\v4.0\Installed" hive="LocalMachine" failonerror="false" verbose="false" />
<readregistry property="xna64" key="Software\Wow6432Node\Microsoft\XNA\Framework\v4.0\Installed" hive="LocalMachine" failonerror="false" verbose="false" />
<if test="${int::parse(xna32) == 1 or int::parse(xna64) == 1}">
<property name="xna.installed" value="true" />
</if>
<readregistry property="xnasdk32" key="Software\Microsoft\XNA\Game Studio\v4.0\Installed" hive="LocalMachine" failonerror="false" verbose="false" />
<readregistry property="xnasdk64" key="Software\Wow6432Node\Microsoft\XNA\Game Studio\v4.0\Installed" hive="LocalMachine" failonerror="false" verbose="false" />
<if test="${int::parse(xnasdk32) == 1 or int::parse(xnasdk64) == 1}">
<property name="xnasdk.installed" value="true" />
</if>
</target>
<target name="anx" description="Build ANX.Framework core" unless="${target::has-executed('anx')}">
<echo message="building: ANX.Framework" />
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir}/${build.configuration}" />
<arg value="/p:AllowUnsafeBlocks=true" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<arg value='/p:DefineConstants="${project.anx.directives}"' />
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${project.anx.path}/${project.anx.name}.csproj" />
</exec>
</target>
<target name="support" description="ANX.Framework supporting libraries" unless="${target::has-executed('support')}">
<fileset id="support_files" basedir="../Support/">
<include name="**/*.csproj" />
<exclude name="**/*PSVita*.csproj" />
<exclude name="**/*Metro*.csproj" />
<exclude name="**/*Linux*.csproj" />
</fileset>
<if test="${project.anx.linux}">
<fileset id="support_files" basedir="../Support/">
<include name="**/*_Linux.csproj" />
</fileset>
</if>
<if test="${project.anx.psvita}">
<fileset id="support_files" basedir="../Support/">
<include name="**/*.PSVITA*_PSVITA.csproj" />
</fileset>
</if>
<if test="${project.anx.metro}">
<fileset id="support_files" basedir="../Support/">
<include name="**/*.Metro*_WindowsMetro.csproj" />
</fileset>
</if>
<foreach item="File" property="projectFile">
<in>
<items refid="support_files" />
</in>
<do>
<echo message="building: ${path::get-file-name-without-extension(projectFile)}" />
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir.base}/${build.configuration}" />
<arg value="/p:AllowUnsafeBlocks=true" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<arg value='/p:DefineConstants="${project.anx.directives}"' />
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${projectFile}" />
</exec>
</do>
</foreach>
</target>
<include buildfile="ANX.RenderSystem.build" />
<include buildfile="ANX.InputSystem.build" />
<include buildfile="ANX.SoundSystem.build" />
<include buildfile="ANX.PlatformSystem.build" />
<target name="create_linux_package">
<call target="build_tools"/>
<call target="linux"/>
<call target="build"/>
</target>
<target name="create_metro_package">
<call target="build_tools"/>
<call target="metro"/>
<call target="build"/>
</target>
<target name="create_msi_packages_ModernUI">
<call target="build"/>
<call target="metro"/>
<call target="build"/>
<property name="build.dir" value="${path::get-full-path('../bin')}" />
<call target="winrt"/>
<call target="build"/>
<call target="create_msi_packages"/>
</target>
<target name="generate_stock_shaders" description="Generate code for stock shaders" depends="build_tools">
<!-- default windows fileset -->
<fileset id="stock_shaders" basedir="../shader/">
<include name="**/build.xml" />
<exclude name="**/*Metro*/build.xml" />
</fileset>
<if test="${project.anx.linux}">
<fileset id="stock_shaders" basedir="../shader/">
<include name="**/GL3/build.xml" />
</fileset>
</if>
<if test="${project.anx.psvita}">
<fileset id="stock_shaders" basedir="../shader/">
<exclude name="**/build.xml" />
</fileset>
</if>
<if test="${project.anx.metro}">
<fileset id="stock_shaders" basedir="../shader/">
<include name="**/*Metro*/build.xml" />
</fileset>
</if>
<foreach item="File" property="buildFile">
<in>
<items refid="stock_shaders" />
</in>
<do>
<echo message="generating: ${path::get-file-name(path::get-directory-name(buildFile))}" />
<exec program="${build.dir.tools}/sscg.exe" >
<arg value='\"${buildFile}\"' />
<arg value="/silent" />
</exec>
</do>
</foreach>
</target>
<target name="samples" description="Build ANX.Framework samples">
<!-- default windows fileset -->
<fileset id="sample_files" basedir="../Samples/">
<include name="**/*.csproj" unless="${not xnasdk.installed}" />
<include name="**/SimpleNoContent.csproj" />
<include name="**/WindowsFormsEditor.csproj" />
<include name="**/WpfEditor.csproj" />
<exclude name="**/*Kinect*.csproj" />
<exclude name="**/*PSVita*.csproj" />
<exclude name="**/*Metro*.csproj" />
<exclude name="**/*Linux*.csproj" />
</fileset>
<if test="${project.anx.linux}">
<fileset id="sample_files" basedir="../Samples/">
<include name="**/*_Linux.csproj" unless="${not xnasdk.installed}" />
<include name="**/SimpleNoContent_Linux.csproj" />
</fileset>
</if>
<if test="${project.anx.psvita}">
<fileset id="sample_files" basedir="../Samples/">
<include name="**/*_PsVita.csproj" />
</fileset>
</if>
<if test="${project.anx.metro}">
<fileset id="sample_files" basedir="../Samples/">
<!--
<include name="**/*_WindowsMetro.csproj" />
-->
<!--<include name="**/SimpleNoContent_WindowsMetro.csproj" />-->
</fileset>
</if>
<foreach item="File" property="projectFile">
<in>
<items refid="sample_files" />
</in>
<do>
<echo message="building: ${path::get-file-name-without-extension(projectFile)}" />
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir.base}/samples/${build.configuration}" />
<arg value="/p:AllowUnsafeBlocks=true" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<arg value='/p:DefineConstants="${project.anx.directives}"' />
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${projectFile}" />
</exec>
</do>
</foreach>
</target>
<target name="templates_VS2010" description="Build ANX.Framework templates for Visual Studio 2010">
<fileset id="template_files" basedir="../Templates">
<include name="Projects/Windows/**/*.csproj"/>
<include name="Projects/Content/**/*.csproj"/>
<!-- no modern UI template -->
<include name="Items/**/*.csproj"/>
<exclude name="**/ProjectTemplate.csproj" /> <!-- child projects of multi project templates -->
</fileset>
<foreach item="File" property="projectFile">
<in>
<items refid="template_files" />
</in>
<do>
<echo message="building: ${path::get-file-name-without-extension(projectFile)}" />
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir.base}/${build.configuration}/VS2010" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<!--
<arg value='/p:DefineConstants="${project.anx.directives}"' />
-->
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${projectFile}" />
</exec>
</do>
</foreach>
</target>
<target name="templates_VS2012" description="Build ANX.Framework templates for Visual Studio 2012">
<fileset id="template_files" basedir="../Templates">
<include name="**/*.csproj"/>
<exclude name="**/ProjectTemplate.csproj" /> <!-- child projects of multi project templates -->
</fileset>
<foreach item="File" property="projectFile">
<in>
<items refid="template_files" />
</in>
<do>
<echo message="building: ${path::get-file-name-without-extension(projectFile)}" />
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir.base}/${build.configuration}/VS2012" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<!--
<arg value='/p:DefineConstants="${project.anx.directives}"' />
-->
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${projectFile}" />
</exec>
</do>
</foreach>
</target>
<target name="VSExtension2012" description="Build ANX extension for Visual Studio 2012">
<property name="VSExtensionConstants" value=""/>
<if test="${project.anx.build_env == 'VS2012'}">
<property name="VSExtensionConstants" value="DEV11;DEV11_OR_LATER"/>
</if>
<echo message="building: ANXVisualStudioPackage"/>
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir.base}/${build.configuration}/VS2012" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<arg value='/p:DefineConstants="${VSExtensionConstants}"' />
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${build.solution_dir}/Visual Studio/ANXVisualStudioPackage/ANXVisualStudioPackage.csproj" />
</exec>
</target>
<target name="build_tools" description="Tools supporting the build process of ANX.Framework" unless="${target::has-executed('build_tools')}">
<foreach item="File" property="projectFile">
<in>
<items basedir="../Tools/">
<include name="**/ProjectConverter.csproj" />
<include name="**/StockShaderCodeGenerator.csproj" />
</items>
</in>
<do>
<echo message="building: ${path::get-file-name-without-extension(projectFile)}" />
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir.tools}" />
<arg value="/p:AllowUnsafeBlocks=true" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<!--
<arg value='/p:DefineConstants="${project.anx.directives}"' />
-->
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${projectFile}" />
</exec>
</do>
</foreach>
</target>
<target name="tools" description="Build ANX.Framework tools" depends="anx, content_pipeline, support" unless="${target::has-executed('tools')}">
<foreach item="File" property="projectFile">
<in>
<items basedir="../Tools/">
<include name="**/*.csproj" />
<!--
<exclude name="**/ProjectConverter.csproj" />
-->
<exclude name="**/*ANX.ContentCompiler.GUI*.csproj" if="${project.anx.metro}" />
<exclude name="**/*ContentBuilder*.csproj" if="${project.anx.metro}" />
<exclude name="**/*ANXStatusComparer*.csproj" if="${project.anx.metro}" />
<exclude name="**/*StockShaderCodeGenerator*.csproj" if="${project.anx.metro}" />
<exclude name="**/*XNBInspector*.csproj" if="${project.anx.metro}" />
<exclude name="**/*OnlineStatusGenerator*.csproj" if="${project.anx.metro}" />
</items>
</in>
<do>
<echo message="building: ${path::get-file-name-without-extension(projectFile)}" />
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir.base}/${build.configuration}" />
<arg value="/p:AllowUnsafeBlocks=true" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<arg value='/p:DefineConstants="${project.anx.directives}"' />
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${projectFile}" />
</exec>
</do>
</foreach>
</target>
<target name="content_pipeline" description="Build ANX.Framework ContentPipeline extensions" depends="anx, support" unless="${target::has-executed('content_pipeline')}">
<echo message="building: Content.Pipeline.Extensions" />
<!--
<exec program="msbuild.exe" >
<arg value="/t:Build"/>
<arg value="/p:Configuration=${build.configuration}"/>
<arg value='/p:Platform="${build.platform}"'/>
<arg value="/p:OutputPath=${build.dir}/${build.configuration}" />
<arg value="/p:SolutionDir=${build.solution_dir}" />
<arg value='/p:DefineConstants="${project.anx.directives}"' />
<arg value="/p:AllowUnsafeBlocks=true" />
<arg value="/clp:ErrorsOnly" />
<arg value="/nologo" />
<arg value="${project.anxcontent.path}/${project.anxcontent.name}.csproj" />
</exec>
-->
</target>
<target name="create_packages" description="generates all type of packages">
<call target="create_zip_packages" />
<call target="create_msi_packages" />
</target>
<target name="create_zip_packages" description="Generate zip package containing binaries" depends="build">
<loadfile file="${project.anx.path}/Properties/AssemblyInfo.cs" property="assembly_version_file" />
<regex pattern="AssemblyVersion\(.(?'assembly_version'\d+\.\d+.\d+)" input="${assembly_version_file}" />
<property name="build.output.release_package" value="../package/${project.anx.name}-${build.configuration}-${assembly_version}.zip"/>
<zip ziplevel="9" zipfile="${build.output.release_package}">
<fileset basedir="../bin/${build.configuration}/">
<include name="*.dll" />
<include name="*.config" />
<include name="../../doc/license.txt" />
</fileset>
</zip>
</target>
<target name="collect_xsd" description="Collect all XSD files and prepare them to be installed with msi">
<foreach item="File" property="xsd_file">
<in>
<items basedir="../">
<include name="ANX.Framework/**/*.xsd"/>
<include name="ANX.Framework.Content.Pipeline/**/*.xsd"/>
</items>
</in>
<do>
<echo message="copying xsd file: ${xsd_file}"/>
<copy file="${xsd_file}" todir="../bin/${build.configuration}/schemas/"></copy>
</do>
</foreach>
</target>
<target name="create_msi_packages" description="Create the installer package" depends="build">
<loadfile file="${project.anx.path}/Properties/AssemblyInfo.cs" property="assembly_version_file" />
<regex pattern="AssemblyVersion\(.(?'assembly_version'\d+\.\d+.\d+)" input="${assembly_version_file}" />
<property name="build.output.installer_package" value="../package/${project.anx.name}-${build.configuration}-${assembly_version}.msi"/>
<property name="wix.dir" value="${path::combine(environment::get-variable('WIX'), 'bin/')}" readonly="true" />
<exec program="${wix.dir}candle.exe">
<arg value="../Installer/anx.wxs"></arg>
<arg value="-dPRODUCTVERSION=${assembly_version}"></arg>
<arg value="-ext"></arg> <!-- extensions="WixUIExtension;WiXUtilExtension;WixVSExtension" -->
<arg value="WixUIExtension"></arg>
<arg value="-ext"></arg>
<arg value="WiXUtilExtension"></arg>
<arg value="-ext"></arg>
<arg value="WixVSExtension"></arg>
<arg value="-out"></arg>
<arg value="${build.dir}/${build.configuration}/installer/"></arg>
<arg value="-nologo"></arg>
</exec>
<exec program="${wix.dir}light.exe">
<arg value="-out"></arg> <!-- out="${build.output.installer_package}" -->
<arg value="${build.output.installer_package}"></arg>
<arg value="-wx"></arg> <!-- warningsaserrors="true" -->
<arg value="-sice:ICE57"></arg> <!-- suppressices="ICE57" -->
<arg value="-cultures:en-us"></arg> <!-- cultures="en-us" -->
<arg value="-ext"></arg> <!-- extensions="WixUIExtension;WiXUtilExtension;WixVSExtension" -->
<arg value="WixUIExtension"></arg>
<arg value="-ext"></arg>
<arg value="WiXUtilExtension"></arg>
<arg value="-ext"></arg>
<arg value="WixVSExtension"></arg>
<arg value="-spdb"></arg> <!-- suppresspdb="true"> -->
<arg value="-fv"></arg> <!-- adds file version to the assembly name table -->
<arg value="${build.dir}/${build.configuration}/installer/*.wixobj"></arg>
<arg value="-nologo"></arg>
</exec>
</target>
<target name="generate_project_files" depends="build_tools">
<fileset id="project_files" basedir="../">
<include name="**/${project.anx.name}/*.csproj" />
<include name="ANX.Framework.Content.Pipeline/**/*.csproj" />
<include name="RenderSystems/**/*.csproj" />
<include name="InputSystems/**/*.csproj" />
<include name="PlatformSystems/**/*.csproj" />
<include name="SoundSystems/**/*.csproj" />
<include name="Samples/**/*.csproj" />
<exclude name="**/*_Linux.csproj" />
<exclude name="**/*_PSVita.csproj" />
<exclude name="**/*_WindowsMetro.csproj" />
</fileset>
<foreach item="File" property="projectFile">
<in>
<items refid="project_files" />
</in>
<do>
<echo message="create project file: ${path::get-file-name-without-extension(projectFile)}" />
<exec program="${build.dir.tools}/ProjectConverter.exe" >
<arg value="&quot;${projectFile}&quot;" />
<arg value="/linux" if="${project.anx.linux}" />
<arg value="/psvita" if="${project.anx.psvita}" />
<arg value="/windowsmetro" if="${project.anx.metro}" />
<arg value="/ProjectReferences" />
<arg value="/FrameworkPath=../.." />
</exec>
</do>
</foreach>
</target>
</project>