editor: prefer bundled mono runtime discovery
This commit is contained in:
@@ -32,12 +32,16 @@ if(NOT TARGET XCEngine)
|
||||
option(XCENGINE_ENABLE_MONO_SCRIPTING "Build the Mono-based C# scripting runtime" ON)
|
||||
|
||||
if(NOT DEFINED XCENGINE_MONO_ROOT_DIR OR XCENGINE_MONO_ROOT_DIR STREQUAL "")
|
||||
if(EXISTS "${XCENGINE_ROOT_DIR}/engine/third_party/mono/binary/mscorlib.dll")
|
||||
set(XCENGINE_MONO_ROOT_DIR_DEFAULT "${XCENGINE_ROOT_DIR}/engine/third_party/mono")
|
||||
else()
|
||||
file(GLOB XCENGINE_MONO_ROOT_DIR_CANDIDATES "${XCENGINE_ROOT_DIR}/*/Fermion/Fermion/external/mono")
|
||||
if(XCENGINE_MONO_ROOT_DIR_CANDIDATES)
|
||||
list(GET XCENGINE_MONO_ROOT_DIR_CANDIDATES 0 XCENGINE_MONO_ROOT_DIR_DEFAULT)
|
||||
else()
|
||||
set(XCENGINE_MONO_ROOT_DIR_DEFAULT "${XCENGINE_ROOT_DIR}/managed/mono")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(
|
||||
XCENGINE_MONO_ROOT_DIR
|
||||
|
||||
@@ -48,6 +48,11 @@ std::filesystem::path FindBundledMonoRootDirectory(const std::filesystem::path&
|
||||
return {};
|
||||
}
|
||||
|
||||
const std::filesystem::path projectBundledMonoRoot = repositoryRoot / "engine" / "third_party" / "mono";
|
||||
if (std::filesystem::exists(projectBundledMonoRoot / "binary" / "mscorlib.dll", ec)) {
|
||||
return projectBundledMonoRoot.lexically_normal();
|
||||
}
|
||||
|
||||
for (std::filesystem::directory_iterator it(repositoryRoot, ec), end; it != end && !ec; it.increment(ec)) {
|
||||
if (ec || !it->is_directory(ec)) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user