# Conditionally compile plugins based on platform

**URL:** <https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083>\
**Category:** Plugins\
**Tags:** MAC, unreal-engine, compile-error, compile, Plugins, CPP, question\
**Created:** [December 10, 2015, 8:19pm UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083 "2015-12-10T20:19:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_bfeb8c0b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bfeb8c0b](https://forums.unrealengine.com/u/anonymous_user_bfeb8c0b)\
**Post date:** [December 10, 2015, 8:19pm UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/1 "2015-12-10T20:19:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![joeGraf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joeGraf](https://forums.unrealengine.com/u/joeGraf)\
**Post date:** [December 10, 2015, 8:52pm UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/2 "2015-12-10T20:52:53Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_bfeb8c0b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_bfeb8c0b](https://forums.unrealengine.com/u/anonymous_user_bfeb8c0b)\
**Post date:** [December 18, 2015, 1:13am UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/3 "2015-12-18T01:13:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DaveCSumo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DaveCSumo](https://forums.unrealengine.com/u/DaveCSumo)\
**Post date:** [September 13, 2017, 8:58am UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/4 "2017-09-13T08:58:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![BitDEVil2K16](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bitdevil2k16/32/993049_2.png) [@BitDEVil2K16](https://forums.unrealengine.com/u/BitDEVil2K16)\
**Post date:** [October 20, 2017, 12:20pm UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/5 "2017-10-20T12:20:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![DanielDurys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DanielDurys](https://forums.unrealengine.com/u/DanielDurys)\
**Post date:** [January 17, 2018, 2:06pm UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/6 "2018-01-17T14:06:49Z")

</div>

It works for me too, thanks 🙂

---

<div class="post-metadata">

**Author:** ![KEATE\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KEATE\_1](https://forums.unrealengine.com/u/KEATE_1)\
**Post date:** [December 8, 2018, 2:37pm UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/7 "2018-12-08T14:37:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![corejake](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@corejake](https://forums.unrealengine.com/u/corejake)\
**Post date:** [May 21, 2019, 8:19pm UTC](https://forums.unrealengine.com/t/conditionally-compile-plugins-based-on-platform/341083/8 "2019-05-21T20:19:41Z")

</div>

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