Skip to content

Commit 3e1911a

Browse files
authored
examples: enable gn and libjpeg_turbo on windows (#1522)
gn: - gn's own build system emits gn_lib.a on all platforms, so make out_static_libs unconditional instead of expecting gn_lib.lib - the postfix_script needs to mkdir the install dirs and copy both the lib and the binary - set targets to gn.exe so ninja builds the right default on Windows - quote $GN in the test script libjpeg_turbo: - the actual DLL names on Windows are jpeg62.dll and turbojpeg.dll, not libjpeg.dll and libturbojpeg.dll
1 parent a1e6010 commit 3e1911a

3 files changed

Lines changed: 10 additions & 13 deletions

File tree

examples/third_party/gn/BUILD.gn.bazel

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,19 @@ ninja(
2727
}),
2828
# gn has no install step, manually grab the artifacts
2929
postfix_script = select({
30-
"@platforms//os:windows": " && ".join([
31-
"cp -a out/gn_lib.lib $$INSTALLDIR/lib",
32-
"cp -a out/gn.exe $$INSTALLDIR/bin",
30+
"@platforms//os:windows": "\n".join([
31+
"mkdir -p \"$$INSTALLDIR/lib\" \"$$INSTALLDIR/bin\"",
32+
"cp -p ./out/gn_lib.lib \"$$INSTALLDIR/lib/gn_lib.lib\"",
33+
"cp -p ./out/gn.exe \"$$INSTALLDIR/bin/gn.exe\"",
3334
]),
3435
"//conditions:default": " && ".join([
3536
"cp -a out/gn_lib.a $$INSTALLDIR/lib",
3637
"cp -a out/gn $$INSTALLDIR/bin",
3738
]),
3839
}),
39-
target_compatible_with = select({
40-
"@platforms//os:windows": ["@rules_foreign_cc_examples_third_party//:broken"],
41-
"//conditions:default": [],
40+
targets = select({
41+
"@platforms//os:windows": ["gn.exe"],
42+
"//conditions:default": [""],
4243
}),
4344
)
4445

examples/third_party/gn/gn_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ if [[ ! -e "$GN" ]]; then
55
exit 1
66
fi
77

8-
exec $GN --help
8+
exec "$GN" --help

examples/third_party/libjpeg_turbo/BUILD.libjpeg_turbo.bazel

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@ cmake(
2222
"libturbojpeg.dylib",
2323
],
2424
"@platforms//os:windows": [
25-
"libjpeg.dll",
26-
"libturbojpeg.dll",
25+
"jpeg62.dll",
26+
"turbojpeg.dll",
2727
],
2828
}),
29-
target_compatible_with = select({
30-
"@platforms//os:windows": ["@rules_foreign_cc_examples_third_party//:broken"],
31-
"//conditions:default": [],
32-
}),
3329
visibility = ["//visibility:public"],
3430
)

0 commit comments

Comments
 (0)