Download

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

Hello,

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/libprotobuf.so: incompatible target

.Build.cs



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/libprotobuf.so");
            //PublicAdditionalLibraries.Add(BuildPath + "/x86_64/libprotobuf.so"); // error AndroidProtobuf/x86_64/libprotobuf.so: incompatible target
            
            PublicAdditionalLibraries.Add(BuildPath + "/armv7/libsqliteX.so");
            //PublicAdditionalLibraries.Add(BuildPath + "/x86_64/libsqliteX.so"); // // error incompatible target

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



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

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

PublicAdditionalLibraries.Add('libprotobuf.so");
PublicAdditionalLibraries.Add(“libsqlliteX.so”);