mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-21 06:45:32 -06:00
Support for loading windows/osx runtimes.
This commit is contained in:
parent
6889773427
commit
b58be97185
5 changed files with 114 additions and 38 deletions
|
|
@ -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\
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
||||
|
|
|
|||
|
|
@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue