Skip to content

Commit

Permalink
Merge pull request #660 from mesonbuild/libdirfix
Browse files Browse the repository at this point in the history
Fix library directory handling
  • Loading branch information
jpakkane authored Jul 30, 2016
2 parents fb3f442 + 10ab887 commit 1d36f68
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/backend/ninjabackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def generate_target_install(self, d):
[], False, '']
d.targets.append(i)
outdir = self.environment.get_shared_lib_dir()
elif isinstance(t, build.SharedLibrary):
elif isinstance(t, build.StaticLibrary):
outdir = self.environment.get_static_lib_dir()
elif isinstance(t, build.Executable):
outdir = self.environment.get_bindir()
Expand Down
18 changes: 10 additions & 8 deletions mesonbuild/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ def __init__(self, source_dir, build_dir, main_script_file, options, original_cm
self.coredata = coredata.load(cdf)
self.first_invocation = False
except FileNotFoundError:
# WARNING: Don't use any values from coredata in __init__. It gets
# re-initialized with project options by the interpreter during
# build file parsing.
self.coredata = coredata.CoreData(options)
self.coredata.meson_script_file = self.meson_script_file
self.first_invocation = True
Expand Down Expand Up @@ -159,14 +162,11 @@ def __init__(self, source_dir, build_dir, main_script_file, options, original_cm
or (cross and self.cross_info.has_host() and self.cross_info.config['host_machine']['system'] == 'windows'):
self.exe_suffix = 'exe'
self.object_suffix = 'obj'
self.shared_lib_dir = self.get_bindir()
self.win_libdir_layout = True
else:
self.exe_suffix = ''
self.object_suffix = 'o'
self.shared_lib_dir = self.get_libdir()
# Common to all platforms
self.import_lib_dir = self.get_libdir()
self.static_lib_dir = self.get_libdir()
self.win_libdir_layout = False

def is_cross_build(self):
return self.cross_info is not None
Expand Down Expand Up @@ -662,15 +662,17 @@ def get_exe_suffix(self):

def get_import_lib_dir(self):
"Install dir for the import library (library used for linking)"
return self.import_lib_dir
return self.get_libdir()

def get_shared_lib_dir(self):
"Install dir for the shared library"
return self.shared_lib_dir
if self.win_libdir_layout:
return self.get_bindir()
return self.get_libdir()

def get_static_lib_dir(self):
"Install dir for the static library"
return self.static_lib_dir
return self.get_libdir()

def get_object_suffix(self):
return self.object_suffix
Expand Down
2 changes: 1 addition & 1 deletion test cases/common/8 install/installed_files.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
usr/bin/prog?exe
usr/lib/libstat.a
usr/libtest/libstat.a
2 changes: 1 addition & 1 deletion test cases/common/8 install/meson.build
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project('install test', 'c')
project('install test', 'c', default_options : ['libdir=libtest'])

stlib = static_library('stat', 'stat.c', install : true)
exe = executable('prog', 'prog.c', install : true)

0 comments on commit 1d36f68

Please sign in to comment.