Skip to content

Adjust sources/tree to build with Bazel #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

#build --compiler=clang
build --nokeep_going --color=yes
# build --nokeep_going --color=yes --crosstool_top=@toolchain//crosstool:toolchain

# build --enable_bzlmod
build --copt=-fPIC
#build -c opt
build:opt -c opt
build:opt --copt=-O3
build:opt --copt=-std=c++17

build:debug -c dbg --strip="never"
build:debug --copt=-g3
build:debug --copt=-O0
build:debug --copt=-UNDEBUG
# build:debug --copt=-v
build:debug --copt=-fdiagnostics-color=always
# build:debug --linkopt=-v
build:debug --linkopt=-Wl,-g
build:debug --linkopt=-Wl,--discard-none


# build:opt -c opt --strip="always"

build --define=target_platform=x86_64
build --action_env=target_platform="x86_64"
build:x86_64 --cpu=k8
build:x86_64 --define=target_platform=x86_64
build:x86_64 --action_env=target_platform="x86_64"

build:jetson --cpu=aarch64
build:jetson --define=target_platform=jetson
build:jetson --action_env=target_platform="jetson"

1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.1.1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
build/
/build
*.pyc
/bazel-*
55 changes: 55 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
_workspace_name = "test"

workspace(name = _workspace_name)

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

new_local_repository(
name = "libsoup",
build_file = "@//buildfiles:third_party/libsoup.BUILD",
path = "/usr",
)

git_repository(
name = "rules_cuda",
# v0.2.3 breaks some lubcupti for our version of bazel
commit = "3f2429254ec956220557e79ea9d5f5e8871c2907",
remote = "https://github.com/bazel-contrib/rules_cuda",
)

load("@rules_cuda//cuda:repositories.bzl", "register_detected_cuda_toolchains", "rules_cuda_dependencies")

rules_cuda_dependencies()

register_detected_cuda_toolchains()

new_git_repository(
name = "glib",
build_file = "//buildfiles:third_party/glib.BUILD",
commit = "763cc3b238398614c20069fd67642730e3a6519b",
patch_cmds = [
"meson setup builddir -Ddebug=true -Dprefix=$(pwd)/external",
"ninja -C builddir install",
],
remote = "https://github.com/GNOME/glib.git",
)

new_local_repository(
name = "json_glib",
build_file = "@//buildfiles:third_party/json_glib.BUILD",
path = "/usr",
)

new_git_repository(
name = "gstreamer",
build_file = "//buildfiles:third_party/gstreamer.BUILD",
commit = "2d8273151571fcab887cc81de48e87aeb61b5c06",
patch_cmds = [
"meson setup builddir -Ddebug=true -Dprefix=$(pwd)/external",
"ninja -C builddir install",
],
remote = "https://github.com/GStreamer/gstreamer.git",
shallow_since = "1712695735 +0100",
)
25 changes: 25 additions & 0 deletions base/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
load("@rules_cc//cc:defs.bzl", "cc_library")

cc_library(
name = "base",
srcs = glob(["*.cpp"]),
copts = [
"-fPIC",
"-Wno-deprecated-declarations",
],
visibility = ["//visibility:public"],
deps = [
":base_includes",
"//threads",
],
)

cc_library(
name = "base_includes",
srcs = [],
hdrs = glob(["*.h"]),
includes = ["."],
visibility = ["//visibility:public"],
deps = [
],
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion filesystem.h → base/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#ifndef __FILESYSTEM_UTIL_H__
#define __FILESYSTEM_UTIL_H__

#include <cstdint>
#include <string>
#include <vector>

Expand Down Expand Up @@ -129,7 +130,7 @@ enum fileTypes
/**
* Return a sorted list of the files in the specified directory. listDir() will glob files from
* the specified path, and filter against wildcard characters including `*` and `?`.
* For example, valid paths would include `~/workspace`, `~/workspace/*.jpg`, ect.
* For example, valid paths would include `~/workspace`, `~/workspace/ *.jpg`, ect.
*
* @see here for a description of wildcard matching: https://www.man7.org/linux/man-pages/man7/glob.7.html
*
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added buildfiles/BUILD
Empty file.
Loading