diff --git a/.gitignore b/.gitignore index fbf6a2efe..7b222ff49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ __pycache__ /target +/nac3standalone/demo/linalg/target nix/windows/msys2 diff --git a/Cargo.lock b/Cargo.lock index ecd098005..749880ba7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -73,15 +73,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - [[package]] name = "ascii-canvas" version = "3.0.0" @@ -256,12 +247,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" -[[package]] -name = "cslice" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8cb7306107e4b10e64994de6d3274bd08996a7c1322a27b86482392f96be0a" - [[package]] name = "dirs-next" version = "2.0.0" @@ -536,12 +521,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - [[package]] name = "libredox" version = "0.1.3" @@ -552,14 +531,6 @@ dependencies = [ "libc", ] -[[package]] -name = "linalg" -version = "0.1.0" -dependencies = [ - "cslice", - "nalgebra", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -688,70 +659,17 @@ version = "0.1.0" dependencies = [ "clap", "inkwell", - "linalg", "nac3core", "nac3parser", "parking_lot", ] -[[package]] -name = "nalgebra" -version = "0.32.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4" -dependencies = [ - "approx", - "num-complex", - "num-rational", - "num-traits", - "simba", - "typenum", -] - [[package]] name = "new_debug_unreachable" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" -[[package]] -name = "num-complex" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - [[package]] name = "once_cell" version = "1.19.0" @@ -781,12 +699,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - [[package]] name = "petgraph" version = "0.6.5" @@ -1158,18 +1070,6 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "simba" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" -dependencies = [ - "approx", - "num-complex", - "num-traits", - "paste", -] - [[package]] name = "similar" version = "2.6.0" @@ -1330,12 +1230,6 @@ dependencies = [ "crunchy", ] -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - [[package]] name = "unic-char-property" version = "0.9.0" diff --git a/nac3standalone/Cargo.toml b/nac3standalone/Cargo.toml index a639c120e..a55a26b94 100644 --- a/nac3standalone/Cargo.toml +++ b/nac3standalone/Cargo.toml @@ -8,7 +8,6 @@ edition = "2021" parking_lot = "0.12" nac3parser = { path = "../nac3parser" } nac3core = { path = "../nac3core" } -linalg = { path = "./demo/linalg" } [dependencies.clap] version = "4.5" diff --git a/nac3standalone/demo/linalg/Cargo.lock b/nac3standalone/demo/linalg/Cargo.lock new file mode 100644 index 000000000..a3385eace --- /dev/null +++ b/nac3standalone/demo/linalg/Cargo.lock @@ -0,0 +1,114 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "approx" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" +dependencies = [ + "num-traits", +] + +[[package]] +name = "autocfg" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" + +[[package]] +name = "cslice" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f8cb7306107e4b10e64994de6d3274bd08996a7c1322a27b86482392f96be0a" + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "linalg" +version = "0.1.0" +dependencies = [ + "cslice", + "nalgebra", +] + +[[package]] +name = "nalgebra" +version = "0.32.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5c17de023a86f59ed79891b2e5d5a94c705dbe904a5b5c9c952ea6221b03e4" +dependencies = [ + "approx", + "num-complex", + "num-rational", + "num-traits", + "simba", + "typenum", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "simba" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", +] + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" diff --git a/nac3standalone/demo/linalg/Cargo.toml b/nac3standalone/demo/linalg/Cargo.toml index 69d15bdb9..923faae52 100644 --- a/nac3standalone/demo/linalg/Cargo.toml +++ b/nac3standalone/demo/linalg/Cargo.toml @@ -9,3 +9,5 @@ crate-type = ["staticlib"] [dependencies] nalgebra = {version = "0.32.6", default-features = false, features = ["libm", "alloc"]} cslice = "0.3.0" + +[workspace] diff --git a/nac3standalone/demo/run_demo.sh b/nac3standalone/demo/run_demo.sh index 6654e61cb..a71c22e48 100755 --- a/nac3standalone/demo/run_demo.sh +++ b/nac3standalone/demo/run_demo.sh @@ -42,14 +42,11 @@ done if [ -n "$debug" ] && [ -e ../../target/debug/nac3standalone ]; then nac3standalone=../../target/debug/nac3standalone - linalg=../../target/debug/deps/liblinalg-?*.a elif [ -e ../../target/release/nac3standalone ]; then nac3standalone=../../target/release/nac3standalone - linalg=../../target/release/deps/liblinalg-?*.a else # used by Nix builds nac3standalone=../../target/x86_64-unknown-linux-gnu/release/nac3standalone - linalg=../../target/x86_64-unknown-linux-gnu/release/deps/liblinalg-?*.a fi rm -f ./*.o ./*.bc demo @@ -57,19 +54,17 @@ rm -f ./*.o ./*.bc demo if [ -z "$i386" ]; then $nac3standalone "${nac3args[@]}" + cd linalg && cargo build --release --target x86_64-unknown-linux-gnu -q && cd .. clang -c -std=gnu11 -Wall -Wextra -O3 -o demo.o demo.c - clang -lm -Wl,--no-warn-search-mismatch -o demo module.o demo.o $linalg + clang -lm -Wl,--no-warn-search-mismatch -o demo module.o demo.o linalg/target/x86_64-unknown-linux-gnu/release/liblinalg.a else # Enable SSE2 to avoid rounding errors with X87's 80-bit fp precision computations $nac3standalone --triple i386-pc-linux-gnu --target-features +sse2 "${nac3args[@]}" - # Compile linalg crate to provide functions compatible with i386 architecture - cd linalg && nix-shell -p rustup --command "RUSTFLAGS=\"-C target-cpu=i386 -C target-feature=+sse2\" cargo build -q --release --target=i686-unknown-linux-gnu" && cd .. - - linalg=../../target/i686-unknown-linux-gnu/release/liblinalg.a - clang -m32 -c -std=gnu11 -Wall -Wextra -O3 -msse2 -o demo.o demo.c - clang -m32 -lm -Wl,--no-warn-search-mismatch -o demo module.o demo.o $linalg + cd linalg && cargo build --release --target i686-unknown-linux-gnu -q && cd .. + clang -m32 -c -std=gnu11 -Wall -Wextra -O3 -msse2 -o demo.o demo.c + clang -m32 -lm -Wl,--no-warn-search-mismatch -o demo module.o demo.o linalg/target/i686-unknown-linux-gnu/release/liblinalg.a fi if [ -z "$outfile" ]; then