Skip to content

Commit

Permalink
But build type build args to vs command line.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Sep 20, 2015
1 parent 7ed4fad commit d23e59e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
4 changes: 2 additions & 2 deletions compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def is_object(fname):
'release' : ['-O3']}

msvc_buildtype_args = {'plain' : [],
'debug' : ["/MDd", "/Zi", "/Ob0", "/Od", "/RTC1"],
'debugoptimized' : ["/MD", "/Zi", "/O2", "/Ob1", "/D"],
'debug' : ["/MDd", "/ZI", "/Ob0", "/Od", "/RTC1"],
'debugoptimized' : ["/MD", "/ZI", "/O2", "/Ob1", "/D"],
'release' : ["/MD", "/O2", "/Ob2"]}

gnulike_buildtype_linker_args = {}
Expand Down
37 changes: 25 additions & 12 deletions vs2010backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,20 @@ def generate_solution(self, sln_filename, projlist):

def generate_projects(self):
projlist = []
comp = None
for l, c in self.environment.coredata.compilers.items():
if l == 'c' or l == 'cpp':
comp = c
break
if comp is None:
raise RuntimeError('C and C++ compilers missing.')
for name, target in self.build.targets.items():
outdir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
fname = name + '.vcxproj'
relname = os.path.join(target.subdir, fname)
projfile = os.path.join(outdir, fname)
uuid = self.environment.coredata.target_guids[name]
self.gen_vcxproj(target, projfile, uuid)
self.gen_vcxproj(target, projfile, uuid, comp)
projlist.append((name, relname, uuid))
return projlist

Expand All @@ -154,16 +161,11 @@ def target_to_build_root(self, target):
def special_quote(self, arr):
return ['"%s"' % i for i in arr]

def gen_vcxproj(self, target, ofname, guid):
down = self.target_to_build_root(target)
proj_to_src_root = os.path.join(down, self.build_to_src)
proj_to_src_dir = os.path.join(proj_to_src_root, target.subdir)
(sources, headers) = self.split_sources(target.sources)
def gen_custom_target_vcxproj(self, target, ofname, guid):
raise NotImplementedError('Custom target not implemented yet. Sorry.')

def gen_vcxproj(self, target, ofname, guid, compiler):
entrypoint = 'WinMainCRTStartup'
buildtype = 'Debug'
platform = "Win32"
project_name = target.name
target_name = target.name
subsystem = 'Windows'
if isinstance(target, build.Executable):
conftype = 'Application'
Expand All @@ -175,8 +177,18 @@ def gen_vcxproj(self, target, ofname, guid):
elif isinstance(target, build.SharedLibrary):
conftype = 'DynamicLibrary'
entrypoint = '_DllMainCrtStartup'
elif isinstance(target, build.CustomTarget):
self.gen_custom_target_vcxproj(target, ofname, guid)
else:
raise MesonException('Unknown target type for %s' % target_name)
raise MesonException('Unknown target type for %s' % target.get_basename())
down = self.target_to_build_root(target)
proj_to_src_root = os.path.join(down, self.build_to_src)
proj_to_src_dir = os.path.join(proj_to_src_root, target.subdir)
(sources, headers) = self.split_sources(target.sources)
buildtype = self.environment.coredata.buildtype
platform = "Win32"
project_name = target.name
target_name = target.name
root = ET.Element('Project', {'DefaultTargets' : "Build",
'ToolsVersion' : '4.0',
'xmlns' : 'http://schemas.microsoft.com/developer/msbuild/2003'})
Expand Down Expand Up @@ -230,6 +242,7 @@ def gen_vcxproj(self, target, ofname, guid):
extra_args = []
# SUCKS, VS can not handle per-language type flags, so just use
# them all.
extra_args += compiler.get_buildtype_args(self.environment.coredata.buildtype)
for l in self.build.global_args.values():
for a in l:
extra_args.append(a)
Expand Down Expand Up @@ -319,7 +332,7 @@ def gen_vcxproj(self, target, ofname, guid):
open(ofname, 'w').write(txt.replace('"', '"'))

def gen_testproj(self, target_name, ofname):
buildtype = 'Debug'
buildtype = self.environment.coredata.buildtype
platform = "Win32"
project_name = target_name
root = ET.Element('Project', {'DefaultTargets' : "Build",
Expand Down

0 comments on commit d23e59e

Please sign in to comment.