How to set inappropriate targets ignoring in .Build.cs ?


I have different .so libraries for different target. The question - how correctly write them in .Build.cs so that compile ignored inappropriate (somethink like if(armv7)) without commenting lines where I adds the x86 lib. If I write all together and chose armv7 target for build I get an error for x86:

error AndroidProtobuf/x86_64/ incompatible target


if (Target.Platform == UnrealTargetPlatform.Android)
            string BuildPath = Utils.MakePathRelativeTo(ModuleDirectory, BuildConfiguration.RelativeEnginePath);

            AdditionalPropertiesForReceipt.Add(new ReceiptProperty("AndroidPlugin", Path.Combine(BuildPath, "APL.xml")));

            PublicAdditionalLibraries.Add(BuildPath + "/armv7/");
            //PublicAdditionalLibraries.Add(BuildPath + "/x86_64/"); // error AndroidProtobuf/x86_64/ incompatible target
            PublicAdditionalLibraries.Add(BuildPath + "/armv7/");
            //PublicAdditionalLibraries.Add(BuildPath + "/x86_64/"); // // error incompatible target

            // Is there something like this?
                      PublicAdditionalLibraries.Add(BuildPath + "/armv7/");
            else if(x86_64)
                      PublicAdditionalLibraries.Add(BuildPath + "/x86_64/");

The paths are filtered by the active architecture. Try this instead:

PublicLibraryPaths.Add(BuildPath + “/ARMv7”);
PublicLibraryPaths.Add(BuildPath + “/x64”);