test
This commit is contained in:
parent
9745267487
commit
afe9e5c93f
16 changed files with 507 additions and 7 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,4 +1,8 @@
|
|||
.direnv
|
||||
/triangle
|
||||
/triangle.wasm
|
||||
/result*
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
|
|
62
A.1.ele
Normal file
62
A.1.ele
Normal file
|
@ -0,0 +1,62 @@
|
|||
60 3 0
|
||||
1 29 2 1
|
||||
2 43 44 33
|
||||
3 28 55 40
|
||||
4 51 46 47
|
||||
5 25 24 23
|
||||
6 14 38 37
|
||||
7 36 52 28
|
||||
8 22 21 43
|
||||
9 33 23 22
|
||||
10 25 23 33
|
||||
11 26 19 51
|
||||
12 3 2 44
|
||||
13 43 4 3
|
||||
14 33 22 43
|
||||
15 4 21 20
|
||||
16 20 53 4
|
||||
17 26 35 19
|
||||
18 17 45 18
|
||||
19 54 35 26
|
||||
20 50 18 27
|
||||
21 53 20 19
|
||||
22 4 43 21
|
||||
23 48 42 7
|
||||
24 2 29 44
|
||||
25 52 30 34
|
||||
26 38 13 12
|
||||
27 41 11 9
|
||||
28 30 54 34
|
||||
29 28 31 39
|
||||
30 11 10 9
|
||||
31 49 31 27
|
||||
32 7 32 41
|
||||
33 14 37 15
|
||||
34 8 41 9
|
||||
35 8 7 41
|
||||
36 18 49 27
|
||||
37 32 42 37
|
||||
38 55 28 39
|
||||
39 47 26 51
|
||||
40 7 45 48
|
||||
41 28 40 36
|
||||
42 18 45 49
|
||||
43 27 31 28
|
||||
44 15 37 42
|
||||
45 42 16 15
|
||||
46 48 17 16
|
||||
47 16 42 48
|
||||
48 13 38 14
|
||||
49 56 5 40
|
||||
50 40 55 56
|
||||
51 44 43 3
|
||||
52 45 17 48
|
||||
53 32 7 42
|
||||
54 47 50 27
|
||||
55 50 47 46
|
||||
56 30 52 36
|
||||
57 19 35 53
|
||||
58 35 54 30
|
||||
59 6 5 56
|
||||
60 55 6 56
|
||||
# Generated by ./triangle -pq A
|
58
A.1.node
Normal file
58
A.1.node
Normal file
|
@ -0,0 +1,58 @@
|
|||
56 2 1 1
|
||||
1 0.20000000000000001 -0.77639999999999998 -0.56999999999999995 1
|
||||
2 0.22 -0.7732 -0.55000000000000004 1
|
||||
3 0.24560000000000001 -0.75639999999999996 -0.51000000000000001 1
|
||||
4 0.27760000000000001 -0.70199999999999996 -0.53000000000000003 1
|
||||
5 0.48880000000000001 -0.20760000000000001 0.28000000000000003 1
|
||||
6 0.50480000000000003 -0.20760000000000001 0.29999999999999999 1
|
||||
7 0.74080000000000001 -0.73960000000000004 0 1
|
||||
8 0.75600000000000001 -0.76119999999999999 -0.01 1
|
||||
9 0.77439999999999998 -0.77239999999999998 0 1
|
||||
10 0.80000000000000004 -0.77639999999999998 0.02 1
|
||||
11 0.80000000000000004 -0.79239999999999999 0.01 1
|
||||
12 0.57920000000000005 -0.79239999999999999 -0.20999999999999999 1
|
||||
13 0.57920000000000005 -0.77639999999999998 -0.20000000000000001 1
|
||||
14 0.62160000000000004 -0.77159999999999995 -0.14999999999999999 1
|
||||
15 0.63360000000000005 -0.76280000000000003 -0.13 1
|
||||
16 0.63919999999999999 -0.74439999999999995 -0.10000000000000001 1
|
||||
17 0.62080000000000002 -0.68440000000000001 -0.059999999999999998 1
|
||||
18 0.58720000000000006 -0.60440000000000005 -0.01 1
|
||||
19 0.36080000000000001 -0.60440000000000005 -0.23999999999999999 1
|
||||
20 0.31919999999999998 -0.70679999999999998 -0.39000000000000001 1
|
||||
21 0.312 -0.73960000000000004 -0.42999999999999999 1
|
||||
22 0.31840000000000002 -0.76119999999999999 -0.44 1
|
||||
23 0.33439999999999998 -0.77159999999999995 -0.44 1
|
||||
24 0.37119999999999997 -0.77639999999999998 -0.40999999999999998 1
|
||||
25 0.37119999999999997 -0.79239999999999999 -0.41999999999999998 1
|
||||
26 0.37440000000000001 -0.56999999999999995 -0.20000000000000001 1
|
||||
27 0.57440000000000002 -0.56999999999999995 0 1
|
||||
28 0.47360000000000002 -0.33079999999999998 0.14000000000000001 1
|
||||
29 0.20000000000000001 -0.79239999999999999 -0.58999999999999997 1
|
||||
30 0.38319999999999999 -0.45479999999999998 -0.125 1
|
||||
31 0.62280000000000002 -0.47360000000000002 0.14999999999999999 1
|
||||
32 0.68959999999999999 -0.79239999999999999 -0.10000000000000001 1
|
||||
33 0.28559999999999997 -0.79239999999999999 -0.505 1
|
||||
34 0.42400000000000004 -0.45039999999999997 -0.029999999999999999 1
|
||||
35 0.33039999999999997 -0.57840000000000003 -0.32750000000000001 1
|
||||
36 0.436 -0.33119999999999999 0.077500000000000013 1
|
||||
37 0.63440000000000007 -0.79239999999999999 -0.155 1
|
||||
38 0.60680000000000001 -0.79239999999999999 -0.1825 1
|
||||
39 0.56380000000000008 -0.34060000000000001 0.22499999999999998 1
|
||||
40 0.46240000000000003 -0.26939999999999997 0.17875000000000002 1
|
||||
41 0.74480000000000002 -0.79239999999999999 -0.044999999999999998 1
|
||||
42 0.66903563402889255 -0.76353258426966275 -0.088266748941717585 0
|
||||
43 0.28531162790697684 -0.7592558139534884 -0.47819374108854901 0
|
||||
44 0.24279999999999999 -0.79239999999999999 -0.54749999999999999 1
|
||||
45 0.68179999999999996 -0.60660000000000003 0.074999999999999997 1
|
||||
46 0.47400000000000003 -0.60440000000000005 -0.12499999999999999 1
|
||||
47 0.47440000000000004 -0.56999999999999995 -0.10000000000000001 1
|
||||
48 0.68806438636232714 -0.7010295113359224 -0.016659253710389593 0
|
||||
49 0.65229999999999999 -0.54010000000000002 0.11249999999999999 1
|
||||
50 0.53060000000000007 -0.60440000000000005 -0.067499999999999991 1
|
||||
51 0.41739999999999999 -0.60440000000000005 -0.1825 1
|
||||
52 0.44880000000000003 -0.39059999999999995 0.055000000000000007 1
|
||||
53 0.30399999999999999 -0.64019999999999999 -0.42875000000000002 1
|
||||
54 0.3992 -0.51019999999999999 -0.115 1
|
||||
55 0.5343 -0.27410000000000001 0.26249999999999996 1
|
||||
56 0.49680000000000002 -0.24755631067961165 0.24587349184654531 0
|
||||
# Generated by ./triangle -pq A
|
57
A.1.poly
Normal file
57
A.1.poly
Normal file
|
@ -0,0 +1,57 @@
|
|||
0 2 1 1
|
||||
52 1
|
||||
1 29 1 1
|
||||
2 2 1 1
|
||||
3 2 3 1
|
||||
4 4 3 1
|
||||
5 4 53 1
|
||||
6 5 6 1
|
||||
7 55 6 1
|
||||
8 8 7 1
|
||||
9 9 8 1
|
||||
10 10 9 1
|
||||
11 10 11 1
|
||||
12 11 41 1
|
||||
13 13 12 1
|
||||
14 13 14 1
|
||||
15 15 14 1
|
||||
16 15 16 1
|
||||
17 17 16 1
|
||||
18 18 17 1
|
||||
19 50 18 1
|
||||
20 19 20 1
|
||||
21 20 21 1
|
||||
22 22 21 1
|
||||
23 22 23 1
|
||||
24 24 23 1
|
||||
25 25 24 1
|
||||
26 25 33 1
|
||||
27 26 47 1
|
||||
28 27 28 1
|
||||
29 28 52 1
|
||||
30 30 36 1
|
||||
31 31 49 1
|
||||
32 32 37 1
|
||||
33 33 44 1
|
||||
34 34 54 1
|
||||
35 35 30 1
|
||||
36 36 40 1
|
||||
37 37 38 1
|
||||
38 38 12 1
|
||||
39 39 31 1
|
||||
40 41 32 1
|
||||
41 44 29 1
|
||||
42 45 7 1
|
||||
43 46 51 1
|
||||
44 47 27 1
|
||||
45 50 46 1
|
||||
46 51 19 1
|
||||
47 52 34 1
|
||||
48 53 35 1
|
||||
49 54 26 1
|
||||
50 40 5 1
|
||||
51 55 39 1
|
||||
52 49 45 1
|
||||
1
|
||||
1 0.46999999999999997 -0.5
|
||||
# Generated by ./triangle -pq A
|
223
Cargo.lock
generated
Normal file
223
Cargo.lock
generated
Normal file
|
@ -0,0 +1,223 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"anstyle-parse",
|
||||
"anstyle-query",
|
||||
"anstyle-wincon",
|
||||
"colorchoice",
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-parse"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
|
||||
dependencies = [
|
||||
"utf8parse",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-query"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
|
||||
dependencies = [
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstyle-wincon"
|
||||
version = "3.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
|
||||
dependencies = [
|
||||
"anstyle",
|
||||
"windows-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
"clap_lex",
|
||||
"strsim",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_derive"
|
||||
version = "4.4.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap_lex"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
|
||||
|
||||
[[package]]
|
||||
name = "colorchoice"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.69"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
||||
dependencies = [
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "triangle"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"clap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-ident"
|
||||
version = "1.0.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
||||
|
||||
[[package]]
|
||||
name = "utf8parse"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.48.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm",
|
||||
"windows_aarch64_msvc",
|
||||
"windows_i686_gnu",
|
||||
"windows_i686_msvc",
|
||||
"windows_x86_64_gnu",
|
||||
"windows_x86_64_gnullvm",
|
||||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
9
Cargo.toml
Normal file
9
Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
|||
[package]
|
||||
name = "triangle"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.4.7", features = ["derive"] }
|
3
makefile
3
makefile
|
@ -73,7 +73,8 @@ CC = cc
|
|||
#
|
||||
# CSWITCHES = -O -DNO_TIMER -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib
|
||||
|
||||
CSWITCHES = -O -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib
|
||||
# CSWITCHES = -O -DLINUX -I/usr/X11R6/include -L/usr/X11R6/lib
|
||||
CSWITCHES = -O -I/usr/X11R6/include -L/usr/X11R6/lib
|
||||
|
||||
# TRILIBDEFS is a list of definitions used to compile an object code version
|
||||
# of Triangle (triangle.o) to be called by another program. The file
|
||||
|
|
3
src/behavior.rs
Normal file
3
src/behavior.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
pub struct Behavior {
|
||||
poly: bool,
|
||||
}
|
22
src/data.rs
Normal file
22
src/data.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
pub enum LocateResult {
|
||||
InTriangle,
|
||||
OnEdge,
|
||||
OnVertex,
|
||||
Outside,
|
||||
}
|
||||
|
||||
pub enum InsertVertexResult {
|
||||
SuccessfulVertex,
|
||||
EncroachingVertex,
|
||||
ViolatingVertex,
|
||||
DuplicateVertex,
|
||||
}
|
||||
|
||||
pub enum FindDirectionResult {
|
||||
Within,
|
||||
LeftCollinear,
|
||||
RightCollinear,
|
||||
}
|
||||
|
||||
pub type FLOAT = f32;
|
||||
pub type Vertex = Vec<FLOAT>;
|
30
src/lib.rs
Normal file
30
src/lib.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
pub mod behavior;
|
||||
pub mod data;
|
||||
pub mod mesh;
|
||||
pub mod primitives;
|
||||
pub mod triangle;
|
||||
pub mod triangulate;
|
||||
|
||||
use crate::{behavior::Behavior, mesh::Mesh};
|
||||
|
||||
pub struct State {
|
||||
mesh: Mesh,
|
||||
behavior: Behavior,
|
||||
}
|
||||
|
||||
impl State {
|
||||
// From triangle.c:12658
|
||||
pub fn plague(&self) {}
|
||||
|
||||
/// Split all the encroached subsegments.
|
||||
/// (from triangle.c:13236)
|
||||
///
|
||||
/// Each encroached subsegment is repaired by splitting it - inserting a
|
||||
/// vertex at or near its midpoint. Newly inserted vertices may encroach
|
||||
/// upon other subsegments; these are also repaired.
|
||||
///
|
||||
/// `triflaws' is a flag that specifies whether one should take note of new
|
||||
/// bad triangles that result from inserting vertices to repair encroached
|
||||
/// subsegments.
|
||||
pub fn split_encroached_subsegments(&self, tri_flaws: bool) {}
|
||||
}
|
1
src/mesh.rs
Normal file
1
src/mesh.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub struct Mesh {}
|
6
src/primitives.rs
Normal file
6
src/primitives.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* Geometric primitives */
|
||||
|
||||
// pub fn fast_two_sum_tail(a, b, x, y) {
|
||||
// let b_virt = x - a;
|
||||
// let y = b - b_virt;
|
||||
// }
|
1
src/triangle.rs
Normal file
1
src/triangle.rs
Normal file
|
@ -0,0 +1 @@
|
|||
pub fn tri_unsuitable() {}
|
11
src/triangulate.rs
Normal file
11
src/triangulate.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
use crate::{data::FLOAT, State};
|
||||
|
||||
pub struct TriangulateIO {
|
||||
pub point_list: Vec<FLOAT>,
|
||||
pub point_attribute_list: Vec<FLOAT>,
|
||||
}
|
||||
|
||||
impl State {
|
||||
// From triangle.c:15669
|
||||
pub fn triangulate(&self) {}
|
||||
}
|
BIN
triangle
Executable file
BIN
triangle
Executable file
Binary file not shown.
22
wasm.nix
22
wasm.nix
|
@ -1,18 +1,30 @@
|
|||
{ buildEmscriptenPackage }:
|
||||
{ stdenv, clang, wasilibc }:
|
||||
|
||||
buildEmscriptenPackage {
|
||||
stdenv.mkDerivation {
|
||||
name = "triangle";
|
||||
src = ./.;
|
||||
|
||||
nativeBuildInputs = [ clang wasilibc ];
|
||||
|
||||
|
||||
configurePhase = "";
|
||||
buildPhase = ''
|
||||
export EM_CACHE=/tmp/em-cache
|
||||
emcc -o triangle triangle.c
|
||||
clang \
|
||||
--target=wasm32-unknown-wasi \
|
||||
-O3 \
|
||||
-flto \
|
||||
-nostdlib \
|
||||
-Wl,--no-entry \
|
||||
-Wl,--export-all \
|
||||
-Wl,--lto-O3 \
|
||||
-o triangle.wasm \
|
||||
triangle.c
|
||||
'';
|
||||
|
||||
checkPhase = "";
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
ls -al
|
||||
mv triangle triangle.wasm $out
|
||||
mv triangle.js triangle.wasm $out
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue