mirror of
https://github.com/obhq/obliteration.git
synced 2024-11-23 03:09:52 +00:00
Removes Qt from Windows CI (#1129)
This commit is contained in:
parent
f7c5ea57fc
commit
118c693710
58
.github/workflows/ci-windows.yml
vendored
58
.github/workflows/ci-windows.yml
vendored
@ -1,21 +1,15 @@
|
|||||||
name: CI (Windows)
|
name: CI (Windows)
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
env:
|
|
||||||
CMAKE_BUILD_PARALLEL_LEVEL: '4'
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Windows
|
name: Windows
|
||||||
runs-on: windows-2022
|
runs-on: windows-2022
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Install Ninja
|
|
||||||
run: choco install ninja
|
|
||||||
- name: Generate cache keys
|
- name: Generate cache keys
|
||||||
run: |
|
run: |
|
||||||
echo "qt=${{ runner.os }}-qt-6.7.2" >> $env:GITHUB_OUTPUT
|
|
||||||
echo "target=${{ runner.os }}-target" >> $env:GITHUB_OUTPUT
|
|
||||||
echo "vulkan=${{ runner.os }}-vulkan-1.3.290.0" >> $env:GITHUB_OUTPUT
|
echo "vulkan=${{ runner.os }}-vulkan-1.3.290.0" >> $env:GITHUB_OUTPUT
|
||||||
id: cache-keys
|
id: cache-keys
|
||||||
- name: Restore Vulkan SDK
|
- name: Restore Vulkan SDK
|
||||||
@ -33,70 +27,22 @@ jobs:
|
|||||||
if: ${{ steps.restore-vulkan.outputs.cache-hit != 'true' }}
|
if: ${{ steps.restore-vulkan.outputs.cache-hit != 'true' }}
|
||||||
- name: Set Vulkan SDK path
|
- name: Set Vulkan SDK path
|
||||||
run: echo "VULKAN_SDK=C:\VulkanSDK" >> $env:GITHUB_ENV
|
run: echo "VULKAN_SDK=C:\VulkanSDK" >> $env:GITHUB_ENV
|
||||||
- name: Restore Qt
|
|
||||||
uses: actions/cache/restore@v4
|
|
||||||
with:
|
|
||||||
path: qt
|
|
||||||
key: ${{ steps.cache-keys.outputs.qt }}
|
|
||||||
id: restore-qt
|
|
||||||
- name: Download Qt
|
|
||||||
run: |
|
|
||||||
Invoke-WebRequest `
|
|
||||||
-Uri "https://download.qt.io/official_releases/qt/6.7/6.7.2/single/qt-everywhere-src-6.7.2.tar.xz" `
|
|
||||||
-OutFile qt.tar.xz
|
|
||||||
7z x -so qt.tar.xz | 7z x -si -ttar
|
|
||||||
rm qt.tar.xz
|
|
||||||
mkdir qt-build
|
|
||||||
if: ${{ steps.restore-qt.outputs.cache-hit != 'true' }}
|
|
||||||
- name: Build Qt
|
|
||||||
run: |
|
|
||||||
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
|
|
||||||
${{ github.workspace }}\qt-everywhere-src-6.7.2\configure.bat -prefix "${{ github.workspace }}\qt" -no-openssl && cmake --build . --parallel && cmake --install .
|
|
||||||
shell: cmd
|
|
||||||
working-directory: qt-build
|
|
||||||
if: ${{ steps.restore-qt.outputs.cache-hit != 'true' }}
|
|
||||||
- name: Set Qt path
|
|
||||||
run: echo "CMAKE_PREFIX_PATH=qt" >> $env:GITHUB_ENV
|
|
||||||
- name: Restore target directory
|
|
||||||
uses: actions/cache/restore@v4
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ steps.cache-keys.outputs.target }}
|
|
||||||
- name: Update Rust
|
- name: Update Rust
|
||||||
run: rustup update stable
|
run: rustup update stable
|
||||||
- name: Add additional Rust targets
|
- name: Add additional Rust targets
|
||||||
run: rustup target add x86_64-unknown-none
|
run: rustup target add x86_64-unknown-none
|
||||||
- name: Run CMake
|
|
||||||
run: cmake --preset windows-release .
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cmake --build --preset windows-release
|
run: python3 build.py -r
|
||||||
- name: Build Slint
|
|
||||||
run: cargo build -p gui --bin obliteration -F slint -r
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --workspace --exclude gui --exclude kernel
|
run: cargo test --workspace --exclude gui --exclude kernel
|
||||||
working-directory: src
|
|
||||||
- name: Export artifacts
|
|
||||||
run: cmake --install build --prefix dist
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: obliteration-win-x64
|
name: obliteration-win-x64
|
||||||
path: dist
|
path: dist
|
||||||
- name: Cache target directory
|
|
||||||
uses: actions/cache/save@v4
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ steps.cache-keys.outputs.target }}-${{ github.run_id }}
|
|
||||||
if: startsWith(github.ref, 'refs/heads/')
|
|
||||||
- name: Cache Vulkan SDK
|
- name: Cache Vulkan SDK
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: C:\VulkanSDK
|
path: C:\VulkanSDK
|
||||||
key: ${{ steps.cache-keys.outputs.vulkan }}
|
key: ${{ steps.cache-keys.outputs.vulkan }}
|
||||||
if: startsWith(github.ref, 'refs/heads/') && steps.install-vulkan.outputs.new-install == 'true'
|
if: startsWith(github.ref, 'refs/heads/') && steps.install-vulkan.outputs.new-install == 'true'
|
||||||
- name: Cache Qt
|
|
||||||
uses: actions/cache/save@v4
|
|
||||||
with:
|
|
||||||
path: qt
|
|
||||||
key: ${{ steps.cache-keys.outputs.qt }}
|
|
||||||
if: startsWith(github.ref, 'refs/heads/') && steps.restore-qt.outputs.cache-hit != 'true'
|
|
||||||
|
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@ -2,6 +2,14 @@
|
|||||||
"[json]": {
|
"[json]": {
|
||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
|
"[jsonl]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[python]": {
|
||||||
|
"editor.rulers": [
|
||||||
|
100
|
||||||
|
]
|
||||||
|
},
|
||||||
"[rust]": {
|
"[rust]": {
|
||||||
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
||||||
"editor.formatOnSave": true,
|
"editor.formatOnSave": true,
|
||||||
|
@ -12,7 +12,7 @@ members = [
|
|||||||
"src/param",
|
"src/param",
|
||||||
"src/pfs",
|
"src/pfs",
|
||||||
"src/pkg",
|
"src/pkg",
|
||||||
"src/tls"
|
"src/tls",
|
||||||
]
|
]
|
||||||
|
|
||||||
[profile.dev]
|
[profile.dev]
|
||||||
@ -20,5 +20,4 @@ panic = "abort"
|
|||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
debug = "full"
|
|
||||||
lto = true
|
lto = true
|
||||||
|
62
build.py
62
build.py
@ -28,9 +28,7 @@ def cargo(package, toolchain=None, target=None, release=False, args=None):
|
|||||||
if args is not None:
|
if args is not None:
|
||||||
cmd.extend(args)
|
cmd.extend(args)
|
||||||
|
|
||||||
cmd.extend([
|
cmd.extend(['--message-format', 'json-render-diagnostics'])
|
||||||
'--message-format', 'json-render-diagnostics'
|
|
||||||
])
|
|
||||||
|
|
||||||
# Run.
|
# Run.
|
||||||
with Popen(cmd, stdout=PIPE) as proc:
|
with Popen(cmd, stdout=PIPE) as proc:
|
||||||
@ -48,42 +46,43 @@ def cargo(package, toolchain=None, target=None, release=False, args=None):
|
|||||||
|
|
||||||
return artifact
|
return artifact
|
||||||
|
|
||||||
def export_darwin(root, kern):
|
def export_darwin(root, kern, gui):
|
||||||
# Create bundle directory.
|
# Create directories.
|
||||||
bundle = os.path.join(root, 'Obliteration.app')
|
bundle = os.path.join(root, 'Obliteration.app')
|
||||||
|
|
||||||
os.mkdir(bundle)
|
|
||||||
|
|
||||||
# Create Contents directory.
|
|
||||||
contents = os.path.join(bundle, 'Contents')
|
contents = os.path.join(bundle, 'Contents')
|
||||||
|
macos = os.path.join(contents, 'MacOS')
|
||||||
os.mkdir(contents)
|
|
||||||
|
|
||||||
# Create Resources directory.
|
|
||||||
resources = os.path.join(contents, 'Resources')
|
resources = os.path.join(contents, 'Resources')
|
||||||
|
|
||||||
|
os.mkdir(bundle)
|
||||||
|
os.mkdir(contents)
|
||||||
|
os.mkdir(macos)
|
||||||
os.mkdir(resources)
|
os.mkdir(resources)
|
||||||
|
|
||||||
# Copy kernel.
|
# Export files
|
||||||
shutil.copy(kern['executable'], resources)
|
shutil.copy(kern['executable'], resources)
|
||||||
|
shutil.copy(gui['executable'], macos)
|
||||||
|
|
||||||
def export_linux(root, kern):
|
def export_linux(root, kern, gui):
|
||||||
|
# Create directories.
|
||||||
|
bin = os.path.join(root, 'bin')
|
||||||
|
share = os.path.join(root, 'share')
|
||||||
|
|
||||||
|
os.mkdir(bin)
|
||||||
|
os.mkdir(share)
|
||||||
|
|
||||||
|
# Export files.
|
||||||
|
shutil.copy(kern['executable'], share)
|
||||||
|
shutil.copy(gui['executable'], bin)
|
||||||
|
|
||||||
|
def export_windows(root, kern, gui):
|
||||||
# Create share directory.
|
# Create share directory.
|
||||||
share = os.path.join(root, 'share')
|
share = os.path.join(root, 'share')
|
||||||
|
|
||||||
os.mkdir(share)
|
os.mkdir(share)
|
||||||
|
|
||||||
# Copy kernel.
|
# Export files.
|
||||||
shutil.copy(kern['executable'], share)
|
|
||||||
|
|
||||||
def export_windows(root, kern):
|
|
||||||
# Create share directory.
|
|
||||||
share = os.path.join(root, 'share')
|
|
||||||
|
|
||||||
os.mkdir(share)
|
|
||||||
|
|
||||||
# Copy kernel.
|
|
||||||
shutil.copy(kern['executable'], share)
|
shutil.copy(kern['executable'], share)
|
||||||
|
shutil.copy(gui['executable'], root)
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Setup argument parser.
|
# Setup argument parser.
|
||||||
@ -98,14 +97,14 @@ def main():
|
|||||||
# Build kernel.
|
# Build kernel.
|
||||||
m = platform.machine()
|
m = platform.machine()
|
||||||
|
|
||||||
if m == 'arm64' or m == 'aarch64':
|
if m == 'aarch64' or m == 'arm64':
|
||||||
kern = cargo(
|
kern = cargo(
|
||||||
'obkrnl',
|
'obkrnl',
|
||||||
toolchain='nightly',
|
toolchain='nightly',
|
||||||
target='aarch64-unknown-none-softfloat',
|
target='aarch64-unknown-none-softfloat',
|
||||||
release=args.release,
|
release=args.release,
|
||||||
args=['-Z', 'build-std=core,alloc'])
|
args=['-Z', 'build-std=core,alloc'])
|
||||||
elif m == 'x86_64':
|
elif m == 'x86_64' or m == 'AMD64':
|
||||||
kern = cargo(
|
kern = cargo(
|
||||||
'obkrnl',
|
'obkrnl',
|
||||||
target='x86_64-unknown-none',
|
target='x86_64-unknown-none',
|
||||||
@ -114,6 +113,9 @@ def main():
|
|||||||
print(f'Architecture {m} is not supported.', file=sys.stderr)
|
print(f'Architecture {m} is not supported.', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Build GUI.
|
||||||
|
gui = cargo('gui', release=args.release, args=['--bin', 'obliteration', '-F', 'slint'])
|
||||||
|
|
||||||
# Create output directory.
|
# Create output directory.
|
||||||
dest = 'dist'
|
dest = 'dist'
|
||||||
|
|
||||||
@ -126,11 +128,11 @@ def main():
|
|||||||
s = platform.system()
|
s = platform.system()
|
||||||
|
|
||||||
if s == 'Darwin':
|
if s == 'Darwin':
|
||||||
export_darwin(dest, kern)
|
export_darwin(dest, kern, gui)
|
||||||
elif s == 'Linux':
|
elif s == 'Linux':
|
||||||
export_linux(dest, kern)
|
export_linux(dest, kern, gui)
|
||||||
elif s == 'Windows':
|
elif s == 'Windows':
|
||||||
export_windows(dest, kern)
|
export_windows(dest, kern, gui)
|
||||||
else:
|
else:
|
||||||
print(f'OS {s} is not supported.', file=sys.stderr)
|
print(f'OS {s} is not supported.', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include <filesystem>
|
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -107,7 +106,6 @@ MainWindow::MainWindow(
|
|||||||
connect(m_launch, &LaunchSettings::saveClicked, this, &MainWindow::saveProfile);
|
connect(m_launch, &LaunchSettings::saveClicked, this, &MainWindow::saveProfile);
|
||||||
connect(m_launch, &LaunchSettings::startClicked, [this](const QString &debug) {
|
connect(m_launch, &LaunchSettings::startClicked, [this](const QString &debug) {
|
||||||
if (debug.isEmpty()) {
|
if (debug.isEmpty()) {
|
||||||
startVmm({});
|
|
||||||
} else {
|
} else {
|
||||||
startDebug(debug);
|
startDebug(debug);
|
||||||
}
|
}
|
||||||
@ -356,9 +354,6 @@ void MainWindow::debuggerConnected()
|
|||||||
QString("Failed to accept a debugger connection: %1.").arg(error_message(error)));
|
QString("Failed to accept a debugger connection: %1.").arg(error_message(error)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start VMM.
|
|
||||||
startVmm(std::move(debugger));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::vmmError(const QString &msg)
|
void MainWindow::vmmError(const QString &msg)
|
||||||
@ -562,37 +557,6 @@ void MainWindow::startDebug(const QString &addr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::startVmm(Rust<DebugClient> &&debug)
|
|
||||||
{
|
|
||||||
// Get full path to kernel binary.
|
|
||||||
std::string kernel;
|
|
||||||
|
|
||||||
m_debugServer.free();
|
|
||||||
|
|
||||||
if (m_args.isSet(Args::kernel)) {
|
|
||||||
kernel = m_args.value(Args::kernel).toStdString();
|
|
||||||
} else {
|
|
||||||
#ifdef _WIN32
|
|
||||||
std::filesystem::path b(QCoreApplication::applicationDirPath().toStdString(), std::filesystem::path::native_format);
|
|
||||||
b /= L"share";
|
|
||||||
b /= L"obkrnl";
|
|
||||||
kernel = b.u8string();
|
|
||||||
#else
|
|
||||||
auto b = std::filesystem::path(QCoreApplication::applicationDirPath().toStdString(), std::filesystem::path::native_format).parent_path();
|
|
||||||
#ifdef __APPLE__
|
|
||||||
b /= "Resources";
|
|
||||||
#else
|
|
||||||
b /= "share";
|
|
||||||
#endif
|
|
||||||
b /= "obkrnl";
|
|
||||||
kernel = b.u8string();
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// Swap launch settings with the screen before getting a Vulkan surface otherwise it will fail.
|
|
||||||
m_main->setCurrentIndex(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MainWindow::requireVmmStopped()
|
bool MainWindow::requireVmmStopped()
|
||||||
{
|
{
|
||||||
if (m_vmm) {
|
if (m_vmm) {
|
||||||
|
@ -33,7 +33,6 @@ public:
|
|||||||
bool loadGames();
|
bool loadGames();
|
||||||
void restoreGeometry();
|
void restoreGeometry();
|
||||||
void startDebug(const QString &addr);
|
void startDebug(const QString &addr);
|
||||||
void startVmm(Rust<DebugClient> &&debug);
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event) override;
|
void closeEvent(QCloseEvent *event) override;
|
||||||
private slots:
|
private slots:
|
||||||
|
Loading…
Reference in New Issue
Block a user