From 8f691674ae2cc6cca55ba886f1504ca3c0581ffd Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Tue, 21 Mar 2017 10:43:28 -0400 Subject: [PATCH] first compiled example using bazel --- .gitignore | 2 ++ examples/WORKSPACE | 44 ++++++++++++++++++++++++++++++++++++++++++++ examples/cpp/BUILD | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 examples/WORKSPACE create mode 100644 examples/cpp/BUILD diff --git a/.gitignore b/.gitignore index c8769df870..5663f9e624 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,5 @@ examples/csharp/solution/*.csproj examples/csharp/*.sln src/bazel-* +examples/bazel-* + diff --git a/examples/WORKSPACE b/examples/WORKSPACE new file mode 100644 index 0000000000..28241c41c2 --- /dev/null +++ b/examples/WORKSPACE @@ -0,0 +1,44 @@ +local_repository( + name = "or_tools_libraries", + path = "../src", +) + +git_repository( + name = "com_github_gflags_gflags", + commit = "f8a0efe03aa69b3336d8e228b37d4ccb17324b88", + remote = "https://github.com/gflags/gflags.git", +) + +bind( + name = "gflags", + actual = "@com_github_gflags_gflags//:gflags", +) + +bind( + name = "gflags_nothreads", + actual = "@com_github_gflags_gflags//:gflags_nothreads", +) + +# proto_library rules implicitly depend on @com_google_protobuf//:protoc, +# which is the proto-compiler. +# This statement defines the @com_google_protobuf repo. +http_archive( + name = "com_google_protobuf", + urls = ["https://github.com/google/protobuf/archive/b4b0e304be5a68de3d0ee1af9b286f958750f5e4.zip"], + strip_prefix = "protobuf-b4b0e304be5a68de3d0ee1af9b286f958750f5e4", + sha256 = "ff771a662fb6bd4d3cc209bcccedef3e93980a49f71df1e987f6afa3bcdcba3a", +) + +# cc_proto_library rules implicitly depend on @com_google_protobuf_cc//:cc_toolchain, +# which is the C++ proto runtime (base classes and common utilities). +http_archive( + name = "com_google_protobuf_cc", + urls = ["https://github.com/google/protobuf/archive/b4b0e304be5a68de3d0ee1af9b286f958750f5e4.zip"], + strip_prefix = "protobuf-b4b0e304be5a68de3d0ee1af9b286f958750f5e4", + sha256 = "ff771a662fb6bd4d3cc209bcccedef3e93980a49f71df1e987f6afa3bcdcba3a", +) + +bind( + name = "protobuf", + actual = "@com_google_protobuf_cc//:protobuf", +) diff --git a/examples/cpp/BUILD b/examples/cpp/BUILD new file mode 100644 index 0000000000..d8c283dfec --- /dev/null +++ b/examples/cpp/BUILD @@ -0,0 +1,38 @@ +cc_library( + name = "jobshop_reader", + hdrs = ["jobshop.h"], + deps = [ + "@or_tools_libraries//base", + "@or_tools_libraries//util", + ], +) + +cc_library( + name = "flexible_jobshop_reader", + hdrs = ["flexible_jobshop.h"], + deps = [ + "@or_tools_libraries//base", + "@or_tools_libraries//util", + ], +) + + +cc_binary( + name = "jobshop_sat", + srcs = [ + "jobshop_sat.cc", + ], + deps = [ + ":flexible_jobshop_reader", + ":jobshop_reader", + "@or_tools_libraries//base", + "@or_tools_libraries//util", + "@or_tools_libraries//sat:disjunctive", + "@or_tools_libraries//sat:integer", + "@or_tools_libraries//sat:intervals", + "@or_tools_libraries//sat:model", + "@or_tools_libraries//sat:optimization", + "@or_tools_libraries//sat:precedences", + "@or_tools_libraries//sat:sat_solver", + ], +) \ No newline at end of file