Now can has linking against shared libraries.

pull/15/head
Jussi Pakkanen 11 years ago
parent 185fd7b5bc
commit f807ab209d
  1. 10
      backends.py
  2. 7
      build.py
  3. 7
      environment.py

@ -1299,7 +1299,7 @@ class Vs2010Backend(Backend):
elif isinstance(target, build.StaticLibrary):
conftype = 'StaticLibrary'
elif isinstance(target, build.SharedLibrary):
conftype = 'SharedLibrary'
conftype = 'DynamicLibrary'
else:
raise MesonException('Unknown target type for %s' % target_name)
root = ET.Element('Project', {'DefaultTargets' : "Build",
@ -1367,7 +1367,7 @@ class Vs2010Backend(Backend):
links = []
for t in target.link_targets:
lobj = self.build.targets[t.get_basename()]
linkname = lobj.get_filename()
linkname = lobj.get_import_filename()
links.append(linkname)
links.append('%(AdditionalDependencies)')
ET.SubElement(link, 'AdditionalDependencies').text = ';'.join(links)
@ -1379,10 +1379,12 @@ class Vs2010Backend(Backend):
subsys.text = subsystem
gendeb = ET.SubElement(link, 'GenerateDebugInformation')
gendeb.text = 'true'
if isinstance(target, build.SharedLibrary):
ET.SubElement(link, 'ImportLibrary').text = target.get_import_filename()
pdb = ET.SubElement(link, 'ProgramDataBaseFileName')
pdb.text = '$(OutDir}%s.pdb' % target_name
entrypoint = ET.SubElement(link, 'EntryPointSymbol')
entrypoint.text = 'mainCRTStartup'
if isinstance(target, build.Executable):
ET.SubElement(link, 'EntryPointSymbol').text = 'mainCRTStartup'
targetmachine = ET.SubElement(link, 'TargetMachine')
targetmachine.text = 'MachineX86'

@ -481,6 +481,9 @@ class StaticLibrary(BuildTarget):
suffix = environment.get_static_lib_suffix()
self.filename = prefix + self.name + '.' + suffix
def get_import_filename(self):
return self.filename
class SharedLibrary(BuildTarget):
def __init__(self, name, subdir, is_cross, sources, objects, environment, kwargs):
self.version = None
@ -488,10 +491,14 @@ class SharedLibrary(BuildTarget):
super().__init__(name, subdir, is_cross, sources, objects, environment, kwargs);
self.prefix = environment.get_shared_lib_prefix()
self.suffix = environment.get_shared_lib_suffix()
self.importsuffix = environment.get_import_lib_suffix()
def get_shbase(self):
return self.prefix + self.name + '.' + self.suffix
def get_import_filename(self):
return self.prefix + self.name + '.' + self.importsuffix
def get_rpaths(self):
return [self.subdir] + self.get_transitive_rpaths()

@ -973,6 +973,7 @@ class Environment():
if (not cross and is_windows()) \
or (cross and self.cross_info['name'] == 'windows'):
self.exe_suffix = 'exe'
self.import_lib_suffix = 'lib'
self.shared_lib_suffix = 'dll'
self.shared_lib_prefix = ''
self.static_lib_suffix = 'lib'
@ -989,6 +990,7 @@ class Environment():
self.static_lib_suffix = 'a'
self.static_lib_prefix = 'lib'
self.object_suffix = 'o'
self.import_lib_suffix = self.shared_lib_suffix
def is_cross_build(self):
return self.cross_info is not None
@ -1269,6 +1271,11 @@ class Environment():
def get_exe_suffix(self):
return self.exe_suffix
# On Windows the library has suffix dll
# but you link against a file that has suffix lib.
def get_import_lib_suffix(self):
return self.import_lib_suffix
def get_shared_lib_prefix(self):
return self.shared_lib_prefix

Loading…
Cancel
Save