This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gtest/gtest.h> | |
#include <mathutils/add.hpp> | |
TEST(mathutils, add) { | |
ASSERT_EQ(3, add(1, 2)); | |
ASSERT_EQ(7, add(4, 3)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cxx_binary( | |
name = 'demo', | |
header_namespace = 'demo', | |
headers = subdir_glob([ | |
('demo/include', '**/*.hpp'), | |
]), | |
srcs = glob([ | |
'demo/src/**/*.cpp', | |
]), | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[cxx] | |
gtest_dep = //googletest:gtest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cxx_binary( | |
name = 'demo', | |
header_namespace = 'demo', | |
headers = subdir_glob([ | |
('demo/include', '**/*.hpp'), | |
]), | |
srcs = glob([ | |
'demo/src/**/*.cpp', | |
]), | |
deps = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cxx_library( | |
name = 'mathutils', | |
header_namespace = 'mathutils', | |
exported_headers = subdir_glob([ | |
('include', '**/*.hpp'), | |
]), | |
srcs = glob([ | |
'src/**/*.cpp', | |
]), | |
visibility = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mathutils/add.hpp> | |
int add(int x, int y) { | |
return x + y; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef MATH_HPP | |
#define MATH_HPP | |
int add(int x, int y); | |
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), | |
]), | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
int main() { | |
std::cout << "Hello, world. " << std::endl; | |
return 0; | |
} |