Skip to content

Commit

Permalink
port-msc: some simplification, found a work around about the 8000 com…
Browse files Browse the repository at this point in the history
…mand arguments length
  • Loading branch information
andreasdr committed Jan 22, 2025
1 parent 47f1321 commit 45322f7
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 102 deletions.
118 changes: 58 additions & 60 deletions make-msc-module.tscript
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions make-unix-module.tscript
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -120,7 +120,6 @@ function: buildLibraryUnix($idx, $name, $libraries, $definitions, $includes, $ld
end

try

# create paths
createPathRecusively($objectPath)
createPathRecusively($libraryPath)
Expand Down
40 changes: 0 additions & 40 deletions make.tscript
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ function: main()

script.call(
$buildLibrary,
0,
"libminitscript",
[
"libssl",
Expand Down Expand Up @@ -287,7 +286,6 @@ function: main()

script.call(
$buildLibrary,
1,
"libyannet",
[
"libssl",
Expand Down Expand Up @@ -337,7 +335,6 @@ function: main()

script.call(
$buildLibrary,
2,
"libtdme-ext",
[],
$rapidJSONDefinitions,
Expand Down Expand Up @@ -510,7 +507,6 @@ function: main()

script.call(
$buildLibrary,
3,
"libagui",
[
"glew",
Expand Down Expand Up @@ -676,7 +672,6 @@ function: main()

script.call(
$buildLibrary,
4,
"libtdme",
[
"glfw3",
Expand Down Expand Up @@ -935,7 +930,6 @@ function: main()

script.call(
$buildLibrary,
5,
"libtdme-tools",
[
"glfw3",
Expand Down Expand Up @@ -1022,7 +1016,6 @@ function: main()

script.call(
$buildLibrary,
6,
"libtdme-tests",
[
"glfw3",
Expand Down Expand Up @@ -1064,7 +1057,6 @@ function: main()

script.call(
$buildLibrary,
7,
"libopengl2renderer",
[
"glew",
Expand All @@ -1082,7 +1074,6 @@ function: main()

script.call(
$buildLibrary,
8,
"libopengl3corerenderer",
[
"glew",
Expand All @@ -1100,7 +1091,6 @@ function: main()

script.call(
$buildLibrary,
9,
"libopengles2renderer",
[
"glesv2",
Expand All @@ -1119,7 +1109,6 @@ function: main()

script.call(
$buildLibrary,
10,
"libvulkanrenderer",
[
"glfw3",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 45322f7

Please sign in to comment.