From 45322f7f58f60b3cd7acb008a7eb2e0f5e888deb Mon Sep 17 00:00:00 2001 From: Andreas Drewke Date: Wed, 22 Jan 2025 16:18:16 +0100 Subject: [PATCH] port-msc: some simplification, found a work around about the 8000 command arguments length --- make-msc-module.tscript | 118 +++++++++++++++++++-------------------- make-unix-module.tscript | 3 +- make.tscript | 40 ------------- 3 files changed, 59 insertions(+), 102 deletions(-) diff --git a/make-msc-module.tscript b/make-msc-module.tscript index 7916848cf..58a2677be 100644 --- a/make-msc-module.tscript +++ b/make-msc-module.tscript @@ -162,8 +162,8 @@ function: generateRCMSC($template, $fileName) ) end -function: buildLibraryMSC($idx, $name, $libraries, $definitions, $includes, $ldFlags, $files, $optional) - console.printLine("Building library: " + $name + "(" + $idx + ")") +function: buildLibraryMSC($name, $libraries, $definitions, $includes, $ldFlags, $files, $optional) + console.printLine("Building library: " + $name) console.printLine() $librariesIncludes = "" @@ -204,34 +204,23 @@ function: buildLibraryMSC($idx, $name, $libraries, $definitions, $includes, $ldF createPathRecusively($libraryPath) # compile each compilation units - $fileObjectPaths = {} $commands = [] $compilationUnits = "" + $compilationUnitsArray = [] forEach($file in $files) # - $fileObjectPathCandidate = - $name + - "/" + - filesystem.getFileName(filesystem.getPathName(filesystem.getPathName($file))) + - "/" + - filesystem.getFileName(filesystem.getPathName($file)) - if ($fileObjectPaths->contains($fileObjectPathCandidate) == false) - $fileObjectPaths->set($fileObjectPathCandidate, $fileObjectPaths->getSize()) - end - $fileObjectPath = - $idx + - "/" + - $fileObjectPaths->get($fileObjectPathCandidate) + $fileObjectPath = filesystem.getPathName($file) # create file object path createPathRecusively($objectPath + "/" + $fileObjectPath) # - $compilationUnit = $objectPath + "/" + $fileObjectPath + "/" + filesystem.removeFileExtension(filesystem.getFileName($file)) + ".obj" + $compilationUnit = $objectPath + "/" + filesystem.removeFileExtension($file) + ".obj" if ($compilationUnits->isEmpty() == false) $compilationUnits = $compilationUnits + " " end $compilationUnits = $compilationUnits + $compilationUnit + $compilationUnitsArray[] = $compilationUnit # $timeStampFile = 0 @@ -295,52 +284,61 @@ function: buildLibraryMSC($idx, $name, $libraries, $definitions, $includes, $ldF $linkerSymbolsFile = $libraryPath + "/" + $name + ".symbols" $linkerDefFile = $libraryPath + "/" + $name + ".def" - # link #1 - $command = - "chcp 65001 > nul && " + - "lib" + - " " + - "/OUT:" + - $libraryPath + "/" + $name + ".lib" + - " " + - $compilationUnits - console.printLine($command) - - # execute - $exitCode = $$.application::EXITCODE_SUCCESS - $error = null - $result = application.execute($command, $exitCode, $error) + # + filesystem.setContentFromString( + filesystem.getPathName($linkerSymbolsFile), + filesystem.getFileName($linkerSymbolsFile), + "" + ) - if ($exitCode != $$.application::EXITCODE_SUCCESS) - console.printLine("lib exited with exit code " + $exitCode + ", see error: " + $error) - if ($optional == false) - console.printLine() - application.exit($$.application::EXITCODE_FAILURE) + # + forEach($compilationUnit in $compilationUnitsArray) + # link #1 + $command = + "chcp 65001 > nul && " + + "lib" + + " " + + "/OUT:" + + $libraryFile + + " " + + $compilationUnit + + # execute + $exitCode = $$.application::EXITCODE_SUCCESS + $error = null + $result = application.execute($command, $exitCode, $error) + + if ($exitCode != $$.application::EXITCODE_SUCCESS) + console.printLine("lib exited with exit code " + $exitCode + ", see error: " + $error) + if ($optional == false) + console.printLine() + application.exit($$.application::EXITCODE_FAILURE) + end end - end - - # dump bin - $command = - "chcp 65001 > nul && " + - "dumpbin" + - " " + - "/LINKERMEMBER" + - " " + - $libraryFile + - " " + - "> " + - $linkerSymbolsFile - # execute - $exitCode = $$.application::EXITCODE_SUCCESS - $error = null - $result = application.execute($command, $exitCode, $error) - - if ($exitCode != $$.application::EXITCODE_SUCCESS) - console.printLine("dumpbin exited with exit code " + $exitCode + ", see error: " + $error) - if ($optional == false) - console.printLine() - application.exit($$.application::EXITCODE_FAILURE) + # dump bin + $command = + "chcp 65001 > nul && " + + "dumpbin" + + " " + + "/LINKERMEMBER" + + " " + + $libraryFile + + " " + + ">> " + + $linkerSymbolsFile + + # execute + $exitCode = $$.application::EXITCODE_SUCCESS + $error = null + $result = application.execute($command, $exitCode, $error) + + if ($exitCode != $$.application::EXITCODE_SUCCESS) + console.printLine("dumpbin exited with exit code " + $exitCode + ", see error: " + $error) + if ($optional == false) + console.printLine() + application.exit($$.application::EXITCODE_FAILURE) + end end end diff --git a/make-unix-module.tscript b/make-unix-module.tscript index 394a1f7a3..69ee993a7 100644 --- a/make-unix-module.tscript +++ b/make-unix-module.tscript @@ -79,7 +79,7 @@ function: determineLibraryFlagsUnix($libraries, &$librariesIncludes, &$libraries return(true) end -function: buildLibraryUnix($idx, $name, $libraries, $definitions, $includes, $ldFlags, $files, $optional) +function: buildLibraryUnix($name, $libraries, $definitions, $includes, $ldFlags, $files, $optional) console.printLine("Building library: " + $name) console.printLine() @@ -120,7 +120,6 @@ function: buildLibraryUnix($idx, $name, $libraries, $definitions, $includes, $ld end try - # create paths createPathRecusively($objectPath) createPathRecusively($libraryPath) diff --git a/make.tscript b/make.tscript index 09b744b60..f807710b7 100644 --- a/make.tscript +++ b/make.tscript @@ -218,7 +218,6 @@ function: main() script.call( $buildLibrary, - 0, "libminitscript", [ "libssl", @@ -287,7 +286,6 @@ function: main() script.call( $buildLibrary, - 1, "libyannet", [ "libssl", @@ -337,7 +335,6 @@ function: main() script.call( $buildLibrary, - 2, "libtdme-ext", [], $rapidJSONDefinitions, @@ -510,7 +507,6 @@ function: main() script.call( $buildLibrary, - 3, "libagui", [ "glew", @@ -676,7 +672,6 @@ function: main() script.call( $buildLibrary, - 4, "libtdme", [ "glfw3", @@ -935,7 +930,6 @@ function: main() script.call( $buildLibrary, - 5, "libtdme-tools", [ "glfw3", @@ -1022,7 +1016,6 @@ function: main() script.call( $buildLibrary, - 6, "libtdme-tests", [ "glfw3", @@ -1064,7 +1057,6 @@ function: main() script.call( $buildLibrary, - 7, "libopengl2renderer", [ "glew", @@ -1082,7 +1074,6 @@ function: main() script.call( $buildLibrary, - 8, "libopengl3corerenderer", [ "glew", @@ -1100,7 +1091,6 @@ function: main() script.call( $buildLibrary, - 9, "libopengles2renderer", [ "glesv2", @@ -1119,7 +1109,6 @@ function: main() script.call( $buildLibrary, - 10, "libvulkanrenderer", [ "glfw3", @@ -1241,35 +1230,6 @@ function: main() "-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", $executableLdFlags, [ - "src/tdme/tests/AudioTest-main.cpp", - "src/tdme/tests/ContainerTest-main.cpp", - "src/tdme/tests/CrashTest-main.cpp", - "src/tdme/tests/EngineTest-main.cpp", - "src/tdme/tests/EntityHierarchyTest-main.cpp", - "src/tdme/tests/HTTPClientTest-main.cpp", - "src/tdme/tests/HTTPDownloadClientTest-main.cpp", - "src/tdme/tests/LODTest-main.cpp", - "src/tdme/tests/FlowMapTest-main.cpp", - "src/tdme/tests/FlowMapTest2-main.cpp", - "src/tdme/tests/FoliageTest-main.cpp", - "src/tdme/tests/MathOperatorTest-main.cpp", - "src/tdme/tests/MinitScriptTest-main.cpp", - "src/tdme/tests/PathFindingTest-main.cpp", - "src/tdme/tests/PhysicsTest1-main.cpp", - "src/tdme/tests/PhysicsTest2-main.cpp", - "src/tdme/tests/PhysicsTest3-main.cpp", - "src/tdme/tests/PhysicsTest4-main.cpp", - "src/tdme/tests/PhysicsTest5-main.cpp", - "src/tdme/tests/RayTracingTest-main.cpp", - "src/tdme/tests/SkinningTest-main.cpp", - "src/tdme/tests/SplineTest-main.cpp", - "src/tdme/tests/TextureAtlasTest-main.cpp", - "src/tdme/tests/ThreadingTest-main.cpp", - "src/tdme/tests/TreeTest-main.cpp", - "src/tdme/tests/UDPClientTest-main.cpp", - "src/tdme/tests/UDPServerTest-main.cpp", - "src/tdme/tests/VideoTest-main.cpp", - "src/tdme/tests/WaterTest-main.cpp", "src/tdme/tools/editor/Editor-main.cpp", "src/tdme/tools/installer/Installer-main.cpp", "src/tdme/tools/cli/archive-main.cpp",