Skip to content

Instantly share code, notes, and snippets.

View njlr's full-sized avatar
🌏
F# ing

njlr njlr

🌏
F# ing
View GitHub Profile
#include <gtest/gtest.h>
#include <mathutils/add.hpp>
TEST(mathutils, add) {
ASSERT_EQ(3, add(1, 2));
ASSERT_EQ(7, add(4, 3));
}
cxx_binary(
name = 'demo',
header_namespace = 'demo',
headers = subdir_glob([
('demo/include', '**/*.hpp'),
]),
srcs = glob([
'demo/src/**/*.cpp',
]),
)
[cxx]
gtest_dep = //googletest:gtest
#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;
}
cxx_binary(
name = 'demo',
header_namespace = 'demo',
headers = subdir_glob([
('demo/include', '**/*.hpp'),
]),
srcs = glob([
'demo/src/**/*.cpp',
]),
deps = [
cxx_library(
name = 'mathutils',
header_namespace = 'mathutils',
exported_headers = subdir_glob([
('include', '**/*.hpp'),
]),
srcs = glob([
'src/**/*.cpp',
]),
visibility = [
#include <mathutils/add.hpp>
int add(int x, int y) {
return x + y;
}
#ifndef MATH_HPP
#define MATH_HPP
int add(int x, int y);
#endif
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'),
]),
)
#include <iostream>
int main() {
std::cout << "Hello, world. " << std::endl;
return 0;
}