Skip to content

Commit

Permalink
[cmake] Add support for BYO Python (RobotLocomotion#19023)
Browse files Browse the repository at this point in the history
Breaking changes:
- Drop support for multi-config generators aka CMAKE_CONFIGURATION_TYPES.
  Specifically, the Eclipse or XCode IDE generators are no longer supported.

Other fixes:
- Bump minimum CMake to 3.16 (per Ubuntu 20.04 Focal).
- Do not use -Werror in CMake builds; only first-party Bazel builds from
  source should do that (i.e., Drake Developers & Drake CI).
- When the requested CMAKE_BUILD_TYPE is unsupported, force it to "Release".
- CMake verbosity enables --announce_rc as well.
- Clarify which rcfiles are loaded in CMake builds.
  - Stop using chained imports; only the top-level file contains imports.
  - Move C++17 flags to focal-specific config file.
- Drop Numpy from CMake python searching; we don't use it anymore.

Non-functional changes:
- Emit a WORKSPACE file and use --package_path in rcfile, to make it easier
  to customize the workspace and debug bazel commands manually.
- Put the rcfile in the conventional place, so we don't need extra args to
  tell Bazel where it is.
- Pass environment variables via rcfile for clarity and reproducibility.
- Rename BAZEL_TARGETS to BAZEL_INSTALL_TARGET; it's impossible for this
  to ever have more than one item in the list.
- Rename BAZEL_TARGETS_ARGS to BAZEL_INSTALL_ARGS; it's impossible for
  this to ever be something other than an install command.
  • Loading branch information
jwnimmer-tri authored Mar 29, 2023
1 parent 0300d22 commit 558aeaa
Show file tree
Hide file tree
Showing 6 changed files with 273 additions and 240 deletions.
7 changes: 6 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Import legacy .bazelrc file.
# Import default settings (also shared with CMake builds).
import %workspace%/tools/bazel.rc

# Import some helper configurations (not shared with CMake builds).
import %workspace%/tools/cc_toolchain/bazel.rc
import %workspace%/tools/dynamic_analysis/bazel.rc
import %workspace%/tools/lint/bazel.rc

# Import environment-specific configuration.
import %workspace%/gen/environment.bazelrc

Expand Down
Loading

0 comments on commit 558aeaa

Please sign in to comment.