Backend work is start.

pull/15/head
Jussi Pakkanen 11 years ago
parent 9d32518c22
commit bc97fb5c85
  1. 10
      backends.py
  2. 1
      build.py
  3. 4
      coredata.py
  4. 6
      interpreter.py
  5. 10
      meson.py

@ -474,7 +474,7 @@ class NinjaBuildElement():
class NinjaBackend(Backend):
def __init__(self, build, interp):
Backend.__init__(self, build, interp)
super().__init__(build, interp)
self.ninja_filename = 'build.ninja'
def generate(self):
@ -1214,3 +1214,11 @@ class NinjaBackend(Backend):
elem.write(outfile)
self.generate_cppcheck_target(outfile)
class Vs2010Backend(Backend):
def __init__(self, build, interp):
super().__init__(build, interp)
def generate(self):
sln_filename = os.path.join(self.environment.get_build_dir(), self.build.project_name + '.sln')
open(sln_filename, 'w')

@ -26,6 +26,7 @@ class Build:
"""
def __init__(self, environment):
self.project_name = 'name of master project'
self.environment = environment
self.projects = {}
self.targets = {}

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import pickle, os
import pickle, os, uuid
version = '0.14.0-research'
@ -23,6 +23,8 @@ version = '0.14.0-research'
class CoreData():
def __init__(self, options):
self.guid = str(uuid.uuid4())
self.target_guids = {}
self.version = version
self.prefix = options.prefix
self.libdir = options.libdir

@ -19,7 +19,7 @@ import dependencies
import mlog
import build
import optinterpreter
import os, sys, platform, subprocess, shutil
import os, sys, platform, subprocess, shutil, uuid
class InterpreterException(coredata.MesonException):
pass
@ -857,6 +857,8 @@ class Interpreter():
for a in args:
if not isinstance(a, str):
raise InvalidArguments('Argument %s is not a string.' % str(a))
if self.subproject == '':
self.build.project_name = args[0]
if self.subproject in self.build.projects:
raise InvalidCode('Second call to project().')
self.build.projects[self.subproject] = args[0]
@ -1159,6 +1161,8 @@ class Interpreter():
self.check_sources_exist(os.path.join(self.source_root, self.subdir), sources)
l = targetclass(name, self.subdir, is_cross, sources, objs, self.environment, kwargs)
self.build.targets[name] = l.held_object
if name not in self.coredata.target_guids:
self.coredata.target_guids[name] = uuid.uuid4()
if self.environment.is_cross_build() and l.is_cross:
txt = ' cross build '
else:

@ -31,6 +31,10 @@ build_types = ['plain', 'debug', 'optimized']
buildtype_help = 'build type, one of: %s' % ', '.join(build_types)
buildtype_help += ' (default: %default)'
backendlist = ['ninja', 'vs2010']
backend_help = 'backend to use, one of: %s' % ', '.join(backendlist)
backend_help += ' (default: %default)'
if environment.is_windows():
def_prefix = 'c:/'
else:
@ -50,8 +54,8 @@ parser.add_option('--mandir' , default='share/man', dest='mandir',
help='relative path of man files (default: %default)')
parser.add_option('--localedir', default='share/locale', dest='localedir',
help='relative path of locale data (default: %default)')
parser.add_option('--backend', default='ninja', dest='backend',
help='the backend to use (default: %default)')
parser.add_option('--backend', default='ninja', dest='backend', choices=backendlist,
help=backend_help)
parser.add_option('--buildtype', default='debug', type='choice', choices=build_types, dest='buildtype',
help=buildtype_help)
parser.add_option('--strip', action='store_true', dest='strip', default=False,\
@ -127,6 +131,8 @@ itself as required.'''
intr.run()
if options.backend == 'ninja':
g = backends.NinjaBackend(b, intr)
elif options.backend == 'vs2010':
g = backends.Vs2010Backend(b, intr)
else:
raise RuntimeError('Unknown backend "%s".' % options.backend)
g.generate()

Loading…
Cancel
Save