Skip to content

Commit

Permalink
Synchronize build tooling from upstream repo
Browse files Browse the repository at this point in the history
* Import cmake-format rules for new cmake commands
* Correct CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
* Format bazel build files with buildifier
* Add bazel workspace rules for more packages
* Add general build utilities in bazel an cmake for things like
  fetchobj, unzip, verify_image, gresource, protostruct_gen
* Add missing config file dependencies to lint targets
* Add cmake rules for creating a debian repository
  • Loading branch information
cheshirekow committed May 13, 2021
1 parent 904c42d commit 8a1a77e
Show file tree
Hide file tree
Showing 29 changed files with 1,166 additions and 127 deletions.
65 changes: 64 additions & 1 deletion .cmake-format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@
"pargs": "1+",
"flags": ["ADD_RUNTARGET"],
"kwargs": {
"INC": {
"pargs": 0,
"kwargs": {
"PUBLIC": "*",
"PRIVATE": "*",
"INTERFACE": "*",
}
},
"LIBDIRS": {
"pargs": "*",
"kwargs": {
"PUBLIC": "*",
"PRIVATE": "*",
"INTERFACE": "*",
}
},
"SRCS": "*",
"DEPS": "*",
"PKGDEPS": "*",
Expand Down Expand Up @@ -105,6 +121,14 @@
]
},

"gresource" : {
"pargs": 2,
"kwargs": {
"SRCDIR": 1,
"DEPENDS": "+",
}
},

"join": {
"pargs": [1, "+"],
"kwargs": {
Expand All @@ -125,7 +149,9 @@
"NAME": 1,
"WORKING_DIRECTORY": 1,
"COMMAND": "+",
"CONFIGURATIONS": "+"
"CONFIGURATIONS": "+",
"DEPENDS": "+",
"LABELS": "+",
}
},

Expand All @@ -142,6 +168,9 @@
"DEPS": "*"
}
},
"create_debian_depsrepo": {
"pargs": [3, "+"]
},
"create_debian_packages": {
"pargs": [
{"nargs": "+", "flags": ["FORCE_PBUILDER"]},
Expand Down Expand Up @@ -203,6 +232,40 @@
},
},

"tangent_extract_svg": {
"kwargs": {
"OUTPUT": 1,
"SRC": 1,
"EXPORT": 1,
}
},

"tangent_fetchobj": {
"pargs": 2,
"kwargs": {
"OUTDIR": 1,
}
},

"tangent_rmark_render": {
"pargs": 1,
"kwargs": {
"UUID": 1,
"OUTPUT": 1,
"FORMAT": 1,
"PAGENO": 1,
"DEPENDS": 1
}
},

"tangent_unzip": {
"pargs": "1+",
"kwargs": {
"OUTPUT": "1+",
"WORKING_DIRECTORY": 1,
}
},


# GtkDocConfig.cmake
"gtk_doc_add_module": {
Expand Down
30 changes: 29 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(tangentsky)
enable_testing()
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

if(NOT CMAKE_INSTALL_PREFIX)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
${CMAKE_BINARY_DIR}/install
CACHE PATH "cmake installation directory")
Expand All @@ -14,6 +14,7 @@ include(GNUInstallDirs)

find_package(Threads REQUIRED)
find_package(fmt QUIET)
find_package(Clang QUIET CONFIG)

if(EXISTS ${CMAKE_SOURCE_DIR}/build_tooling/cmake)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/build_tooling/cmake)
Expand All @@ -25,10 +26,15 @@ include(tangent)

# cmake-lint: disable=E1122
pkg_find(
PKG cairomm-1.0
PKG cairomm-svg-1.0
PKG cairomm-pdf-1.0
PKG eigen3
PKG fontconfig
PKG freetype2
PKG fuse
PKG gdk-pixbuf-2.0
PKG gdkmm-3.0
PKG glib-2.0
PKG glibmm-2.4
PKG gnuradio-osmosdr
Expand All @@ -40,11 +46,19 @@ pkg_find(
PKG libelf
PKG libglog
PKG libpng NAMES libpng12 libpng16
PKG librsvg-2.0
PKG librtlsdr
PKG libssh
PKG libssh_threads
PKG libudev
PKG libzip
PKG openssl
PKG pango
PKG pangoft2
PKG pangomm-1.4
PKG protobuf
PKG tinyxml2
PKG uuid
PKG vulkan
PKG x11-xcb)

Expand All @@ -59,4 +73,18 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR})
set(CTEST_ENVIRONMENT "PYTHONPATH=${CMAKE_SOURCE_DIR}")

add_compile_options(-Wall -Werror)

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILE_VERSION VERSION_GREATER 5.9.99)
add_compile_options(
-Wimplicit-fallthrough
"--system-header-prefix=${CMAKE_SOURCE_DIR}/third_party")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILE_VERSION VERSION_GREATER 6.9.9)
add_compile_options(-Wimplicit-fallthrough)
endif()
endif()

glob_subdirs()
73 changes: 49 additions & 24 deletions build_tooling/bazel/WORKSPACE.bionic
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,62 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# rules_cc defines rules for generating C++ code from Protocol Buffers.
http_archive(
name = "rules_cc",
sha256 = "35f2fb4ea0b3e61ad64a369de284e4fbbdcdba71836a5555abb5e194cf119509",
strip_prefix = "rules_cc-624b5d59dfb45672d4239422fa1e3de1822ee110",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
"https://github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
],
name = "rules_cc",
sha256 = "35f2fb4ea0b3e61ad64a369de284e4fbbdcdba71836a5555abb5e194cf119509",
strip_prefix = "rules_cc-624b5d59dfb45672d4239422fa1e3de1822ee110",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
"https://github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
],
)

