From f937dbeba8bf3ddb907b7bccfdc2c88ed0c0c664 Mon Sep 17 00:00:00 2001 From: Dwight Date: Mon, 25 Nov 2013 10:14:19 -0500 Subject: [PATCH] more work on the vcxproj file generator. --- buildscripts/make_vcxproj.py | 47 ++++++++++++++++++++++++++++++++---- buildscripts/vcxproj.header | 8 +++--- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/buildscripts/make_vcxproj.py b/buildscripts/make_vcxproj.py index 6df27339e95..ff92146cf39 100644 --- a/buildscripts/make_vcxproj.py +++ b/buildscripts/make_vcxproj.py @@ -14,6 +14,8 @@ import sys import os +target = sys.argv[1] + footer= """ @@ -42,7 +44,11 @@ def get_defines(x): common_defines = get_defines(common_defines_str.split(' ')) -print "\n" +f = open('buildscripts/vcxproj.header', 'r') +header = f.read().replace("_TARGET_", target) +print header + +print "" print ';'.join(common_defines) + ";%(PreprocessorDefinitions)" print "\n" print "\n" @@ -55,14 +61,32 @@ common_defines.add("_DEBUG") common_defines.add("V8_TARGET_ARCH_X64") common_defines.add("V8_TARGET_ARCH_IA32") +machine_path = "" + +def add_globally(path): + print "\n\n" + print "" + machine_path + "" + print "\n" + def say(x,line): # buildinfo.cpp is for scons only -- see version.cpp for more info if not "buildinfo.cpp" in x: + if x.startswith('build\\'): + #global machine_path + #if not machine_path: + # machine_path = x.split("mongo")[0] + #sys.stderr.write("todo: adding machine gen'd include path " + machine_path + " to vcxproj\n") + sys.stderr.write("adding machine gen'd file " + x + " to vcxproj\n") xtra = "" - # it would be better to look at the command line inclusions comprehensively instead of hard code - # this way, but this will get us going... - if "v8\\src" in x: - xtra = "src\\third_party\\v8\\src" + if "v8\\src" in x: # or machine_path: + xtra = "" + # it would be better to look at the command line inclusions comprehensively instead of hard code + # this way, but this will get us going... + if "v8\\src" in x: + xtra += "src\\third_party\\v8\\src;" + #if machine_path: + # xtra += machine_path + xtra += "" # add /D command line items that are uncommon defines = "" for s in get_defines(line): @@ -73,11 +97,24 @@ def say(x,line): xtra += "" + defines + "%(PreprocessorDefinitions)" print " " + xtra + "" +from shutil import copyfile + +# for the machine generated files we copy them into the src build tree locally. +# this is annoying but vstudio doesn't seem to like having parallel sets of -I include +# paths so had to do this to make it happy +def pyth(x): + for s in x: + if s.startswith("build") and s.endswith(".h"): + sys.stderr.write("copying " + s + " to src/ tree\n") + copyfile(s, 'src\mongo' + s.split("mongo")[1]) + def main (): for line in sys.stdin: x = line.split(' ') if x[0] == "cl": say(x[3],x) + elif "python" in x[0]: + pyth(x) print footer main() diff --git a/buildscripts/vcxproj.header b/buildscripts/vcxproj.header index d6933db51de..3631eb72359 100644 --- a/buildscripts/vcxproj.header +++ b/buildscripts/vcxproj.header @@ -43,10 +43,10 @@ - mongod - {215B2D68-0A70-4D10-8E75-B31010C62A91} + _TARGET_ + Win32Proj - mongod + _TARGET_ @@ -98,7 +98,7 @@ %(RelativeDir)/ - src\mongo;src;src\third_party\v8\include;src\third_party\pcre-8.30;src\third_party\boost;src\third_party\snappy;src\third_party\s2 + src;src\mongo;src\third_party\v8\include;src\third_party\pcre-8.30;src\third_party\boost;src\third_party\snappy;src\third_party\s2;src\third_party\yaml-cpp-0.5.1\include WIN32;XP_WIN;%(PreprocessorDefinitions) 4355;4800;4267;4244;4351 true