Skip to content

Instantly share code, notes, and snippets.

@njlr
njlr / BUCK
Created January 3, 2017 14:39
BUCK file for Google Test
cxx_library(
name = 'googletest',
header_namespace = '',
srcs = [
'googletest/src/gtest-all.cc',
'googletest/src/gtest_main.cc',
],
headers = subdir_glob([
('googletest', 'src/*.h'),
('googletest', 'src/*.cc'),
cxx_library(
name = 'my-library',
exported_headers = subdir_glob([
('include', '**/*.hpp'),
]),
srcs = glob([
'src/**/*.cpp',
]),
)

Buckaroo contributor agreement

The Buckaroo Agreement (this "Agreement") applies to any Contribution you make to any Work.

This is a binding legal agreement on you and any organization you represent. If you are signing this Agreement on behalf of your employer or other organization, you represent and warrant that you have the authority to agree to this Agreement on behalf of the organization.

1. Definitions

"Contribution" means any original work, including any modification of or addition to an existing work, that you submit to Buckaroo in any manner for inclusion in any Work.

#include <iostream>
int main() {
std::cout << "Hello, world. " << std::endl;
return 0;
}
cxx_binary(
name = 'buck-cpp-example',
header_namespace = 'buck-cpp-example',
srcs = glob([
'buck-cpp-example/src/**/*.cpp',
]),
headers = subdir_glob([
('buck-cpp-example/include', '**/*.hpp'),
]),
)
#ifndef MATH_HPP
#define MATH_HPP
int add(int x, int y);
#endif
#include <mathutils/add.hpp>
int add(int x, int y) {
return x + y;
}
cxx_library(
name = 'mathutils',
header_namespace = 'mathutils',
exported_headers = subdir_glob([
('include', '**/*.hpp'),
]),
srcs = glob([
'src/**/*.cpp',
]),
visibility = [
cxx_binary(
name = 'demo',
header_namespace = 'demo',
headers = subdir_glob([
('demo/include', '**/*.hpp'),
]),
srcs = glob([
'demo/src/**/*.cpp',
]),
deps = [
#include <iostream>
#include <mathutils/add.hpp>
int main() {
std::cout << "Hello, world. " << std::endl;
std::cout << "3 + 4 = " << add(3, 4) << std::endl;
return 0;
}