-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github actions to build the example project (#37)
Summary: Pull Request resolved: #37 Test Plan: github Differential Revision: D53061782 Pulled By: shayne-fletcher fbshipit-source-id: 0bdaca9d00fd7761d15363c04be81319b9fccccc
- Loading branch information
1 parent
2e3b3c7
commit d943e14
Showing
7 changed files
with
53 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,18 @@ | ||
[repositories] | ||
root = . | ||
prelude = prelude | ||
toolchains = toolchains | ||
none = none | ||
|
||
[repository_aliases] | ||
config = prelude | ||
fbcode = none | ||
fbsource = none | ||
buck = none | ||
|
||
[parser] | ||
target_platform_detector_spec = target:root//...->prelude//platforms:default | ||
|
||
[rust] | ||
default_edition = 2018 | ||
remap_src_paths = yes | ||
rustc_check_flags = --cap-lints=warn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,7 @@ | ||
buildscript = [] | ||
[[buildscript]] | ||
|
||
[[platform_fixup.'cfg(target_arch = "x86_64")'.buildscript]] | ||
[platform_fixup.'cfg(target_arch = "x86_64")'.buildscript.cxx_library] | ||
[buildscript.cxx_library] | ||
name = "blake3_avx512" | ||
srcs = ["c/blake3_avx512.c"] | ||
compiler_flags = ["-mavx512f", "-mavx512vl"] | ||
headers = ["c/*.h"] | ||
|
||
[[platform_fixup.'cfg(target_arch = "arm")'.buildscript]] | ||
[platform_fixup.'cfg(target_arch = "arm")'.buildscript.cxx_library] | ||
name = "blake3_neon-armv7" | ||
srcs = ["c/blake3_neon.c"] | ||
compiler_flags = ["-mfpu=neon-vfpv4", "-mfloat-abi=hard"] | ||
headers = ["c/*.h"] | ||
|
||
[[platform_fixup.'cfg(target_arch = "aarch64")'.buildscript]] | ||
[platform_fixup.'cfg(target_arch = "aarch64")'.buildscript.cxx_library] | ||
name = "blake3_neon-aarch64" | ||
srcs = ["c/blake3_neon.c"] | ||
headers = ["c/*.h"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,7 @@ | ||
# @nolint | ||
|
||
load(":iterable.bzl", "iterable") | ||
load(":new_sets.bzl", "sets") | ||
load(":type_defs.bzl", "is_dict") | ||
|
||
# Get current target platform - hard-coded for example, matches one of the platforms | ||
# defined in reindeer.toml. | ||
def _get_plat(): | ||
return "linux-x86_64" | ||
|
||
def extend(orig, new): | ||
if orig == None: | ||
ret = new | ||
elif new == None: | ||
ret = orig | ||
elif is_dict(orig): | ||
ret = orig.copy() | ||
ret.update(new) | ||
else: # list | ||
ret = orig + new | ||
return ret | ||
|
||
# Add platform-specific args to args for a given platform. This assumes there's some static configuration | ||
# for target platform (_get_plat) which isn't very flexible. A better approach would be to construct | ||
# srcs/deps/etc with `select` to conditionally configure each target, but that's out of scope for this. | ||
def platform_attrs(platformname, platformattrs, attrs): | ||
for attr in sets.to_list(sets.make(iterable.concat(attrs.keys(), platformattrs.get(platformname, {}).keys()))): | ||
new = extend(attrs.get(attr), platformattrs.get(platformname, {}).get(attr)) | ||
attrs[attr] = new | ||
return attrs | ||
|
||
def third_party_rust_library(name, platform = {}, dlopen_enable = False, python_ext = None, **kwargs): | ||
# This works around a bug in Buck, which complains if srcs is missing - but that can happen if all | ||
# the sources are mapped_srcs | ||
if "srcs" not in kwargs: | ||
kwargs["srcs"] = [] | ||
|
||
# Rust crates which are python extensions need special handling to make sure they get linked | ||
# properly. This is not enough on its own - it still assumes there's a dependency on the python | ||
# library. | ||
if dlopen_enable or python_ext: | ||
# This is all pretty ELF/Linux-specific | ||
linker_flags = ["-shared"] | ||
if python_ext: | ||
linker_flags.append("-uPyInit_{}".format(python_ext)) | ||
kwargs["preferred_linkage"] = "static" | ||
cxx_binary(name = name + "-so", link_style = "static_pic", linker_flags = linker_flags, deps = [":" + name]) | ||
|
||
kwargs = platform_attrs(_get_plat(), platform, kwargs) | ||
|
||
rustc_flags = kwargs.get("rustc_flags", []) | ||
kwargs["rustc_flags"] = ["--cap-lints=allow"] + rustc_flags | ||
|
||
rust_library(name, **kwargs) | ||
|
||
# `platform` is a map from a platform (defined in reindeer.toml) to the attributes | ||
# specific to that platform. | ||
def third_party_rust_binary(name, platform = {}, **kwargs): | ||
# This works around a bug in Buck, which complains if srcs is missing - but that can happen if all | ||
# the sources are mapped_srcs | ||
if "srcs" not in kwargs: | ||
kwargs["srcs"] = [] | ||
|
||
kwargs = platform_attrs(_get_plat(), platform, kwargs) | ||
|
||
rustc_flags = kwargs.get("rustc_flags", []) | ||
kwargs["rustc_flags"] = ["--cap-lints=allow"] + rustc_flags | ||
|
||
rust_binary(name, **kwargs) | ||
|
||
def third_party_rust_cxx_library(name, **kwargs): | ||
cxx_library(name, **kwargs) | ||
native.cxx_library(name = name, **kwargs) | ||
|
||
def third_party_rust_prebuilt_cxx_library(name, **kwargs): | ||
prebuilt_cxx_library(name, **kwargs) | ||
native.prebuilt_cxx_library(name = name, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
load("@prelude//toolchains:demo.bzl", "system_demo_toolchains") | ||
system_demo_toolchains() |