Bundle trimspNL for packaged builds
This commit is contained in:
@@ -49,11 +49,18 @@ Install the `gfortran` compiler, then:
|
||||
```bash
|
||||
cd trimsp/fortran
|
||||
make
|
||||
make install
|
||||
```
|
||||
|
||||
This will install the `trimspNL` binary in `/usr/local/bin`,
|
||||
but it can be moved to any other directory in your `PATH`.
|
||||
|
||||
This creates the `trimspNL` binary in the repository root. For packaged
|
||||
Electron builds, copy or rebuild it into:
|
||||
|
||||
```text
|
||||
resources/bin/trimspNL
|
||||
```
|
||||
|
||||
The application will prefer that bundled copy when running from a packaged
|
||||
install. During development it can still use a local checkout copy or a
|
||||
`trimspNL` binary found in the configured path or in `PATH`.
|
||||
|
||||
###### Running the GUI ######
|
||||
|
||||
@@ -75,11 +82,14 @@ Install [Node.js] (`nodejs`, `nodejs-libs` and `npm`), then run:
|
||||
|
||||
```bash
|
||||
cd trimsp
|
||||
cp trimspNL resources/bin/trimspNL
|
||||
npm install
|
||||
npm run make
|
||||
```
|
||||
|
||||
This uses Electron Forge to build Linux packages from the current checkout.
|
||||
The packaged application bundles `resources/bin/trimspNL` inside the app
|
||||
resources, so make sure that file exists and is up to date before packaging.
|
||||
|
||||
The generated files are written under:
|
||||
|
||||
|
||||
@@ -73,6 +73,25 @@ function fileExists(filename) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getTrimBinaryPath(configuredPath) {
|
||||
const candidates = [];
|
||||
if (configuredPath) {
|
||||
candidates.push(path.join(configuredPath, "trimspNL"));
|
||||
}
|
||||
if (process.resourcesPath) {
|
||||
candidates.push(path.join(process.resourcesPath, "bin", "trimspNL"));
|
||||
candidates.push(path.join(process.resourcesPath, "trimspNL"));
|
||||
}
|
||||
candidates.push(path.join(process.cwd(), "trimspNL"));
|
||||
|
||||
for (const candidate of candidates) {
|
||||
if (fileExists(candidate)) {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return "trimspNL";
|
||||
}
|
||||
|
||||
function setWorkFolder(foldername) {
|
||||
const folder = Array.isArray(foldername) ? foldername[0] : foldername;
|
||||
if (folder) {
|
||||
|
||||
+1
-9
@@ -3607,15 +3607,7 @@ async function startSequence() {
|
||||
let webOrApp = amIWeb();
|
||||
// Only for Node.js
|
||||
if (!webOrApp) {
|
||||
// Check if the trimspNL binary is found
|
||||
if (!fileExists(trimBin)) {
|
||||
// check if it is in rpm
|
||||
trimBin = "/usr/lib/TrimSP/resources/app/trimspNL";
|
||||
if (!fileExists(trimBin)) {
|
||||
// if not found, try in PATH and hope for the best
|
||||
trimBin = "trimspNL";
|
||||
}
|
||||
}
|
||||
trimBin = getTrimBinaryPath(All["trimPath"]);
|
||||
// Check if workPath exists otherwise create it
|
||||
checkDir(All['workPath']); // from TrimSPelec.js, Electron/Node specific
|
||||
} else {
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
"forge": {
|
||||
"packagerConfig": {
|
||||
"icon": "appicons/icons/png/1024x1024.png",
|
||||
"extraResource": [
|
||||
"resources/bin"
|
||||
],
|
||||
"ignore": [
|
||||
"Readme.md",
|
||||
"ToDo.txt",
|
||||
|
||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user