From 9f2875b307183fd76862f6c9f51dc37785ab4368 Mon Sep 17 00:00:00 2001 From: Nimrod Gileadi Date: Wed, 7 Feb 2024 07:37:26 -0800 Subject: [PATCH] Use system zlib instead of building from source. ZLIB has some issues with building with CMake, which mean we had to explicitly list all targets to build, instead of just running cmake as usual. If we use zlib from the system, this is not necessary. Also in this CL: - Remove the explicit list of targets to build with GH Actions. - Run the tests from the correct directory. PiperOrigin-RevId: 604978828 Change-Id: I36f596c6be433e643670dd8055674c4daebcf2c8 --- .github/workflows/build.yml | 11 ++++++----- mjpc/grpc/CMakeLists.txt | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb953b4ee..c47ea5564 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,13 +19,11 @@ jobs: -DCMAKE_C_COMPILER:STRING=clang-12 -DCMAKE_CXX_COMPILER:STRING=clang++-12 -DMJPC_BUILD_GRPC_SERVICE:BOOL=ON - additional_targets: "agent_server direct_server filter_server" tmpdir: "/tmp" - os: macos-12 cmake_args: >- -G Ninja -DMJPC_BUILD_GRPC_SERVICE:BOOL=ON - additional_targets: "agent_server direct_server filter_server" tmpdir: "/tmp" name: "MuJoCo MPC on ${{ matrix.os }} ${{ matrix.additional_label }}" @@ -43,9 +41,10 @@ jobs: libxrandr-dev libxi-dev ninja-build + zlib1g-dev - name: Prepare macOS if: ${{ runner.os == 'macOS' }} - run: brew install ninja + run: brew install ninja zlib - name: Prepare Windows if: ${{ runner.os == 'Windows' }} # Install llvm 16 manually, remove after @@ -68,10 +67,12 @@ jobs: $cmake_extra_args - name: Build MuJoCo MPC working-directory: build - run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} --target mjpc agent_test agent_utilities_test cost_derivatives_test norm_test rollout_test threadpool_test trajectory_test direct_force_test direct_optimize_test direct_parameter_test direct_sensor_test direct_trajectory_test direct_utilities_test batch_filter_test batch_prior_test kalman_test spline_test unscented_test cubic_test gradient_planner_test gradient_test linear_test zero_test backward_pass_test ilqg_test robust_planner_test sampling_planner_test state_test task_test utilities_test ${{ matrix.additional_targets }} + run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} - name: Test MuJoCo MPC working-directory: build - run: ctest -C Release --output-on-failure . + run: > + cd mjpc/test && + ctest -C Release --output-on-failure . - name: Notify team chat shell: bash env: diff --git a/mjpc/grpc/CMakeLists.txt b/mjpc/grpc/CMakeLists.txt index 112ac2b26..bd94bb279 100644 --- a/mjpc/grpc/CMakeLists.txt +++ b/mjpc/grpc/CMakeLists.txt @@ -20,6 +20,10 @@ set(BUILD_SHARED_LIBS CACHE INTERNAL "Build SHARED libraries" ) +find_package(ZLIB REQUIRED) +set(gRPC_ZLIB_PROVIDER "package" CACHE INTERNAL "") +set(ZLIB_BUILD_EXAMPLES OFF) + findorfetch( USE_SYSTEM_PACKAGE OFF @@ -35,9 +39,6 @@ findorfetch( gRPC ) -find_package(ZLIB REQUIRED) -set(gRPC_ZLIB_PROVIDER "package" CACHE INTERNAL "") -set(ZLIB_BUILD_EXAMPLES OFF) set(_PROTOBUF_LIBPROTOBUF libprotobuf) set(_REFLECTION grpc++_reflection) set(_PROTOBUF_PROTOC $)