diff --git a/appveyor.yml b/appveyor.yml index 9552c89b..f361ba77 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ image: Visual Studio 2017 before_build: - - ps: Invoke-WebRequest -Uri https://github.com/qmlnet/qt-runtimes/releases/download/releases/qt-5.12.2-877b810-win-x64-dev.tar.gz -OutFile C:\qmlnet-qt.tar.gz + - ps: Invoke-WebRequest -Uri https://github.com/qmlnet/qt-runtimes/releases/download/releases/qt-5.12.2-ad0689c-win-x64-dev.tar.gz -OutFile C:\qmlnet-qt.tar.gz - cmd: 7z x C:\qmlnet-qt.tar.gz -oC:\ - cmd: 7z x C:\qmlnet-qt.tar -oC:\qmlnet-qt - cmd: rm -r C:\Tools\GitVersion\ diff --git a/build/travis.linux.sh b/build/travis.linux.sh index 6f2626c5..81dcf12e 100755 --- a/build/travis.linux.sh +++ b/build/travis.linux.sh @@ -6,7 +6,7 @@ QT_DIR=$SCRIPT_DIR/Qt sudo apt-get install -y libgl1-mesa-dev mkdir -p $QT_DIR -wget -O- -q https://github.com/qmlnet/qt-runtimes/releases/download/releases/qt-5.12.2-877b810-linux-x64-dev.tar.gz | tar xpz -C $QT_DIR +wget -O- -q https://github.com/qmlnet/qt-runtimes/releases/download/releases/qt-5.12.2-ad0689c-linux-x64-dev.tar.gz | tar xpz -C $QT_DIR export PATH=$QT_DIR/qt/bin:$PATH export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/src/native/output:$QT_DIR/qt/lib diff --git a/build/travis.osx.sh b/build/travis.osx.sh index 9049bdbc..fc32ab73 100755 --- a/build/travis.osx.sh +++ b/build/travis.osx.sh @@ -5,7 +5,7 @@ SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) QT_DIR=$SCRIPT_DIR/Qt mkdir -p $QT_DIR -wget -O- -q https://github.com/qmlnet/qt-runtimes/releases/download/releases/qt-5.12.2-877b810-osx-x64-dev.tar.gz | tar xpz -C $QT_DIR +wget -O- -q https://github.com/qmlnet/qt-runtimes/releases/download/releases/qt-5.12.2-ad0689c-osx-x64-dev.tar.gz | tar xpz -C $QT_DIR export PATH=$QT_DIR/qt/bin:$PATH export DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/src/native/output:$QT_DIR/qt/lib diff --git a/src/net/Qml.Net/QmlNetConfig.cs b/src/net/Qml.Net/QmlNetConfig.cs index 41a27adc..10f6e764 100644 --- a/src/net/Qml.Net/QmlNetConfig.cs +++ b/src/net/Qml.Net/QmlNetConfig.cs @@ -4,7 +4,7 @@ namespace Qml.Net { public class QmlNetConfig { - public static string QtBuildVersion => "qt-5.12.2-877b810"; + public static string QtBuildVersion => "qt-5.12.2-ad0689c"; public static bool ListenForExceptionsWhenInvokingTasks { get; set; } diff --git a/src/net/Qml.Net/Runtimes/RuntimeManager.cs b/src/net/Qml.Net/Runtimes/RuntimeManager.cs index d835791a..cb7adbcb 100644 --- a/src/net/Qml.Net/Runtimes/RuntimeManager.cs +++ b/src/net/Qml.Net/Runtimes/RuntimeManager.cs @@ -139,42 +139,118 @@ namespace Qml.Net.Runtimes throw new Exception($"The version of the runtime directory was {versionFile}, but expected {expectedVersion}"); } - var pluginsDirectory = Path.Combine(directory, "qt", "plugins"); - if (!Directory.Exists(pluginsDirectory)) + if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { - throw new Exception($"Plugins directory didn't exist: {pluginsDirectory}"); - } - Environment.SetEnvironmentVariable("QT_PLUGIN_PATH", pluginsDirectory); - - var qmlDirectory = Path.Combine(directory, "qt", "qml"); - if (!Directory.Exists(qmlDirectory)) - { - throw new Exception($"QML directory didn't exist: {qmlDirectory}"); - } - Environment.SetEnvironmentVariable("QML2_IMPORT_PATH", qmlDirectory); - - var libDirectory = Path.Combine(directory, "qt", "lib"); - if (!Directory.Exists(libDirectory)) - { - throw new Exception($"The lib directory didn't exist: {libDirectory}"); - } - - var preloadPath = Path.Combine(libDirectory, "preload.txt"); - if (!File.Exists(preloadPath)) - { - throw new Exception($"The preload.txt file didn't exist: {preloadPath}"); - } - - var libsToPreload = File.ReadAllLines(preloadPath).Where(x => !string.IsNullOrEmpty(x)) - .Select(x => Path.Combine(libDirectory, x)) - .ToList(); - var platformLoader = NetNativeLibLoader.Loader.PlatformLoaderBase.SelectPlatformLoader(); - foreach (var libToPreload in libsToPreload) - { - var libHandler = platformLoader.LoadLibrary(libToPreload); - if (libHandler == IntPtr.Zero) + var pluginsDirectory = Path.Combine(directory, "qt", "plugins"); + if (!Directory.Exists(pluginsDirectory)) { - throw new Exception($"Unabled to preload library: {libToPreload}"); + throw new Exception($"Plugins directory didn't exist: {pluginsDirectory}"); + } + Environment.SetEnvironmentVariable("QT_PLUGIN_PATH", pluginsDirectory); + + var qmlDirectory = Path.Combine(directory, "qt", "qml"); + if (!Directory.Exists(qmlDirectory)) + { + throw new Exception($"QML directory didn't exist: {qmlDirectory}"); + } + Environment.SetEnvironmentVariable("QML2_IMPORT_PATH", qmlDirectory); + + var libDirectory = Path.Combine(directory, "qt", "lib"); + if (!Directory.Exists(libDirectory)) + { + throw new Exception($"The lib directory didn't exist: {libDirectory}"); + } + + var preloadPath = Path.Combine(libDirectory, "preload.txt"); + if (!File.Exists(preloadPath)) + { + throw new Exception($"The preload.txt file didn't exist: {preloadPath}"); + } + + var libsToPreload = File.ReadAllLines(preloadPath).Where(x => !string.IsNullOrEmpty(x)) + .Select(x => Path.Combine(libDirectory, x)) + .ToList(); + var platformLoader = NetNativeLibLoader.Loader.PlatformLoaderBase.SelectPlatformLoader(); + foreach (var libToPreload in libsToPreload) + { + var libHandler = platformLoader.LoadLibrary(libToPreload); + if (libHandler == IntPtr.Zero) + { + throw new Exception($"Unabled to preload library: {libToPreload}"); + } + } + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + var pluginsDirectory = Path.Combine(directory, "qt", "plugins"); + if (!Directory.Exists(pluginsDirectory)) + { + throw new Exception($"Plugins directory didn't exist: {pluginsDirectory}"); + } + Environment.SetEnvironmentVariable("QT_PLUGIN_PATH", pluginsDirectory); + + var qmlDirectory = Path.Combine(directory, "qt", "qml"); + if (!Directory.Exists(qmlDirectory)) + { + throw new Exception($"QML directory didn't exist: {qmlDirectory}"); + } + Environment.SetEnvironmentVariable("QML2_IMPORT_PATH", qmlDirectory); + + var libDirectory = Path.Combine(directory, "qt", "lib"); + if (!Directory.Exists(libDirectory)) + { + throw new Exception($"The lib directory didn't exist: {libDirectory}"); + } + + var preloadPath = Path.Combine(libDirectory, "preload.txt"); + if (!File.Exists(preloadPath)) + { + throw new Exception($"The preload.txt file didn't exist: {preloadPath}"); + } + + var libsToPreload = File.ReadAllLines(preloadPath).Where(x => !string.IsNullOrEmpty(x)) + .Select(x => Path.Combine(libDirectory, x)) + .ToList(); + var platformLoader = NetNativeLibLoader.Loader.PlatformLoaderBase.SelectPlatformLoader(); + foreach (var libToPreload in libsToPreload) + { + var libHandler = platformLoader.LoadLibrary(libToPreload); + if (libHandler == IntPtr.Zero) + { + throw new Exception($"Unabled to preload library: {libToPreload}"); + } + } + } + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + var pluginsDirectory = Path.Combine(directory, "qt", "plugins"); + if (!Directory.Exists(pluginsDirectory)) + { + throw new Exception($"Plugins directory didn't exist: {pluginsDirectory}"); + } + Environment.SetEnvironmentVariable("QT_PLUGIN_PATH", pluginsDirectory); + + var qmlDirectory = Path.Combine(directory, "qt", "qml"); + if (!Directory.Exists(qmlDirectory)) + { + throw new Exception($"QML directory didn't exist: {qmlDirectory}"); + } + Environment.SetEnvironmentVariable("QML2_IMPORT_PATH", qmlDirectory); + + var binDirectory = Path.Combine(directory, "qt", "bin"); + if (!Directory.Exists(binDirectory)) + { + throw new Exception($"The bin directory didn't exist: {binDirectory}"); + } + + Environment.SetEnvironmentVariable("PATH", $"{binDirectory};{Environment.GetEnvironmentVariable("PATH")}"); + + var preloadPath = Path.Combine(binDirectory, "preload.txt"); + if (!File.Exists(preloadPath)) + { + throw new Exception($"The preload.txt file didn't exist: {preloadPath}"); } } }