When using wraps, How To link a binary to static libraries #12754
-
I'm trying to build NetPanzer so it will link to static libraries that are built via meson wraps. Though I've specified My meson.build is in netpanzer/netpanzer#133 Clearly trying to use the wrap system primarily for a Windows build, I could see possibly shipping NetPanzer with the dlls, but I can't imagine installing them to Windows system locations when the binary is installed. What do most Windows developers do in cases like this? I don't normally develop on Windows and not familiar with the environment, to be honest, so I'm pretty much open to feedback about this. I searched the meson docs of course, and found these tickets that are possibly related: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
phyfs_dep = dependency('physfs', required: false)
if not phyfs_dep.found()
phyfs_dep = cc.find_library('physfs', has_headers: 'physfs.h', required: false)
if not phyfs_dep.found()
# This will use the fallback
phyfs_dep = dependency('physfs')
# or
phyfs_dep = dependency(
'physfs',
required: false,
fallback: 'physfs',
default_options: ['default_library=static']
)
endif
endif
deps += phyfs_dep So what you're doing here is 4 lookups:
Only if the number 4 lookup is the one that gets found, does the default_options for it apply. But it seems to be a straight-up duplicate of the number 3 lookup (it cannot fail, because it is defaulting to required: true). There is a good reason to use the number 1 and number 2 lookups as you've done, iff you cannot rely on dependency() working but want to find an external physfs. This assumes, however, that physfs can be installed without a pkg-config file. It works because the number 1 lookup is not required, so by default it won't use a subproject fallback. Hence you advance to the find_library lookup, and only trigger subprojects after find_library has failed too. |
Beta Was this translation helpful? Give feedback.
So what you're doing here is 4 lookups:
Only if the number 4 lookup is the one that gets found, does the default_opti…