Skip to content

Commit 9eb0458

Browse files
committed
chore(app): bun-tauri dev/build defaults and FEFF packaging assets
1 parent 6bc8ac9 commit 9eb0458

14 files changed

Lines changed: 167 additions & 7 deletions

File tree

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1+
[build]
2+
target-dir = "target"
3+
14
[target.aarch64-apple-darwin]
25
linker = "clang"

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ license = "MIT OR Apache-2.0"
2626
[profile.bench]
2727
debug = true
2828

29+
[profile.dev]
30+
debug = 1
31+
incremental = true
32+
codegen-units = 256
33+
2934

3035
[workspace.dependencies]
3136
easyfft = { version = "0.4.2", features = ["serde"] }

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ xraytsubaki is a Rust-based program that implements the core functionalities of
44

55
Currently the main source code is placed under `./crates/xraytsubaki/`.
66

7+
## Tauri App Dev (Bun Default)
8+
9+
The desktop app lives in `xraytsubaki-app/`.
10+
11+
Recommended dev flow:
12+
13+
```bash
14+
cd xraytsubaki-app
15+
bun install
16+
bun run tauri:dev
17+
```
18+
19+
Notes:
20+
- The Tauri/Vite dev server uses `http://localhost:1420` with strict port binding.
21+
- If port `1420` is already used, stop the previous dev process before rerunning.
22+
23+
npm fallback (if Bun is unavailable):
24+
25+
```bash
26+
cd xraytsubaki-app
27+
npm install
28+
npm run tauri -- dev
29+
```
30+
731
## Project Genesis and Objectives
832

933
The inception of this project was triggered when I needed to process over 1000 spectra from in-situ measurements. The data loading and processing in xraylarch were too time-consuming, not to mention also for demeter. The goal was to develop a tool capable of processing data within a reasonable timeframe. While this project does not seek to replace xraylarch, it does aim to provide a phenomenally fast core API for xraylarch's backend to augment its capacity.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Third-Party Notices
2+
3+
## FEFF85EXAFS (Feff8L)
4+
5+
xraytsubaki may bundle FEFF module executables built from FEFF85EXAFS for EXAFS path generation.
6+
7+
- Upstream project: https://github.com/xraypy/feff85exafs
8+
- Project organization: https://github.com/xraypy
9+
- Primary maintainers/contributors: Bruce Ravel (`bruceravel`), Matt Newville (`newville`), and xraypy contributors
10+
- Upstream note: "Based on or developed using Distribution: FEFF8.5L Copyright (c) [2013] University of Washington"
11+
12+
License text from FEFF85EXAFS (`LICENSE`):
13+
14+
Copyright (c) 2013 - 2015
15+
All rights reserved.
16+
17+
Redistribution and use in source and binary forms, with or without modification,
18+
are permitted provided that the following conditions are met:
19+
20+
Redistributions of source code must retain the above copyright notice, this
21+
list of conditions and the following disclaimer.
22+
23+
Redistributions in binary form must reproduce the above copyright notice, this
24+
list of conditions and the following disclaimer in the documentation and/or
25+
other materials provided with the distribution.
26+
27+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
28+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
31+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
34+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

xraytsubaki-app/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8+
"dev:tauri": "vite",
89
"build": "tsc -b && vite build",
10+
"build:tauri": "tsc -b && vite build",
911
"preview": "vite preview",
1012
"tauri": "tauri",
13+
"tauri:dev": "tauri dev",
1114
"type-check": "tsc --noEmit",
1215
"lint": "eslint src/",
1316
"lint:fix": "eslint src/ --fix",
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
APP_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
6+
7+
os="$(uname -s | tr '[:upper:]' '[:lower:]')"
8+
case "${os}" in
9+
darwin) os="macos" ;;
10+
mingw*|msys*|cygwin*) os="windows" ;;
11+
esac
12+
13+
arch="$(uname -m)"
14+
case "${arch}" in
15+
arm64) arch="aarch64" ;;
16+
amd64) arch="x86_64" ;;
17+
esac
18+
platform_dir="${os}-${arch}"
19+
20+
resource_dir="${APP_DIR}/src-tauri/resources/feff/${platform_dir}"
21+
mkdir -p "${resource_dir}"
22+
23+
work_dir="$(mktemp -d "${TMPDIR:-/tmp}/feff85exafs.XXXXXX")"
24+
cleanup() {
25+
rm -rf "${work_dir}"
26+
}
27+
trap cleanup EXIT
28+
29+
echo "[bundle-feff] cloning FEFF85EXAFS into ${work_dir}"
30+
git clone --depth 1 https://github.com/xraypy/feff85exafs.git "${work_dir}/src"
31+
32+
pushd "${work_dir}/src" >/dev/null
33+
echo "[bundle-feff] building FEFF85EXAFS (make install)"
34+
make install
35+
popd >/dev/null
36+
37+
bin_dir="${work_dir}/src/local_install/bin"
38+
modules=(
39+
feff8l_rdinp
40+
feff8l_pot
41+
feff8l_xsph
42+
feff8l_pathfinder
43+
feff8l_genfmt
44+
feff8l_ff2x
45+
)
46+
47+
exe_suffix=""
48+
if [[ "${os}" == "windows" ]]; then
49+
exe_suffix=".exe"
50+
fi
51+
52+
for module in "${modules[@]}"; do
53+
src_path="${bin_dir}/${module}${exe_suffix}"
54+
if [[ ! -f "${src_path}" ]]; then
55+
echo "[bundle-feff] missing expected module: ${src_path}" >&2
56+
exit 1
57+
fi
58+
cp -f "${src_path}" "${resource_dir}/${module}${exe_suffix}"
59+
chmod +x "${resource_dir}/${module}${exe_suffix}"
60+
done
61+
62+
echo "[bundle-feff] copied FEFF modules to ${resource_dir}"
63+
echo "[bundle-feff] keep THIRD_PARTY_NOTICES.md with redistributions"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Bundled FEFF Modules
2+
3+
Place FEFF85EXAFS module executables in the platform directory for packaging.
4+
5+
Required module names:
6+
- `feff8l_rdinp`
7+
- `feff8l_pot`
8+
- `feff8l_xsph`
9+
- `feff8l_pathfinder`
10+
- `feff8l_genfmt`
11+
- `feff8l_ff2x`
12+
13+
Windows requires `.exe` suffix for each module.
14+
15+
Platform directories:
16+
- `macos-aarch64/`
17+
- `macos-x86_64/`
18+
- `linux-aarch64/`
19+
- `linux-x86_64/`
20+
- `windows-x86_64/`
21+
22+
Build source and attribution:
23+
- Source: https://github.com/xraypy/feff85exafs
24+
- Keep `THIRD_PARTY_NOTICES.md` included with distributions.

xraytsubaki-app/src-tauri/resources/feff/linux-aarch64/.gitkeep

Whitespace-only changes.

xraytsubaki-app/src-tauri/resources/feff/linux-x86_64/.gitkeep

Whitespace-only changes.

xraytsubaki-app/src-tauri/resources/feff/macos-aarch64/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)