ogre / BuildingOgreWinRT.txt

To build Ogre in WinRT mode some manual steps are required:

1. The code and generated cmake solution can't be on a network drive - 
else you will get a similar error when you will try to run the result exe:
Error : DEP0700 : Registration of the app in the layout folder "\bin\Debug\AppX" failed.
Rejecting a request to register from file:////bin/Debug/AppX/AppxManifest.xml because 
the files are on a network share. Copy the files to the local computer before registering 
the package.
I found this issue the hard way when working with VMWare and shared folders to the host

2. You need Windows 8 Release Preview (build 8400) or later.
Windows 8 Developer/Consumer Preview (build 8102/8250) are not supported.
We recommend using the final version of Windows 8. You can get a trial version
from  the Microsoft site, google for it. 

5.	Download and install this cmake
Now we need to fix cmake to support visual studio express.
6.	Run visual studio express for windows phone 8 as admin (right click panel then "run as admin")
7.	open this file in visual studio "C:\Program Files (x86)\CMake 2.8\share\cmake-2.8\Modules\CMakeVS11FindMake.cmake"
8.	Goto line 19 and change it from:
NAMES devenv
NAMES devenv VPDExpress

4. You need Visual Studio 2012 Release Preview or later.
Note: There have been reports of issues with the express version.
We recommend using one of final version of Visual Studio 2012. You can get a 
trial version from  the Microsoft site, google for it. 

5. Patched dependencies must be used, compiled with #define WINAPI_FAMILY = 2.
Cg is not supported, and only headers from OIS are needed. 

6. Compile dependencies for all configurations that you plan to use before running CMake.
Dependencies for Win32 and for WinRT must be located in separate folders, Win32 version 
can be built from OgreDependencies.VS2012.sln, WinRT from OgreDependencies.VS2012.WinRT.sln
Run CMake, select "Visual Studio 11" generator,  specify source and binaries folders, 
than "Configure", specify WinRT dependencies folder, again "Configure", set 
OGRE_BUILD_PLATFORM_WINRT  check ignoring other errors, again "Configure", should be 
no more errors and "Generate". Also set OGRE_STATIC to on.
If you want build time to be shorter - set OGRE_UNITY_BUILD to on.

7. Remove the following projects from the solution: ALL_BUILD, INSTALL, PACKAGE.

8. In WinRT mode VS2012 by default uses precompiled headers, and CMake can not yet prevent this.
So, open OGRE.sln in Visual Studio, select All projects (but not the solution itself) 
Right click, than go to "Properties" select "Configuration Properties", than "All Configurations"
and under "Configuration Properties > General > Windows Store App Support" choose "Yes". After this
(not before) go to "Configuration Properties > C/C++ > Precompiled Headers > Precompiled Header"
and choose "Not Using Precompiled Headers".

9. As CMake can not generate valid WinRT app project we need to use our own.
Therefore "File > Add > Existing Project ..." and select
"Samples > Browser > WinRT > SampleBrowserWinRT.vcxproj". 
Repeat this for "Samples > Browser > WinRT.Xaml > SampleBrowserWinRTXaml.vcxproj".
if this is your first time on that computer - you will be asked for a developer licence, do the
required steps.

10.	Add dependencies to solution by right clicking the solution, selecting add existing project, 
select "solution" in the combo next to the file select edit at the bottom then select the 
dependencies solution, all the dependencies should be now a part of the solution. Remove OIS 
project that you just add - but leave the rest in.

11. Add project dependencies: "SampleBrowserWinRT > Properties", than 
"Common Properties > Framework and References", remove all existing references
and then "add" and in that window add a check mark next to all the projects on the list (except 
for the SampleBrowser projects...)
Repeat this for SampleBrowserWinRTXaml. 
In prerelease version of VS2012 it take big amount of time, but this bug was fixed in RTM.

12.	Select only RenderSystem_Direct3D11 project in the solution tree, right click, properties, select all configs and "win32" platform in the combos at the top of the properties window, select "configuration properties"->"C++"->"Command line" on the tree on the left of that window, add
/ZW /AI "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcpackages"
To the command line

13. right click SampleBrowserWP8 -> Properties -> C++ -> General -> Additional Include Directories 
Add the path of 
[your build directory]\include ex: c:\ogre\build6\include
[your dependencies dir]\include ex: C:\ogre\dep\include
[your dependencies dir]\include\ois

14. Try to build the solution.

15. If you have a compile issue with finding OIS.h - this is becouse SampleBrowserWinRT.vcxproj
wasn't generated by cmake, the way to fix it is just to copy paste the ois path from one of the 
other projects "additional include directories" to SampleBrowserWinRT.vcxproj "additional 
include directories" config.

16. If you get any compile\link error with "...mklink /J..." failed - it mean that the 
code is not on a local drive (VMWare shared folder will not work for this...)

17. Select SampleBrowserWinRT or SampleBrowserWinRTXaml as the start up project and run.