media:cpp - lnx

This commit is contained in:
lovebird 2026-04-13 20:23:19 +02:00
parent 4479d0ce88
commit 74983ff125
6 changed files with 34 additions and 11 deletions

View File

@ -3,7 +3,7 @@ build/
CMakeUserPresets.json
.vs/
*.user
cache
# Windows libvips SDK (see scripts/fetch-vips-windows.ps1)
third_party/vips-dev-*/
third_party/vips-dev-x64-all*.zip

View File

@ -1,6 +1,14 @@
#!/usr/bin/env bash
#rm -rf /tmp/polymech-build
mkdir -p /tmp/polymech-build
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
mkdir -p /tmp/polymech-media-build
export PATH="/snap/bin:$PATH"
cmake -S ./ -B /tmp/polymech-build -DCMAKE_BUILD_TYPE=Release
cmake --build /tmp/polymech-build
cmake -S "$SCRIPT_DIR" -B /tmp/polymech-media-build -DCMAKE_BUILD_TYPE=Release
cmake --build /tmp/polymech-media-build
echo ""
echo "Built binary (CMake RUNTIME_OUTPUT_DIRECTORY): ${SCRIPT_DIR}/dist/media-img"
if [[ -f "${SCRIPT_DIR}/dist/media-img" ]]; then
ls -la "${SCRIPT_DIR}/dist/media-img"
else
echo "Warning: ${SCRIPT_DIR}/dist/media-img not found; see CMake build log above." >&2
fi

BIN
packages/media/cpp/dist/media-img vendored Normal file

Binary file not shown.

View File

@ -5,7 +5,7 @@
# Tested on: Ubuntu 20.04+ / Debian 11+
# Usage: sudo bash install-lnx.sh
# ─────────────────────────────────────────────────────────────────────────────
set -euo pipefail
#set -euo pipefail
echo "── media-img (C++) Linux dependency installer ──"

View File

@ -21,11 +21,11 @@
"test:media:rest": "node orchestrator/test-media.mjs --rest-only",
"test:media:ipc": "node orchestrator/test-media.mjs --ipc-only",
"test:media:url": "node orchestrator/test-media.mjs --url-only",
"run": ".\\dist\\media-img.exe --help",
"resize": ".\\dist\\media-img.exe resize",
"serve": ".\\dist\\media-img.exe serve --help",
"ipc": ".\\dist\\media-img.exe ipc --help",
"kbot": ".\\dist\\media-img.exe kbot --help"
"run": "node scripts/invoke-media-img.mjs --help",
"resize": "node scripts/invoke-media-img.mjs resize",
"serve": "node scripts/invoke-media-img.mjs serve --help",
"ipc": "node scripts/invoke-media-img.mjs ipc --help",
"kbot": "node scripts/invoke-media-img.mjs kbot --help"
},
"keywords": [],
"author": "",

View File

@ -0,0 +1,15 @@
#!/usr/bin/env node
/**
* Cross-platform launcher: runs dist/media-img or dist/media-img.exe from package root.
* Used by package.json convenience scripts on Linux, macOS, and Windows.
*/
import { spawnSync } from 'node:child_process';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
const exe = process.platform === 'win32' ? 'media-img.exe' : 'media-img';
const bin = resolve(root, 'dist', exe);
const args = process.argv.slice(2);
const r = spawnSync(bin, args, { stdio: 'inherit' });
process.exit(r.status ?? 1);