@@ -162,8 +162,8 @@ function: generateRCMSC($template, $fileName)
162162 )
163163end
164164
165- function: buildLibraryMSC($idx, $ name, $libraries, $definitions, $includes, $ldFlags, $files, $optional)
166- console.printLine("Building library: " + $name + "(" + $idx + ")" )
165+ function: buildLibraryMSC($name, $libraries, $definitions, $includes, $ldFlags, $files, $optional)
166+ console.printLine("Building library: " + $name)
167167 console.printLine()
168168
169169 $librariesIncludes = ""
@@ -204,34 +204,23 @@ function: buildLibraryMSC($idx, $name, $libraries, $definitions, $includes, $ldF
204204 createPathRecusively($libraryPath)
205205
206206 # compile each compilation units
207- $fileObjectPaths = {}
208207 $commands = []
209208 $compilationUnits = ""
209+ $compilationUnitsArray = []
210210 forEach($file in $files)
211211 #
212- $fileObjectPathCandidate =
213- $name +
214- "/" +
215- filesystem.getFileName(filesystem.getPathName(filesystem.getPathName($file))) +
216- "/" +
217- filesystem.getFileName(filesystem.getPathName($file))
218- if ($fileObjectPaths->contains($fileObjectPathCandidate) == false)
219- $fileObjectPaths->set($fileObjectPathCandidate, $fileObjectPaths->getSize())
220- end
221- $fileObjectPath =
222- $idx +
223- "/" +
224- $fileObjectPaths->get($fileObjectPathCandidate)
212+ $fileObjectPath = filesystem.getPathName($file)
225213
226214 # create file object path
227215 createPathRecusively($objectPath + "/" + $fileObjectPath)
228216
229217 #
230- $compilationUnit = $objectPath + "/" + $fileObjectPath + "/" + filesystem.removeFileExtension(filesystem.getFileName( $file) ) + ".obj"
218+ $compilationUnit = $objectPath + "/" + filesystem.removeFileExtension($file) + ".obj"
231219 if ($compilationUnits->isEmpty() == false)
232220 $compilationUnits = $compilationUnits + " "
233221 end
234222 $compilationUnits = $compilationUnits + $compilationUnit
223+ $compilationUnitsArray[] = $compilationUnit
235224
236225 #
237226 $timeStampFile = 0
@@ -295,52 +284,61 @@ function: buildLibraryMSC($idx, $name, $libraries, $definitions, $includes, $ldF
295284 $linkerSymbolsFile = $libraryPath + "/" + $name + ".symbols"
296285 $linkerDefFile = $libraryPath + "/" + $name + ".def"
297286
298- # link #1
299- $command =
300- "chcp 65001 > nul && " +
301- "lib" +
302- " " +
303- "/OUT:" +
304- $libraryPath + "/" + $name + ".lib" +
305- " " +
306- $compilationUnits
307- console.printLine($command)
308-
309- # execute
310- $exitCode = $$.application::EXITCODE_SUCCESS
311- $error = null
312- $result = application.execute($command, $exitCode, $error)
287+ #
288+ filesystem.setContentFromString(
289+ filesystem.getPathName($linkerSymbolsFile),
290+ filesystem.getFileName($linkerSymbolsFile),
291+ ""
292+ )
313293
314- if ($exitCode != $$.application::EXITCODE_SUCCESS)
315- console.printLine("lib exited with exit code " + $exitCode + ", see error: " + $error)
316- if ($optional == false)
317- console.printLine()
318- application.exit($$.application::EXITCODE_FAILURE)
294+ #
295+ forEach($compilationUnit in $compilationUnitsArray)
296+ # link #1
297+ $command =
298+ "chcp 65001 > nul && " +
299+ "lib" +
300+ " " +
301+ "/OUT:" +
302+ $libraryFile +
303+ " " +
304+ $compilationUnit
305+
306+ # execute
307+ $exitCode = $$.application::EXITCODE_SUCCESS
308+ $error = null
309+ $result = application.execute($command, $exitCode, $error)
310+
311+ if ($exitCode != $$.application::EXITCODE_SUCCESS)
312+ console.printLine("lib exited with exit code " + $exitCode + ", see error: " + $error)
313+ if ($optional == false)
314+ console.printLine()
315+ application.exit($$.application::EXITCODE_FAILURE)
316+ end
319317 end
320- end
321-
322- # dump bin
323- $command =
324- "chcp 65001 > nul && " +
325- "dumpbin" +
326- " " +
327- "/LINKERMEMBER" +
328- " " +
329- $libraryFile +
330- " " +
331- "> " +
332- $linkerSymbolsFile
333318
334- # execute
335- $exitCode = $$.application::EXITCODE_SUCCESS
336- $error = null
337- $result = application.execute($command, $exitCode, $error)
338-
339- if ($exitCode != $$.application::EXITCODE_SUCCESS)
340- console.printLine("dumpbin exited with exit code " + $exitCode + ", see error: " + $error)
341- if ($optional == false)
342- console.printLine()
343- application.exit($$.application::EXITCODE_FAILURE)
319+ # dump bin
320+ $command =
321+ "chcp 65001 > nul && " +
322+ "dumpbin" +
323+ " " +
324+ "/LINKERMEMBER" +
325+ " " +
326+ $libraryFile +
327+ " " +
328+ ">> " +
329+ $linkerSymbolsFile
330+
331+ # execute
332+ $exitCode = $$.application::EXITCODE_SUCCESS
333+ $error = null
334+ $result = application.execute($command, $exitCode, $error)
335+
336+ if ($exitCode != $$.application::EXITCODE_SUCCESS)
337+ console.printLine("dumpbin exited with exit code " + $exitCode + ", see error: " + $error)
338+ if ($optional == false)
339+ console.printLine()
340+ application.exit($$.application::EXITCODE_FAILURE)
341+ end
344342 end
345343 end
346344
0 commit comments