# rules_java defines rules for generating Java code from Protocol Buffers.
http_archive(
name = "rules_java",
sha256 = "ccf00372878d141f7d5568cedc4c42ad4811ba367ea3e26bc7c43445bbc52895",
strip_prefix = "rules_java-d7bf804c8731edd232cb061cb2a9fe003a85d8ee",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
"https://github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
],
name = "rules_java",
sha256 = "ccf00372878d141f7d5568cedc4c42ad4811ba367ea3e26bc7c43445bbc52895",
strip_prefix = "rules_java-d7bf804c8731edd232cb061cb2a9fe003a85d8ee",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
"https://github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
],
)

# rules_proto defines abstract rules for building Protocol Buffers.
http_archive(
name = "rules_proto",
sha256 = "2490dca4f249b8a9a3ab07bd1ba6eca085aaf8e45a734af92aad0c42d9dc7aaf",
strip_prefix = "rules_proto-218ffa7dfa5408492dc86c01ee637614f8695c45",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/218ffa7dfa5408492dc86c01ee637614f8695c45.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/218ffa7dfa5408492dc86c01ee637614f8695c45.tar.gz",
],
name = "com_google_protobuf",
sha256 = "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
strip_prefix = "protobuf-3.13.0",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()

http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
)

load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies")

rules_cc_dependencies()

load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
load(
"@rules_java//java:repositories.bzl",
"rules_java_dependencies",
"rules_java_toolchains",
)

rules_java_dependencies()

rules_java_toolchains()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
load(
"@rules_proto//proto:repositories.bzl",
"rules_proto_dependencies",
"rules_proto_toolchains",
)

rules_proto_dependencies()
rules_proto_toolchains()

Expand All @@ -49,3 +66,11 @@ new_local_repository(
build_file = "build_tooling/bazel/system-bionic.bzl",
path = "/",
)

load("@rules_python//python:pip.bzl", "pip_install")
pip_install(
name = "pip_deps",
requirements = "//build_tooling:pip-requirements.txt",
)

register_toolchains("//:py_toolchain")
79 changes: 51 additions & 28 deletions build_tooling/bazel/WORKSPACE.xenial
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,75 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# rules_cc defines rules for generating C++ code from Protocol Buffers.
http_archive(
name = "rules_cc",
sha256 = "35f2fb4ea0b3e61ad64a369de284e4fbbdcdba71836a5555abb5e194cf119509",
strip_prefix = "rules_cc-624b5d59dfb45672d4239422fa1e3de1822ee110",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
"https://github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
],
name = "rules_cc",
sha256 = "35f2fb4ea0b3e61ad64a369de284e4fbbdcdba71836a5555abb5e194cf119509",
strip_prefix = "rules_cc-624b5d59dfb45672d4239422fa1e3de1822ee110",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
"https://github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz",
],
)

# rules_java defines rules for generating Java code from Protocol Buffers.
http_archive(
name = "rules_java",
sha256 = "ccf00372878d141f7d5568cedc4c42ad4811ba367ea3e26bc7c43445bbc52895",
strip_prefix = "rules_java-d7bf804c8731edd232cb061cb2a9fe003a85d8ee",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
"https://github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
],
name = "rules_java",
sha256 = "ccf00372878d141f7d5568cedc4c42ad4811ba367ea3e26bc7c43445bbc52895",
strip_prefix = "rules_java-d7bf804c8731edd232cb061cb2a9fe003a85d8ee",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
"https://github.com/bazelbuild/rules_java/archive/d7bf804c8731edd232cb061cb2a9fe003a85d8ee.tar.gz",
],
)

# rules_proto defines abstract rules for building Protocol Buffers.
http_archive(
name = "rules_proto",
sha256 = "2490dca4f249b8a9a3ab07bd1ba6eca085aaf8e45a734af92aad0c42d9dc7aaf",
strip_prefix = "rules_proto-218ffa7dfa5408492dc86c01ee637614f8695c45",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/218ffa7dfa5408492dc86c01ee637614f8695c45.tar.gz",
"https://github.com/bazelbuild/rules_proto/archive/218ffa7dfa5408492dc86c01ee637614f8695c45.tar.gz",
],
name = "com_google_protobuf",
sha256 = "9b4ee22c250fe31b16f1a24d61467e40780a3fbb9b91c3b65be2a376ed913a1a",
strip_prefix = "protobuf-3.13.0",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
protobuf_deps()

http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
)

load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies")

rules_cc_dependencies()

load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains")
load(
"@rules_java//java:repositories.bzl",
"rules_java_dependencies",
"rules_java_toolchains",
)

rules_java_dependencies()

rules_java_toolchains()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
load(
"@rules_proto//proto:repositories.bzl",
"rules_proto_dependencies",
"rules_proto_toolchains",
)

rules_proto_dependencies()
rules_proto_toolchains()


new_local_repository(
name="system",
path="/",
build_file="build_tooling/bazel/system-xenial.bzl"
name = "system",
build_file = "build_tooling/bazel/system-xenial.bzl",
path = "/",
)

load("@rules_python//python:pip.bzl", "pip_install")
pip_install(
name = "pip_deps",
requirements = "//build_tooling:pip-requirements.txt",
)

register_toolchains("//:py_toolchain")
1 change: 1 addition & 0 deletions build_tooling/bazel/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ glslang_compile = rule(
},
doc = "Compile one or more glsl files into SPIR-V",
)

Loading

0 comments on commit 8a1a77e

Please sign in to comment.