Added Visual Studio project generation. Use "vsproj=yes" in command line. This does not set up NMAKE properly.

This commit is contained in:
Antony Jones 2015-05-03 15:18:56 -06:00
parent b56badf77b
commit 2a4da03f10
3 changed files with 146 additions and 91 deletions

View file

@ -123,6 +123,7 @@ opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no") opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no') opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '') opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
# add platform specific options # add platform specific options
@ -177,6 +178,25 @@ if selected_platform in platform_list:
else: else:
env = env_base.Clone() env = env_base.Clone()
if env['vsproj']=="yes":
env.vs_incs = []
env.vs_srcs = []
def AddToVSProject( sources ):
for x in sources:
if type(x) == type(""):
fname = env.File(x).path
else:
fname = env.File(x)[0].path
pieces = fname.split(".")
if len(pieces)>0:
basename = pieces[0]
basename = basename.replace('\\\\','/')
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
env.vs_incs = env.vs_incs + [basename + ".h"]
#print basename
env.AddToVSProject = AddToVSProject
env.extra_suffix="" env.extra_suffix=""
if env["extra_suffix"] != '' : if env["extra_suffix"] != '' :
@ -330,6 +350,32 @@ if selected_platform in platform_list:
SConscript("main/SCsub") SConscript("main/SCsub")
SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform
# Microsoft Visual Studio Project Generation
if (env['vsproj'])=="yes":
AddToVSProject(env.core_sources)
AddToVSProject(env.main_sources)
AddToVSProject(env.modules_sources)
AddToVSProject(env.scene_sources)
AddToVSProject(env.servers_sources)
AddToVSProject(env.tool_sources)
debug_variants = ['Debug|Win32']+['Debug|x64']
release_variants = ['Release|Win32']+['Release|x64']
release_debug_variants = ['Release_Debug|Win32']+['Release_Debug|x64']
variants = debug_variants + release_variants + release_debug_variants
debug_targets = ['Debug']+['Debug']
release_targets = ['Release']+['Release']
release_debug_targets = ['ReleaseDebug']+['ReleaseDebug']
targets = debug_targets + release_targets + release_debug_targets
msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ],
incs = env.vs_incs,
srcs = env.vs_srcs,
runfile = targets,
buildtarget = targets,
auto_build_solution=1,
variant = variants)
else: else:

View file

