Cut over to Bazel.

This commit is contained in:
Kyle Isom 2023-02-16 19:56:49 -08:00
parent 08ce01ab87
commit 9a7208913d
18 changed files with 81 additions and 7 deletions

4
.gitignore vendored
View File

@ -7,3 +7,7 @@
/docs/xml/
docs/sphinx/_build/
docs/sphinx/api/
/bazel-bin/
/bazel-out/
/bazel-testlogs/
/bazel-wrmath/

View File

@ -15,7 +15,7 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
# Don't warn on unused functions, because this is a library and not all
# functions might be used.
add_compile_options(-Werror -Wno-unused-function -Wall -g -O0)
# add_compile_options(-Werror -Wno-unused-function -Wall -g -O0)
if (DEFINED ENV{CMAKE_GCOV})
add_compile_options(-fprofile-arcs -ftest-coverage)
@ -29,10 +29,10 @@ message(STATUS, "Code coverage enabled.")
endif()
include_directories(include)
include_directories(wrmath)
file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS include/**.h)
file(GLOB_RECURSE ${PROJECT_NAME}_SOURCES src/*.cc)
file(GLOB_RECURSE ${PROJECT_NAME}_HEADERS wrmath/**.h)
file(GLOB_RECURSE ${PROJECT_NAME}_SOURCES wrmath/*.cc)
## BUILD
@ -109,4 +109,4 @@ include(CMakePack.txt)
## DOCUMENTATE
add_subdirectory ("docs")
## add_subdirectory ("docs")

8
WORKSPACE Normal file
View File

@ -0,0 +1,8 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "com_google_googletest",
sha256 = "983a7f2f4cc2a4d75d94ee06300c46a657291fba965e355d11ab3b6965a7b0e5",
strip_prefix = "googletest-b796f7d44681514f58a683a3a71ff17c94edb0c1",
urls = ["https://github.com/google/googletest/archive/b796f7d44681514f58a683a3a71ff17c94edb0c1.zip"],
)

View File

@ -72,7 +72,7 @@ exhale_args = {
"createTreeView": True,
"exhaleExecutesDoxygen": True,
"exhaleDoxygenStdin": """
INPUT = ../../include ../../src
INPUT = ../../include ../../wrmath
USE_XML = YES
"""
}

1
extern/googletest vendored

@ -1 +0,0 @@
Subproject commit 4e29e48840e611ecbef33d10960d7480d2e9034a

39
test/BUILD.bazel Normal file
View File

@ -0,0 +1,39 @@
cc_test(
name = "madgwick_test",
size = "small",
srcs = ["madgwick_test.cc"],
deps = [
"//wrmath",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "orientation_test",
size = "small",
srcs = ["orientation_test.cc"],
deps = [
"//wrmath",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "quaternion_test",
size = "small",
srcs = ["quaternion_test.cc"],
deps = [
"//wrmath",
"@com_google_googletest//:gtest_main",
],
)
cc_test(
name = "vector_test",
size = "small",
srcs = ["vector_test.cc"],
deps = [
"//wrmath",
"@com_google_googletest//:gtest_main",
],
)

11
tools/BUILD.bazel Normal file
View File

@ -0,0 +1,11 @@
cc_binary(
name = "euler2quat",
srcs = ["euler2quat.cc"],
deps = ["//wrmath"],
)
cc_binary(
name = "quaternion",
srcs = ["quaternion.cc"],
deps = ["//wrmath"],
)

6
wrmath/BUILD.bazel Normal file
View File

@ -0,0 +1,6 @@
cc_library(
name = "wrmath",
srcs = glob(["*.cc"]),
hdrs = glob(["**/*.h"]),
visibility = ["//visibility:public"],
)

View File

@ -5,6 +5,7 @@
#include <cassert>
#define _USE_MATH_DEFINES
#include <cmath>
#include <initializer_list>
#include <iostream>

View File

@ -3,9 +3,15 @@
#define __WRMATH_UTIL_MATH_H
#define _USE_MATH_DEFINES
#include <cmath>
#ifndef M_PI
#define M_PI 3.14159265359
#endif
namespace wr {
/// math contains utility math functions.
namespace math {