I think I finally have intellisense mainly working.
This commit is contained in:
@@ -1,12 +1,3 @@
|
|||||||
diff --git a/.clangd b/.clangd
|
|
||||||
new file mode 100644
|
|
||||||
index 000000000000..e10607a4bc4f
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/.clangd
|
|
||||||
@@ -0,0 +1,3 @@
|
|
||||||
+CompileFlags:
|
|
||||||
+ Add:
|
|
||||||
+ - "-D__INTELLISENSE__=1"
|
|
||||||
diff --git a/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py b/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py
|
diff --git a/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py b/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py
|
||||||
index f56f5ea9cac4..ff1c4030b38f 100644
|
index f56f5ea9cac4..ff1c4030b38f 100644
|
||||||
--- a/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py
|
--- a/Engine/Extras/LLDBDataFormatters/UEDataFormatters_2ByteChars.py
|
||||||
|
|||||||
66
build.py
66
build.py
@@ -238,50 +238,30 @@ def build_luprex_and_integration():
|
|||||||
shell(INTEGRATION, f"{UNREALENGINE}/Engine/Build/BatchFiles/{BUILD_BAT} -waitmutex IntegrationEditor {OS} DebugGame {INTEGRATION}/Integration.uproject")
|
shell(INTEGRATION, f"{UNREALENGINE}/Engine/Build/BatchFiles/{BUILD_BAT} -waitmutex IntegrationEditor {OS} DebugGame {INTEGRATION}/Integration.uproject")
|
||||||
|
|
||||||
|
|
||||||
def build_intellisense_database_for_clangd(force):
|
#
|
||||||
|
# Make a compile_commands.json file.
|
||||||
|
#
|
||||||
|
|
||||||
|
def build_intellisense_database_for_clangd():
|
||||||
"""
|
"""
|
||||||
This builds compile_commands.json, which tells the intellisense system
|
This builds compile_commands.json, which tells the intellisense system
|
||||||
based on clangd how to compile each source file. We automatically rebuild
|
based on clangd how to compile each source file.
|
||||||
if a C++ file has been added or removed. That probably isn't sufficient:
|
This also installs a .clangd file in the UnrealEngine directory.
|
||||||
we should also rebuild if a Build.cs file has been edited. Coming Soon.
|
|
||||||
Until then, if your intellisense starts acting badly, do a 'build.py all',
|
|
||||||
which sets the 'force' argument above to true.
|
|
||||||
|
|
||||||
Rebuilding the intellisense database touches rsp files, which
|
|
||||||
unfortunately, causes the entire C++ build to be restarted the next
|
|
||||||
time you run 'build'. This is terrible behavior from Unreal's build
|
|
||||||
system. We have a hacky workaround: we save the RSP files before
|
|
||||||
running the intellisense build, then we restore them afterward.
|
|
||||||
"""
|
"""
|
||||||
Path(f"{INTEGRATION}/.vscode").mkdir(exist_ok = True)
|
mods1 = Path(f"{INTEGRATION}/Intermediate/Build/{OS}").rglob("UnrealEditor/DebugGame/**/Module.*.o.rsp")
|
||||||
Path(f"{UNREALENGINE}/.vscode").mkdir(exist_ok = True)
|
mods2 = Path(f"{UNREALENGINE}/Engine/Intermediate/Build/{OS}").rglob("UnrealEditor/Development/**/Module.*.o.rsp")
|
||||||
hash_file = Path(f"{INTEGRATION}/.vscode/cpp_hash")
|
mods = list(mods1) + list(mods2)
|
||||||
new_hash = hash_json(find_cpp(f"{INTEGRATION}/Source"))
|
clangs = list(Path(f"{UNREALENGINE}/Engine/Extras/ThirdPartyNotUE/SDKs").rglob("*-linux-gnu/bin/clang++"))
|
||||||
old_hash = read_if_exists(hash_file).strip()
|
if len(clangs) != 1: sys.exit("Couldn't identify correct clang++ compiler in UnrealEngine thirdparty directory")
|
||||||
if (new_hash != old_hash) or force:
|
clang = str(clangs[0])
|
||||||
hash_file.unlink(missing_ok=True)
|
ccjson = json.loads(Path(f"{INTEGRATION}/luprex/build/{OS}/compile_commands.json").read_text())
|
||||||
create_tarfile(f"{INTEGRATION}/Intermediate", "*.rsp", f"{INTEGRATION}/rsp_files.tgz")
|
ccdir = f"{UNREALENGINE}/Engine/Source";
|
||||||
create_tarfile(f"{UNREALENGINE}/Engine", "*.rsp", f"{UNREALENGINE}/rsp_files.tgz")
|
for mod in mods:
|
||||||
try:
|
rsp = str(mod)
|
||||||
Path(f"{INTEGRATION}/.vscode/compile_commands.json").unlink(missing_ok=True)
|
cpp = rsp.removesuffix(".o.rsp")
|
||||||
shell(INTEGRATION, f"{UNREALENGINE}/Engine/Build/BatchFiles/{BUILD_BAT} -waitmutex IntegrationEditor {OS} DebugGame {INTEGRATION}/Integration.uproject -mode=GenerateClangDatabase -OutputDir={INTEGRATION}/.vscode")
|
args = [clang, "@"+rsp]
|
||||||
shell(UNREALENGINE, f"{UNREALENGINE}/Engine/Build/BatchFiles/{BUILD_BAT} -waitmutex UnrealEditor {OS} DebugGame -mode=GenerateClangDatabase -OutputDir={UNREALENGINE}/.vscode")
|
ccjson.append({ "file" : cpp, "arguments":args, "directory":ccdir })
|
||||||
cc1 = json.loads(Path(f"{INTEGRATION}/.vscode/compile_commands.json").read_text())
|
Path(f"{INTEGRATION}/.vscode/compile_commands.json").write_text(json.dumps(ccjson, indent=2))
|
||||||
cc2 = json.loads(Path(f"{INTEGRATION}/luprex/build/{OS}/compile_commands.json").read_text())
|
|
||||||
cc3 = json.loads(Path(f"{UNREALENGINE}/.vscode/compile_commands.json").read_text())
|
|
||||||
cc = cc1 + cc2 + cc3
|
|
||||||
Path(f"{INTEGRATION}/.vscode/compile_commands.json").write_text(json.dumps(cc, indent=2))
|
|
||||||
except Exception as e:
|
|
||||||
error = e
|
|
||||||
else:
|
|
||||||
error = None
|
|
||||||
# finally:
|
|
||||||
# tarfile.open(f"{INTEGRATION}/rsp_files.tgz").extractall(path=f"{INTEGRATION}/Intermediate")
|
|
||||||
# tarfile.open(f"{UNREALENGINE}/rsp_files.tgz").extractall(path=f"{UNREALENGINE}/Engine")
|
|
||||||
# Path(f"{INTEGRATION}/rsp_files.tgz").unlink()
|
|
||||||
# Path(f"{UNREALENGINE}/rsp_files.tgz").unlink()
|
|
||||||
if error: raise error
|
|
||||||
hash_file.write_text(new_hash)
|
|
||||||
|
|
||||||
|
|
||||||
def generate_integration_code_workspace():
|
def generate_integration_code_workspace():
|
||||||
@@ -320,7 +300,7 @@ store_system_config_in_globals(CONFIG)
|
|||||||
os.chdir(f"{INTEGRATION}/EnginePatches")
|
os.chdir(f"{INTEGRATION}/EnginePatches")
|
||||||
|
|
||||||
if MODE == "experiment":
|
if MODE == "experiment":
|
||||||
build_intellisense_database_for_clangd(True)
|
build_intellisense_database_for_clangd()
|
||||||
|
|
||||||
if MODE == "all":
|
if MODE == "all":
|
||||||
checkout_correct_unreal_engine_branch_and_apply_patch()
|
checkout_correct_unreal_engine_branch_and_apply_patch()
|
||||||
@@ -333,7 +313,7 @@ if MODE == "all":
|
|||||||
|
|
||||||
if MODE in ["all", "c++"]:
|
if MODE in ["all", "c++"]:
|
||||||
build_luprex_and_integration()
|
build_luprex_and_integration()
|
||||||
# build_intellisense_database_for_clangd(MODE == "all")
|
build_intellisense_database_for_clangd()
|
||||||
|
|
||||||
if MODE == "clean":
|
if MODE == "clean":
|
||||||
build_clean()
|
build_clean()
|
||||||
|
|||||||
Reference in New Issue
Block a user