Closed pr0g closed 4 months ago
It may be that this just isn't supported (see https://github.com/bkaradzic/bgfx/issues/670), but I'm just wondering what would be the workaround for compiling with BGFX_LIBRARY_TYPE=SHARED
set?
Do you need to compile once with the library as STATIC to build the tools, and then again as SHARED for use by the C API? If there's any kind of workaround or optimum way to approach this I'd be really grateful to know. Thanks!
Actually maybe it's fine, I just need to do this...
cmake -B build -G "Ninja Multi-Config" -DBGFX_LIBRARY_TYPE=SHARED -DBGFX_BUILD_TOOLS=OFF -DBGFX_BUILD_EXAMPLES=OFF
To build the library as shared, and then build the tools separately... I'll do that for now, please ignore this! 🙂
Issue
When using CMake to compile
bgfx
on Windows with-DBGFX_LIBRARY_TYPE=SHARED
, linking fails onexample-common.lib
andtexturev
andgeometryv
that use it. Things work correctly on macOS and Linux.A lot of errors are reported so it's quite hard to make sense of what's causing it precisely, here's a snippet:
Seems related to
function(add_example ARG_NAME)
most likely (inexamples.cmake
)Repro
Clone the repo and its submodules, then run the below commands and see the error output
I might be doing something stupid so please let me know if there's some other flag I need to pass or setting to change to get things to work.
Thanks!