Skip to content

Commit

Permalink
Switch build to bazel
Browse files Browse the repository at this point in the history
  • Loading branch information
dsharlet committed Jan 18, 2024
1 parent ec15819 commit 88880a6
Show file tree
Hide file tree
Showing 45 changed files with 303 additions and 347 deletions.
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
common --enable_bzlmod
build --action_env=BAZEL_CXXOPTS="-std=c++20:-fstrict-aliasing:-Wall"
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
gcc: '11'

- name: Build and test
run: make test -j8
run: bazel test -c opt ...

- name: Build and run performance app
run: make bin/performance && bin/performance
run: bazel run -c opt apps/performance
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Output directories
bin/*
obj/*
docs/*
bazel-*

*.lock

# Compiled Object files
*.slo
Expand All @@ -18,9 +18,6 @@ docs/*
*.dylib
*.dll

# Fortran module files
*.mod

# Compiled Static libraries
*.lai
*.la
Expand Down
Empty file added BUILD
Empty file.
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bazel_dep(name = "googletest", version = "1.14.0")
45 changes: 0 additions & 45 deletions Makefile

This file was deleted.

10 changes: 10 additions & 0 deletions apps/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cc_binary(
name = "memcpy",
srcs = ["memcpy.cc", "benchmark.h"],
)

cc_binary(
name = "performance",
srcs = ["performance.cc", "benchmark.h"],
deps = ["//src:slinky"],
)
2 changes: 1 addition & 1 deletion apps/memcpy.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "benchmark.h"
#include "apps/benchmark.h"

#include <cassert>
#include <chrono>
Expand Down
4 changes: 2 additions & 2 deletions apps/performance.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "benchmark.h"
#include "pipeline.h"
#include "apps/benchmark.h"
#include "src/pipeline.h"

#include <cassert>
#include <cstdlib>
Expand Down
43 changes: 43 additions & 0 deletions src/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

cc_library(
name = "runtime",
srcs = [
"buffer.cc",
],
hdrs = [
"arithmetic.h",
"buffer.h",
],
visibility = ["//visibility:public"],
)

cc_library(
name = "slinky",
srcs = [
"evaluate.cc",
"expr.cc",
"infer_bounds.cc",
"node_mutator.cc",
"optimizations.cc",
"pipeline.cc",
"print.cc",
"simplify.cc",
"substitute.cc",
],
hdrs = [
"arithmetic.h",
"evaluate.h",
"expr.h",
"infer_bounds.h",
"node_mutator.h",
"optimizations.h",
"pipeline.h",
"print.h",
"ref_count.h",
"simplify.h",
"substitute.h",
"symbol_map.h",
],
deps = [":runtime"],
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions src/arithmetic.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define SLINKY_EUCLIDEAN_DIVISION_H

#include <cmath>
#include <limits>

namespace slinky {

Expand Down
2 changes: 1 addition & 1 deletion src/buffer.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "buffer.h"
#include "src/buffer.h"

#include <cstdint>

Expand Down
3 changes: 1 addition & 2 deletions src/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include <memory>
#include <span>

#include "arithmetic.h"
#include "ref_count.h"
#include "src/arithmetic.h"

namespace slinky {

Expand Down
8 changes: 4 additions & 4 deletions src/evaluate.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include "evaluate.h"
#include "src/evaluate.h"

#include <cassert>
#include <iostream>

#include "print.h"
#include "simplify.h"
#include "substitute.h"
#include "src/print.h"
#include "src/simplify.h"
#include "src/substitute.h"

namespace slinky {

Expand Down
4 changes: 2 additions & 2 deletions src/evaluate.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef SLINKY_EVALUATE_H
#define SLINKY_EVALUATE_H

#include "expr.h"
#include "symbol_map.h"
#include "src/expr.h"
#include "src/symbol_map.h"

namespace slinky {

Expand Down
4 changes: 2 additions & 2 deletions src/expr.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "expr.h"
#include "src/expr.h"

#include "simplify.h"
#include "src/simplify.h"

#include <limits>

Expand Down
4 changes: 2 additions & 2 deletions src/expr.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef SLINKY_EXPR_H
#define SLINKY_EXPR_H

#include "buffer.h"
#include "ref_count.h"
#include "src/buffer.h"
#include "src/ref_count.h"

#include <cstdlib>
#include <functional>
Expand Down
12 changes: 6 additions & 6 deletions src/infer_bounds.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "infer_bounds.h"
#include "src/infer_bounds.h"

#include <cassert>
#include <iostream>

#include "node_mutator.h"
#include "optimizations.h"
#include "print.h"
#include "simplify.h"
#include "substitute.h"
#include "src/node_mutator.h"
#include "src/optimizations.h"
#include "src/print.h"
#include "src/simplify.h"
#include "src/substitute.h"

namespace slinky {

Expand Down
2 changes: 1 addition & 1 deletion src/infer_bounds.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SLINKY_INFER_BOUNDS_H
#define SLINKY_INFER_BOUNDS_H

#include "symbol_map.h"
#include "src/symbol_map.h"

namespace slinky {

Expand Down
2 changes: 1 addition & 1 deletion src/node_mutator.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "node_mutator.h"
#include "src/node_mutator.h"

namespace slinky {

Expand Down
2 changes: 1 addition & 1 deletion src/node_mutator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SLINKY_NODE_MUTATOR_H
#define SLINKY_NODE_MUTATOR_H

#include "expr.h"
#include "src/expr.h"

namespace slinky {

Expand Down
12 changes: 6 additions & 6 deletions src/optimizations.cc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "optimizations.h"
#include "src/optimizations.h"

#include <cassert>
#include <map>
#include <set>

#include "evaluate.h"
#include "node_mutator.h"
#include "print.h"
#include "simplify.h"
#include "substitute.h"
#include "src/evaluate.h"
#include "src/node_mutator.h"
#include "src/print.h"
#include "src/simplify.h"
#include "src/substitute.h"

namespace slinky {

Expand Down
2 changes: 1 addition & 1 deletion src/optimizations.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SLINKY_OPTIMIZATIONS_H
#define SLINKY_OPTIMIZATIONS_H

#include "expr.h"
#include "src/expr.h"

namespace slinky {

Expand Down
16 changes: 8 additions & 8 deletions src/pipeline.cc
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#include "pipeline.h"
#include "src/pipeline.h"

#include <cassert>
#include <iostream>
#include <list>
#include <map>
#include <set>

#include "evaluate.h"
#include "infer_bounds.h"
#include "node_mutator.h"
#include "optimizations.h"
#include "print.h"
#include "simplify.h"
#include "substitute.h"
#include "src/evaluate.h"
#include "src/infer_bounds.h"
#include "src/node_mutator.h"
#include "src/optimizations.h"
#include "src/print.h"
#include "src/simplify.h"
#include "src/substitute.h"

namespace slinky {

Expand Down
6 changes: 3 additions & 3 deletions src/pipeline.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef SLINKY_PIPELINE_H
#define SLINKY_PIPELINE_H

#include "evaluate.h"
#include "expr.h"
#include "ref_count.h"
#include "src/evaluate.h"
#include "src/expr.h"
#include "src/ref_count.h"

namespace slinky {

Expand Down
2 changes: 1 addition & 1 deletion src/print.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "print.h"
#include "src/print.h"

#include <cassert>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion src/print.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef SLINKY_PRINT_H
#define SLINKY_PRINT_H

#include "expr.h"
#include "src/expr.h"

#include <tuple>

Expand Down
10 changes: 5 additions & 5 deletions src/simplify.cc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include "simplify.h"
#include "src/simplify.h"

#include <cassert>
#include <iostream>
#include <limits>

#include "evaluate.h"
#include "node_mutator.h"
#include "print.h"
#include "substitute.h"
#include "src/evaluate.h"
#include "src/node_mutator.h"
#include "src/print.h"
#include "src/substitute.h"

namespace slinky {

Expand Down
4 changes: 2 additions & 2 deletions src/simplify.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef SLINKY_SIMPLIFY_H
#define SLINKY_SIMPLIFY_H

#include "expr.h"
#include "symbol_map.h"
#include "src/expr.h"
#include "src/symbol_map.h"

namespace slinky {

Expand Down
6 changes: 3 additions & 3 deletions src/substitute.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "substitute.h"
#include "src/substitute.h"

#include <cassert>

#include "node_mutator.h"
#include "symbol_map.h"
#include "src/node_mutator.h"
#include "src/symbol_map.h"

namespace slinky {

Expand Down
Loading

0 comments on commit 88880a6

Please sign in to comment.