Conditionally compile plugins based on platform

You specify the platforms in the .uplugin file. Like so:

"Modules" :
[
    {
        "Name": "FlurryEditor",
        "Type": "Editor"
    },
	{
		"Name" : "IOSFlurry",
		"Type" : "Runtime",
		"LoadingPhase" : "PreDefault",
		"WhitelistPlatforms" : [ "IOS" ]
	}
]

I’m using Unreal Version 4.9.2

I would like to know is there a way to conditionally compile plugins based on the current platform?

For example,

I have a project that works perfectly (compiling in VS 2013) for development in a windows environment and has a few Custom Plugins that all work properly. That being said, if I transfer said project over to my Macbook (MacOS) to do further development, the project fails to completely compile w/ XCode.

The reason the project won’t compile is simple, my Custom Plugins only work on Windows (due to Library requirements *.dll etc).

That being said, is there a configuration I can use to just simply say “Hey UE4, please don’t even TRY to compile those plugins” ONLY when we are in a MacOS environment?

I feel like there is something I can edit in each of the Plugins *.build.cs file. But I’m not exactly sure which steps I can take. Simply removing the plugin from the project is NOT an option because we are using Revision control, and don’t want to have 2 separate sets of Source Code just because of a few plugins.

Thanks in advance for any answers. Much appreciated.

I don’t want to mislead anyone, but this DID NOT work for me. I’ve tried “WhiteListPlatforms”, and “BlackListPlatforms.”

In both cases, after re-generating project files, XCODE was still trying to Compile a plugin that I had BlackListed for IOS.

I’m going to write this one off as a bug.

That being said, I found a solution:

Just delete the .uplugin file that you “DO NOT” want to even try to compile. This is a much simpler approach, and it won’t allow the “Project File Generation” code to even notice that’s a plugin and add it to the build list.

My observations:

If you are under version control software such as Perforce, each time you grab the latest version, this file (*.uplugin) will be added back to the project file structure, just don’t forget to “re-delete” it. That should take care of the problem until “WhiteListPlatforms” or “BlackListPlatforms” starts working again.

I cannot give any source, as I am under NDA / working for a company which it is NOT allowed. I deeply apologize that I cannot provide samples.

Might want to try using a lower case L in “WhitelistPlatforms”.

This Works i have this tested for AdvanceSession and Android Build…

"Modules" :
    [
        {
            "Name" : "AdvancedSteamSessions",
            "Type" : "RunTime",
			"LoadingPhase" : "PreDefault",
			"WhitelistPlatforms" :
			[
                "Win32",
                "Win64"
			]
        } 
    ],
	"Plugins": [
		{
			"Name": "AdvancedSessions",
			"Enabled": true
		},..........

And compile Works
Thx

It works for me too, thanks :slight_smile:

That works for me2…I’m trying to set the target platform for a long time.Thx…

“SupportedTargetPlatforms”: [
“Win64”
]
or
“TargetPlatforms”: [
“Android”,
“IOS”
]