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)
|
||||
on:
|
||||
workflow_call:
|
||||
env:
|
||||
CMAKE_BUILD_PARALLEL_LEVEL: '4'
|
||||
jobs:
|
||||
build:
|
||||
name: Windows
|
||||
runs-on: windows-2022
|
||||
steps:
|
||||
- name: Checkout source
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Install Ninja
|
||||
run: choco install ninja
|
||||
- name: Generate cache keys
|
||||
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
|
||||
id: cache-keys
|
||||
- name: Restore Vulkan SDK
|
||||
@ -33,70 +27,22 @@ jobs:
|
||||
if: ${{ steps.restore-vulkan.outputs.cache-hit != 'true' }}
|
||||
- name: Set Vulkan SDK path
|
||||
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
|
||||
run: rustup update stable
|
||||
- name: Add additional Rust targets
|
||||
run: rustup target add x86_64-unknown-none
|
||||
- name: Run CMake
|
||||
run: cmake --preset windows-release .
|
||||
- name: Build
|
||||
run: cmake --build --preset windows-release
|
||||
- name: Build Slint
|
||||
run: cargo build -p gui --bin obliteration -F slint -r
|
||||
run: python3 build.py -r
|
||||
- name: Run tests
|
||||
run: cargo test --workspace --exclude gui --exclude kernel
|
||||
working-directory: src
|
||||
- name: Export artifacts
|
||||
run: cmake --install build --prefix dist
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: obliteration-win-x64
|
||||
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
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: C:\VulkanSDK
|
||||
key: ${{ steps.cache-keys.outputs.vulkan }}
|
||||
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]": {
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[jsonl]": {
|
||||
"editor.formatOnSave": true
|
||||
},
|
||||
"[python]": {
|
||||
"editor.rulers": [
|
||||
100
|
||||
]
|
||||
},
|
||||
"[rust]": {
|
||||
"editor.defaultFormatter": "rust-lang.rust-analyzer",
|
||||
"editor.formatOnSave": true,
|
||||
|
@ -12,7 +12,7 @@ members = [
|
||||
"src/param",
|
||||
"src/pfs",
|
||||
"src/pkg",
|
||||
"src/tls"
|
||||
"src/tls",
|
||||
]
|
||||
|
||||
[profile.dev]
|
||||
@ -20,5 +20,4 @@ panic = "abort"
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
debug = "full"
|
||||
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:
|
||||
cmd.extend(args)
|
||||
|
||||
cmd.extend([
|
||||
'--message-format', 'json-render-diagnostics'
|
||||
])
|
||||
cmd.extend(['--message-format', 'json-render-diagnostics'])
|
||||
|
||||
# Run.
|
||||
with Popen(cmd, stdout=PIPE) as proc:
|
||||
@ -48,42 +46,43 @@ def cargo(package, toolchain=None, target=None, release=False, args=None):
|
||||
|
||||
return artifact
|
||||
|
||||
def export_darwin(root, kern):
|
||||
# Create bundle directory.
|
||||
def export_darwin(root, kern, gui):
|
||||
# Create directories.
|
||||
bundle = os.path.join(root, 'Obliteration.app')
|
||||
|
||||
os.mkdir(bundle)
|
||||
|
||||
# Create Contents directory.
|
||||
contents = os.path.join(bundle, 'Contents')
|
||||
|
||||
os.mkdir(contents)
|
||||
|
||||
# Create Resources directory.
|
||||
macos = os.path.join(contents, 'MacOS')
|
||||
resources = os.path.join(contents, 'Resources')
|
||||
|
||||
os.mkdir(bundle)
|
||||
os.mkdir(contents)
|
||||
os.mkdir(macos)
|
||||
os.mkdir(resources)
|
||||
|
||||
# Copy kernel.
|
||||
# Export files
|
||||
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.
|
||||
share = os.path.join(root, 'share')
|
||||
|
||||
os.mkdir(share)
|
||||
|
||||
# Copy kernel.
|
||||
shutil.copy(kern['executable'], share)
|
||||
|
||||
def export_windows(root, kern):
|
||||
# Create share directory.
|
||||
share = os.path.join(root, 'share')
|
||||
|
||||
os.mkdir(share)
|
||||
|
||||
# Copy kernel.
|
||||
# Export files.
|
||||
shutil.copy(kern['executable'], share)
|
||||
shutil.copy(gui['executable'], root)
|
||||
|
||||
def main():
|
||||
# Setup argument parser.
|
||||
@ -98,14 +97,14 @@ def main():
|
||||
# Build kernel.
|
||||
m = platform.machine()
|
||||
|
||||
if m == 'arm64' or m == 'aarch64':
|
||||
if m == 'aarch64' or m == 'arm64':
|
||||
kern = cargo(
|
||||
'obkrnl',
|
||||
toolchain='nightly',
|
||||
target='aarch64-unknown-none-softfloat',
|
||||
release=args.release,
|
||||
args=['-Z', 'build-std=core,alloc'])
|
||||
elif m == 'x86_64':
|
||||
elif m == 'x86_64' or m == 'AMD64':
|
||||
kern = cargo(
|
||||
'obkrnl',
|
||||
target='x86_64-unknown-none',
|
||||
@ -114,6 +113,9 @@ def main():
|
||||
print(f'Architecture {m} is not supported.', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Build GUI.
|
||||
gui = cargo('gui', release=args.release, args=['--bin', 'obliteration', '-F', 'slint'])
|
||||
|
||||
# Create output directory.
|
||||
dest = 'dist'
|
||||
|
||||
@ -126,11 +128,11 @@ def main():
|
||||
s = platform.system()
|
||||
|
||||
if s == 'Darwin':
|
||||
export_darwin(dest, kern)
|
||||
export_darwin(dest, kern, gui)
|
||||
elif s == 'Linux':
|
||||
export_linux(dest, kern)
|
||||
export_linux(dest, kern, gui)
|
||||
elif s == 'Windows':
|
||||
export_windows(dest, kern)
|
||||
export_windows(dest, kern, gui)
|
||||
else:
|
||||
print(f'OS {s} is not supported.', file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
@ -30,7 +30,6 @@
|
||||
#include <QToolBar>
|
||||
#include <QUrl>
|
||||
|
||||
#include <filesystem>
|
||||
#include <utility>
|
||||
|
||||
#ifndef _WIN32
|
||||
@ -107,7 +106,6 @@ MainWindow::MainWindow(
|
||||
connect(m_launch, &LaunchSettings::saveClicked, this, &MainWindow::saveProfile);
|
||||
connect(m_launch, &LaunchSettings::startClicked, [this](const QString &debug) {
|
||||
if (debug.isEmpty()) {
|
||||
startVmm({});
|
||||
} else {
|
||||
startDebug(debug);
|
||||
}
|
||||
@ -356,9 +354,6 @@ void MainWindow::debuggerConnected()
|
||||
QString("Failed to accept a debugger connection: %1.").arg(error_message(error)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Start VMM.
|
||||
startVmm(std::move(debugger));
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
if (m_vmm) {
|
||||
|
@ -33,7 +33,6 @@ public:
|
||||
bool loadGames();
|
||||
void restoreGeometry();
|
||||
void startDebug(const QString &addr);
|
||||
void startVmm(Rust<DebugClient> &&debug);
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
private slots:
|
||||
|
Loading…
Reference in New Issue
Block a user