|
|
|
project('whole archive', 'c')
|
|
|
|
|
Add Visual Studio 2012/2013 backends (#8803)
* backends: Add a Visual Studio 2013 backend
This is more-or-less a quick port from the VS2015 backend, except that
we update the Visual Studio version strings and toolset versions
accordingly. Also correct the generator string for Visual Studio 2015
in mesonbuild/cmake/common.py.
* backend: Add VS2012 backend
Similar to what we did for Visual Studio 2013, add a Visual Studio 2012
backend.
* vs2010backend.py: Implement `link_whole:` if needed
We actually need Visual Studio 2015 Update 2 to use `/WHOLEARCHIVE:`,
which is what we are currently using for `link_whole:` on Visual Studio.
For Visual Studio versions before that, we need to expand from the
static targets that were indicated by `link_whole:`, and any of the
sub-dependent targets that were pulled in via the dependent target's
`link_whole:`. This wil ensure `link_whole:` would actually work in
such cases.
* vs2010backend.py: Handle objects from generated sources
Unforunately, we can't use backends.determine_ext_objs() reliably, as
the Visual Studio backends handle this differently.
* vs2010backend.py: Fix generating VS2010 projects
Visual Studio 2010 (at least the Express Edition) does not set the envvar
%VisualStudioVersion% in its command prompt, so fix generating VS2010
projects by taking account into this, so that we can determine the location
of vcvarsall.bat correctly.
* whole archive test: Disable on vs2012/2013 backends too
The Visual Studio 2012/2013 IDE has problems handling the items that would be
generated from this test case, so skip this test when using
--backend=vs[2012|2013]. This test does work for the Ninja backend when
VS2012 or VS2013 is used, though.
Consolidate this error message with XCode along with the vs2010 backend.
* docs: Add the new vs2012 and vs2013 backends
Let people know that we have backends for vs2012 and 2013. Also let
people know that generating Visual Studio 2010 projects have been fixed
and the pre-vs2015 backends now handle the `link_whole:` project option.
3 years ago
|
|
|
if meson.backend() == 'xcode' or \
|
|
|
|
meson.backend() == 'vs2010' or \
|
|
|
|
meson.backend() == 'vs2012' or \
|
|
|
|
meson.backend() == 'vs2013'
|
|
|
|
error('MESON_SKIP_TEST: whole-archive not supported in Xcode nor pre-VS2015 IDE. Patches welcome.')
|
|
|
|
endif
|
|
|
|
|
|
|
|
add_project_arguments('-I' + meson.source_root(), language : 'c')
|
|
|
|
|
|
|
|
# Test 1: link_whole keeps all symbols
|
|
|
|
# Make static func1
|
|
|
|
subdir('st_func1')
|
|
|
|
# Make shared func2 linking whole func1 archive
|
|
|
|
subdir('sh_func2_linked_func1')
|
|
|
|
# Link exe with shared library only
|
|
|
|
subdir('exe')
|
|
|
|
# Test that both func1 and func2 are accessible from shared library
|
|
|
|
test('prog', exe)
|
|
|
|
|
|
|
|
# Test 2: link_whole can be used instead of source list, see #2180
|
|
|
|
# Make static func2
|
|
|
|
subdir('st_func2')
|
|
|
|
# Link both func1 and func2 into same shared library
|
|
|
|
# which does not have any sources other than 2 static libraries
|
|
|
|
subdir('sh_only_link_whole')
|
|
|
|
# Link exe2 with shared library only
|
|
|
|
subdir('exe2')
|
|
|
|
# Test that both func1 and func2 are accessible from shared library
|
|
|
|
test('prog2', exe2)
|
|
|
|
|
|
|
|
# Test 3: link_whole can be used in declare_dependency()
|
|
|
|
func1_dep = declare_dependency(link_whole : [st_func1])
|
|
|
|
# Use dependency to link func1 into shared library
|
|
|
|
subdir('sh_func2_dep_func1')
|
|
|
|
# Link exe3 with shared library
|
|
|
|
subdir('exe3')
|
|
|
|
# Test that both func1 and func2 are accessible from shared library
|
|
|
|
test('prog3', exe3)
|
|
|
|
|
|
|
|
# Test 4: link_whole can be used in transitive declare_dependency()
|
|
|
|
func1_trans_dep = declare_dependency(dependencies : func1_dep)
|
|
|
|
# Use transitive dependency to link func1 into shared library
|
|
|
|
subdir('sh_func2_transdep_func1')
|
|
|
|
# Link exe4 with shared library
|
|
|
|
subdir('exe4')
|
|
|
|
# Test that both func1 and func2 are accessible from shared library
|
|
|
|
test('prog4', exe4)
|