repo_id
stringclasses
205 values
file_path
stringlengths
33
141
content
stringlengths
1
307k
__index_level_0__
int64
0
0
/home/johnshepherd
/home/johnshepherd/drake/CMakeLists.txt
# -*- mode: cmake -*- # vi: set ft=cmake : cmake_minimum_required(VERSION 3.16) project(drake DESCRIPTION "Model-based design and verification for robotics" LANGUAGES C CXX ) # The primary build system for Drake is Bazel (https://bazel.build/). For CMake, # our objective is to accept configuration options using their standard spelling # (e.g., `-DCMAKE_BUILD_TYPE=Release`) and install Drake using those settings. # # We'll do that by converting the settings to generated Bazel inputs: # - a `WORKSPACE.bazel` file that specifies dependencies; and # - a `.bazelrc` file that specifies configuration choices. # and then running the `@drake//:install` program from that temporary workspace. list(INSERT CMAKE_MODULE_PATH 0 "${PROJECT_SOURCE_DIR}/cmake/modules") include(CTest) configure_file(CTestCustom.cmake.in CTestCustom.cmake @ONLY) if(ANDROID OR CYGWIN OR IOS OR NOT UNIX) message(FATAL_ERROR "Android, Cygwin, iOS, and non-Unix platforms are NOT supported" ) endif() set(BAZELRC_IMPORTS "tools/bazel.rc") set(UNIX_DISTRIBUTION_ID) set(UNIX_DISTRIBUTION_CODENAME) if(APPLE) if(CMAKE_SYSTEM_VERSION VERSION_LESS 21) message(WARNING "Darwin ${CMAKE_SYSTEM_VERSION} is NOT supported. Please use " "Darwin 21.x (macOS Monterey) or newer." ) endif() list(APPEND BAZELRC_IMPORTS "tools/macos.bazelrc") execute_process( COMMAND "/usr/bin/arch" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE MACOS_ARCH) if(MACOS_ARCH STREQUAL "") message(FATAL_ERROR "Could NOT query macOS arch") endif() list(APPEND BAZELRC_IMPORTS "tools/macos-arch-${MACOS_ARCH}.bazelrc") else() list(APPEND BAZELRC_IMPORTS "tools/ubuntu.bazelrc") find_program(LSB_RELEASE_EXECUTABLE NAMES lsb_release) mark_as_advanced(LSB_RELEASE_EXECUTABLE) if(NOT LSB_RELEASE_EXECUTABLE) message(WARNING "Could NOT find the lsb_release executable") else() execute_process(COMMAND "${LSB_RELEASE_EXECUTABLE}" --codename --short RESULT_VARIABLE LSB_RELEASE_CODENAME_SHORT_RESULT_VARIABLE OUTPUT_VARIABLE UNIX_DISTRIBUTION_CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT LSB_RELEASE_CODENAME_SHORT_RESULT_VARIABLE EQUAL 0) message(WARNING "Could NOT run the lsb_release executable") else() set(MAYBE_RC "tools/ubuntu-${UNIX_DISTRIBUTION_CODENAME}.bazelrc") if(NOT EXISTS "${PROJECT_SOURCE_DIR}/${MAYBE_RC}") message(WARNING "Could NOT find config file ${MAYBE_RC}") else() list(APPEND BAZELRC_IMPORTS "${MAYBE_RC}") endif() endif() endif() endif() # The version passed to find_package(Bazel) should match the # minimum_bazel_version value in the call to versions.check() in WORKSPACE. set(MINIMUM_BAZEL_VERSION 5.1) find_package(Bazel ${MINIMUM_BAZEL_VERSION} MODULE) if(NOT Bazel_FOUND) set(Bazel_EXECUTABLE "${PROJECT_SOURCE_DIR}/third_party/com_github_bazelbuild_bazelisk/bazelisk.py") message(STATUS "Using Bazelisk as Bazel_EXECUTABLE to fetch Bazel on demand") endif() get_filename_component(C_COMPILER_REALPATH "${CMAKE_C_COMPILER}" REALPATH) get_filename_component(C_COMPILER_NAME "${C_COMPILER_REALPATH}" NAME) get_filename_component(CXX_COMPILER_REALPATH "${CMAKE_CXX_COMPILER}" REALPATH) get_filename_component(CXX_COMPILER_NAME "${CXX_COMPILER_REALPATH}" NAME) if(C_COMPILER_NAME STREQUAL ccache OR CXX_COMPILER_NAME STREQUAL ccache) message(FATAL_ERROR "Compilation with ccache is NOT supported due to incompatibility with Bazel" ) endif() # The minimum compiler versions should match those listed in both # doc/_pages/from_source.md and tools/workspace/cc/repository.bzl. set(MINIMUM_APPLE_CLANG_VERSION 14) set(MINIMUM_CLANG_VERSION 15) set(MINIMUM_GNU_VERSION 11) if(CMAKE_C_COMPILER_ID STREQUAL AppleClang) if(CMAKE_C_COMPILER_VERSION VERSION_LESS ${MINIMUM_APPLE_CLANG_VERSION}) message(WARNING "Compilation with clang ${CMAKE_C_COMPILER_VERSION} is NOT supported" ) endif() elseif(CMAKE_C_COMPILER_ID STREQUAL Clang) if(CMAKE_C_COMPILER_VERSION VERSION_LESS ${MINIMUM_CLANG_VERSION}) message(WARNING "Compilation with clang ${CMAKE_C_COMPILER_VERSION} is NOT supported" ) endif() elseif(CMAKE_C_COMPILER_ID STREQUAL GNU) if(CMAKE_C_COMPILER_VERSION VERSION_LESS ${MINIMUM_GNU_VERSION}) message(WARNING "Compilation with gcc ${CMAKE_C_COMPILER_VERSION} is NOT supported" ) endif() else() message(WARNING "Compilation with ${CMAKE_C_COMPILER_ID} is NOT supported. Compilation of " "project drake_cxx_python may fail." ) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMUM_APPLE_CLANG_VERSION}) message(WARNING "Compilation with clang++ ${CMAKE_CXX_COMPILER_VERSION} is NOT supported" ) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL Clang) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMUM_CLANG_VERSION}) message(WARNING "Compilation with clang++ ${CMAKE_CXX_COMPILER_VERSION} is NOT supported" ) endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL GNU) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMUM_GNU_VERSION}) message(WARNING "Compilation with g++ ${CMAKE_CXX_COMPILER_VERSION} is NOT supported" ) endif() else() message(WARNING "Compilation with ${CMAKE_CXX_COMPILER_ID} is NOT supported. Compilation " "of project drake_cxx_python may fail." ) endif() # Determine the CMAKE_BUILD_TYPE. We'll store it as BUILD_TYPE_LOWER so that # we can treat it as case-insensitive in our string comparisons. get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) if(IS_MULTI_CONFIG) message(FATAL_ERROR "Drake does not support multi-config generators") endif() set(SUPPORTED_BUILD_TYPES Release RelWithDebInfo Debug MinSizeRel) string(REPLACE ";" " " SUPPORTED_BUILD_TYPES_STRING "${SUPPORTED_BUILD_TYPES}" ) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "${SUPPORTED_BUILD_TYPES}" ) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: ${SUPPORTED_BUILD_TYPES_STRING}" FORCE ) endif() string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER) string(TOLOWER "${SUPPORTED_BUILD_TYPES}" SUPPORTED_BUILD_TYPES_LOWER) if(NOT BUILD_TYPE_LOWER IN_LIST SUPPORTED_BUILD_TYPES_LOWER) message(WARNING "Configuration CMAKE_BUILD_TYPE='${CMAKE_BUILD_TYPE}' is NOT supported. " "Defaulting to Release, options are: ${SUPPORTED_BUILD_TYPES_STRING}" ) set(BUILD_TYPE_LOWER release) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: ${SUPPORTED_BUILD_TYPES_STRING}" FORCE ) endif() # TODO(jwnimmer-tri) We don't currently pass along the user's selected C++ # standard nor CMAKE_CXX_FLAGS to Bazel, but we should. set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD 20) # The supported Python major/minor versions should match those listed in # doc/_pages/from_source.md. if(APPLE) # The macOS python version should match what's listed in both the # tools/workspace/python/repository.bzl and doc/_pages/installation.md. set(SUPPORTED_PYTHON_VERSION 3.12) else() if(UNIX_DISTRIBUTION_CODENAME STREQUAL noble) set(SUPPORTED_PYTHON_VERSION 3.12) else() # UNIX_DISTRIBUTION_CODENAME := jammy set(SUPPORTED_PYTHON_VERSION 3.10) endif() endif() # Next we'll very carefully choose which Python interpreter to use. # # - If the user provided the legacy spelling -DPYTHON_EXECUTABLE, shift that # into -DPython_EXECUTABLE instead and continue (with a warning). # # - If the user provided -DPython_EXECUTABLE, take it at face value (and # therefore error out if they gave us a broken definition). # # - Otherwise, try to find SUPPORTED_PYTHON_VERSION and use it if found. # # - Otherwise, try to find any Python 3 interpreter at all. # # In all cases, we'll warn in case the found Python is not supported. if(PYTHON_EXECUTABLE AND NOT Python_EXECUTABLE) set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}" CACHE FILEPATH "Path to the python3 executable" FORCE ) message(WARNING "To select a Python interpreter, you should define Python_EXECUTABLE " "not PYTHON_EXECUTABLE. The uppercase spelling is used for backwards " "compatibility only.") unset(PYTHON_EXECUTABLE CACHE) endif() if(Python_EXECUTABLE) find_package(Python 3 EXACT MODULE REQUIRED COMPONENTS Development Interpreter ) else() find_package(Python ${SUPPORTED_PYTHON_VERSION} EXACT MODULE COMPONENTS Development Interpreter ) if(NOT Python_FOUND) find_package(Python 3 EXACT MODULE REQUIRED COMPONENTS Development Interpreter ) endif() endif() if(NOT Python_INTERPRETER_ID STREQUAL Python) message(WARNING "Python interpreter ${Python_INTERPRETER_ID} is NOT supported. Python " "code in project drake_cxx_python may fail at runtime." ) endif() set(PYTHON_VERSION_MAJOR_MINOR "${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}" ) if(NOT PYTHON_VERSION_MAJOR_MINOR VERSION_EQUAL SUPPORTED_PYTHON_VERSION) message(WARNING "The found Python version ${PYTHON_VERSION_MAJOR_MINOR} differs from " "Drake's preferred version ${SUPPORTED_PYTHON_VERSION} on this platform. " "You may experience compatibility problems that are outside the scope of " "Drake's continuous integration test suites." ) endif() if(CMAKE_COLOR_MAKEFILE) set(BAZEL_COLOR yes) else() set(BAZEL_COLOR no) endif() if(CMAKE_VERBOSE_MAKEFILE) set(BAZEL_SUBCOMMANDS yes) set(BAZEL_ANNOUNCE_RC yes) else() set(BAZEL_SUBCOMMANDS no) set(BAZEL_ANNOUNCE_RC no) endif() set(BAZEL_REPO_ENV) if(NOT APPLE) string(APPEND BAZEL_REPO_ENV " --repo_env=CC=${CMAKE_C_COMPILER}" " --repo_env=CXX=${CMAKE_CXX_COMPILER}" ) endif() get_filename_component(PROJECT_BINARY_DIR_REALPATH "${PROJECT_BINARY_DIR}" REALPATH ) get_filename_component(PROJECT_SOURCE_DIR_REALPATH "${PROJECT_SOURCE_DIR}" REALPATH ) # Check whether the PROJECT_BINARY_DIR is a subdirectory of the # PROJECT_SOURCE_DIR. string(FIND "${PROJECT_BINARY_DIR_REALPATH}/" "${PROJECT_SOURCE_DIR_REALPATH}/" STRING_FIND_RESULT_VARIABLE ) if(STRING_FIND_RESULT_VARIABLE EQUAL 0) # The --output_base cannot be within the WORKSPACE (a subdirectory of # PROJECT_SOURCE_DIR), so fallback to the using the same parent directory # that Bazel uses by default for its --output_base. if(APPLE) set(BAZEL_OUTPUT_BASE "/var/tmp") else() set(BAZEL_OUTPUT_BASE "$ENV{HOME}/.cache/bazel") endif() else() set(BAZEL_OUTPUT_BASE "${PROJECT_BINARY_DIR}") endif() # Compute the MD5 hash of the PROJECT_BINARY_DIR rather than the WORKSPACE # (PROJECT_SOURCE_DIR) to avoid colliding with the directory that Bazel uses by # default. string(MD5 PROJECT_BINARY_DIR_MD5 "${PROJECT_BINARY_DIR_REALPATH}") set(BAZEL_OUTPUT_BASE "${BAZEL_OUTPUT_BASE}/_bazel_$ENV{USER}/${PROJECT_BINARY_DIR_MD5}" ) function(generate_external_repository_file OUTPUT) set(out_path ${CMAKE_CURRENT_BINARY_DIR}/external/workspace/${OUTPUT}) if(ARGN) file(GENERATE OUTPUT ${out_path} INPUT ${CMAKE_CURRENT_SOURCE_DIR}/cmake/external/workspace/${ARGN}) else() file(GENERATE OUTPUT ${out_path} CONTENT "") endif() endfunction() # Symlinks the C++ include path for TARGET as workspace/NAME/include, e.g. # workspace/eigen/include -> .../build/install/include/eigen3 function(symlink_external_repository_includes NAME TARGET) get_target_property(include_dir ${TARGET} INTERFACE_INCLUDE_DIRECTORIES) set(workspace ${CMAKE_CURRENT_BINARY_DIR}/external/workspace) file(MAKE_DIRECTORY ${workspace}/${NAME}) file(CREATE_LINK ${include_dir} ${workspace}/${NAME}/include SYMBOLIC) endfunction() # Symlinks the C++ libraries for TARGET as workspace/NAME/lib/*, e.g. # workspace/fmt/lib/libfmt.so.6.1.2 -> .../build/install/lib/fmt/libfmt.so.6.1.2 # workspace/fmt/lib/libfmt.so.6 -> .../build/install/lib/fmt/libfmt.so.6.1.2 function(symlink_external_repository_libs NAME TARGET) set(workspace "${CMAKE_CURRENT_BINARY_DIR}/external/workspace") file(MAKE_DIRECTORY "${workspace}/${NAME}/lib") # Link the full library name (i.e., libfmt.so.6.1.2 in the case of shared). get_target_property(location ${TARGET} LOCATION_${CMAKE_BUILD_TYPE}) if(NOT location) message(FATAL_ERROR "Target ${TARGET} has no library in LOCATION_${CMAKE_BUILD_TYPE}") endif() get_filename_component(basename "${location}" NAME) file(CREATE_LINK "${location}" "${workspace}/${NAME}/lib/${basename}" SYMBOLIC) # Link the SONAME spelling in case of shared libraries. # If the basename does not match this pattern, this part is all a no-op. string(REGEX REPLACE "(\\.so\\.[0-9]+)\\.[0-9]+\\.[0-9]+$" "\\1" other_basename "${basename}") string(REGEX REPLACE "(\\.[0-9]+)\\.[0-9]+\\.[0-9]+\\.dylib$" "\\1.dylib" other_basename "${other_basename}") file(CREATE_LINK "${location}" "${workspace}/${NAME}/lib/${other_basename}" SYMBOLIC) endfunction() set(BAZEL_WORKSPACE_EXTRA) set(BAZEL_WORKSPACE_EXCLUDES) macro(override_repository NAME) set(repo "${CMAKE_CURRENT_BINARY_DIR}/external/workspace/${NAME}") string(APPEND BAZEL_WORKSPACE_EXTRA "local_repository(name = '${NAME}', path = '${repo}')\n") list(APPEND BAZEL_WORKSPACE_EXCLUDES "${NAME}") endmacro() option(WITH_USER_EIGEN "Use user-provided Eigen3" OFF) if(WITH_USER_EIGEN) find_package(Eigen3 CONFIG REQUIRED) symlink_external_repository_includes(eigen Eigen3::Eigen) generate_external_repository_file(eigen/WORKSPACE) generate_external_repository_file( eigen/BUILD.bazel eigen/BUILD.bazel.in) override_repository(eigen) endif() option(WITH_USER_FMT "Use user-provided fmt" OFF) if(WITH_USER_FMT) find_package(fmt CONFIG REQUIRED) symlink_external_repository_includes(fmt fmt::fmt) symlink_external_repository_libs(fmt fmt::fmt) generate_external_repository_file(fmt/WORKSPACE) generate_external_repository_file( fmt/BUILD.bazel fmt/BUILD.bazel.in) override_repository(fmt) endif() option(WITH_USER_SPDLOG "Use user-provided spdlog" OFF) if(WITH_USER_SPDLOG) if(NOT WITH_USER_FMT) message(FATAL_ERROR "User-provided spdlog (WITH_USER_SPDLOG) " "requires user-provided fmt (WITH_USER_FMT).") endif() find_package(spdlog CONFIG REQUIRED) symlink_external_repository_includes(spdlog spdlog::spdlog) symlink_external_repository_libs(spdlog spdlog::spdlog) generate_external_repository_file(spdlog/WORKSPACE) generate_external_repository_file( spdlog/BUILD.bazel spdlog/BUILD.bazel.in) override_repository(spdlog) endif() set(BAZEL_CONFIG) option(WITH_GUROBI "Build with support for Gurobi" OFF) if(WITH_GUROBI) find_package(Gurobi 10.0 EXACT MODULE REQUIRED) string(APPEND BAZEL_CONFIG " --config=gurobi") if(NOT APPLE) get_filename_component(GUROBI_HOME "${Gurobi_INCLUDE_DIRS}" DIRECTORY) string(APPEND BAZEL_REPO_ENV " --repo_env=GUROBI_HOME=${GUROBI_HOME}") endif() endif() option(WITH_MOSEK "Build with support for MOSEK" OFF) if(WITH_MOSEK) string(APPEND BAZEL_CONFIG " --config=mosek") endif() option(WITH_OPENMP "Build with support for OpenMP" OFF) if(WITH_OPENMP) string(APPEND BAZEL_CONFIG " --config=omp") endif() set(WITH_ROBOTLOCOMOTION_SNOPT OFF CACHE BOOL "Build with support for SNOPT using the RobotLocomotion/snopt private GitHub repository" ) set(WITH_SNOPT OFF CACHE BOOL "Build with support for SNOPT using a SNOPT source archive at SNOPT_PATH" ) if(WITH_ROBOTLOCOMOTION_SNOPT AND WITH_SNOPT) message(FATAL_ERROR "WITH_ROBOTLOCOMOTION_SNOPT and WITH_SNOPT options are mutually exclusive" ) endif() if(WITH_ROBOTLOCOMOTION_SNOPT OR WITH_SNOPT) enable_language(Fortran) if(CMAKE_Fortran_COMPILER_ID STREQUAL GNU) if(CMAKE_Fortran_COMPILER_VERSION VERSION_LESS ${MINIMUM_GNU_VERSION}) message(FATAL_ERROR "Compilation with gfortran ${CMAKE_Fortran_COMPILER_VERSION} is NOT " "supported" ) endif() else() message(WARNING "Compilation with ${CMAKE_Fortran_COMPILER_ID} is NOT supported. " "Compilation of project drake_cxx_python may fail." ) endif() string(APPEND BAZEL_CONFIG " --config=snopt") if(WITH_ROBOTLOCOMOTION_SNOPT) string(APPEND BAZEL_REPO_ENV " --repo_env=SNOPT_PATH=git") else() set(SNOPT_PATH SNOPT_PATH-NOTFOUND CACHE FILEPATH "Path to SNOPT source archive" ) if(NOT EXISTS "${SNOPT_PATH}") message(FATAL_ERROR "SNOPT source archive was NOT found at '${SNOPT_PATH}'" ) endif() mark_as_advanced(SNOPT_PATH) string(APPEND BAZEL_REPO_ENV " --repo_env=SNOPT_PATH=${SNOPT_PATH}") endif() endif() if(BUILD_TYPE_LOWER STREQUAL debug) string(APPEND BAZEL_CONFIG " --config=Debug") elseif(BUILD_TYPE_LOWER STREQUAL minsizerel) string(APPEND BAZEL_CONFIG " --config=MinSizeRel") elseif(BUILD_TYPE_LOWER STREQUAL release) string(APPEND BAZEL_CONFIG " --config=Release") elseif(BUILD_TYPE_LOWER STREQUAL relwithdebinfo) string(APPEND BAZEL_CONFIG " --config=RelWithDebInfo") endif() # N.B. If you are testing the CMake API and making changes to `installer.py`, # you can change this target to something more lightweight, such as # `//tools/install/dummy:install`. set(BAZEL_INSTALL_TARGET //:install) if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "${PROJECT_BINARY_DIR}/install" CACHE STRING "Install path prefix, prepended onto install directories" FORCE ) endif() set(BAZEL_INSTALL_ARGS "\${CMAKE_INSTALL_PREFIX}") if(CMAKE_COLOR_MAKEFILE) list(INSERT BAZEL_INSTALL_ARGS 0 "--color") endif() if(CMAKE_INSTALL_NAME_TOOL) list(INSERT BAZEL_INSTALL_ARGS 0 "--install_name_tool" "${CMAKE_INSTALL_NAME_TOOL}" ) endif() if(CMAKE_STRIP) list(INSERT BAZEL_INSTALL_ARGS 0 "--strip_tool" "${CMAKE_STRIP}") endif() # If CMAKE_BUILD_TYPE is Debug or RelWithDebInfo, do NOT strip symbols during # install. if(BUILD_TYPE_LOWER MATCHES "^(debug|relwithdebinfo)$") # SNOPT has restrictions for redistribution given that we are statically # linking it in. if(WITH_SNOPT OR WITH_ROBOTLOCOMOTION_SNOPT) message(WARNING "Install configurations Debug and RelWithDebInfo will STILL strip " "symbols because support for SNOPT is enabled" ) else() list(INSERT BAZEL_INSTALL_ARGS 0 --no_strip) endif() endif() set(BAZELRC_IMPORT) foreach(import IN LISTS BAZELRC_IMPORTS) string(APPEND BAZELRC_IMPORT "import ${PROJECT_SOURCE_DIR}/${import}\n") endforeach() # We need to run Bazel in a dedicated temporary directory. The particular # name `drake_build_cwd` isn't important, it just needs to be unique. Note, # however, that the macOS wheel builds also need to know this path, so if it # ever changes, tools/wheel/macos/build-wheel.sh will also need to be updated. configure_file(cmake/bazel.rc.in drake_build_cwd/.bazelrc @ONLY) configure_file(cmake/WORKSPACE.in drake_build_cwd/WORKSPACE.bazel @ONLY) file(CREATE_LINK "${PROJECT_SOURCE_DIR}/.bazeliskrc" drake_build_cwd/.bazeliskrc SYMBOLIC) find_package(Git) set(GIT_DIR "${PROJECT_SOURCE_DIR}/.git") execute_process( COMMAND "${Bazel_EXECUTABLE}" info --announce_rc WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/drake_build_cwd" ) set(GENERATE_DRAKE_VERSION_ARGS) if(DEFINED DRAKE_VERSION_OVERRIDE) list(APPEND GENERATE_DRAKE_VERSION_ARGS "-DDRAKE_VERSION_OVERRIDE=${DRAKE_VERSION_OVERRIDE}") endif() if(DEFINED DRAKE_GIT_SHA_OVERRIDE) list(APPEND GENERATE_DRAKE_VERSION_ARGS "-DDRAKE_GIT_SHA_OVERRIDE=${DRAKE_GIT_SHA_OVERRIDE}") endif() add_custom_target(drake_version ALL COMMAND "${CMAKE_COMMAND}" ${GENERATE_DRAKE_VERSION_ARGS} "-DGIT_DIR=${GIT_DIR}" "-DGIT_EXECUTABLE=${GIT_EXECUTABLE}" "-DINPUT_FILE=${PROJECT_SOURCE_DIR}/tools/install/libdrake/VERSION.TXT.in" "-DOUTPUT_FILE=${PROJECT_BINARY_DIR}/VERSION.TXT" -P "${PROJECT_SOURCE_DIR}/tools/install/libdrake/generate_version.cmake" ) add_custom_target(drake_cxx_python ALL COMMAND "${Bazel_EXECUTABLE}" build ${BAZEL_INSTALL_TARGET} WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/drake_build_cwd" USES_TERMINAL ) install(CODE "execute_process( COMMAND \"${Bazel_EXECUTABLE}\" run ${BAZEL_INSTALL_TARGET} -- ${BAZEL_INSTALL_ARGS} WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}/drake_build_cwd\" )" ALL_COMPONENTS ) install(FILES "${PROJECT_BINARY_DIR}/VERSION.TXT" DESTINATION share/doc/drake)
0
/home/johnshepherd
/home/johnshepherd/drake/CONTRIBUTING.md
### Contributing code If you have improvements to Drake, send us your pull requests! Please see our developer's page for details: * `doc/_pages/developers.rst` * [online version](https://drake.mit.edu/developers.html)
0
/home/johnshepherd
/home/johnshepherd/drake/CTestConfig.cmake
# -*- mode: cmake -*- # vi: set ft=cmake : set(CTEST_PROJECT_NAME drake) set(CTEST_NIGHTLY_START_TIME "00:00:00 EST") set(CTEST_DROP_METHOD https) set(CTEST_DROP_SITE drake-cdash.csail.mit.edu) set(CTEST_DROP_LOCATION "/submit.php?project=${CTEST_PROJECT_NAME}") set(CTEST_DROP_SITE_CDASH ON)
0
/home/johnshepherd
/home/johnshepherd/drake/BUILD.bazel
# This file is named BUILD.bazel instead of the more typical BUILD, so that on # OSX it won't conflict with a build artifacts directory named "build". load("//tools/install:install.bzl", "install", "install_test") load("//tools/lint:lint.bzl", "add_lint_tests") load("//tools/skylark:py.bzl", "py_library") package( default_visibility = ["//visibility:public"], ) exports_files([ "CPPLINT.cfg", ".bazelproject", ".clang-format", ".drake-find_resource-sentinel", "package.xml", ]) # Drake's top-level module; all drake_py_stuff rules add this to deps. # (We use py_library here because drake_py_library would be circular.) # This file should NOT be installed (see commits in __init__.py). py_library( name = "module_py", srcs = ["__init__.py"], ) # Expose shared library for (a) installed binaries, (b) Drake Python bindings, # and (c) downstream C++ libraries which will also provide Python bindings. alias( name = "drake_shared_library", actual = "//tools/install/libdrake:drake_shared_library", visibility = ["//visibility:public"], ) # A manually-curated collection of most model files in Drake, so that we can # easily provide access to them for tools like //tools:model_visualizer. filegroup( name = "all_models", data = [ "//bindings/pydrake/multibody:models", "//examples/acrobot:models", "//examples/hardware_sim:demo_data", "//examples/hydroelastic/ball_plate:models", "//examples/hydroelastic/python_ball_paddle:models", "//examples/hydroelastic/python_nonconvex_mesh:models", "//examples/hydroelastic/spatula_slip_control:models", "//examples/kuka_iiwa_arm/models", "//examples/multibody/cart_pole:models", "//examples/multibody/deformable:models", "//examples/multibody/four_bar:models", "//examples/pendulum:models", "//examples/planar_gripper:models", "//examples/quadrotor:models", "//examples/scene_graph:models", "//examples/simple_gripper:models", "//multibody/benchmarks/acrobot:models", "@drake_models", ], visibility = ["//:__subpackages__"], ) # A manually-curated collection of some test model files in Drake, for use by # //tools:model_visualizer_private. filegroup( name = "some_test_models", testonly = True, data = [ # It's okay to add more items to this list, as needed. "//geometry/render:test_models", "//manipulation/util:test_models", "//manipulation/util:test_directives", "//multibody/parsing:test_models", "//geometry:test_obj_files", "//geometry:test_stl_files", "//geometry:test_vtk_files", "//geometry:environment_maps", "//geometry/render_gltf_client:merge_resources", "//geometry/render_gltf_client:gltf_client_test_models", ], visibility = ["//tools:__pkg__"], ) # To create a manifest of all installed files for use by drake_bazel_installed, # we declare an install target that contains almost everything -- but it can't # contain the bazel logic that is generated based on the manifest, so we'll add # that in below in the final :install target. install( name = "all_install_targets_except_bazel", data = ["package.xml"], docs = ["LICENSE.TXT"], visibility = ["//tools/install/bazel:__pkg__"], deps = [ "//bindings/pydrake:install", "//common:install", "//examples:install", "//geometry:install", "//lcmtypes:install", "//multibody/parsing:install", "//setup:install", "//tools/install/libdrake:install", "//tools/workspace:install_external_packages", "//tutorials:install", ], ) _INSTALL_TEST_COMMANDS = "install_test_commands" install( name = "install", install_tests_script = _INSTALL_TEST_COMMANDS, deps = [ ":all_install_targets_except_bazel", "//tools/install/bazel:install", ], ) install_test( name = "install_test", args = ["--install_tests_filename=$(location :{})".format( _INSTALL_TEST_COMMANDS, )], data = [ ":install", _INSTALL_TEST_COMMANDS, ], tags = [ # Running acceptance tests under coverage (kcov) probably burns more CI # time and flakiness compared to any upside. "no_kcov", # Running acceptance tests under Valgrind tools is extremely slow and # of limited value, so skip them. "no_valgrind_tools", ], ) add_lint_tests( bazel_lint_extra_srcs = glob( [ "cmake/external/workspace/**/*.bazel.in", "cmake/external/workspace/**/*.bzl", ], allow_empty = False, ), )
0
/home/johnshepherd
/home/johnshepherd/drake/README.md
# Drake Model-Based Design and Verification for Robotics. Please see the [Drake Documentation](https://drake.mit.edu) for more information.
0
/home/johnshepherd
/home/johnshepherd/drake/.bazelignore
debian
0
/home/johnshepherd
/home/johnshepherd/drake/.clang-tidy
--- # This file is not used by CI and the checks included are not part of the Drake style guide Checks: > clang-analyzer-*, clang-diagnostic-*, cppcoreguidelines-*, google-*, modernize-*, performance-*, readability-*, -cppcoreguidelines-pro-bounds-array-to-pointer-decay, -cppcoreguidelines-pro-bounds-pointer-arithmetic, -cppcoreguidelines-pro-type-static-cast-downcast, -modernize-use-bool-literals, -modernize-use-transparent-functors, -modernize-use-using, -readability-else-after-return, -readability-named-parameter, CheckOptions: - { key: readability-identifier-naming.ClassCase, value: CamelCase } - { key: readability-identifier-naming.NamespaceCase, value: lower_case } - { key: readability-identifier-naming.PrivateMemberSuffix, value: '_' } - { key: readability-identifier-naming.StructCase, value: CamelCase } - { key: readability-identifier-naming.VariableCase, value: lower_case } ...
0
/home/johnshepherd
/home/johnshepherd/drake/LICENSE.TXT
All components of Drake are licensed under the BSD 3-Clause License shown below. Where noted in the source code, some portions may be subject to other permissive, non-viral licenses. Copyright 2012-2022 Robot Locomotion Group @ CSAIL All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the Massachusetts Institute of Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0
/home/johnshepherd
/home/johnshepherd/drake/.editorconfig
# This is drake's EditorConfig file. It allows users to have per-project coding # styles. For more information, see http://editorconfig.org/ # # top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] charset = utf-8 end_of_line = lf indent_size = 2 indent_style = space insert_final_newline = true trim_trailing_whitespace = true max_line_length = 80 [*.md] trim_trailing_whitespace = false [*.{bazel,bzl,py}] indent_size = 4 max_line_length = 79
0
/home/johnshepherd
/home/johnshepherd/drake/.bazelproject
# This is the default project view file for CLion. It describes which # directories and targets CLion should traverse when ingesting the Bazel build. # # Developers who only wish to work on a subset of Drake may maintain custom # project views locally. The more narrowly scoped the project view, the faster # CLion indexing will be. Restricted project views of general interest may also # be committed to this directory, with file names of the form foo.bazelproject. # # Detailed documentation for the file format is available at # https://ij.bazel.build/docs/project-views.html directories: . -build targets: //...:all build_flags: --experimental_google_legacy_api
0
/home/johnshepherd
/home/johnshepherd/drake/.clang-format
# -*- yaml -*- # This file determines clang-format's style settings; for details, refer to # http://clang.llvm.org/docs/ClangFormatStyleOptions.html BasedOnStyle: Google Language: Cpp # Force pointers to the type for C++. DerivePointerAlignment: false PointerAlignment: Left # Compress functions onto a single line (when they fit) iff they are defined # inline (inside a of class) or are empty. AllowShortFunctionsOnASingleLine: Inline # Compress lambdas onto a single line iff they are empty. AllowShortLambdasOnASingleLine: Empty # Specify the #include statement order. This implements the order mandated by # the Google C++ Style Guide: related header, C headers, C++ headers, library # headers, and finally the project headers. # # To obtain updated lists of system headers used in the below expressions, see: # http://stackoverflow.com/questions/2027991/list-of-standard-header-files-in-c-and-c/2029106#2029106. IncludeCategories: # Spacers used by drake/tools/formatter.py. - Regex: '^<clang-format-priority-15>$' Priority: 15 - Regex: '^<clang-format-priority-25>$' Priority: 25 - Regex: '^<clang-format-priority-35>$' Priority: 35 - Regex: '^<clang-format-priority-45>$' Priority: 45 # C system headers. The header_dependency_test.py contains a copy of this # list; be sure to update that test anytime this list changes. - Regex: '^[<"](aio|arpa/inet|assert|complex|cpio|ctype|curses|dirent|dlfcn|errno|fcntl|fenv|float|fmtmsg|fnmatch|ftw|glob|grp|iconv|inttypes|iso646|langinfo|libgen|limits|locale|math|monetary|mqueue|ndbm|netdb|net/if|netinet/in|netinet/tcp|nl_types|poll|pthread|pwd|regex|sched|search|semaphore|setjmp|signal|spawn|stdalign|stdarg|stdatomic|stdbool|stddef|stdint|stdio|stdlib|stdnoreturn|string|strings|stropts|sys/ipc|syslog|sys/mman|sys/msg|sys/resource|sys/select|sys/sem|sys/shm|sys/socket|sys/stat|sys/statvfs|sys/time|sys/times|sys/types|sys/uio|sys/un|sys/utsname|sys/wait|tar|term|termios|tgmath|threads|time|trace|uchar|ulimit|uncntrl|unistd|utime|utmpx|wchar|wctype|wordexp)\.h[">]$' Priority: 20 # C++ system headers (as of C++23). The header_dependency_test.py contains a # copy of this list; be sure to update that test anytime this list changes. - Regex: '^[<"](algorithm|any|array|atomic|barrier|bit|bitset|cassert|ccomplex|cctype|cerrno|cfenv|cfloat|charconv|chrono|cinttypes|ciso646|climits|clocale|cmath|codecvt|compare|complex|concepts|condition_variable|coroutine|csetjmp|csignal|cstdalign|cstdarg|cstdbool|cstddef|cstdint|cstdio|cstdlib|cstring|ctgmath|ctime|cuchar|cwchar|cwctype|deque|exception|execution|expected|filesystem|flat_map|flat_set|format|forward_list|fstream|functional|future|generator|initializer_list|iomanip|ios|iosfwd|iostream|istream|iterator|latch|limits|list|locale|map|mdspan|memory|memory_resource|mutex|new|numbers|numeric|optional|ostream|print|queue|random|ranges|ratio|regex|scoped_allocator|semaphore|set|shared_mutex|source_location|span|spanstream|sstream|stack|stacktrace|stdexcept|stdfloat|stop_token|streambuf|string|string_view|strstream|syncstream|system_error|thread|tuple|type_traits|typeindex|typeinfo|unordered_map|unordered_set|utility|valarray|variant|vector|version)[">]$' Priority: 30 # Other libraries' h files (with angles). - Regex: '^<' Priority: 40 # Your project's h files. - Regex: '^"drake' Priority: 50 # Other libraries' h files (with quotes). - Regex: '^"' Priority: 40
0
/home/johnshepherd
/home/johnshepherd/drake/.bazelrc
# 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 # Try to import user-specific configuration local to workspace. try-import %workspace%/user.bazelrc
0
/home/johnshepherd
/home/johnshepherd/drake/__init__.py
# It confusing to have both drake-the-workspace and drake-the-lcmtypes-package # on sys.path at the same time via Bazel's py_library(imports = ...). # # To prevent that confusion, and possibly also import errors, in our # //lcmtypes:lcmtypes_drake_py rule we use add_current_package_to_imports = # False, and then here in drake-the-workspace's package initialization we use # __path__ editing to fold the two directories into the same package. # # We need to do it on a best-effort basis, because not all of our py_binary # rules use lcmtypes -- sometimes the lcmtypes will be absent from runfiles. # # Note that this file should NOT be installed (`//:install` should not touch # it). The `//lcmtypes`-supplied init file is the correct file to install. try: import drake.lcmtypes __path__.append(list(drake.lcmtypes.__path__)[0] + "/drake") from drake.lcmtypes.drake import * except ImportError: pass
0
/home/johnshepherd
/home/johnshepherd/drake/WORKSPACE
# This file marks a workspace root for the Bazel build system. # See `https://bazel.build/`. workspace(name = "drake") load("//tools/workspace:default.bzl", "add_default_workspace") add_default_workspace() load("@build_bazel_apple_support//crosstool:setup.bzl", "apple_cc_configure") apple_cc_configure() # Add some special heuristic logic for using CLion with Drake. load("//tools/clion:repository.bzl", "drake_clion_environment") drake_clion_environment() load("@bazel_skylib//lib:versions.bzl", "versions") # This needs to be in WORKSPACE or a repository rule for native.bazel_version # to actually be defined. The minimum_bazel_version value should match the # version passed to the find_package(Bazel) call in the root CMakeLists.txt. versions.check(minimum_bazel_version = "6.0") # The cargo_universe programs are only used by Drake's new_release tooling, not # by any compilation rules. As such, we can put it directly into the WORKSPACE # instead of into our `//tools/workspace:default.bzl` repositories. load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies") # noqa crate_universe_dependencies(bootstrap = True)
0
/home/johnshepherd
/home/johnshepherd/drake/package.xml
<?xml version="1.0"?> <?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> <package format="2"> <name>drake</name> <version>0.0.0</version> <description> Model-Based Design and Verification for Robotics. </description> <maintainer email="drake-users@mit.edu">Drake Users</maintainer> <license>BSD</license> </package>
0
/home/johnshepherd
/home/johnshepherd/drake/.bazeliskrc
# When bazelisk in use (as is typical, per Drake install_prereqs), this dotfile # specifies which version of Bazel should be used to build and test Drake. USE_BAZEL_VERSION=7.1.1 # For some reason the google mirrors are very flaky in Drake CI in EC2, so # we'll point to the GitHub mirrors instead. BAZELISK_BASE_URL=https://github.com/bazelbuild/bazel/releases/download
0
/home/johnshepherd
/home/johnshepherd/drake/CTestCustom.cmake.in
# -*- mode: cmake -*- # vi: set ft=cmake : list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE ".*/test/.*" ".*/third_party/.*" ) string(ASCII 27 ESC) # Note that due to limitations in the CMake language there may only be one # element in each list containing mismatched opening square brackets # (i.e., [ without matching ]) and that element must be the last element of the # list. # "DEBUG" emitted by Bazel may be colored yellow (CSI 33m), "WARNING" emitted # by Bazel may be colored magenta (CSI 35m), and "warning" emitted by Clang may # be colored magenta (CSI 35m) and bolded (CSI 1m). list(APPEND CTEST_CUSTOM_ERROR_EXCEPTION "^DEBUG: " ": DrakeDeprecationWarning: " ": SyntaxWarning: invalid escape sequence " "^WARNING: " ": warning: " ":[0-9]+: Failure$" "(^${ESC}\\[33mDEBUG|^${ESC}\\[35mWARNING|: ${ESC}\\[0m${ESC}\\[0\;1\;35mwarning): ${ESC}\\[0m" ) # "ERROR" emitted by Bazel may be colored red (CSI 31m) and bolded (CSI 1m). list(APPEND CTEST_CUSTOM_ERROR_MATCH "^ERROR: " "^${ESC}\\[31m${ESC}\\[1mERROR: ${ESC}\\[0m" ) # Ignore various Mac CROSSTOOL-related warnings. list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION "ranlib: file: .* has no symbols" "ranlib: warning for library: .* the table of contents is empty \\(no object file members in the library define global symbols\\)" "warning: argument unused during compilation: '-pie' \\[-Wunused-command-line-argument\\]" "warning: '_FORTIFY_SOURCE' macro redefined \\[-Wmacro-redefined\\]" ) # "WARNING" emitted by Bazel may be colored magenta (CSI 35m) and "warning" # emitted by Clang may be colored magenta (CSI 35m) and bolded (CSI 1m). list(APPEND CTEST_CUSTOM_WARNING_MATCH ": DrakeDeprecationWarning: " "^WARNING: " ": warning: " "(^${ESC}\\[35mWARNING|: ${ESC}\\[0m${ESC}\\[0\;1\;35mwarning): ${ESC}\\[0m" ) set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS 100) set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 100)
0
/home/johnshepherd
/home/johnshepherd/drake/.drake-find_resource-sentinel
This file is used as a sentinel to anchor the implementation of FindResource.
0
/home/johnshepherd
/home/johnshepherd/drake/CPPLINT.cfg
# Copyright 2016 Robot Locomotion Group @ CSAIL. All rights reserved. # # All components of Drake are licensed under the BSD 3-Clause License. # See LICENSE.TXT or https://drake.mit.edu/ for details. # Stop searching for additional config files. set noparent # Disable a warning about C++ features that were not in the original # C++11 specification (and so might not be well-supported). In the # case of Drake, our supported minimum platforms are new enough that # this warning is irrelevant. filter=-build/c++11 # Drake uses `#pragma once`, not the `#ifndef FOO_H` guard. # https://drake.mit.edu/styleguide/cppguide.html#The__pragma_once_Guard filter=-build/header_guard filter=+build/pragma_once # Disable cpplint's include order. We have our own via //tools:drakelint. filter=-build/include_order # We do not care about the whitespace details of a TODO comment. It is not # relevant for easy grepping, and the GSG does not specify any particular # whitespace style. (We *do* care what the "TODO(username)" itself looks like # because GSG forces a particular style there, but that formatting is covered # by the readability/todo rule, which we leave enabled.) filter=-whitespace/todo # TODO(#1805) Fix this. filter=-legal/copyright # Ignore code that isn't ours. exclude_files=third_party # It's not worth lint-gardening the documentation. exclude_files=doc
0
/home/johnshepherd/drake
/home/johnshepherd/drake/third_party/BUILD.bazel
load("//tools/lint:lint.bzl", "add_lint_tests") package(default_visibility = ["//visibility:public"]) exports_files(glob([ "com_github_bazelbuild_bazelisk/**", "com_github_bazelbuild_rules_python/**", ])) add_lint_tests( bazel_lint_extra_srcs = [ "com_github_bazelbuild_rules_cc/whole_archive.bzl", ], )
0
/home/johnshepherd/drake
/home/johnshepherd/drake/third_party/README.md
The `/third_party` sub-directory contains software that is housed alongside Drake, but was not authored by the Drake developers. It typically has different copyright ownership and licensing terms than the rest of Drake.
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_bazelbuild_rules_python/internal_config_repo.bzl
# Copyright 2023 The Bazel Authors. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Repository to generate configuration settings info from the environment. This handles settings that can't be encoded as regular build configuration flags, such as globals available to Bazel versions, or propagating user environment settings for rules to later use. """ _ENABLE_PYSTAR_ENVVAR_NAME = "RULES_PYTHON_ENABLE_PYSTAR" _ENABLE_PYSTAR_DEFAULT = "1" _CONFIG_TEMPLATE = """\ config = struct( enable_pystar = {enable_pystar}, ) """ # The py_internal symbol is only accessible from within @rules_python, so we have to # load it from there and re-export it so that rules_python can later load it. _PY_INTERNAL_SHIM = """\ load("@rules_python//tools/build_defs/python/private:py_internal_renamed.bzl", "py_internal_renamed") py_internal_impl = py_internal_renamed """ ROOT_BUILD_TEMPLATE = """\ load("@bazel_skylib//:bzl_library.bzl", "bzl_library") package( default_visibility = [ "{visibility}", ] ) bzl_library( name = "rules_python_config_bzl", srcs = ["rules_python_config.bzl"] ) bzl_library( name = "py_internal_bzl", srcs = ["py_internal.bzl"], deps = [{py_internal_dep}], ) """ def _internal_config_repo_impl(rctx): pystar_requested = _bool_from_environ(rctx, _ENABLE_PYSTAR_ENVVAR_NAME, _ENABLE_PYSTAR_DEFAULT) # Bazel 7+ (dev and later) has native.starlark_doc_extract, and thus the # py_internal global, which are necessary for the pystar implementation. if pystar_requested and hasattr(native, "starlark_doc_extract"): enable_pystar = pystar_requested else: enable_pystar = False rctx.file("rules_python_config.bzl", _CONFIG_TEMPLATE.format( enable_pystar = enable_pystar, )) if enable_pystar: shim_content = _PY_INTERNAL_SHIM py_internal_dep = '"@rules_python//tools/build_defs/python/private:py_internal_renamed_bzl"' else: shim_content = "py_internal_impl = None\n" py_internal_dep = "" # Bazel 5 doesn't support repository visibility, so just use public # as a stand-in if native.bazel_version.startswith("5."): visibility = "//visibility:public" else: visibility = "@rules_python//:__subpackages__" rctx.file("BUILD", ROOT_BUILD_TEMPLATE.format( py_internal_dep = py_internal_dep, visibility = visibility, )) rctx.file("py_internal.bzl", shim_content) return None internal_config_repo = repository_rule( implementation = _internal_config_repo_impl, environ = [_ENABLE_PYSTAR_ENVVAR_NAME], ) def _bool_from_environ(rctx, key, default): return bool(int(rctx.os.environ.get(key, default)))
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_bazelbuild_rules_python/LICENSE
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_bazelbuild_rules_cc/whole_archive.bzl
# Copyright 2019 The Bazel Authors. All rights reserved. # Copyright 2019 Toyota Research Institute. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # This function is forked and modified from bazelbuild/rules_cc as of: # https://github.com/bazelbuild/rules_cc/blob/262ebec/cc/find_cc_toolchain.bzl def _find_cc_toolchain(ctx): # Check the incompatible flag for toolchain resolution. if hasattr(cc_common, "is_cc_toolchain_resolution_enabled_do_not_use") and cc_common.is_cc_toolchain_resolution_enabled_do_not_use(ctx = ctx): # noqa valid_names = [ # The name for Bazel 6 and earlier. "//cc:toolchain_type", # The name for Bazel 7 and after. "@@bazel_tools//tools/cpp:toolchain_type", ] for possible_name in valid_names: if possible_name in ctx.toolchains: info = ctx.toolchains[possible_name] if all([ hasattr(info, x) for x in ["cc_provider_in_toolchain", "cc"] ]): # This logic is cherry-picked from upstream d5d830b. return info.cc return info fail("In order to use find_cc_toolchain, your rule has to depend on C++ toolchain. See find_cc_toolchain.bzl docs for details.") # noqa # Fall back to the legacy implicit attribute lookup. if hasattr(ctx.attr, "_cc_toolchain"): return ctx.attr._cc_toolchain[cc_common.CcToolchainInfo] # We didn't find anything. fail("In order to use find_cc_toolchain, your rule has to depend on C++ toolchain. See find_cc_toolchain.bzl docs for details.") # noqa # This function was inspired by bazelbuild/rules_cc as of: # https://github.com/bazelbuild/rules_cc/blob/262ebec3c2296296526740db4aefce68c80de7fa/examples/my_c_archive/my_c_archive.bzl def _cc_whole_archive_library_impl(ctx): # Find the C++ toolchain. cc_toolchain = _find_cc_toolchain(ctx) feature_configuration = cc_common.configure_features( ctx = ctx, cc_toolchain = cc_toolchain, requested_features = ctx.features, unsupported_features = ctx.disabled_features, ) # Iterate over the transitive list of libraries we want to link, adding # `alwayslink = True` to each one. deps_cc_infos = cc_common.merge_cc_infos( cc_infos = [dep[CcInfo] for dep in ctx.attr.deps], ) old_linker_inputs = deps_cc_infos.linking_context.linker_inputs.to_list() # noqa new_linker_inputs = [] for old_linker_input in old_linker_inputs: old_libraries = old_linker_input.libraries new_libraries = [] for old_library in old_libraries: # Objective-C libraries (objc_library(...)) need special treatment. # We want the objc object code itself, but not its redundant copy # of the nearby C++ object code (the "applebin"). is_objc_library = any([ "_objc/non_arc/" in obj.path for obj in old_library.objects ]) static_path = getattr(old_library.static_library, "path", "") if not is_objc_library and "/applebin_macos-darwin" in static_path: # Avoid double-linking from objc_library() deps; see # https://github.com/bazelbuild/rules_apple/issues/1474. continue # Make a new_library (identical to old_library, but always linked). new_library = cc_common.create_library_to_link( actions = ctx.actions, feature_configuration = feature_configuration, cc_toolchain = cc_toolchain, static_library = old_library.static_library, pic_static_library = old_library.pic_static_library, dynamic_library = old_library.resolved_symlink_dynamic_library, # noqa interface_library = old_library.resolved_symlink_interface_library, # noqa # This is where the magic happens! alwayslink = True, ) new_libraries.append(new_library) new_linker_input = cc_common.create_linker_input( owner = ctx.label, libraries = depset(direct = new_libraries), additional_inputs = depset(direct = old_linker_input.additional_inputs), # noqa user_link_flags = depset(direct = old_linker_input.user_link_flags), # noqa ) new_linker_inputs.append(new_linker_input) # Return the CcInfo to pass along to code that wants to link us. linking_context = cc_common.create_linking_context( linker_inputs = depset(direct = new_linker_inputs), ) return [ DefaultInfo( runfiles = ctx.runfiles( collect_data = True, collect_default = True, ), ), CcInfo( compilation_context = deps_cc_infos.compilation_context, linking_context = linking_context, ), ] # Forked and modified from bazelbuild/rules_cc as of: # https://github.com/bazelbuild/rules_cc/blob/262ebec3c2296296526740db4aefce68c80de7fa/examples/my_c_archive/my_c_archive.bzl cc_whole_archive_library = rule( implementation = _cc_whole_archive_library_impl, attrs = { "deps": attr.label_list(providers = [CcInfo]), "_cc_toolchain": attr.label( default = Label("@bazel_tools//tools/cpp:current_cc_toolchain"), ), }, fragments = ["cpp"], toolchains = ["@bazel_tools//tools/cpp:toolchain_type"], ) """Creates an cc_library with `alwayslink = True` added to all of its deps, to work around https://github.com/bazelbuild/bazel/issues/7362 not providing any useful way to create shared libraries from multiple cc_library targets unless you want even statically-linked programs to keep all of their symbols. """
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_bazelbuild_rules_cc/LICENSE
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_bazelbuild_bazelisk/bazelisk.py
#!/usr/bin/env python3 """ Copyright 2018 Google Inc. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import base64 from contextlib import closing import hashlib import json import netrc import os import os.path import platform import re import shutil import subprocess import sys import tempfile import time try: from urllib.parse import urlparse from urllib.request import urlopen, Request from urllib.error import HTTPError except ImportError: # Python 2.x compatibility hack. # http://python-future.org/compatible_idioms.html?highlight=urllib#urllib-module from urlparse import urlparse from urllib2 import urlopen, Request, HTTPError FileNotFoundError = IOError ONE_HOUR = 1 * 60 * 60 LATEST_PATTERN = re.compile(r"latest(-(?P<offset>\d+))?$") LAST_GREEN_COMMIT_BASE_PATH = ( "https://storage.googleapis.com/bazel-untrusted-builds/last_green_commit/" ) LAST_GREEN_COMMIT_PATH_SUFFIXES = { "last_green": "github.com/bazelbuild/bazel.git/bazel-bazel", "last_downstream_green": "downstream_pipeline", } BAZEL_GCS_PATH_PATTERN = ( "https://storage.googleapis.com/bazel-builds/artifacts/{platform}/{commit}/bazel" ) SUPPORTED_PLATFORMS = {"linux": "ubuntu1404", "windows": "windows", "darwin": "macos"} TOOLS_BAZEL_PATH = "./tools/bazel" BAZEL_REAL = "BAZEL_REAL" BAZEL_UPSTREAM = "bazelbuild" def get_env_or_config(name, default=None): """Reads a configuration value from the environment, but falls back to reading it from .bazeliskrc in the workspace root. """ if name in os.environ: return os.environ[name] env_files = [] root = find_workspace_root() if root: env_files.append(os.path.join(root, ".bazeliskrc")) for env_file in env_files: try: with open(env_file, "r") as f: for line in f.readlines(): line = line.split("#", 1)[0].strip() if not line: continue some_name, some_value = line.split("=", 1) if some_name == name: return some_value except Exception: pass return default def decide_which_bazel_version_to_use(): # Check in this order: # - env var "USE_BAZEL_VERSION" is set to a specific version. # - env var "USE_NIGHTLY_BAZEL" or "USE_BAZEL_NIGHTLY" is set -> latest # nightly. (TODO) # - env var "USE_CANARY_BAZEL" or "USE_BAZEL_CANARY" is set -> latest # rc. (TODO) # - the file workspace_root/tools/bazel exists -> that version. (TODO) # - workspace_root/.bazelversion exists -> read contents, that version. # - workspace_root/WORKSPACE contains a version -> that version. (TODO) # - fallback: latest release use_bazel_version = get_env_or_config("USE_BAZEL_VERSION") if use_bazel_version is not None: return use_bazel_version workspace_root = find_workspace_root() if workspace_root: bazelversion_path = os.path.join(workspace_root, ".bazelversion") if os.path.exists(bazelversion_path): with open(bazelversion_path, "r") as f: return f.read().strip() return "latest" def find_workspace_root(root=None): if root is None: root = os.getcwd() for boundary in ["MODULE.bazel", "REPO.bazel", "WORKSPACE.bazel", "WORKSPACE"]: path = os.path.join(root, boundary) if os.path.exists(path) and not os.path.isdir(path): return root new_root = os.path.dirname(root) return find_workspace_root(new_root) if new_root != root else None def resolve_version_label_to_number_or_commit(bazelisk_directory, version): """Resolves the given label to a released version of Bazel or a commit. Args: bazelisk_directory: string; path to a directory that can store temporary data for Bazelisk. version: string; the version label that should be resolved. Returns: A (string, bool) tuple that consists of two parts: 1. the resolved number of a Bazel release (candidate), or the commit of an unreleased Bazel binary, 2. An indicator for whether the returned version refers to a commit. """ suffix = LAST_GREEN_COMMIT_PATH_SUFFIXES.get(version) if suffix: return get_last_green_commit(suffix), True if "latest" in version: match = LATEST_PATTERN.match(version) if not match: raise Exception( 'Invalid version "{}". In addition to using a version ' 'number such as "0.20.0", you can use values such as ' '"latest" and "latest-N", with N being a non-negative ' "integer.".format(version) ) history = get_version_history(bazelisk_directory) offset = int(match.group("offset") or "0") return resolve_latest_version(history, offset), False return version, False def get_last_green_commit(path_suffix): return read_remote_text_file(LAST_GREEN_COMMIT_BASE_PATH + path_suffix).strip() def get_releases_json(bazelisk_directory): """Returns the most recent versions of Bazel, in descending order.""" releases = os.path.join(bazelisk_directory, "releases.json") # Use a cached version if it's fresh enough. if os.path.exists(releases): if abs(time.time() - os.path.getmtime(releases)) < ONE_HOUR: with open(releases, "rb") as f: try: return json.loads(f.read().decode("utf-8")) except ValueError: print("WARN: Could not parse cached releases.json.") pass with open(releases, "wb") as f: body = read_remote_text_file("https://api.github.com/repos/bazelbuild/bazel/releases") f.write(body.encode("utf-8")) return json.loads(body) def read_remote_text_file(url): with closing(urlopen(url)) as res: body = res.read() try: return body.decode(res.info().get_content_charset("iso-8859-1")) except AttributeError: # Python 2.x compatibility hack return body.decode(res.info().getparam("charset") or "iso-8859-1") def get_version_history(bazelisk_directory): return sorted( ( release["tag_name"] for release in get_releases_json(bazelisk_directory) if not release["prerelease"] ), # This only handles versions with numeric components, but that is fine # since prerelease versions have been excluded. key=lambda version: tuple(int(component) for component in version.split('.')), reverse=True, ) def resolve_latest_version(version_history, offset): if offset >= len(version_history): version = "latest-{}".format(offset) if offset else "latest" raise Exception( 'Cannot resolve version "{}": There are only {} Bazel ' "releases.".format(version, len(version_history)) ) # This only works since we store the history in descending order. return version_history[offset] def get_operating_system(): operating_system = platform.system().lower() if operating_system not in ("linux", "darwin", "windows"): raise Exception( 'Unsupported operating system "{}". ' "Bazel currently only supports Linux, macOS and Windows.".format(operating_system) ) return operating_system def determine_executable_filename_suffix(): operating_system = get_operating_system() return ".exe" if operating_system == "windows" else "" def determine_bazel_filename(version): operating_system = get_operating_system() supported_machines = get_supported_machine_archs(version, operating_system) machine = normalized_machine_arch_name() if machine not in supported_machines: raise Exception( 'Unsupported machine architecture "{}". Bazel {} only supports {} on {}.'.format( machine, version, ", ".join(supported_machines), operating_system.capitalize() ) ) filename_suffix = determine_executable_filename_suffix() bazel_flavor = "bazel" if get_env_or_config("BAZELISK_NOJDK", "0") != "0": bazel_flavor = "bazel_nojdk" return "{}-{}-{}-{}{}".format(bazel_flavor, version, operating_system, machine, filename_suffix) def get_supported_machine_archs(version, operating_system): supported_machines = ["x86_64"] versions = version.split(".")[:2] if len(versions) == 2: # released version major, minor = int(versions[0]), int(versions[1]) if ( operating_system == "darwin" and (major > 4 or major == 4 and minor >= 1) or operating_system == "linux" and (major > 3 or major == 3 and minor >= 4) ): # Linux arm64 was supported since 3.4.0. # Darwin arm64 was supported since 4.1.0. supported_machines.append("arm64") elif operating_system in ("darwin", "linux"): # This is needed to run bazelisk_test.sh on Linux and Darwin arm64 machines, which are # becoming more and more popular. # It works because all recent commits of Bazel support arm64 on Darwin and Linux. # However, this would add arm64 by mistake if the commit is too old, which should be # a rare scenario. supported_machines.append("arm64") return supported_machines def normalized_machine_arch_name(): machine = platform.machine().lower() if machine == "amd64": machine = "x86_64" elif machine == "aarch64": machine = "arm64" return machine def determine_url(version, is_commit, bazel_filename): if is_commit: sys.stderr.write("Using unreleased version at commit {}\n".format(version)) # No need to validate the platform thanks to determine_bazel_filename(). return BAZEL_GCS_PATH_PATTERN.format( platform=SUPPORTED_PLATFORMS[platform.system().lower()], commit=version ) # Split version into base version and optional additional identifier. # Example: '0.19.1' -> ('0.19.1', None), '0.20.0rc1' -> ('0.20.0', 'rc1') (version, rc) = re.match(r"(\d*\.\d*(?:\.\d*)?)(rc\d+)?", version).groups() bazelisk_base_url = get_env_or_config("BAZELISK_BASE_URL") if bazelisk_base_url is not None: return "{}/{}/{}".format(bazelisk_base_url, version, bazel_filename) else: return "https://releases.bazel.build/{}/{}/{}".format( version, rc if rc else "release", bazel_filename ) def trim_suffix(string, suffix): if string.endswith(suffix): return string[: len(string) - len(suffix)] else: return string def download_bazel_into_directory(version, is_commit, directory): bazel_filename = determine_bazel_filename(version) bazel_url = determine_url(version, is_commit, bazel_filename) filename_suffix = determine_executable_filename_suffix() bazel_directory_name = trim_suffix(bazel_filename, filename_suffix) destination_dir = os.path.join(directory, bazel_directory_name, "bin") maybe_makedirs(destination_dir) destination_path = os.path.join(destination_dir, "bazel" + filename_suffix) if not os.path.exists(destination_path): download(bazel_url, destination_path) os.chmod(destination_path, 0o755) sha256_path = destination_path + ".sha256" expected_hash = "" if not os.path.exists(sha256_path): try: download(bazel_url + ".sha256", sha256_path) except HTTPError as e: if e.code == 404: sys.stderr.write( "The Bazel mirror does not have a checksum file; skipping checksum verification." ) return destination_path raise e with open(sha256_path, "r") as sha_file: expected_hash = sha_file.read().split()[0] sha256_hash = hashlib.sha256() with open(destination_path, "rb") as bazel_file: for byte_block in iter(lambda: bazel_file.read(4096), b""): sha256_hash.update(byte_block) actual_hash = sha256_hash.hexdigest() if actual_hash != expected_hash: os.remove(destination_path) os.remove(sha256_path) print( "The downloaded Bazel binary is corrupted. Expected SHA-256 {}, got {}. Please try again.".format( expected_hash, actual_hash ) ) # Exiting with a special exit code not used by Bazel, so the calling process may retry based on that. # https://docs.bazel.build/versions/0.21.0/guide.html#what-exit-code-will-i-get sys.exit(22) return destination_path def download(url, destination_path): sys.stderr.write("Downloading {}...\n".format(url)) request = Request(url) if get_env_or_config("BAZELISK_BASE_URL") is not None: parts = urlparse(url) creds = None try: creds = netrc.netrc().hosts.get(parts.netloc) except Exception: pass if creds is not None: auth = base64.b64encode(("%s:%s" % (creds[0], creds[2])).encode("ascii")) request.add_header("Authorization", "Basic %s" % auth.decode("utf-8")) with closing(urlopen(request)) as response, open(destination_path, "wb") as file: shutil.copyfileobj(response, file) def get_bazelisk_directory(): bazelisk_home = get_env_or_config("BAZELISK_HOME") if bazelisk_home is not None: return bazelisk_home operating_system = get_operating_system() base_dir = None if operating_system == "windows": base_dir = os.environ.get("LocalAppData") if base_dir is None: raise Exception("%LocalAppData% is not defined") elif operating_system == "darwin": base_dir = os.environ.get("HOME") if base_dir is None: raise Exception("$HOME is not defined") base_dir = os.path.join(base_dir, "Library/Caches") elif operating_system == "linux": base_dir = os.environ.get("XDG_CACHE_HOME") if base_dir is None: base_dir = os.environ.get("HOME") if base_dir is None: raise Exception("neither $XDG_CACHE_HOME nor $HOME are defined") base_dir = os.path.join(base_dir, ".cache") else: raise Exception("Unsupported operating system '{}'".format(operating_system)) return os.path.join(base_dir, "bazelisk") def maybe_makedirs(path): """ Creates a directory and its parents if necessary. """ try: os.makedirs(path) except OSError as e: if not os.path.isdir(path): raise e def delegate_tools_bazel(bazel_path): """Match Bazel's own delegation behavior in the builds distributed by most package managers: use tools/bazel if it's present, executable, and not this script. """ root = find_workspace_root() if root: wrapper = os.path.join(root, TOOLS_BAZEL_PATH) if os.path.exists(wrapper) and os.access(wrapper, os.X_OK): try: if not os.path.samefile(wrapper, __file__): return wrapper except AttributeError: # Python 2 on Windows does not support os.path.samefile if os.path.abspath(wrapper) != os.path.abspath(__file__): return wrapper return None def prepend_directory_to_path(env, directory): """ Prepend binary directory to PATH """ if "PATH" in env: env["PATH"] = directory + os.pathsep + env["PATH"] else: env["PATH"] = directory def make_bazel_cmd(bazel_path, argv): env = os.environ.copy() wrapper = delegate_tools_bazel(bazel_path) if wrapper: env[BAZEL_REAL] = bazel_path bazel_path = wrapper directory = os.path.dirname(bazel_path) prepend_directory_to_path(env, directory) return { "exec": bazel_path, "args": argv, "env": env, } def execute_bazel(bazel_path, argv): cmd = make_bazel_cmd(bazel_path, argv) # We cannot use close_fds on Windows, so disable it there. p = subprocess.Popen([cmd["exec"]] + cmd["args"], close_fds=os.name != "nt", env=cmd["env"]) while True: try: return p.wait() except KeyboardInterrupt: # Bazel will also get the signal and terminate. # We should continue waiting until it does so. pass def get_bazel_path(): bazelisk_directory = get_bazelisk_directory() maybe_makedirs(bazelisk_directory) bazel_version = decide_which_bazel_version_to_use() bazel_version, is_commit = resolve_version_label_to_number_or_commit( bazelisk_directory, bazel_version ) # TODO: Support other forks just like Go version bazel_directory = os.path.join(bazelisk_directory, "downloads", BAZEL_UPSTREAM) return download_bazel_into_directory(bazel_version, is_commit, bazel_directory) def main(argv=None): if argv is None: argv = sys.argv bazel_path = get_bazel_path() argv = argv[1:] if argv and argv[0] == "--print_env": cmd = make_bazel_cmd(bazel_path, argv) env = cmd["env"] for key in env: print("{}={}".format(key, env[key])) return 0 return execute_bazel(bazel_path, argv) if __name__ == "__main__": sys.exit(main())
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_bazelbuild_bazelisk/LICENSE
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_tensorflow_tensorflow/README.md
These files are copied from https://github.com/tensorflow/tensorflow which is licensed as Apache-2.0.
0
/home/johnshepherd/drake/third_party
/home/johnshepherd/drake/third_party/com_github_tensorflow_tensorflow/LICENSE
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ## Some of TensorFlow's code is derived from Caffe, which is subject to the following copyright notice: COPYRIGHT All contributions by the University of California: Copyright (c) 2014, The Regents of the University of California (Regents) All rights reserved. All other contributions: Copyright (c) 2014, the respective contributors All rights reserved. Caffe uses a shared copyright model: each contributor holds copyright over their contributions to Caffe. The project versioning records all such contribution and copyright details. If a contributor wants to further mark their specific copyright on a particular contribution, they should indicate their copyright solely in the commit message of the change when it is committed. LICENSE Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. CONTRIBUTION AGREEMENT By contributing to the BVLC/caffe repository through pull-request, comment, or otherwise, the contributor releases their content to the license and copyright terms herein.
0
/home/johnshepherd/drake/third_party/com_github_tensorflow_tensorflow/third_party
/home/johnshepherd/drake/third_party/com_github_tensorflow_tensorflow/third_party/jpeg/jpeg.BUILD
# Description: # libjpeg-turbo is a drop in replacement for jpeglib optimized with SIMD. load("@bazel_skylib//rules:expand_template.bzl", "expand_template") load("@bazel_skylib//rules:common_settings.bzl", "string_flag") licenses(["notice"]) # custom notice-style license, see LICENSE.md exports_files(["LICENSE.md"]) WIN_COPTS = [ "/Ox", "-DWITH_SIMD", "-wd4996", ] libjpegturbo_copts = select({ ":android": [ "-O3", "-fPIC", "-w", ], ":windows": WIN_COPTS, "//conditions:default": [ "-O3", "-w", ], }) + select({ ":armeabi-v7a": [ "-D__ARM_NEON__", "-DNEON_INTRINSICS", "-march=armv7-a", "-mfpu=neon", "-mfloat-abi=softfp", "-fprefetch-loop-arrays", ], ":arm64-v8a": [ "-DNEON_INTRINSICS", ], ":linux_ppc64le": [ "-mcpu=power8", "-mtune=power8", ], "//conditions:default": [], }) cc_library( name = "jpeg", srcs = [ "jaricom.c", "jcapimin.c", "jcapistd.c", "jcarith.c", "jccoefct.c", "jccolor.c", "jcdctmgr.c", "jchuff.c", "jchuff.h", "jcinit.c", "jcmainct.c", "jcmarker.c", "jcmaster.c", "jcomapi.c", "jconfig.h", "jconfigint.h", "jcparam.c", "jcphuff.c", "jcprepct.c", "jcsample.c", "jctrans.c", "jdapimin.c", "jdapistd.c", "jdarith.c", "jdatadst.c", "jdatasrc.c", "jdcoefct.c", "jdcoefct.h", "jdcolor.c", "jdct.h", "jddctmgr.c", "jdhuff.c", "jdhuff.h", "jdinput.c", "jdmainct.c", "jdmainct.h", "jdmarker.c", "jdmaster.c", "jdmaster.h", "jdmerge.c", "jdmerge.h", "jdphuff.c", "jdpostct.c", "jdsample.c", "jdsample.h", "jdtrans.c", "jerror.c", "jfdctflt.c", "jfdctfst.c", "jfdctint.c", "jidctflt.c", "jidctfst.c", "jidctint.c", "jidctred.c", "jinclude.h", "jmemmgr.c", "jmemnobs.c", "jmemsys.h", "jpeg_nbits_table.h", "jpegcomp.h", "jquant1.c", "jquant2.c", "jutils.c", "jversion.h", ], hdrs = [ "jccolext.c", # should have been named .inc "jdcol565.c", # should have been named .inc "jdcolext.c", # should have been named .inc "jdmrg565.c", # should have been named .inc "jdmrgext.c", # should have been named .inc "jerror.h", "jmorecfg.h", "jpegint.h", "jpeglib.h", "jstdhuff.c", # should have been named .inc ], copts = libjpegturbo_copts, visibility = ["//visibility:public"], deps = select({ ":nosimd": [":simd_none"], ":k8": [":simd_x86_64"], ":armeabi-v7a": [":simd_armv7a"], ":arm64-v8a": [":simd_armv8a"], ":linux_ppc64le": [":simd_altivec"], ":windows": [":simd_win_x86_64"], "//conditions:default": [":simd_none"], }), ) cc_library( name = "simd_altivec", srcs = [ "jchuff.h", "jconfig.h", "jconfigint.h", "jdct.h", "jerror.h", "jinclude.h", "jmorecfg.h", "jpegint.h", "jpeglib.h", "jsimd.h", "jsimddct.h", "simd/jsimd.h", "simd/powerpc/jccolor-altivec.c", "simd/powerpc/jcgray-altivec.c", "simd/powerpc/jcsample-altivec.c", "simd/powerpc/jdcolor-altivec.c", "simd/powerpc/jdmerge-altivec.c", "simd/powerpc/jdsample-altivec.c", "simd/powerpc/jfdctfst-altivec.c", "simd/powerpc/jfdctint-altivec.c", "simd/powerpc/jidctfst-altivec.c", "simd/powerpc/jidctint-altivec.c", "simd/powerpc/jquanti-altivec.c", "simd/powerpc/jsimd.c", ], hdrs = [ "simd/powerpc/jccolext-altivec.c", "simd/powerpc/jcgryext-altivec.c", "simd/powerpc/jcsample.h", "simd/powerpc/jdcolext-altivec.c", "simd/powerpc/jdmrgext-altivec.c", "simd/powerpc/jsimd_altivec.h", ], copts = libjpegturbo_copts, ) SRCS_SIMD_COMMON = [ "jchuff.h", "jconfig.h", "jconfigint.h", "jdct.h", "jerror.h", "jinclude.h", "jmorecfg.h", "jpegint.h", "jpeglib.h", "jsimddct.h", "jsimd.h", "simd/jsimd.h", ] cc_library( name = "simd_x86_64", srcs = [ "simd/x86_64/jccolor-avx2.o", "simd/x86_64/jccolor-sse2.o", "simd/x86_64/jcgray-avx2.o", "simd/x86_64/jcgray-sse2.o", "simd/x86_64/jchuff-sse2.o", "simd/x86_64/jcphuff-sse2.o", "simd/x86_64/jcsample-avx2.o", "simd/x86_64/jcsample-sse2.o", "simd/x86_64/jdcolor-avx2.o", "simd/x86_64/jdcolor-sse2.o", "simd/x86_64/jdmerge-avx2.o", "simd/x86_64/jdmerge-sse2.o", "simd/x86_64/jdsample-avx2.o", "simd/x86_64/jdsample-sse2.o", "simd/x86_64/jfdctflt-sse.o", "simd/x86_64/jfdctfst-sse2.o", "simd/x86_64/jfdctint-avx2.o", "simd/x86_64/jfdctint-sse2.o", "simd/x86_64/jidctflt-sse2.o", "simd/x86_64/jidctfst-sse2.o", "simd/x86_64/jidctint-avx2.o", "simd/x86_64/jidctint-sse2.o", "simd/x86_64/jidctred-sse2.o", "simd/x86_64/jquantf-sse2.o", "simd/x86_64/jquanti-avx2.o", "simd/x86_64/jquanti-sse2.o", "simd/x86_64/jsimd.c", "simd/x86_64/jsimdcpu.o", ] + SRCS_SIMD_COMMON, copts = libjpegturbo_copts, linkstatic = 1, ) genrule( name = "simd_x86_64_assemblage23", srcs = [ "jconfig.h", "jconfigint.h", "simd/x86_64/jccolext-avx2.asm", "simd/x86_64/jccolext-sse2.asm", "simd/x86_64/jccolor-avx2.asm", "simd/x86_64/jccolor-sse2.asm", "simd/x86_64/jcgray-avx2.asm", "simd/x86_64/jcgray-sse2.asm", "simd/x86_64/jcgryext-avx2.asm", "simd/x86_64/jcgryext-sse2.asm", "simd/x86_64/jchuff-sse2.asm", "simd/x86_64/jcphuff-sse2.asm", "simd/x86_64/jcsample-avx2.asm", "simd/x86_64/jcsample-sse2.asm", "simd/x86_64/jdcolext-avx2.asm", "simd/x86_64/jdcolext-sse2.asm", "simd/x86_64/jdcolor-avx2.asm", "simd/x86_64/jdcolor-sse2.asm", "simd/x86_64/jdmerge-avx2.asm", "simd/x86_64/jdmerge-sse2.asm", "simd/x86_64/jdmrgext-avx2.asm", "simd/x86_64/jdmrgext-sse2.asm", "simd/x86_64/jdsample-avx2.asm", "simd/x86_64/jdsample-sse2.asm", "simd/x86_64/jfdctflt-sse.asm", "simd/x86_64/jfdctfst-sse2.asm", "simd/x86_64/jfdctint-avx2.asm", "simd/x86_64/jfdctint-sse2.asm", "simd/x86_64/jidctflt-sse2.asm", "simd/x86_64/jidctfst-sse2.asm", "simd/x86_64/jidctint-avx2.asm", "simd/x86_64/jidctint-sse2.asm", "simd/x86_64/jidctred-sse2.asm", "simd/x86_64/jquantf-sse2.asm", "simd/x86_64/jquanti-avx2.asm", "simd/x86_64/jquanti-sse2.asm", "simd/x86_64/jsimdcpu.asm", "simd/nasm/jcolsamp.inc", "simd/nasm/jdct.inc", "simd/nasm/jsimdcfg.inc", "simd/nasm/jsimdcfg.inc.h", "simd/nasm/jsimdext.inc", ], outs = [ "simd/x86_64/jccolor-avx2.o", "simd/x86_64/jccolor-sse2.o", "simd/x86_64/jcgray-avx2.o", "simd/x86_64/jcgray-sse2.o", "simd/x86_64/jchuff-sse2.o", "simd/x86_64/jcphuff-sse2.o", "simd/x86_64/jcsample-avx2.o", "simd/x86_64/jcsample-sse2.o", "simd/x86_64/jdcolor-avx2.o", "simd/x86_64/jdcolor-sse2.o", "simd/x86_64/jdmerge-avx2.o", "simd/x86_64/jdmerge-sse2.o", "simd/x86_64/jdsample-avx2.o", "simd/x86_64/jdsample-sse2.o", "simd/x86_64/jfdctflt-sse.o", "simd/x86_64/jfdctfst-sse2.o", "simd/x86_64/jfdctint-avx2.o", "simd/x86_64/jfdctint-sse2.o", "simd/x86_64/jidctflt-sse2.o", "simd/x86_64/jidctfst-sse2.o", "simd/x86_64/jidctint-avx2.o", "simd/x86_64/jidctint-sse2.o", "simd/x86_64/jidctred-sse2.o", "simd/x86_64/jquantf-sse2.o", "simd/x86_64/jquanti-avx2.o", "simd/x86_64/jquanti-sse2.o", "simd/x86_64/jsimdcpu.o", ], cmd = "for out in $(OUTS); do\n" + " $(location @nasm//:nasm) -f elf64" + " -DELF -DPIC -D__x86_64__" + " -I $$(dirname $(location jconfig.h))/" + " -I $$(dirname $(location jconfigint.h))/" + " -I $$(dirname $(location simd/nasm/jsimdcfg.inc.h))/" + " -I $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/" + " -o $$out" + " $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/$$(basename $${out%.o}.asm)\n" + "done", tools = ["@nasm"], ) expand_template( name = "neon-compat_gen", out = "simd/arm/neon-compat.h", substitutions = { "#cmakedefine HAVE_VLD1_S16_X3": "#define HAVE_VLD1_S16_X3", "#cmakedefine HAVE_VLD1_U16_X2": "#define HAVE_VLD1_U16_X2", "#cmakedefine HAVE_VLD1Q_U8_X4": "#define HAVE_VLD1Q_U8_X4", }, template = "simd/arm/neon-compat.h.in", ) genrule( name = "neon-compat_hdr_src", srcs = ["simd/arm/neon-compat.h"], outs = ["neon-compat.h"], cmd = "cp $(location simd/arm/neon-compat.h) $@", ) cc_library( name = "neon-compat_hdr", hdrs = ["neon-compat.h"], copts = libjpegturbo_copts, ) SRCS_SIMD_ARM = [ "simd/arm/jccolor-neon.c", "simd/arm/jcgray-neon.c", "simd/arm/jcphuff-neon.c", "simd/arm/jcsample-neon.c", "simd/arm/jdcolor-neon.c", "simd/arm/jdmerge-neon.c", "simd/arm/jdsample-neon.c", "simd/arm/jfdctfst-neon.c", "simd/arm/jfdctint-neon.c", "simd/arm/jidctfst-neon.c", "simd/arm/jidctint-neon.c", "simd/arm/jidctred-neon.c", "simd/arm/jquanti-neon.c", ] # .c files in the following list are used like .h files in that they are # "#include"-ed in the actual .c files. So, treat them like normal headers, and # they *should not* be compiled into individual objects. HDRS_SIMD_ARM = [ "simd/arm/align.h", "simd/arm/jchuff.h", "simd/arm/jcgryext-neon.c", "simd/arm/jdcolext-neon.c", "simd/arm/jdmrgext-neon.c", ] cc_library( name = "simd_armv7a", srcs = [ "simd/arm/aarch32/jchuff-neon.c", "simd/arm/aarch32/jsimd.c", ] + SRCS_SIMD_COMMON + SRCS_SIMD_ARM, hdrs = [ "simd/arm/aarch32/jccolext-neon.c", ] + HDRS_SIMD_ARM, copts = libjpegturbo_copts, visibility = ["//visibility:private"], deps = [":neon-compat_hdr"], ) cc_library( name = "simd_armv8a", srcs = [ "simd/arm/aarch64/jchuff-neon.c", "simd/arm/aarch64/jsimd.c", ] + SRCS_SIMD_COMMON + SRCS_SIMD_ARM, hdrs = [ "simd/arm/aarch64/jccolext-neon.c", ] + HDRS_SIMD_ARM, copts = libjpegturbo_copts, visibility = ["//visibility:private"], deps = [":neon-compat_hdr"], ) cc_library( name = "simd_win_x86_64", srcs = [ "simd/x86_64/jccolor-avx2.obj", "simd/x86_64/jccolor-sse2.obj", "simd/x86_64/jcgray-avx2.obj", "simd/x86_64/jcgray-sse2.obj", "simd/x86_64/jchuff-sse2.obj", "simd/x86_64/jcphuff-sse2.obj", "simd/x86_64/jcsample-avx2.obj", "simd/x86_64/jcsample-sse2.obj", "simd/x86_64/jdcolor-avx2.obj", "simd/x86_64/jdcolor-sse2.obj", "simd/x86_64/jdmerge-avx2.obj", "simd/x86_64/jdmerge-sse2.obj", "simd/x86_64/jdsample-avx2.obj", "simd/x86_64/jdsample-sse2.obj", "simd/x86_64/jfdctflt-sse.obj", "simd/x86_64/jfdctfst-sse2.obj", "simd/x86_64/jfdctint-avx2.obj", "simd/x86_64/jfdctint-sse2.obj", "simd/x86_64/jidctflt-sse2.obj", "simd/x86_64/jidctfst-sse2.obj", "simd/x86_64/jidctint-avx2.obj", "simd/x86_64/jidctint-sse2.obj", "simd/x86_64/jidctred-sse2.obj", "simd/x86_64/jquantf-sse2.obj", "simd/x86_64/jquanti-avx2.obj", "simd/x86_64/jquanti-sse2.obj", "simd/x86_64/jsimd.c", "simd/x86_64/jsimdcpu.obj", ] + SRCS_SIMD_COMMON, copts = libjpegturbo_copts, ) genrule( name = "simd_win_x86_64_assemble", srcs = [ "jconfig.h", "jconfigint.h", "simd/x86_64/jccolext-avx2.asm", "simd/x86_64/jccolext-sse2.asm", "simd/x86_64/jccolor-avx2.asm", "simd/x86_64/jccolor-sse2.asm", "simd/x86_64/jcgray-avx2.asm", "simd/x86_64/jcgray-sse2.asm", "simd/x86_64/jcgryext-avx2.asm", "simd/x86_64/jcgryext-sse2.asm", "simd/x86_64/jchuff-sse2.asm", "simd/x86_64/jcphuff-sse2.asm", "simd/x86_64/jcsample-avx2.asm", "simd/x86_64/jcsample-sse2.asm", "simd/x86_64/jdcolext-avx2.asm", "simd/x86_64/jdcolext-sse2.asm", "simd/x86_64/jdcolor-avx2.asm", "simd/x86_64/jdcolor-sse2.asm", "simd/x86_64/jdmerge-avx2.asm", "simd/x86_64/jdmerge-sse2.asm", "simd/x86_64/jdmrgext-avx2.asm", "simd/x86_64/jdmrgext-sse2.asm", "simd/x86_64/jdsample-avx2.asm", "simd/x86_64/jdsample-sse2.asm", "simd/x86_64/jfdctflt-sse.asm", "simd/x86_64/jfdctfst-sse2.asm", "simd/x86_64/jfdctint-avx2.asm", "simd/x86_64/jfdctint-sse2.asm", "simd/x86_64/jidctflt-sse2.asm", "simd/x86_64/jidctfst-sse2.asm", "simd/x86_64/jidctint-avx2.asm", "simd/x86_64/jidctint-sse2.asm", "simd/x86_64/jidctred-sse2.asm", "simd/x86_64/jquantf-sse2.asm", "simd/x86_64/jquanti-avx2.asm", "simd/x86_64/jquanti-sse2.asm", "simd/x86_64/jsimdcpu.asm", "simd/nasm/jcolsamp.inc", "simd/nasm/jdct.inc", "simd/nasm/jsimdcfg.inc", "simd/nasm/jsimdcfg.inc.h", "simd/nasm/jsimdext.inc", ], outs = [ "simd/x86_64/jccolor-avx2.obj", "simd/x86_64/jccolor-sse2.obj", "simd/x86_64/jcgray-avx2.obj", "simd/x86_64/jcgray-sse2.obj", "simd/x86_64/jchuff-sse2.obj", "simd/x86_64/jcphuff-sse2.obj", "simd/x86_64/jcsample-avx2.obj", "simd/x86_64/jcsample-sse2.obj", "simd/x86_64/jdcolor-avx2.obj", "simd/x86_64/jdcolor-sse2.obj", "simd/x86_64/jdmerge-avx2.obj", "simd/x86_64/jdmerge-sse2.obj", "simd/x86_64/jdsample-avx2.obj", "simd/x86_64/jdsample-sse2.obj", "simd/x86_64/jfdctflt-sse.obj", "simd/x86_64/jfdctfst-sse2.obj", "simd/x86_64/jfdctint-avx2.obj", "simd/x86_64/jfdctint-sse2.obj", "simd/x86_64/jidctflt-sse2.obj", "simd/x86_64/jidctfst-sse2.obj", "simd/x86_64/jidctint-avx2.obj", "simd/x86_64/jidctint-sse2.obj", "simd/x86_64/jidctred-sse2.obj", "simd/x86_64/jquantf-sse2.obj", "simd/x86_64/jquanti-avx2.obj", "simd/x86_64/jquanti-sse2.obj", "simd/x86_64/jsimdcpu.obj", ], cmd = "for out in $(OUTS); do\n" + " $(location @nasm//:nasm) -fwin64 -DWIN64 -D__x86_64__" + " -I $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/" + " -I $$(dirname $(location simd/nasm/jdct.inc))/" + " -I $$(dirname $(location simd/nasm/jdct.inc))/../../win/" + " -o $$out" + " $$(dirname $(location simd/x86_64/jccolext-sse2.asm))/$$(basename $${out%.obj}.asm)\n" + "done", tools = ["@nasm"], ) cc_library( name = "simd_none", srcs = [ "jchuff.h", "jconfig.h", "jconfigint.h", "jdct.h", "jerror.h", "jinclude.h", "jmorecfg.h", "jpegint.h", "jpeglib.h", "jsimd.h", "jsimd_none.c", "jsimddct.h", ], copts = libjpegturbo_copts, ) expand_template( name = "jversion", out = "jversion.h", substitutions = { "@COPYRIGHT_YEAR@": "1991-2022", }, template = "jversion.h.in", ) expand_template( name = "jconfig_win", out = "jconfig_win.h", substitutions = { "@JPEG_LIB_VERSION@": "62", "@VERSION@": "2.1.4", "@LIBJPEG_TURBO_VERSION_NUMBER@": "2001004", "@BITS_IN_JSAMPLE@": "8", "#cmakedefine C_ARITH_CODING_SUPPORTED": "#define C_ARITH_CODING_SUPPORTED", "#cmakedefine D_ARITH_CODING_SUPPORTED": "#define D_ARITH_CODING_SUPPORTED", "#cmakedefine MEM_SRCDST_SUPPORTED": "#define MEM_SRCDST_SUPPORTED", "#cmakedefine WITH_SIMD": "", }, template = "win/jconfig.h.in", ) JCONFIG_NOWIN_COMMON_SUBSTITUTIONS = { "@JPEG_LIB_VERSION@": "62", "@VERSION@": "2.1.4", "@LIBJPEG_TURBO_VERSION_NUMBER@": "2001004", "#cmakedefine C_ARITH_CODING_SUPPORTED 1": "#define C_ARITH_CODING_SUPPORTED 1", "#cmakedefine D_ARITH_CODING_SUPPORTED 1": "#define D_ARITH_CODING_SUPPORTED 1", "#cmakedefine MEM_SRCDST_SUPPORTED 1": "#define MEM_SRCDST_SUPPORTED 1", "@BITS_IN_JSAMPLE@": "8", "#cmakedefine HAVE_LOCALE_H 1": "#define HAVE_LOCALE_H 1", "#cmakedefine HAVE_STDDEF_H 1": "#define HAVE_STDDEF_H 1", "#cmakedefine HAVE_STDLIB_H 1": "#define HAVE_STDLIB_H 1", "#cmakedefine NEED_SYS_TYPES_H 1": "#define NEED_SYS_TYPES_H 1", "#cmakedefine NEED_BSD_STRINGS 1": "", "#cmakedefine HAVE_UNSIGNED_CHAR 1": "#define HAVE_UNSIGNED_CHAR 1", "#cmakedefine HAVE_UNSIGNED_SHORT 1": "#define HAVE_UNSIGNED_SHORT 1", "#cmakedefine INCOMPLETE_TYPES_BROKEN 1": "", "#cmakedefine RIGHT_SHIFT_IS_UNSIGNED 1": "", "#cmakedefine __CHAR_UNSIGNED__ 1": "", "#undef const": "", "#undef size_t": "", } JCONFIG_NOWIN_SIMD_SUBSTITUTIONS = { "#cmakedefine WITH_SIMD 1": "#define WITH_SIMD 1", } JCONFIG_NOWIN_NOSIMD_SUBSTITUTIONS = { "#cmakedefine WITH_SIMD 1": "", } JCONFIG_NOWIN_SIMD_SUBSTITUTIONS.update(JCONFIG_NOWIN_COMMON_SUBSTITUTIONS) JCONFIG_NOWIN_NOSIMD_SUBSTITUTIONS.update(JCONFIG_NOWIN_COMMON_SUBSTITUTIONS) expand_template( name = "jconfig_nowin_nosimd", out = "jconfig_nowin_nosimd.h", substitutions = JCONFIG_NOWIN_NOSIMD_SUBSTITUTIONS, template = "jconfig.h.in", ) expand_template( name = "jconfig_nowin_simd", out = "jconfig_nowin_simd.h", substitutions = JCONFIG_NOWIN_SIMD_SUBSTITUTIONS, template = "jconfig.h.in", ) JCONFIGINT_COMMON_SUBSTITUTIONS = { "@BUILD@": "20221022", "@VERSION@": "2.1.4", "@CMAKE_PROJECT_NAME@": "libjpeg-turbo", "#undef inline": "", "#cmakedefine HAVE_INTRIN_H": "", } JCONFIGINT_NOWIN_SUBSTITUTIONS = { "#cmakedefine HAVE_BUILTIN_CTZL": "#define HAVE_BUILTIN_CTZL", "@INLINE@": "inline __attribute__((always_inline))", "#define SIZEOF_SIZE_T @SIZE_T@": "#if (__WORDSIZE==64 && !defined(__native_client__))\n" + "#define SIZEOF_SIZE_T 8\n" + "#else\n" + "#define SIZEOF_SIZE_T 4\n" + "#endif\n", } JCONFIGINT_WIN_SUBSTITUTIONS = { "#cmakedefine HAVE_BUILTIN_CTZL": "", "#define INLINE @INLINE@": "#if defined(__GNUC__)\n" + "#define INLINE inline __attribute__((always_inline))\n" + "#elif defined(_MSC_VER)\n" + "#define INLINE __forceinline\n" + "#else\n" + "#define INLINE\n" + "#endif\n", "#define SIZEOF_SIZE_T @SIZE_T@": "#if (__WORDSIZE==64)\n" + "#define SIZEOF_SIZE_T 8\n" + "#else\n" + "#define SIZEOF_SIZE_T 4\n" + "#endif\n", } JCONFIGINT_NOWIN_SUBSTITUTIONS.update(JCONFIGINT_COMMON_SUBSTITUTIONS) JCONFIGINT_WIN_SUBSTITUTIONS.update(JCONFIGINT_COMMON_SUBSTITUTIONS) expand_template( name = "jconfigint_nowin", out = "jconfigint_nowin.h", substitutions = JCONFIGINT_NOWIN_SUBSTITUTIONS, template = "jconfigint.h.in", ) expand_template( name = "jconfigint_win", out = "jconfigint_win.h", substitutions = JCONFIGINT_WIN_SUBSTITUTIONS, template = "jconfigint.h.in", ) genrule( name = "configure", srcs = [ "jconfig_win.h", "jconfig_nowin_nosimd.h", "jconfig_nowin_simd.h", ], outs = ["jconfig.h"], cmd = select({ ":windows": "cp $(location jconfig_win.h) $@", ":k8": "cp $(location jconfig_nowin_simd.h) $@", ":armeabi-v7a": "cp $(location jconfig_nowin_simd.h) $@", ":arm64-v8a": "cp $(location jconfig_nowin_simd.h) $@", ":linux_ppc64le": "cp $(location jconfig_nowin_simd.h) $@", "//conditions:default": "cp $(location jconfig_nowin_nosimd.h) $@", }), ) genrule( name = "configure_internal", srcs = [ "jconfigint_win.h", "jconfigint_nowin.h", ], outs = ["jconfigint.h"], cmd = select({ ":windows": "cp $(location jconfigint_win.h) $@", "//conditions:default": "cp $(location jconfigint_nowin.h) $@", }), ) # jiminy cricket the way this file is generated is completely outrageous genrule( name = "configure_simd", outs = ["simd/jsimdcfg.inc"], cmd = "cat <<'EOF' >$@\n" + "%define DCTSIZE 8\n" + "%define DCTSIZE2 64\n" + "%define RGB_RED 0\n" + "%define RGB_GREEN 1\n" + "%define RGB_BLUE 2\n" + "%define RGB_PIXELSIZE 3\n" + "%define EXT_RGB_RED 0\n" + "%define EXT_RGB_GREEN 1\n" + "%define EXT_RGB_BLUE 2\n" + "%define EXT_RGB_PIXELSIZE 3\n" + "%define EXT_RGBX_RED 0\n" + "%define EXT_RGBX_GREEN 1\n" + "%define EXT_RGBX_BLUE 2\n" + "%define EXT_RGBX_PIXELSIZE 4\n" + "%define EXT_BGR_RED 2\n" + "%define EXT_BGR_GREEN 1\n" + "%define EXT_BGR_BLUE 0\n" + "%define EXT_BGR_PIXELSIZE 3\n" + "%define EXT_BGRX_RED 2\n" + "%define EXT_BGRX_GREEN 1\n" + "%define EXT_BGRX_BLUE 0\n" + "%define EXT_BGRX_PIXELSIZE 4\n" + "%define EXT_XBGR_RED 3\n" + "%define EXT_XBGR_GREEN 2\n" + "%define EXT_XBGR_BLUE 1\n" + "%define EXT_XBGR_PIXELSIZE 4\n" + "%define EXT_XRGB_RED 1\n" + "%define EXT_XRGB_GREEN 2\n" + "%define EXT_XRGB_BLUE 3\n" + "%define EXT_XRGB_PIXELSIZE 4\n" + "%define RGBX_FILLER_0XFF 1\n" + "%define JSAMPLE byte ; unsigned char\n" + "%define SIZEOF_JSAMPLE SIZEOF_BYTE ; sizeof(JSAMPLE)\n" + "%define CENTERJSAMPLE 128\n" + "%define JCOEF word ; short\n" + "%define SIZEOF_JCOEF SIZEOF_WORD ; sizeof(JCOEF)\n" + "%define JDIMENSION dword ; unsigned int\n" + "%define SIZEOF_JDIMENSION SIZEOF_DWORD ; sizeof(JDIMENSION)\n" + "%define JSAMPROW POINTER ; JSAMPLE * (jpeglib.h)\n" + "%define JSAMPARRAY POINTER ; JSAMPROW * (jpeglib.h)\n" + "%define JSAMPIMAGE POINTER ; JSAMPARRAY * (jpeglib.h)\n" + "%define JCOEFPTR POINTER ; JCOEF * (jpeglib.h)\n" + "%define SIZEOF_JSAMPROW SIZEOF_POINTER ; sizeof(JSAMPROW)\n" + "%define SIZEOF_JSAMPARRAY SIZEOF_POINTER ; sizeof(JSAMPARRAY)\n" + "%define SIZEOF_JSAMPIMAGE SIZEOF_POINTER ; sizeof(JSAMPIMAGE)\n" + "%define SIZEOF_JCOEFPTR SIZEOF_POINTER ; sizeof(JCOEFPTR)\n" + "%define DCTELEM word ; short\n" + "%define SIZEOF_DCTELEM SIZEOF_WORD ; sizeof(DCTELEM)\n" + "%define float FP32 ; float\n" + "%define SIZEOF_FAST_FLOAT SIZEOF_FP32 ; sizeof(float)\n" + "%define ISLOW_MULT_TYPE word ; must be short\n" + "%define SIZEOF_ISLOW_MULT_TYPE SIZEOF_WORD ; sizeof(ISLOW_MULT_TYPE)\n" + "%define IFAST_MULT_TYPE word ; must be short\n" + "%define SIZEOF_IFAST_MULT_TYPE SIZEOF_WORD ; sizeof(IFAST_MULT_TYPE)\n" + "%define IFAST_SCALE_BITS 2 ; fractional bits in scale factors\n" + "%define FLOAT_MULT_TYPE FP32 ; must be float\n" + "%define SIZEOF_FLOAT_MULT_TYPE SIZEOF_FP32 ; sizeof(FLOAT_MULT_TYPE)\n" + "%define JSIMD_NONE 0x00\n" + "%define JSIMD_MMX 0x01\n" + "%define JSIMD_3DNOW 0x02\n" + "%define JSIMD_SSE 0x04\n" + "%define JSIMD_SSE2 0x08\n" + "EOF", ) string_flag( name = "noasm", build_setting_default = "no", ) config_setting( name = "nosimd", flag_values = {":noasm": "yes"}, ) config_setting( name = "k8", flag_values = {":noasm": "no"}, values = {"cpu": "k8"}, ) config_setting( name = "android", values = {"crosstool_top": "//external:android/crosstool"}, ) config_setting( name = "armeabi-v7a", flag_values = {":noasm": "no"}, values = {"cpu": "armeabi-v7a"}, ) config_setting( name = "arm64-v8a", flag_values = {":noasm": "no"}, values = {"cpu": "arm64-v8a"}, ) config_setting( name = "windows", flag_values = {":noasm": "no"}, values = {"cpu": "x64_windows"}, ) config_setting( name = "linux_ppc64le", flag_values = {":noasm": "no"}, values = {"cpu": "ppc"}, )
0
/home/johnshepherd/drake/third_party/com_github_tensorflow_tensorflow/third_party
/home/johnshepherd/drake/third_party/com_github_tensorflow_tensorflow/third_party/jpeg/workspace.bzl
"""loads the jpeg library, used by TF.""" load("//third_party:repo.bzl", "tf_http_archive", "tf_mirror_urls") def repo(): tf_http_archive( name = "libjpeg_turbo", urls = tf_mirror_urls("https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/2.1.4.tar.gz"), sha256 = "a78b05c0d8427a90eb5b4eb08af25309770c8379592bb0b8a863373128e6143f", strip_prefix = "libjpeg-turbo-2.1.4", build_file = "//third_party/jpeg:jpeg.BUILD", system_build_file = "//third_party/jpeg:BUILD.system", )
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_iiwa_status.lcm
package drake; struct lcmt_iiwa_status { // The timestamp in microseconds. int64_t utime; int32_t num_joints; // From FRI documentation: "The currently measured joint positions of the // robot in radians." double joint_position_measured[num_joints]; // The FRI driver does not provide velocity; we estimate it in our driver via // a low-pass filter. Units are radians / sec. double joint_velocity_estimated[num_joints]; // From FRI documentation: "The last commanded joint positions of the robot in // radians." double joint_position_commanded[num_joints]; // From FRI documentation: // "The joint positions commanded by the interpolator in radians. When // commanding a motion overlay in your robot application, this method will // give access to the joint positions currently commanded by the motion // interpolator. This method will return NULL during monitoring mode." // // The Kuka motion interpolated code is a black-box to us, so we typically do // not try to model/simulate this signal. double joint_position_ipo[num_joints]; // From FRI documentation: "The currently measured joint torques of the robot // in Nm." // // This appears to be the raw measurement of the torque sensors, which is // attempting to track joint_torque_commanded. double joint_torque_measured[num_joints]; // From FRI documentation: "The last commanded joint torques of the robot in // Nm." // // This appears to be most similar to the torque input to multibody plant. double joint_torque_commanded[num_joints]; // From FRI documentation: "The currently measured external joint torques of // the robot in Nm. The external torques corresponds to the measured torques // when removing the torques induced by the robot itself." // // This appears to be the contact forces (in joint coordinates) as well as any // residuals from modeling errors (as computed by the onboard Kuka inverse // dynamics model, which is a black-box to us). Recall that the inertia of // the tool is included (potentially very approximately) in the onboard Kuka // model, so long as a tool is defined in the active Sunrise project. You can // use the Kuka pendant to teach the tool inertia. double joint_torque_external[num_joints]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_acrobot_u.lcm
package drake; struct lcmt_acrobot_u { int64_t timestamp; double tau; // Newton-meters }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_force_torque.lcm
package drake; struct lcmt_force_torque { // The timestamp in milliseconds. int64_t timestamp; double fx; double fy; double fz; double tx; double ty; double tz; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/BUILD.bazel
load("//tools/install:install.bzl", "install") load("//tools/lint:lint.bzl", "add_lint_tests") load( "//tools/skylark:drake_cc.bzl", "drake_cc_googletest", "drake_cc_library", "drake_transitive_installed_hdrs_filegroup", ) load( "//tools/skylark:drake_java.bzl", "drake_java_binary", ) load( "//tools/skylark:drake_lcm.bzl", "drake_lcm_cc_library", "drake_lcm_java_library", "drake_lcm_py_library", ) load( "//tools/skylark:drake_py.bzl", "drake_py_library", "drake_py_test", ) load("//tools/workspace:generate_file.bzl", "generate_file") load(":defs.bzl", "ALL_LCM_SRCS") package(default_visibility = ["//visibility:public"]) # Search for all *.lcm files. _GLOB_ALL_LCM_SRCS = sorted(glob(["*.lcm"])) # The list of files in the glob, but not in defs.bzl. _MISSING_ALL = [ x for x in _GLOB_ALL_LCM_SRCS if x not in ALL_LCM_SRCS ] # Fail with an error message if the two lists disagree. # TODO(jwnimmer-tri) Ideally, we'd fail at test-time, not build-time. (len(_MISSING_ALL) == 0) or fail( "Please update lcmtypes/defs.bzl to add {}".format( _MISSING_ALL, ), ) # The list of files in defs.bzl, but not in the glob. _EXTRA_ALL = [ x for x in ALL_LCM_SRCS if x not in _GLOB_ALL_LCM_SRCS ] # Fail with an error message if the two lists disagree. # TODO(jwnimmer-tri) Ideally, we'd fail at test-time, not build-time. (len(_EXTRA_ALL) == 0) or fail( "Please update lcmtypes/defs.bzl remove {}".format( _EXTRA_ALL, ), ) drake_lcm_cc_library( name = "acrobot", lcm_package = "drake", lcm_srcs = [ "lcmt_acrobot_u.lcm", "lcmt_acrobot_x.lcm", "lcmt_acrobot_y.lcm", ], ) drake_lcm_cc_library( name = "call_python", lcm_package = "drake", lcm_srcs = [ "lcmt_call_python.lcm", "lcmt_call_python_data.lcm", ], ) drake_lcm_cc_library( name = "contact_results_for_viz", lcm_package = "drake", lcm_srcs = ["lcmt_contact_results_for_viz.lcm"], deps = [ ":hydroelastic_contact_surface_for_viz", ":point_pair_contact_info_for_viz", ], ) drake_lcm_cc_library( name = "experimental_deformable_mesh", lcm_package = "drake", lcm_srcs = [ "experimental_lcmt_deformable_tri.lcm", "experimental_lcmt_deformable_tri_mesh_init.lcm", "experimental_lcmt_deformable_tri_meshes_init.lcm", "experimental_lcmt_deformable_tri_mesh_update.lcm", "experimental_lcmt_deformable_tri_meshes_update.lcm", ], ) drake_lcm_cc_library( name = "header", lcm_package = "drake", lcm_srcs = ["lcmt_header.lcm"], ) drake_lcm_cc_library( name = "hydroelastic_contact_surface_for_viz", lcm_package = "drake", lcm_srcs = ["lcmt_hydroelastic_contact_surface_for_viz.lcm"], deps = [ ":hydroelastic_quadrature_per_point_data_for_viz", ":point", ], ) drake_lcm_cc_library( name = "hydroelastic_quadrature_per_point_data_for_viz", lcm_package = "drake", lcm_srcs = ["lcmt_hydroelastic_quadrature_per_point_data_for_viz.lcm"], ) drake_lcm_cc_library( name = "image", lcm_package = "drake", lcm_srcs = ["lcmt_image.lcm"], deps = [":header"], ) drake_lcm_cc_library( name = "image_array", lcm_package = "drake", lcm_srcs = ["lcmt_image_array.lcm"], deps = [ ":header", ":image", ], ) drake_lcm_cc_library( name = "point", lcm_package = "drake", lcm_srcs = ["lcmt_point.lcm"], ) drake_lcm_cc_library( name = "point_cloud", lcm_package = "drake", lcm_srcs = [ "lcmt_point_cloud.lcm", "lcmt_point_cloud_field.lcm", ], ) drake_lcm_cc_library( name = "point_pair_contact_info_for_viz", lcm_package = "drake", lcm_srcs = ["lcmt_point_pair_contact_info_for_viz.lcm"], ) drake_lcm_cc_library( name = "planar_manipuland_status", lcm_package = "drake", lcm_srcs = ["lcmt_planar_manipuland_status.lcm"], ) drake_lcm_cc_library( name = "planar_gripper", lcm_package = "drake", lcm_srcs = [ "lcmt_planar_gripper_command.lcm", "lcmt_planar_gripper_status.lcm", "lcmt_planar_gripper_finger_command.lcm", "lcmt_planar_gripper_finger_face_assignment.lcm", "lcmt_planar_gripper_finger_face_assignments.lcm", "lcmt_planar_gripper_finger_status.lcm", "lcmt_planar_plant_state.lcm", "lcmt_force_torque.lcm", ], ) drake_lcm_cc_library( name = "quaternion", lcm_package = "drake", lcm_srcs = ["lcmt_quaternion.lcm"], ) drake_lcm_cc_library( name = "robot_plan", lcm_package = "drake", lcm_srcs = [ "lcmt_robot_plan.lcm", "lcmt_robot_state.lcm", ], ) drake_lcm_cc_library( name = "scope", lcm_package = "drake", lcm_srcs = ["lcmt_scope.lcm"], ) drake_lcm_cc_library( name = "drake_signal", lcm_package = "drake", lcm_srcs = ["lcmt_drake_signal.lcm"], ) drake_lcm_cc_library( name = "viewer", lcm_package = "drake", lcm_srcs = [ "lcmt_viewer_command.lcm", "lcmt_viewer_draw.lcm", "lcmt_viewer_geometry_data.lcm", "lcmt_viewer_link_data.lcm", "lcmt_viewer_load_robot.lcm", ], ) drake_lcm_cc_library( name = "allegro", lcm_package = "drake", lcm_srcs = [ "lcmt_allegro_command.lcm", "lcmt_allegro_status.lcm", ], ) drake_lcm_cc_library( name = "iiwa", lcm_package = "drake", lcm_srcs = [ "lcmt_iiwa_command.lcm", "lcmt_iiwa_status.lcm", "lcmt_iiwa_status_telemetry.lcm", ], ) drake_lcm_cc_library( name = "schunk", lcm_package = "drake", lcm_srcs = [ "lcmt_schunk_wsg_command.lcm", "lcmt_schunk_wsg_status.lcm", ], ) drake_lcm_cc_library( name = "jaco", lcm_package = "drake", lcm_srcs = [ "lcmt_jaco_command.lcm", "lcmt_jaco_status.lcm", ], ) drake_lcm_cc_library( name = "panda", lcm_package = "drake", lcm_srcs = [ "lcmt_panda_command.lcm", "lcmt_panda_status.lcm", ], ) # Generate the *.py sources, but keep __init__.py separate, so that it doesn't # get installed. The install will use this (private) library. Users should # depend on ":lcmtypes_drake_py", immediately below. drake_lcm_py_library( name = "_generated_lcmtypes_drake_py", # We'll rely on the //:module_py path munging instead. add_current_package_to_imports = False, lcm_package = "drake", lcm_srcs = ALL_LCM_SRCS, visibility = ["//visibility:private"], ) drake_py_library( name = "lcmtypes_drake_py", srcs = ["__init__.py"], deps = [ ":_generated_lcmtypes_drake_py", ], ) drake_lcm_java_library( name = "lcmtypes_drake_java", lcm_package = "drake", lcm_srcs = ALL_LCM_SRCS, ) # This should list every LCM type that is known to Drake. LCMTYPES_CC = [ ":acrobot", ":allegro", ":call_python", ":experimental_deformable_mesh", ":point", ":point_cloud", ":header", ":quaternion", ":image", ":image_array", ":contact_results_for_viz", ":drake_signal", ":hydroelastic_contact_surface_for_viz", ":iiwa", ":jaco", ":panda", ":planar_manipuland_status", ":planar_gripper", ":point_pair_contact_info_for_viz", ":robot_plan", ":schunk", ":scope", ":viewer", ] # This rule should list every LCM type that is known to Drake or its external # dependencies. drake_java_binary( name = "drake-lcm-spy", main_class = "lcm.spy.Spy", visibility = ["//visibility:private"], runtime_deps = [ ":lcmtypes_drake_java", ], ) drake_cc_library( name = "lcmtypes_drake_cc", deps = LCMTYPES_CC, ) drake_transitive_installed_hdrs_filegroup( name = "lcmtypes_drake_cc_headers", visibility = ["//visibility:private"], deps = LCMTYPES_CC, ) # The drake-lcmtypes-cpp library is distinct from (but required by) the drake # library; refer to `tools/install/libdrake/drake.cps` for library structure. # Therefore, we install Drake's lcmtypes C++ headers to a different directory # than the drake library's include path; this ensures that downstream code is # using the correct include paths for the libraries they need. The path to # `include/drake_lcmtypes` is provided to downstream code via `drake.cps` and # its generated cmake config `lib/cmake/drake/drake-config.cmake. install( name = "install_drake_cc_headers", hdrs = [":lcmtypes_drake_cc_headers"], hdr_dest = "include/drake_lcmtypes", visibility = ["//visibility:private"], ) install( name = "install", install_tests = select({ "@lcm//:lcm_install_java_is_off": [], "//conditions:default": [ ":test/drake-lcm-spy_install_test.py", ], }), targets = [ ":_generated_lcmtypes_drake_py", ] + select({ "@lcm//:lcm_install_java_is_off": [], "//conditions:default": [ ":drake-lcm-spy", ":drake-lcm-spy-launcher", ":lcmtypes_drake_java", ], }), rename = { "share/java/liblcmtypes_drake_java.jar": "lcmtypes_drake.jar", "bin/drake-lcm-spy-launcher.sh": "drake-lcm-spy", }, allowed_externals = [ "@com_jidesoft_jide_oss//jar", "@commons_io//jar", "@lcm//:lcm-java", "@net_sf_jchart2d//jar", "@org_apache_xmlgraphics_commons//jar", ], deps = [ ":install_drake_cc_headers", "@lcm//:install", ], ) # === test/ === # TODO(jwnimmer-tri) We use this to test the `use_new_lcm_gen = True` flag. # Once we turn on that flag by default, we can probably ditch this test. generate_file( name = "test_message.lcm", content = """ package drake; struct test_message { double value; } """, visibility = ["//visibility:private"], ) drake_lcm_cc_library( name = "test_message", lcm_package = "drake", lcm_srcs = ["test_message.lcm"], use_new_lcm_gen = True, visibility = ["//visibility:private"], ) drake_cc_googletest( name = "test_message_test", deps = [ ":test_message", "//lcm:lcm_messages", ], ) drake_py_test( name = "nested_types_test", deps = [ ":lcmtypes_drake_py", ], ) add_lint_tests( python_lint_extra_srcs = [ ":test/drake-lcm-spy_install_test.py", ], )
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_allegro_status.lcm
package drake; struct lcmt_allegro_status { // The timestamp in microseconds. int64_t utime; int32_t num_joints; double joint_position_measured[num_joints]; double joint_velocity_estimated[num_joints]; double joint_position_commanded[num_joints]; double joint_torque_commanded[num_joints]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_hydroelastic_quadrature_per_point_data_for_viz.lcm
package drake; struct lcmt_hydroelastic_quadrature_per_point_data_for_viz { // The quadrature point Q, as an offset vector in the world frame W, at which // the traction and slip velocities are evaluated. double p_WQ[3]; // Denoting Point Aq as the point of Body A coincident with Q and Point Bq as // the point of Body B coincident with Q, calculates vr (the velocity // of Bq relative to Aq) and then calculates the component perpendicular to // the unit surface normal n̂ as vt = vr - (vr⋅n̂)n̂. // The resulting vector vt is expressed in the world frame W. double vt_BqAq_W[3]; // The traction vector, expressed in the world frame and with units of Pa, // applied to Body A at Point Q (i.e., Frame A is shifted to Aq). double traction_Aq_W[3]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_planar_gripper_finger_status.lcm
package drake; struct lcmt_planar_gripper_finger_status { double joint_position[2]; double joint_velocity[2]; // Torques here are ignored. lcmt_force_torque fingertip_force; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/experimental_lcmt_deformable_tri_meshes_init.lcm
package drake; struct experimental_lcmt_deformable_tri_meshes_init { int32_t num_meshes; experimental_lcmt_deformable_tri_mesh_init meshes[num_meshes]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_panda_command.lcm
package drake; // Commands the desired state of a Franka Panda arm. // // The Franka Control Interface provides a number of possible modes to control // the arm, as described in // // https://frankaemika.github.io/docs/libfranka.html#realtime-commands // // The expected control mode is given by the control_mode_expected, below. // // The num_joint_{position,velocity,torque} size must not have multiple // different non-zero values. Each one must be set to either the actual // number of joints (e.g., 7) or else zero. struct lcmt_panda_command { // The timestamp in microseconds. int64_t utime; // The commanded joint positions in radians. // // These values must be provided if the CONTROL_MODE_POSITION bit is set // within control_mode_expected. int32_t num_joint_position; double joint_position[num_joint_position]; // The commanded joint velocities in radians per second. // // These values must be provided if the CONTROL_MODE_VELOCITY bit is set // within control_mode_expected. int32_t num_joint_velocity; double joint_velocity[num_joint_velocity]; // The commanded joint torques. // // These values must be provided if the CONTROL_MODE_TORQUE bit is set // within control_mode_expected. int32_t num_joint_torque; double joint_torque[num_joint_torque]; // Describes how the controller expects the driver to be configured. See // the values for control_mode in lcmt_panda_status. int8_t control_mode_expected; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_header.lcm
package drake; // This holds timestamp and a particular coordinate frame. // This follows ROS's convention except the timestamp since // utime has been widely used in Drake LCM. struct lcmt_header { // Sequence ID: consecutively increasing ID. int32_t seq; // Timestamp in microseconds. int64_t utime; // The name of a frame this data is associated with. string frame_name; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/defs.bzl
# This is a list of all *.lcm files in this folder. # Our BUILD.bazel rules cross-check that it remains up-to-date. ALL_LCM_SRCS = [ "experimental_lcmt_deformable_tri.lcm", "experimental_lcmt_deformable_tri_mesh_init.lcm", "experimental_lcmt_deformable_tri_mesh_update.lcm", "experimental_lcmt_deformable_tri_meshes_init.lcm", "experimental_lcmt_deformable_tri_meshes_update.lcm", "lcmt_acrobot_u.lcm", "lcmt_acrobot_x.lcm", "lcmt_acrobot_y.lcm", "lcmt_allegro_command.lcm", "lcmt_allegro_status.lcm", "lcmt_call_python.lcm", "lcmt_call_python_data.lcm", "lcmt_contact_results_for_viz.lcm", "lcmt_drake_signal.lcm", "lcmt_force_torque.lcm", "lcmt_header.lcm", "lcmt_hydroelastic_contact_surface_for_viz.lcm", "lcmt_hydroelastic_quadrature_per_point_data_for_viz.lcm", "lcmt_iiwa_command.lcm", "lcmt_iiwa_status.lcm", "lcmt_iiwa_status_telemetry.lcm", "lcmt_image.lcm", "lcmt_image_array.lcm", "lcmt_jaco_command.lcm", "lcmt_jaco_status.lcm", "lcmt_panda_command.lcm", "lcmt_panda_status.lcm", "lcmt_planar_gripper_command.lcm", "lcmt_planar_gripper_finger_command.lcm", "lcmt_planar_gripper_finger_face_assignment.lcm", "lcmt_planar_gripper_finger_face_assignments.lcm", "lcmt_planar_gripper_finger_status.lcm", "lcmt_planar_gripper_status.lcm", "lcmt_planar_manipuland_status.lcm", "lcmt_planar_plant_state.lcm", "lcmt_point.lcm", "lcmt_point_cloud.lcm", "lcmt_point_cloud_field.lcm", "lcmt_point_pair_contact_info_for_viz.lcm", "lcmt_quaternion.lcm", "lcmt_robot_plan.lcm", "lcmt_robot_state.lcm", "lcmt_schunk_wsg_command.lcm", "lcmt_schunk_wsg_status.lcm", "lcmt_scope.lcm", "lcmt_viewer_command.lcm", "lcmt_viewer_draw.lcm", "lcmt_viewer_geometry_data.lcm", "lcmt_viewer_link_data.lcm", "lcmt_viewer_load_robot.lcm", ]
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_planar_plant_state.lcm
package drake; // The current status of the entire planar-gripper/brick MBP. All angular // positions/velocities are expressed in radians and radians/second. struct lcmt_planar_plant_state { // in microseconds int64_t utime; int32_t num_states; double plant_state[num_states]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_iiwa_status_telemetry.lcm
package drake; struct lcmt_iiwa_status_telemetry { // Host's timestamp in micro seconds when the status packet is received. int64_t host_utime; // Iiwa controller's timestamp in micro seconds for the status packet. int64_t iiwa_utime; // Estimated offset defined as: host - iiwa int64_t estimated_dt_host_minus_iiwa; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_planar_gripper_finger_face_assignment.lcm
package drake; // Communicates the finger-face assignment info for a specified finger. struct lcmt_planar_gripper_finger_face_assignment { // in microseconds int64_t utime; // Finger name: {finger1, finger2, finger3} string finger_name; // Brick face name: {PosY, NegY, PosZ, NegZ} string brick_face_name; // The contact point if in contact, or the proximity witness point if not in // contact. It is position vector from the brick's body B's origin (Bo) to a // point Bq (a point of B), expressed in B's frame. double p_BoBq_B[2]; // {y-coordinate, z-coordinate} // A boolean that indicates whether this finger is in contact with the // specified brick face. If true, the finger is in contact and p_BoBq_B // indicates the actual contact point. If false, the finger is not in contact // and p_BoBq_B indicates the witness point to a proximity query. boolean is_in_contact; // if true, the finger is in contact. }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_robot_state.lcm
package drake; struct lcmt_robot_state { int64_t utime; int16_t num_joints; string joint_name[num_joints]; float joint_position[num_joints]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_panda_status.lcm
package drake; // The current status of a Franka Panda arm. All angular // positions/velocities are expressed in radians and radians/second. // // The fields of this message are based on the franka::RobotState message // found in libfranka, see // https://frankaemika.github.io/libfranka/structfranka_1_1RobotState.html // Where the names of some fields have been changed to be more "drake-like", // the original field name is referenced here. struct lcmt_panda_status { // The timestamp in microseconds. int64_t utime; int32_t num_joints; // franka::RobotState.q double joint_position[num_joints]; // franka::RobotState.q_d double joint_position_desired[num_joints]; // franka::RobotState.dq double joint_velocity[num_joints]; // franka::RobotState.dq_d double joint_velocity_desired[num_joints]; // franka::RobotState.ddq_d double joint_acceleration_desired[num_joints]; // franka::RobotState.tau_J double joint_torque[num_joints]; // franka::RobotState.tau_J_d double joint_torque_desired[num_joints]; // franka::RobotState.tau_ext_hat_filtered double joint_torque_external[num_joints]; double control_command_success_rate; // enum for robot mode const int8_t kOther = 0; const int8_t kIdle = 1; const int8_t kMove = 2; const int8_t kGuiding = 3; const int8_t kReflex = 4; const int8_t kUserStopped = 5; const int8_t kAutomaticErrorRecovery = 6; int8_t robot_mode; // franka::RobotState.time.toMSec() * 1000 int64_t robot_utime; // Information about how the driver's control mode is configured, as // described in // https://frankaemika.github.io/docs/libfranka.html#realtime-commands and // https://frankaemika.github.io/libfranka/classfranka_1_1Robot.html // // For a driver based on libfranka, at most one of position or velocity // control would be enabled at any given time. In other circumstances // (e.g. simulation) both position and velocity commands may potentially be // used. const int8_t CONTROL_MODE_POSITION = 1; const int8_t CONTROL_MODE_VELOCITY = 2; const int8_t CONTROL_MODE_TORQUE = 4; // Mask of enabled control modes int8_t control_mode; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_contact_results_for_viz.lcm
package drake; struct lcmt_contact_results_for_viz { // in microseconds int64_t timestamp; int32_t num_point_pair_contacts; lcmt_point_pair_contact_info_for_viz point_pair_contact_info[ num_point_pair_contacts]; int32_t num_hydroelastic_contacts; lcmt_hydroelastic_contact_surface_for_viz hydroelastic_contacts[ num_hydroelastic_contacts]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_drake_signal.lcm
package drake; // This LCM message contains a basic vector of doubles that can represent any // signal passed around in Drake. Note that the channel name on which this // message is sent will represent the name of the overall signal. struct lcmt_drake_signal { // The number of elements in the signal. int32_t dim; // The value of each element in the signal. double val[dim]; // The name of each element in the signal. string coord[dim]; // The timestamp in milliseconds. int64_t timestamp; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_point_pair_contact_info_for_viz.lcm
package drake; struct lcmt_point_pair_contact_info_for_viz { // TODO(edrumwri) Consider removing this data which is already present in the // structure in which this message is stored (lcmt_contact_results_for_viz). // In microseconds int64_t timestamp; // Names of the colliding bodies string body1_name; string body2_name; // These are all expressed in the world frame. double contact_point[3]; double contact_force[3]; double normal[3]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_planar_gripper_finger_face_assignments.lcm
package drake; // Communicates the finger-face assignments for each finger. // of the planar-gripper. struct lcmt_planar_gripper_finger_face_assignments { // in microseconds int64_t utime; int32_t num_fingers; lcmt_planar_gripper_finger_face_assignment finger_face_assignments[num_fingers]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_viewer_command.lcm
package drake; struct lcmt_viewer_command { int8_t command_type; string command_data; // enum for viewer command type const int8_t STATUS = 0; const int8_t LOAD_MODEL = 1; const int8_t LOAD_RENDERER = 2; const int8_t SHUTDOWN = 3; const int8_t START_RECORDING = 4; const int8_t STOP_RECORDING = 5; const int8_t LOAD_TERRAIN = 6; const int8_t SET_TERRAIN_TRANSFORM = 7; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_point.lcm
package drake; // A representation of a 3D point. struct lcmt_point { double x; double y; double z; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_call_python_data.lcm
package drake; // Generic data structure to wrap Python data types, for use with CallPython. // For historical reasons, interface is modeled on mxArray (see // https://www.mathworks.com/help/matlab/matlab_external/matlab-data.html). struct lcmt_call_python_data { // For data_type. const int8_t REMOTE_VARIABLE_REFERENCE = 0, DOUBLE = 1, CHAR = 2, LOGICAL = 3, INT = 4; // For shape_type. const int8_t MATRIX = 0, VECTOR = 1, SCALAR = 2; int8_t data_type; int8_t shape_type; int32_t rows; int32_t cols; int32_t num_bytes; byte data[num_bytes]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_viewer_geometry_data.lcm
package drake; struct lcmt_viewer_geometry_data { int8_t type; // Defines an enum for geometry type. const int8_t BOX = 1; const int8_t SPHERE = 2; const int8_t CYLINDER = 3; const int8_t MESH = 4; const int8_t CAPSULE = 5; const int8_t ELLIPSOID = 6; float position[3]; // x, y, z float quaternion[4]; // w, x, y, z float color[4]; // r, g, b, a string string_data; int32_t num_float_data; float float_data[num_float_data]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_schunk_wsg_status.lcm
package drake; struct lcmt_schunk_wsg_status { int64_t utime; //< The timestamp in microseconds. double actual_position_mm; // The combined force being applied by both gripper fingers in newtons. // While some implementations may report a negative value for this field // under some circumstances, it should always be interpreted as an unsigned // quantity (absolute value). double actual_force; double actual_speed_mm_per_s; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_image.lcm
package drake; // A representation of an image. struct lcmt_image { // The timestamp and the frame name where this image is obtained. lcmt_header header; // The image width in pixels. int32_t width; // The image height in pixels. int32_t height; // The physical memory size per a single row in bytes. int32_t row_stride; // The size of `data` in bytes. int32_t size; // The data that contains actual image. byte data[size]; // The boolean to denote if the data is stored in the bigendian order. boolean bigendian; // The semantic meaning of pixels. int8_t pixel_format; // The data type for a channel. int8_t channel_type; // The compression method. int8_t compression_method; // enum for pixel_format. const int8_t PIXEL_FORMAT_GRAY = 0; const int8_t PIXEL_FORMAT_RGB = 1; const int8_t PIXEL_FORMAT_BGR = 2; const int8_t PIXEL_FORMAT_RGBA = 3; const int8_t PIXEL_FORMAT_BGRA = 4; const int8_t PIXEL_FORMAT_DEPTH = 5; const int8_t PIXEL_FORMAT_LABEL = 6; const int8_t PIXEL_FORMAT_MASK = 7; const int8_t PIXEL_FORMAT_DISPARITY = 8; const int8_t PIXEL_FORMAT_BAYER_BGGR = 9; const int8_t PIXEL_FORMAT_BAYER_RGGB = 10; const int8_t PIXEL_FORMAT_BAYER_GBRG = 11; const int8_t PIXEL_FORMAT_BAYER_GRBG = 12; const int8_t PIXEL_FORMAT_INVALID = -1; // enum for channel_type. const int8_t CHANNEL_TYPE_INT8 = 0; const int8_t CHANNEL_TYPE_UINT8 = 1; const int8_t CHANNEL_TYPE_INT16 = 2; const int8_t CHANNEL_TYPE_UINT16 = 3; const int8_t CHANNEL_TYPE_INT32 = 4; const int8_t CHANNEL_TYPE_UINT32 = 5; const int8_t CHANNEL_TYPE_FLOAT32 = 6; const int8_t CHANNEL_TYPE_FLOAT64 = 7; const int8_t CHANNEL_TYPE_INVALID = -1; // enum for compression_method. const int8_t COMPRESSION_METHOD_NOT_COMPRESSED = 0; const int8_t COMPRESSION_METHOD_ZLIB = 1; const int8_t COMPRESSION_METHOD_JPEG = 2; const int8_t COMPRESSION_METHOD_PNG = 3; const int8_t COMPRESSION_METHOD_INVALID = -1; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_jaco_command.lcm
package drake; // Commands a single set of joint states for the arm. All angular // positions/velocities are expressed in radians and radians/second. struct lcmt_jaco_command { // The timestamp in microseconds. int64_t utime; int32_t num_joints; double joint_position[num_joints]; double joint_velocity[num_joints]; int32_t num_fingers; double finger_position[num_fingers]; double finger_velocity[num_fingers]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/experimental_lcmt_deformable_tri_meshes_update.lcm
package drake; // For each mesh included in this message, provide the number of vertices and // their positions in world space at time `timestamp`. struct experimental_lcmt_deformable_tri_meshes_update { // in microseconds int64_t timestamp; int32_t num_meshes; experimental_lcmt_deformable_tri_mesh_update meshes[num_meshes]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_quaternion.lcm
package drake; // A representation of an orientation in quaternion. struct lcmt_quaternion { double w; double x; double y; double z; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_allegro_command.lcm
package drake; // Commands a single set of joint states for the hand. struct lcmt_allegro_command { // The timestamp in microseconds. int64_t utime; // The reference joint positions. int32_t num_joints; double joint_position[num_joints]; // The reference joint torques. They should only be sent when the hand is in // torque control mode. Otherwise, num_torques should be set to zero, and // the numbers in joint_torque, if any, are ignored. int32_t num_torques; double joint_torque[num_torques]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_planar_gripper_status.lcm
package drake; // The current status of a planar-gripper. All angular // positions/velocities are expressed in radians and radians/second. struct lcmt_planar_gripper_status { // The timestamp in microseconds (this is typically the wall clock // time of the sender https://en.wikipedia.org/wiki/Unix_time ) int64_t utime; // The planar gripper consists of N fingers, each finger consists of two // actuated joints. int8_t num_fingers; lcmt_planar_gripper_finger_status finger_status[num_fingers]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/experimental_lcmt_deformable_tri_mesh_update.lcm
package drake; // An update to the vertex positions of the mesh named `name`. // * `num_vertices` is the number of vertex positions to be passed in this // message. // * `vertices_W[i]` contains the world space position of the i-th vertex // passed in this message. struct experimental_lcmt_deformable_tri_mesh_update { string name; int32_t num_vertices; double vertices_W[num_vertices][3]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_planar_gripper_command.lcm
package drake; // Commands a single set of joint states for the planar gripper. All angular // positions/velocities are expressed in radians and radians/second. struct lcmt_planar_gripper_command { // The timestamp in microseconds. int64_t utime; // The planar gripper consists of N fingers, each finger consists of two // actuated joints. int8_t num_fingers; lcmt_planar_gripper_finger_command finger_command[num_fingers]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/__init__.py
# Empty Python module `__init__`, required to make this a module.
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_viewer_load_robot.lcm
package drake; struct lcmt_viewer_load_robot { int32_t num_links; lcmt_viewer_link_data link[num_links]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_point_cloud_field.lcm
package drake; // Describes one field (i.e., channel) within an lcmt_point_cloud. // // Modeled after PCL and ROS conventions: // https://pointclouds.org/documentation/structpcl_1_1_p_c_l_point_field.html // https://docs.ros.org/en/api/sensor_msgs/html/msg/PointField.html // http://wiki.ros.org/pcl/Overview#Common_PointCloud2_field_names // struct lcmt_point_cloud_field { // Field name. string name; // Location of this field after the start of each point's data. int32_t byte_offset; // Element type, per the constants shown below. int8_t datatype; // Number of elements per field. int32_t count; // Allowed values for datatype. const int8_t INT8 = 1; const int8_t UINT8 = 2; const int8_t INT16 = 3; const int8_t UINT16 = 4; const int8_t INT32 = 5; const int8_t UINT32 = 6; const int8_t FLOAT32 = 7; const int8_t FLOAT64 = 8; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_scope.lcm
package drake; // The message type for LcmScopeSystem. struct lcmt_scope { // The timestamp in microseconds. int64_t utime; // The scoped value. int32_t size; double value[size]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_planar_gripper_finger_command.lcm
package drake; struct lcmt_planar_gripper_finger_command { // Only used when the planar gripper is in joint position control mode. // Otherwise, ignored. double joint_position[2]; double joint_velocity[2]; // Only used when the planar gripper is in joint torque control mode. // Otherwise, ignored. double joint_torque[2]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_hydroelastic_contact_surface_for_viz.lcm
package drake; struct lcmt_hydroelastic_contact_surface_for_viz { // The contact is between two bodies, but we track multiple names per body // so that visualizers can fully disambiguate contacts: // // - name of the geometry affixed to the body which produced the surface. // - name of the body. // - name of the model instance to which the body belongs. // - uniqueness of the body name. If unique, the body can unambiguously be // represented by just its body name. Otherwise it must be combined with // its model instance name. The validity of this logic relies on // MultibodyPlant's requirement that model instance names must be unique. // - the number of collision geometries affixed to the body. If the // colliding bodies both have a single collision geometry each, there can // be only one contact surface between them and display can be // streamlined. Otherwise, the possibility of multiple contact surfaces // needs to be accounted for. // string geometry1_name; string body1_name; string model1_name; boolean body1_unique; int32_t collision_count1; string geometry2_name; string body2_name; string model2_name; boolean body2_unique; int32_t collision_count2; // The centroid of the contact surface, as an offset vector expressed in the // world frame. double centroid_W[3]; // The force, expressed in the world frame, that is applied to `body1_name` // at the centroid of the contact surface. double force_C_W[3]; // The moment, expressed in the world frame, that is applied to `body1_name` // at the centroid of the contact surface. double moment_C_W[3]; // The *total* number of quadrature points. The number of per-face quadrature // points are typically 1 or 3 (in the future, some arbitrary number may be // permitted). There is no guaranteed pattern of correspondence between the // ith quadrature point and the jth mesh face. int32_t num_quadrature_points; // The quadrature point data. lcmt_hydroelastic_quadrature_per_point_data_for_viz quadrature_point_data[num_quadrature_points]; // The vertices. int32_t num_vertices; // TODO(SeanCurtis-TRI): It would be nice to have a simple Vector3 type here, // but the concept of a 3D point is perfectly sufficient. lcmt_point p_WV[num_vertices]; // Pressure values at each vertex. double pressure[num_vertices]; // The polygons are encoded in one long stream as // c0, v00, v01, ..., c1, v10, v11, ... // Such that each polygon has a count of vertices ci, followed by ci number // of 0-indexed indices into the vertex set. The total number of integer // values is recorded here. int32_t poly_data_int_count; int32_t poly_data[poly_data_int_count]; }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_robot_plan.lcm
package drake; struct lcmt_robot_plan { int64_t utime; int32_t num_states; lcmt_robot_state plan[num_states]; // each individual state is also timed. }
0
/home/johnshepherd/drake
/home/johnshepherd/drake/lcmtypes/lcmt_acrobot_y.lcm
package drake; struct lcmt_acrobot_y { int64_t timestamp; double theta1; // measured position double theta2; double tau; // measured actual torque }
0
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
35
Edit dataset card