@ -1,91 +1,94 @@
Import('env') Import('env')
env.drivers_sources=[] env.drivers_sources=[]
#env.add_source_files(env.drivers_sources,"*.cpp") #env.add_source_files(env.drivers_sources,"*.cpp")
env.Append(CPPPATH=["vorbis"]) env.Append(CPPPATH=["vorbis"])
Export('env') Export('env')
SConscript('unix/SCsub'); SConscript('unix/SCsub');
SConscript('alsa/SCsub'); SConscript('alsa/SCsub');
SConscript('pulseaudio/SCsub'); SConscript('pulseaudio/SCsub');
SConscript('windows/SCsub'); SConscript('windows/SCsub');
SConscript('gles2/SCsub'); SConscript('gles2/SCsub');
SConscript('gl_context/SCsub'); SConscript('gl_context/SCsub');
SConscript('openssl/SCsub'); SConscript('openssl/SCsub');
if (env["png"]=="yes"): if (env["png"]=="yes"):
SConscript("png/SCsub"); SConscript("png/SCsub");
if (env["jpg"]=="yes"): if (env["jpg"]=="yes"):
SConscript("jpg/SCsub"); SConscript("jpg/SCsub");
if (env["webp"]=="yes"): if (env["webp"]=="yes"):
SConscript("webp/SCsub"); SConscript("webp/SCsub");
SConscript("dds/SCsub"); SConscript("dds/SCsub");
SConscript("pvr/SCsub"); SConscript("pvr/SCsub");
SConscript("etc1/SCsub") SConscript("etc1/SCsub")
if (env["builtin_zlib"]=="yes"): if (env["builtin_zlib"]=="yes"):
SConscript("builtin_zlib/SCsub"); SConscript("builtin_zlib/SCsub");
if (env["openssl"]=="builtin"): if (env["openssl"]=="builtin"):
SConscript("builtin_openssl2/SCsub"); SConscript("builtin_openssl2/SCsub");
SConscript("rtaudio/SCsub"); SConscript("rtaudio/SCsub");
SConscript("nedmalloc/SCsub"); SConscript("nedmalloc/SCsub");
SConscript("trex/SCsub"); SConscript("trex/SCsub");
SConscript("chibi/SCsub"); SConscript("chibi/SCsub");
if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theora"]=="yes"): if (env["vorbis"]=="yes" or env["speex"]=="yes" or env["theora"]=="yes"):
SConscript("ogg/SCsub"); SConscript("ogg/SCsub");
if (env["vorbis"]=="yes"): if (env["vorbis"]=="yes"):
SConscript("vorbis/SCsub"); SConscript("vorbis/SCsub");
if (env["tools"]=="yes"): if (env["tools"]=="yes"):
SConscript("convex_decomp/SCsub"); SConscript("convex_decomp/SCsub");
if env["theora"]=="yes": if env["theora"]=="yes":
SConscript("theoraplayer/SCsub") SConscript("theoraplayer/SCsub")
if (env["theora"]=="yes"): if (env["theora"]=="yes"):
SConscript("theora/SCsub"); SConscript("theora/SCsub");
if (env['speex']=='yes'): if (env['speex']=='yes'):
SConscript("speex/SCsub"); SConscript("speex/SCsub");
if (env['musepack']=='yes'): if (env['musepack']=='yes'):
SConscript("mpc/SCsub"); SConscript("mpc/SCsub");
if (env["squish"]=="yes" and env["tools"]=="yes"): if (env["squish"]=="yes" and env["tools"]=="yes"):
SConscript("squish/SCsub"); SConscript("squish/SCsub");
num = 0 num = 0
cur_base = "" cur_base = ""
total = len(env.drivers_sources) total = len(env.drivers_sources)
max_src = 64 max_src = 64
list = [] list = []
lib_list = [] lib_list = []
import string import string
for f in env.drivers_sources: if env['vsproj']=="yes":
fname = "" env.AddToVSProject(env.drivers_sources)
if type(f) == type(""):
fname = env.File(f).path for f in env.drivers_sources:
else: fname = ""
fname = env.File(f)[0].path if type(f) == type(""):
#base = string.join(fname.split("/")[:-1], "/") fname = env.File(f).path
fname = fname.replace("\\", "/") else:
base = string.join(fname.split("/")[:2], "/") fname = env.File(f)[0].path
if base != cur_base and len(list) > max_src: #base = string.join(fname.split("/")[:-1], "/")
lib = env.Library("drivers"+str(num), list) fname = fname.replace("\\", "/")
lib_list.append(lib) base = string.join(fname.split("/")[:2], "/")
list = [] if base != cur_base and len(list) > max_src:
num = num+1 lib = env.Library("drivers"+str(num), list)
cur_base = base lib_list.append(lib)
list.append(f) list = []
num = num+1
if len(list) > 0: cur_base = base
lib = env.Library("drivers"+str(num), list) list.append(f)
lib_list.append(lib)
if len(list) > 0:
lib = env.Library("drivers"+str(num), list)
drivers_base=[] lib_list.append(lib)
env.add_source_files(drivers_base,"*.cpp")
lib_list.insert(0, env.Library("drivers", drivers_base))
drivers_base=[]
env.Prepend(LIBS=lib_list) env.add_source_files(drivers_base,"*.cpp")
lib_list.insert(0, env.Library("drivers", drivers_base))
#lib = env.Library("drivers",env.drivers_sources)
#env.Prepend(LIBS=[lib]) env.Prepend(LIBS=lib_list)
#lib = env.Library("drivers",env.drivers_sources)
#env.Prepend(LIBS=[lib])

View file

@ -12,3 +12,9 @@ common_win=[
] ]
env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"]) env.Program('#bin/godot',['godot_win.cpp']+common_win,PROGSUFFIX=env["PROGSUFFIX"])
# Microsoft Visual Studio Project Generation
if (env['vsproj'])=="yes":
env.vs_srcs = env.vs_srcs + ["platform/windows/godot_win.cpp"]
for x in common_win:
env.vs_srcs = env.vs_srcs + ["platform/windows/" + x]