How to package a VR-Flat-Hybrid game for android?

I am trying to package my game for Android. What I mean with VR-Flat-Hybrid is, that the game can be played on a flat smartphone screen and with an HMD, like the HTC Vive. So I need to include things like SteamVRChaperone, which are not available for Android.

I had a different Error first. It was something along the lines of: “did not find SteamVRChaperoneComponent.generated.h”.

I fixed that by adding “#if PLATFORM_WINDOWS” everywhere where I was using SteamVRChaperoneComponent or VRNotificationsComponent. But I want to support Playstation VR as well. Can I use “#if PLATFORM_WINDOWS || PLATFORM_PLAYSTATION” instead?

Now I get the Error below. I am guessing it occurs because I always add “SteamVR”, “SteamVRController”, “HeadMountedDisplay” to the PrivateDependencyModuleNames in MyProject.Build.cs. So how do I check if I am compiling for a SteamVR compatible system? Or at least where can I find information about the “UEBuildConfiguration”?

MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: Performing 1 actions (4 in parallel)
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: [1/1] clang++.exe RobotDefenseCPP-armv7-es2.so
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: clang++.exe: error: no such file or directory: 'C:/Program Files (x86)/Epic Games/4.12/Engine/Plugins/Runtime/Steam/SteamVR/Binaries/Android/UE4-SteamVR-armv7-es2.a'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: clang++.exe: error: no such file or directory: 'C:/Program Files (x86)/Epic Games/4.12/Engine/Plugins/Runtime/Steam/SteamVR/Binaries/Android/UE4-SteamVRController-armv7-es2.a'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: clang++.exe: error: no such file or directory: 'C:/Program Files (x86)/Epic Games/4.12/Engine/Plugins/Runtime/Steam/SteamVR/Binaries/Android/UE4-SteamVR-armv7-es2.a'
MainFrameActions: Packaging (Android (ATC)): UnrealBuildTool: clang++.exe: error: no such file or directory: 'C:/Program Files (x86)/Epic Games/4.12/Engine/Plugins/Runtime/Steam/SteamVR/Binaries/Android/UE4-SteamVRController-armv7-es2.a'

As I assumed, the problem was the configuration of the MyProject.Build.cs file. I was able to successfully package my project with the configuration below. I wish there was more documentation concerning the Build.cs file. I still don’t really know what the different platform options are in “Target.Platform” and I don’t know what is inside the UEBuildConfiguration.

public class MyProject : ModuleRules
{
	public MyProject (TargetInfo Target)
	{
		PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

        PrivateDependencyModuleNames.AddRange(new string[]
        {
            "HeadMountedDisplay", // VR
            "UMG", "Slate", "SlateCore", // UI
            "PhysX", "APEX" // PhysX
        });

        if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
        {
            PrivateDependencyModuleNames.AddRange(new string[]
            {
                "SteamVR", "SteamVRController" // SteamVR
            });
        }

        // Uncomment if you are using online features
        PrivateDependencyModuleNames.Add("OnlineSubsystem");
		if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64))
		{
			if (UEBuildConfiguration.bCompileSteamOSS == true)
			{
				DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
			}
		}
	}
}

PS: The other question is still unsolved though: Can I use something along the lines of:

#if PLATFORM_WINDOWS || PLATFORM_PLAYSTATION

?

PPS: I am now using

#if (PLATFORM_WINDOWS || PLATFORM_PS4)
#endif // (PLATFORM_WINDOWS || PLATFORM_PS4)

to exclude anything VR related. And I am using

#if PLATFORM_WINDOWS
#endif // PLATFORM_WINDOWS

to exclude everything related to SteamVR. (Valve, please add Linux support)

PPPS: I created a list of all the Target.Platform names I could find with a search in Visual Studio. so you can compare those names in your ProjectName.Build.cs file like this:

if (Target.Platform == UnrealTargetPlatform.SomePlatformName)
  1. Mac
  2. Linux
  3. Win32
  4. Win64
  5. Android
  6. IOS
  7. HTML5
  8. TVOS
  9. XboxOne
  10. PS4
  11. WinRT
  12. WinRT_ARM

These are all the Names I could find.