Skip to content

Commit

Permalink
internal: start switching libraries to dynamic linkage (PoC) (#1915)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pospelove authored Apr 12, 2024
1 parent d23a6bd commit f73debf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
3 changes: 2 additions & 1 deletion overlay_triplets/x64-windows-sp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)

if(${PORT} MATCHES "chakracore")
# Keep in sync with skyrim-platform\tools\dev_service\index.js, requiredVcpkgDlls constant
if(${PORT} MATCHES "spdlog|fmt|chakracore")
set(VCPKG_CRT_LINKAGE static) # VCPKG_CRT_LINKAGE should be the same for all ports
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
17 changes: 13 additions & 4 deletions skyrim-platform/tools/dev_service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ let path = require("path");
let childProcess = require("child_process");
let game = require("./game");

// Keep this in sync with triplet file overlay_triplets\x64-windows-sp.cmake or similar
const requiredVcpkgDlls = [
"spdlog.dll",
"fmt.dll",
"ChakraCore.dll"
];

function writeFileSyncRecursive(filename, content, charset) {
filename
.split(path.sep)
Expand Down Expand Up @@ -134,10 +141,12 @@ const watchCallback = (_eventType, fileName) => {

cp(binPath("SkyrimPlatform.pdb"), distDir);
cp(binPath("SkyrimPlatformImpl.pdb"), distDir);
cp(
binPath("ChakraCore.dll"),
path.join(distDir, "Data/Platform/Distribution/RuntimeDependencies")
);
requiredVcpkgDlls.forEach((dll) => {
cp(
binPath(dll),
path.join(distDir, "Data/Platform/Distribution/RuntimeDependencies")
);
});
cp(
binPath("SkyrimPlatformCEF.exe.hidden"),
path.join(distDir, "Data/Platform/Distribution/RuntimeDependencies")
Expand Down
6 changes: 5 additions & 1 deletion unit/DistContentsExpected.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
"client/Data/Platform/UI/fb344395b65fad4dc9b2b4dbecaaf9ae.svg",
"client/Data/Platform/UI/ffb48dba84edac2a01a89b25c3ba270e.mp3",
"client/Data/Platform/UI/24f47c642fc63bf9f479df7cb8e4746a.wav",
"client/Data/Platform/UI/4c9effcbaeeb2d8ca70ae680ac1e3b9a.wav"
"client/Data/Platform/UI/4c9effcbaeeb2d8ca70ae680ac1e3b9a.wav",
"server/fmt.dll",
"server/spdlog.dll"
]
},
{
Expand Down Expand Up @@ -283,6 +285,7 @@
"client/Data/Platform/Distribution/RuntimeDependencies/ChakraCore.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/chrome_elf.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/d3dcompiler_47.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/fmt.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/icudtl.dat",
"client/Data/Platform/Distribution/RuntimeDependencies/libcef.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/libEGL.dll",
Expand All @@ -291,6 +294,7 @@
"client/Data/Platform/Distribution/RuntimeDependencies/libGLESv2.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/SkyrimPlatformCEF.exe.hidden",
"client/Data/Platform/Distribution/RuntimeDependencies/SkyrimPlatformImpl.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/spdlog.dll",
"client/Data/Platform/Distribution/RuntimeDependencies/snapshot_blob.bin",
"client/Data/Platform/Distribution/RuntimeDependencies/v8_context_snapshot.bin",
"client/Data/Platform/Distribution/___systemPolyfill.js",
Expand Down

0 comments on commit f73debf

Please sign in to comment.