Made boost on windows kinda work.

pull/262/head
Jussi Pakkanen 10 years ago
parent 4dd6a85075
commit 776f899e78
  1. 6
      compilers.py
  2. 56
      dependencies.py
  3. 5
      mesonlib.py
  4. 1
      ninjabackend.py
  5. 2
      test cases/frameworks/1 boost/meson.build

@ -925,9 +925,9 @@ class VisualStudioCCompiler(CCompiler):
self.always_args = VisualStudioCCompiler.vs2013_always_args
else:
self.always_args = VisualStudioCCompiler.vs2010_always_args
self.std_warn_args = {'1': ['/W2'],
'2': ['/W3'],
'3': ['/w4']}
self.warn_args = {'1': ['/W2'],
'2': ['/W3'],
'3': ['/w4']}
def get_always_args(self):
return self.always_args

@ -393,6 +393,7 @@ class BoostDependency(Dependency):
def __init__(self, environment, kwargs):
Dependency.__init__(self)
self.name = 'boost'
self.libdir = ''
try:
self.boost_root = os.environ['BOOST_ROOT']
if not os.path.isabs(self.boost_root):
@ -400,9 +401,14 @@ class BoostDependency(Dependency):
except KeyError:
self.boost_root = None
if self.boost_root is None:
self.incdir = '/usr/include/boost'
if mesonlib.is_windows():
self.boost_root = self.detect_win_root()
self.incdir = os.path.join(self.boost_root, 'boost')
else:
self.incdir = '/usr/include/boost'
else:
self.incdir = os.path.join(self.boost_root, 'include/boost')
mlog.debug('Boost library root dir is', self.boost_root)
self.src_modules = {}
self.lib_modules = {}
self.lib_modules_mt = {}
@ -422,10 +428,20 @@ class BoostDependency(Dependency):
else:
mlog.log("Dependency Boost (%s) found:" % module_str, mlog.red('NO'))
def detect_win_root(self):
globtext = 'c:\\local\\boost_*'
files = glob.glob(globtext)
if len(files) > 0:
return files[0]
return 'C:\\'
def get_compile_args(self):
args = []
if self.boost_root is not None:
args.append('-I' + os.path.join(self.boost_root, 'include'))
if mesonlib.is_windows():
args.append('-I' + self.boost_root)
else:
args.append('-I' + os.path.join(self.boost_root, 'include'))
return args
def get_requested(self, kwargs):
@ -472,6 +488,28 @@ class BoostDependency(Dependency):
self.src_modules[os.path.split(entry)[-1]] = True
def detect_lib_modules(self):
if mesonlib.is_windows():
return self.detect_lib_modules_win()
return self.detect_lib_modules_nix()
def detect_lib_modules_win(self):
if mesonlib.is_32bit():
gl = 'lib32*'
else:
gl = 'lib64*'
libdir = glob.glob(os.path.join(self.boost_root, gl))
if len(libdir) == 0:
return
libdir = libdir[0]
self.libdir = libdir
globber = 'boost_*-gd-*.lib' # FIXME
for entry in glob.glob(os.path.join(libdir, globber)):
(_, fname) = os.path.split(entry)
base = fname.split('_', 1)[1]
modname = base.split('-', 1)[0]
self.lib_modules_mt[modname] = fname
def detect_lib_modules_nix(self):
globber = 'libboost_*.so' # FIXME, make platform independent.
if self.boost_root is None:
libdirs = mesonlib.get_library_dirs()
@ -488,12 +526,24 @@ class BoostDependency(Dependency):
else:
self.lib_modules[name] = True
def get_link_args(self):
def get_win_link_args(self):
args = []
if self.boost_root:
# FIXME, these are in gcc format, not msvc.
# On the other hand, so are the args that
# pkg-config returns.
args.append('/LIBPATH:' + self.libdir)
for module in self.requested_modules:
module = BoostDependency.name2lib.get(module, module)
if module in self.lib_modules_mt:
args.append(self.lib_modules_mt[module])
return args
def get_link_args(self):
if mesonlib.is_windows():
return self.get_win_link_args()
args = []
if self.boost_root:
args.append('-L' + os.path.join(self.boost_root, 'lib'))
for module in self.requested_modules:
module = BoostDependency.name2lib.get(module, module)

@ -14,7 +14,7 @@
"""A library of random helper functionality."""
import platform, subprocess, operator, os, shutil, re
import platform, subprocess, operator, os, shutil, re, sys
from glob import glob
@ -79,6 +79,9 @@ def is_windows():
platname = platform.system().lower()
return platname == 'windows' or 'mingw' in platname
def is_32bit():
return not(sys.maxsize > 2**32)
def is_debianlike():
try:
open('/etc/debian_version', 'r')

@ -1401,7 +1401,6 @@ rule FORTRAN_DEP_HACK
def generate_shlib_aliases(self, target, outdir):
basename = target.get_filename()
aliases = target.get_aliaslist()
aliascmd = []
if not mesonlib.is_windows():
for alias in aliases:
aliasfile = os.path.join(self.environment.get_build_dir(), outdir, alias)

@ -2,6 +2,8 @@ project('boosttest', 'cpp')
if meson.get_compiler('cpp').get_id() != 'msvc'
add_global_arguments('-std=c++11', language : 'cpp')
else
add_global_arguments('/EHsc', language : 'cpp')
endif
# We want to have multiple separate configurations of Boost

Loading…
Cancel
Save