MCPcopy Create free account
hub / github.com/URLab-Sim/UnrealRoboticsLab / AddThirdPartyLibrary

Method AddThirdPartyLibrary

Source/URLab/URLab.Build.cs:141–229  ·  view source on GitHub ↗
(string LibraryName, ReadOnlyTargetRules Target)

Source from the content-addressed store, hash-verified

139 }
140
141 private void AddThirdPartyLibrary(string LibraryName, ReadOnlyTargetRules Target)
142 {
143 string FullPath = Path.Combine(ThirdPartyPath, LibraryName);
144
145 // Add include directory if it exists
146 string IncludePath = Path.Combine(FullPath, "include");
147 if (Directory.Exists(IncludePath))
148 {
149 PublicIncludePaths.Add(IncludePath);
150 }
151
152 if (Target.Platform == UnrealTargetPlatform.Win64)
153 {
154 // Link all libraries in the lib directory
155 string LibPath = Path.Combine(FullPath, "lib");
156 if (Directory.Exists(LibPath))
157 {
158 string[] LibFiles = Directory.GetFiles(LibPath, "*.lib", SearchOption.AllDirectories);
159 foreach (string LibFile in LibFiles)
160 {
161 PublicAdditionalLibraries.Add(LibFile);
162 }
163 }
164
165 // Stage DLLs next to executable for packaged builds
166 // Skip MSVC runtime DLLs (handled by redistributable installer)
167 string BinPath = Path.Combine(FullPath, "bin");
168 if (Directory.Exists(BinPath))
169 {
170 string[] DllFiles = Directory.GetFiles(BinPath, "*.dll", SearchOption.AllDirectories);
171 foreach (string DllFile in DllFiles)
172 {
173 string DllName = Path.GetFileName(DllFile);
174 if (DllName.StartsWith("vcruntime") || DllName.StartsWith("msvcp") || DllName.StartsWith("concrt"))
175 continue;
176 RuntimeDependencies.Add("$(BinaryOutputDir)/" + DllName, DllFile, StagedFileType.NonUFS);
177 PublicDelayLoadDLLs.Add(DllName);
178 }
179 }
180 }
181 else if (Target.Platform == UnrealTargetPlatform.Linux)
182 {
183 // On Linux the URLab plugin .so already gets `${ORIGIN}` added to
184 // its RPATH by UBT, so the runtime loader resolves third-party
185 // shared libs (libmujoco / lib_coacd / libzmq) from the plugin's
186 // own Binaries/Linux/ directory. The `setup_rpath_linux.sh`
187 // helper symlinks third_party/install/<pkg>/lib/*.so* into
188 // Binaries/Linux/ after the plugin builds, so no LD_LIBRARY_PATH
189 // is needed at editor / packaging time.
190 //
191 // (UBT's auto-computed relative RPATH from absolute lib paths
192 // resolves incorrectly when the plugin lives outside the host
193 // project — the ${ORIGIN}/../../../../UnrealEngine/.. chain it
194 // emits assumes engine and project share a common ancestor.
195 // Staging via $ORIGIN sidesteps that entirely.)
196 string LibPath = Path.Combine(FullPath, "lib");
197 if (Directory.Exists(LibPath))
198 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected