google / heir

A compiler for homomorphic encryption
https://heir.dev/
Apache License 2.0
348 stars 49 forks source link

build: create build macros #1045

Open asraa opened 1 month ago

asraa commented 1 month ago

for cmake:

for bazel:

j2kun commented 1 month ago

@AlexanderViand-Intel maybe you can explain what part of the boilerplate seems confusing? Is it the invocation of gentbl_cc_library? as in https://github.com/google/heir/blob/90796977be9b7da90f5dd8bd8a9fbfc75039cc33/lib/Dialect/Secret/Transforms/BUILD#L156C1-L156C18

AlexanderViand-Intel commented 1 month ago

Less "confusing", just somewhat verbose compared to add_heir_dialect(DialectName) ;)

The "convenience factor" that I like is that the CMake macro automatically generates inc files for ops, types, attributes, enums, etc based on whether the corresponding .td file exits (plus, at least for passes, a few additional rules based on observed use patterns). So there's less changing of build files when you add/remove .td files.

j2kun commented 1 month ago

I think I can do that. Only caveat I can see rn is that the dependencies will have to be specified outside the macro.