td icon indicating copy to clipboard operation
td copied to clipboard

Enhance pkg-config generation for interface libraries and Windows compatibility

Open luadebug opened this issue 3 months ago • 1 comments

Back in 2024s problem of PE size exceeding was resolved https://github.com/tdlib/td/issues/2888, but actually the issue is still present and as workaround we need to split tdcore.lib into two part in case we build for Windows OS host, LTO enable flag comes here as helper to enforce splitting into two parts.

Unfortunately .pc generation handler for tdcore_part1.lib & tdcore_part2.lib was not implemented yet. This is attempt to make that splitting work. As https://github.com/microsoft/vcpkg/pull/47690 validates generated .pc would work against vcpkg ci. https://github.com/microsoft/vcpkg/pull/47690/files#diff-bab39c8782e3538fd5a1a88f8c113153002bff5f4410bc4329729a7e9a59e99dR1

FAILED: tdcore.lib 
C:\Windows\system32\cmd.exe /C "cd . && C:\PROGRA~1\MICROS~1\2022\ENTERP~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\lib.exe  /machine:x64 /nologo /out:tdcore.lib @CMakeFiles\tdcore.rsp && cd ."
tdcore.lib : fatal error LNK1248: image size (1022142D3) exceeds maximum allowable size (FFFFFFFF)

ninja: build stopped: subcommand failed.

luadebug avatar Oct 20 '25 21:10 luadebug

Is it possible to avoid special handling of td_core with if ("${TARGET}" STREQUAL "tdcore" AND "${LIBRARY_TYPE}" STREQUAL "INTERFACE_LIBRARY") and always propagate interface libraries to the final target? The generator cmake/GeneratePkgConfig.cmake is supposed to be project-agnostic and shouldn't depend on specific names of target or project structure.

levlam avatar Oct 21 '25 14:10 levlam