diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29d56463..de82a656 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -154,6 +154,18 @@ jobs: - name: Build samples working-directory: sample/build run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} + - name: Configure simulate + working-directory: simulate + run: > + mkdir build && + cd build && + cmake .. + -DCMAKE_BUILD_TYPE:STRING=Release + -Dmujoco_ROOT:STRING=${{ matrix.tmpdir }}/mujoco_install + ${{ matrix.cmake_args }} + - name: Build simulate + working-directory: simulate/build + run: cmake --build . --config=Release ${{ matrix.cmake_build_args }} - name: Make Python sdist shell: bash working-directory: python diff --git a/simulate/CMakeLists.txt b/simulate/CMakeLists.txt index 1b923c78..f9ddc9b5 100644 --- a/simulate/CMakeLists.txt +++ b/simulate/CMakeLists.txt @@ -22,6 +22,11 @@ set(CMAKE_POLICY_DEFAULT_CMP0072 NEW) # This line has to appear before 'PROJECT' in order to be able to disable incremental linking set(MSVC_INCREMENTAL_DEFAULT ON) +set(MUJOCO_DEP_VERSION_lodepng + b4ed2cd7ecf61d29076169b49199371456d4f90b + CACHE STRING "Version of `lodepng` to be fetched." +) + project( mujoco_simulate VERSION 2.2.1 @@ -71,6 +76,27 @@ if(MUJOCO_HARDEN) endif() endif() +# Fetch lodepng dependency. +if(NOT TARGET lodepng) + FetchContent_Declare( + lodepng + GIT_REPOSITORY https://github.com/lvandeve/lodepng.git + GIT_TAG ${MUJOCO_DEP_VERSION_lodepng} + ) + + FetchContent_GetProperties(lodepng) + if(NOT lodepng_POPULATED) + FetchContent_Populate(lodepng) + # This is not a CMake project. + set(LODEPNG_SRCS ${lodepng_SOURCE_DIR}/lodepng.cpp) + set(LODEPNG_HEADERS ${lodepng_SOURCE_DIR}/lodepng.h) + add_library(lodepng STATIC ${LODEPNG_HEADERS} ${LODEPNG_SRCS}) + target_compile_options(lodepng PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) + target_link_options(lodepng PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) + target_include_directories(lodepng PUBLIC ${lodepng_SOURCE_DIR}) + endif() +endif() + # mjsimulate library add_library(mjsimulate STATIC) target_sources(