parent
9bf09a909b
commit
858bdbacfd
4 changed files with 49 additions and 43 deletions
29
SConstruct
29
SConstruct
|
@ -316,31 +316,6 @@ if selected_platform in platform_list:
|
||||||
env["warnings"] = "extra"
|
env["warnings"] = "extra"
|
||||||
env["werror"] = True
|
env["werror"] = True
|
||||||
|
|
||||||
if env["vsproj"]:
|
|
||||||
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("\\\\", "/")
|
|
||||||
if os.path.isfile(basename + ".h"):
|
|
||||||
env.vs_incs = env.vs_incs + [basename + ".h"]
|
|
||||||
elif os.path.isfile(basename + ".hpp"):
|
|
||||||
env.vs_incs = env.vs_incs + [basename + ".hpp"]
|
|
||||||
if os.path.isfile(basename + ".c"):
|
|
||||||
env.vs_srcs = env.vs_srcs + [basename + ".c"]
|
|
||||||
elif os.path.isfile(basename + ".cpp"):
|
|
||||||
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
|
|
||||||
|
|
||||||
env.AddToVSProject = AddToVSProject
|
|
||||||
|
|
||||||
env.extra_suffix = ""
|
env.extra_suffix = ""
|
||||||
|
|
||||||
if env["extra_suffix"] != "":
|
if env["extra_suffix"] != "":
|
||||||
|
@ -604,6 +579,10 @@ if selected_platform in platform_list:
|
||||||
CacheDir(scons_cache_path)
|
CacheDir(scons_cache_path)
|
||||||
print("Scons cache enabled... (path: '" + scons_cache_path + "')")
|
print("Scons cache enabled... (path: '" + scons_cache_path + "')")
|
||||||
|
|
||||||
|
if env["vsproj"]:
|
||||||
|
env.vs_incs = []
|
||||||
|
env.vs_srcs = []
|
||||||
|
|
||||||
Export("env")
|
Export("env")
|
||||||
|
|
||||||
# build subdirs, the build order is dependent on link order.
|
# build subdirs, the build order is dependent on link order.
|
||||||
|
|
|
@ -33,15 +33,6 @@ else:
|
||||||
# Core dependencies
|
# Core dependencies
|
||||||
SConscript("png/SCsub")
|
SConscript("png/SCsub")
|
||||||
|
|
||||||
if env["vsproj"]:
|
|
||||||
import os
|
|
||||||
|
|
||||||
path = os.getcwd()
|
|
||||||
# Change directory so the path resolves correctly in the function call.
|
|
||||||
os.chdir("..")
|
|
||||||
env.AddToVSProject(env.drivers_sources)
|
|
||||||
os.chdir(path)
|
|
||||||
|
|
||||||
env.add_source_files(env.drivers_sources, "*.cpp")
|
env.add_source_files(env.drivers_sources, "*.cpp")
|
||||||
|
|
||||||
lib = env.add_library("drivers", env.drivers_sources)
|
lib = env.add_library("drivers", env.drivers_sources)
|
||||||
|
|
48
methods.py
48
methods.py
|
@ -5,6 +5,9 @@ import subprocess
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from compat import iteritems, isbasestring, open_utf8, decode_utf8, qualname
|
from compat import iteritems, isbasestring, open_utf8, decode_utf8, qualname
|
||||||
|
|
||||||
|
from SCons import Node
|
||||||
|
from SCons.Script import Glob
|
||||||
|
|
||||||
|
|
||||||
def add_source_files(self, sources, files, warn_duplicates=True):
|
def add_source_files(self, sources, files, warn_duplicates=True):
|
||||||
# Convert string to list of absolute paths (including expanding wildcard)
|
# Convert string to list of absolute paths (including expanding wildcard)
|
||||||
|
@ -564,6 +567,35 @@ def generate_cpp_hint_file(filename):
|
||||||
print("Could not write cpp.hint file.")
|
print("Could not write cpp.hint file.")
|
||||||
|
|
||||||
|
|
||||||
|
def glob_recursive(pattern, node="."):
|
||||||
|
results = []
|
||||||
|
for f in Glob(str(node) + "/*", source=True):
|
||||||
|
if type(f) is Node.FS.Dir:
|
||||||
|
results += glob_recursive(pattern, f)
|
||||||
|
results += Glob(str(node) + "/" + pattern, source=True)
|
||||||
|
return results
|
||||||
|
|
||||||
|
|
||||||
|
def add_to_vs_project(env, 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("\\\\", "/")
|
||||||
|
if os.path.isfile(basename + ".h"):
|
||||||
|
env.vs_incs += [basename + ".h"]
|
||||||
|
elif os.path.isfile(basename + ".hpp"):
|
||||||
|
env.vs_incs += [basename + ".hpp"]
|
||||||
|
if os.path.isfile(basename + ".c"):
|
||||||
|
env.vs_srcs += [basename + ".c"]
|
||||||
|
elif os.path.isfile(basename + ".cpp"):
|
||||||
|
env.vs_srcs += [basename + ".cpp"]
|
||||||
|
|
||||||
|
|
||||||
def generate_vs_project(env, num_jobs):
|
def generate_vs_project(env, num_jobs):
|
||||||
batch_file = find_visual_c_batch_file(env)
|
batch_file = find_visual_c_batch_file(env)
|
||||||
if batch_file:
|
if batch_file:
|
||||||
|
@ -596,12 +628,16 @@ def generate_vs_project(env, num_jobs):
|
||||||
result = " ^& ".join(common_build_prefix + [" ".join([commands] + common_build_postfix)])
|
result = " ^& ".join(common_build_prefix + [" ".join([commands] + common_build_postfix)])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
env.AddToVSProject(env.core_sources)
|
add_to_vs_project(env, env.core_sources)
|
||||||
env.AddToVSProject(env.main_sources)
|
add_to_vs_project(env, env.drivers_sources)
|
||||||
env.AddToVSProject(env.modules_sources)
|
add_to_vs_project(env, env.main_sources)
|
||||||
env.AddToVSProject(env.scene_sources)
|
add_to_vs_project(env, env.modules_sources)
|
||||||
env.AddToVSProject(env.servers_sources)
|
add_to_vs_project(env, env.scene_sources)
|
||||||
env.AddToVSProject(env.editor_sources)
|
add_to_vs_project(env, env.servers_sources)
|
||||||
|
add_to_vs_project(env, env.editor_sources)
|
||||||
|
|
||||||
|
for header in glob_recursive("**/*.h"):
|
||||||
|
env.vs_incs.append(str(header))
|
||||||
|
|
||||||
env["MSVSBUILDCOM"] = build_commandline("scons")
|
env["MSVSBUILDCOM"] = build_commandline("scons")
|
||||||
env["MSVSREBUILDCOM"] = build_commandline("scons vsproj=yes")
|
env["MSVSREBUILDCOM"] = build_commandline("scons vsproj=yes")
|
||||||
|
|
|
@ -25,10 +25,10 @@ prog = env.add_program("#bin/godot", common_win + res_obj, PROGSUFFIX=env["PROGS
|
||||||
|
|
||||||
# Microsoft Visual Studio Project Generation
|
# Microsoft Visual Studio Project Generation
|
||||||
if env["vsproj"]:
|
if env["vsproj"]:
|
||||||
env.vs_srcs = env.vs_srcs + ["platform/windows/" + res_file]
|
env.vs_srcs += ["platform/windows/" + res_file]
|
||||||
env.vs_srcs = env.vs_srcs + ["platform/windows/godot.natvis"]
|
env.vs_srcs += ["platform/windows/godot.natvis"]
|
||||||
for x in common_win:
|
for x in common_win:
|
||||||
env.vs_srcs = env.vs_srcs + ["platform/windows/" + str(x)]
|
env.vs_srcs += ["platform/windows/" + str(x)]
|
||||||
|
|
||||||
if not os.getenv("VCINSTALLDIR"):
|
if not os.getenv("VCINSTALLDIR"):
|
||||||
if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]:
|
if (env["debug_symbols"] == "full" or env["debug_symbols"] == "yes") and env["separate_debug_symbols"]:
|
||||||
|
|
Loading…
Reference in a new issue