Skip to content

Commit a3092ea

Browse files
committed
build: modernize build, packaging, and metadata configuration across CMake and Bazel
Refactor project build configuration to improve portability, security defaults, and packaging behavior across platforms and build systems. - CMake: - Default BUILD_SHARED_LIBS to top-level project usage instead of always ON. - Require the configured C++ standard (C++98) and keep extensions disabled. - Enable hardening by default and migrate from global flag string mutation to add_compile_options/add_link_options. - Add additional linker hardening checks (including -Wl,-z,separate-code) and apply safer non-Debug conditionals where appropriate. - Add ENABLE_INSTALLATION and ENABLE_PACKAGING options, both defaulting to top-level usage. - Gate install, pkg-config generation, and CPack setup behind ENABLE_INSTALLATION/ENABLE_PACKAGING. - Add namespace alias target (PROJECT_NAME::AVO) and improve export/install package metadata. - Add PACKAGE_INFO and SBOM export/install support for newer CMake versions. - Use TYPE DOC for documentation/license installation and gate docs install on ENABLE_INSTALLATION. - Bazel: - Make shared library target publicly visible. - Bump CPS metadata compatibility/version and add a release CPS descriptor with OS-specific library locations. - Include both base and release CPS descriptors in packaged artifacts. - Tighten Debian package architecture selection to supported CPUs with explicit no-match error. - Restrict Debian package target compatibility to Linux. - Improve source target options: platform-specific warning flags, Windows export define, and include path handling. - Remove obsolete source file from Bazel target sources. - Examples: - Introduce BUILD_EXAMPLES option in CMake (default top-level). - Add PIE capability check for example executables. - Normalize and clean up example target definitions and properties. - Add compile warning/security flags to Bazel example tests. - CI and dependency automation: - Remove brew upgrade step from CI setup jobs to reduce volatility. - Remove Dependabot workflow config and retain Renovate licensing metadata. - Metadata and cleanup: - Add SPDX license companion file for renovate.json. - Remove legacy REUSE dep5 metadata file. - Remove obsolete src/Export.cc implementation. Net effect: - 14 files changed, 353 insertions, 1316 deletions. - Consolidates build logic, improves hardening defaults, and makes install/packaging behavior friendlier for embedded/subproject consumption.
1 parent 70e0e1e commit a3092ea

14 files changed

Lines changed: 305 additions & 1290 deletions

File tree

.bazelrc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ build --sandbox_default_allow_network=false
3838
build:macos --apple_generate_dsym=true
3939
build:macos --apple_crosstool_top=@local_config_apple_cc//:toolchain
4040
build:macos --apple_platform_type=macos
41-
build:macos --crosstool_top=@local_config_apple_cc//:toolchain
42-
build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain
4341

4442
common --enable_platform_specific_config=true
4543
common --heap_dump_on_oom=true

.github/dependabot.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ jobs:
167167
- name: setup
168168
run: |
169169
brew update -q
170-
brew upgrade -f -q
171170
brew bundle install -q
172171
brew cleanup -q -s
173172
rm -rf $(brew --cache)
@@ -463,7 +462,6 @@ jobs:
463462
- name: setup
464463
run: |
465464
brew update -q
466-
brew upgrade -f -q
467465
brew bundle install -q
468466
brew cleanup -q -s
469467
rm -rf $(brew --cache)

.reuse/dep5

Lines changed: 0 additions & 1049 deletions
This file was deleted.

BUILD.bazel

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ pkg_files(
7575

7676
cc_shared_library(
7777
name = "AVO",
78+
visibility = ["//visibility:public"],
7879
deps = ["//src:AVO"],
7980
)
8081

@@ -101,7 +102,7 @@ cat << 'EOF' > $@
101102
}
102103
},
103104
"cps_path": "@prefix@/lib/cps/AVO",
104-
"cps_version": "0.13.0",
105+
"cps_version": "0.14.1",
105106
"default_components": ["AVO"],
106107
"description": "Reciprocal Collision Avoidance with Acceleration-Velocity Obstacles",
107108
"license": "Apache-2.0",
@@ -114,9 +115,64 @@ EOF
114115
""",
115116
)
116117

118+
genrule(
119+
name = "avo_release_cps",
120+
outs = ["AVO@release.cps"],
121+
cmd = select({
122+
"@platforms//os:macos": """
123+
cat << 'EOF' > $@
124+
{
125+
"components":
126+
{
127+
"AVO":
128+
{
129+
"location": "@prefix@/lib/libAVO.dylib"
130+
}
131+
},
132+
"configuration": "Release",
133+
"name": "AVO"
134+
}
135+
EOF
136+
""",
137+
"@platforms//os:windows": """
138+
cat << 'EOF' > $@
139+
{
140+
"components":
141+
{
142+
"AVO":
143+
{
144+
"location": "@prefix@/lib/AVO.dll"
145+
}
146+
},
147+
"configuration": "Release",
148+
"name": "AVO"
149+
}
150+
EOF
151+
""",
152+
"//conditions:default": """
153+
cat << 'EOF' > $@
154+
{
155+
"components":
156+
{
157+
"AVO":
158+
{
159+
"location": "@prefix@/lib/libAVO.so"
160+
}
161+
},
162+
"configuration": "Release",
163+
"name": "AVO"
164+
}
165+
EOF
166+
""",
167+
}),
168+
)
169+
117170
pkg_files(
118171
name = "cps",
119-
srcs = ["AVO.cps"],
172+
srcs = [
173+
"AVO.cps",
174+
"AVO@release.cps",
175+
],
120176
attributes = pkg_attributes(mode = "0644"),
121177
prefix = "usr/lib/cps/AVO",
122178
)
@@ -197,11 +253,13 @@ pkg_tar(
197253

198254
pkg_deb(
199255
name = "deb",
200-
architecture = select({
201-
"@platforms//cpu:arm": "amd64",
202-
"@platforms//os:macos": "arm64",
203-
"//conditions:default": "all",
204-
}),
256+
architecture = select(
257+
{
258+
"@platforms//cpu:aarch64": "arm64",
259+
"@platforms//cpu:x86_64": "amd64",
260+
},
261+
no_match_error = "Unsupported CPU for //:deb. Supported CPUs: aarch64, x86_64.",
262+
),
205263
data = ":tar",
206264
depends = [
207265
"libc6",
@@ -215,6 +273,7 @@ pkg_deb(
215273
package = "avo",
216274
priority = "optional",
217275
section = "contrib/libdevel",
276+
target_compatible_with = ["@platforms//os:linux"],
218277
triggers = "triggers",
219278
version = "1.0.1",
220279
)

0 commit comments

Comments
 (0)