Skip to content

Commit 45322f7

Browse files
committed
port-msc: some simplification, found a work around about the 8000 command arguments length
1 parent 47f1321 commit 45322f7

File tree

3 files changed

+59
-102
lines changed

3 files changed

+59
-102
lines changed

make-msc-module.tscript

Lines changed: 58 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,8 @@ function: generateRCMSC($template, $fileName)
162162
)
163163
end
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

make-unix-module.tscript

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function: determineLibraryFlagsUnix($libraries, &$librariesIncludes, &$libraries
7979
return(true)
8080
end
8181

82-
function: buildLibraryUnix($idx, $name, $libraries, $definitions, $includes, $ldFlags, $files, $optional)
82+
function: buildLibraryUnix($name, $libraries, $definitions, $includes, $ldFlags, $files, $optional)
8383
console.printLine("Building library: " + $name)
8484
console.printLine()
8585

@@ -120,7 +120,6 @@ function: buildLibraryUnix($idx, $name, $libraries, $definitions, $includes, $ld
120120
end
121121

122122
try
123-
124123
# create paths
125124
createPathRecusively($objectPath)
126125
createPathRecusively($libraryPath)

make.tscript

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,6 @@ function: main()
218218

219219
script.call(
220220
$buildLibrary,
221-
0,
222221
"libminitscript",
223222
[
224223
"libssl",
@@ -287,7 +286,6 @@ function: main()
287286

288287
script.call(
289288
$buildLibrary,
290-
1,
291289
"libyannet",
292290
[
293291
"libssl",
@@ -337,7 +335,6 @@ function: main()
337335

338336
script.call(
339337
$buildLibrary,
340-
2,
341338
"libtdme-ext",
342339
[],
343340
$rapidJSONDefinitions,
@@ -510,7 +507,6 @@ function: main()
510507

511508
script.call(
512509
$buildLibrary,
513-
3,
514510
"libagui",
515511
[
516512
"glew",
@@ -676,7 +672,6 @@ function: main()
676672

677673
script.call(
678674
$buildLibrary,
679-
4,
680675
"libtdme",
681676
[
682677
"glfw3",
@@ -935,7 +930,6 @@ function: main()
935930

936931
script.call(
937932
$buildLibrary,
938-
5,
939933
"libtdme-tools",
940934
[
941935
"glfw3",
@@ -1022,7 +1016,6 @@ function: main()
10221016

10231017
script.call(
10241018
$buildLibrary,
1025-
6,
10261019
"libtdme-tests",
10271020
[
10281021
"glfw3",
@@ -1064,7 +1057,6 @@ function: main()
10641057

10651058
script.call(
10661059
$buildLibrary,
1067-
7,
10681060
"libopengl2renderer",
10691061
[
10701062
"glew",
@@ -1082,7 +1074,6 @@ function: main()
10821074

10831075
script.call(
10841076
$buildLibrary,
1085-
8,
10861077
"libopengl3corerenderer",
10871078
[
10881079
"glew",
@@ -1100,7 +1091,6 @@ function: main()
11001091

11011092
script.call(
11021093
$buildLibrary,
1103-
9,
11041094
"libopengles2renderer",
11051095
[
11061096
"glesv2",
@@ -1119,7 +1109,6 @@ function: main()
11191109

11201110
script.call(
11211111
$buildLibrary,
1122-
10,
11231112
"libvulkanrenderer",
11241113
[
11251114
"glfw3",
@@ -1241,35 +1230,6 @@ function: main()
12411230
"-Isrc -Iext -I. -Iext/reactphysics3d/include/ -Iext/vhacd/include/ -Iext/cpp-spline/src -Iext/zlib -Iext/yannet/src -Iext/minitscript/src -Iext/a-gui/src",
12421231
$executableLdFlags,
12431232
[
1244-
"src/tdme/tests/AudioTest-main.cpp",
1245-
"src/tdme/tests/ContainerTest-main.cpp",
1246-
"src/tdme/tests/CrashTest-main.cpp",
1247-
"src/tdme/tests/EngineTest-main.cpp",
1248-
"src/tdme/tests/EntityHierarchyTest-main.cpp",
1249-
"src/tdme/tests/HTTPClientTest-main.cpp",
1250-
"src/tdme/tests/HTTPDownloadClientTest-main.cpp",
1251-
"src/tdme/tests/LODTest-main.cpp",
1252-
"src/tdme/tests/FlowMapTest-main.cpp",
1253-
"src/tdme/tests/FlowMapTest2-main.cpp",
1254-
"src/tdme/tests/FoliageTest-main.cpp",
1255-
"src/tdme/tests/MathOperatorTest-main.cpp",
1256-
"src/tdme/tests/MinitScriptTest-main.cpp",
1257-
"src/tdme/tests/PathFindingTest-main.cpp",
1258-
"src/tdme/tests/PhysicsTest1-main.cpp",
1259-
"src/tdme/tests/PhysicsTest2-main.cpp",
1260-
"src/tdme/tests/PhysicsTest3-main.cpp",
1261-
"src/tdme/tests/PhysicsTest4-main.cpp",
1262-
"src/tdme/tests/PhysicsTest5-main.cpp",
1263-
"src/tdme/tests/RayTracingTest-main.cpp",
1264-
"src/tdme/tests/SkinningTest-main.cpp",
1265-
"src/tdme/tests/SplineTest-main.cpp",
1266-
"src/tdme/tests/TextureAtlasTest-main.cpp",
1267-
"src/tdme/tests/ThreadingTest-main.cpp",
1268-
"src/tdme/tests/TreeTest-main.cpp",
1269-
"src/tdme/tests/UDPClientTest-main.cpp",
1270-
"src/tdme/tests/UDPServerTest-main.cpp",
1271-
"src/tdme/tests/VideoTest-main.cpp",
1272-
"src/tdme/tests/WaterTest-main.cpp",
12731233
"src/tdme/tools/editor/Editor-main.cpp",
12741234
"src/tdme/tools/installer/Installer-main.cpp",
12751235
"src/tdme/tools/cli/archive-main.cpp",

0 commit comments

Comments
 (0)