Automated g4 rollback of changelist 885555524.
*** Reason for rollback *** Rolling back obj/stl decoder inclusion as sources due to broken windows build. *** Original change description *** Include obj and stl decoder plugins as sources in CMake builds. This removes the need to load these decoders via mj_loadAllPluginLibraries when using MuJoCo built with CMake. Other plugins are unchanged. *** PiperOrigin-RevId: 885576586 Change-Id: I31e6fa4d10697862f7d800d0d771ca752747e36d
This commit is contained in:
committed by
Copybara-Service
parent
15ca42ff68
commit
ef78f07ffb
@@ -112,7 +112,6 @@ if(NOT EMSCRIPTEN)
|
||||
endif()
|
||||
add_subdirectory(plugin/obj_decoder)
|
||||
add_subdirectory(plugin/stl_decoder)
|
||||
|
||||
add_subdirectory(src/engine)
|
||||
add_subdirectory(src/user)
|
||||
add_subdirectory(src/xml)
|
||||
|
||||
@@ -38,6 +38,7 @@ function(add_mujoco_shell_test TEST_NAME TARGET_BINARY)
|
||||
"CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}"
|
||||
"TARGET_BINARY=$<TARGET_FILE:${TARGET_BINARY}>"
|
||||
"TEST_TMPDIR=${TEST_TMPDIR}"
|
||||
"MUJOCO_PLUGIN_DIR=$<TARGET_FILE_DIR:obj_decoder>"
|
||||
)
|
||||
if(WIN32)
|
||||
# Define the directory containing the mujoco DLL library so that it can be added to the PATH.
|
||||
|
||||
@@ -28,8 +28,6 @@ General
|
||||
(previously the scalar), and subsequent elements are the higher-order :ref:`polynomial<gePolynomial>` coefficients.
|
||||
|
||||
**Migration:** Replace assignments like ``joint.stiffness = val`` with ``joint.stiffness[0] = val``.
|
||||
- ``.obj`` and ``.stl`` decoders are now included as source when building MuJoCo with CMake. This fixes the
|
||||
behaviour from the previous release where it required downstream code to load these plugins explicitly.
|
||||
|
||||
|
||||
Bug fixes
|
||||
|
||||
@@ -12,9 +12,48 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
target_compile_definitions(mujoco PRIVATE TINYOBJLOADER_IMPLEMENTATION)
|
||||
target_sources(mujoco PRIVATE
|
||||
obj_decoder.cc
|
||||
if(EMSCRIPTEN)
|
||||
add_library(obj_decoder OBJECT obj_decoder.cc)
|
||||
else()
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
add_library(obj_decoder SHARED obj_decoder.cc)
|
||||
endif()
|
||||
|
||||
target_include_directories(obj_decoder PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(mujoco PRIVATE tinyobjloader)
|
||||
if(EMSCRIPTEN)
|
||||
target_link_libraries(obj_decoder PRIVATE
|
||||
tinyobjloader
|
||||
)
|
||||
else()
|
||||
target_link_libraries(obj_decoder PRIVATE
|
||||
mujoco
|
||||
tinyobjloader
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(obj_decoder PRIVATE TINYOBJLOADER_IMPLEMENTATION)
|
||||
|
||||
target_compile_options(obj_decoder PRIVATE
|
||||
${AVX_COMPILE_OPTIONS}
|
||||
${MUJOCO_MACOS_COMPILE_OPTIONS}
|
||||
${EXTRA_COMPILE_OPTIONS}
|
||||
${MUJOCO_CXX_FLAGS}
|
||||
)
|
||||
|
||||
if(NOT EMSCRIPTEN)
|
||||
target_link_options(obj_decoder PRIVATE
|
||||
${MUJOCO_MACOS_LINK_OPTIONS}
|
||||
${EXTRA_LINK_OPTIONS}
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS obj_decoder
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -12,6 +12,43 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
target_sources(mujoco PRIVATE
|
||||
stl_decoder.cc
|
||||
if(EMSCRIPTEN)
|
||||
add_library(stl_decoder OBJECT stl_decoder.cc)
|
||||
else()
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
|
||||
|
||||
add_library(stl_decoder SHARED stl_decoder.cc)
|
||||
endif()
|
||||
|
||||
target_include_directories(stl_decoder PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../include
|
||||
)
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
target_link_libraries(stl_decoder PRIVATE)
|
||||
else()
|
||||
target_link_libraries(stl_decoder PRIVATE
|
||||
mujoco
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(stl_decoder PRIVATE
|
||||
${AVX_COMPILE_OPTIONS}
|
||||
${MUJOCO_MACOS_COMPILE_OPTIONS}
|
||||
${EXTRA_COMPILE_OPTIONS}
|
||||
${MUJOCO_CXX_FLAGS}
|
||||
)
|
||||
|
||||
if(NOT EMSCRIPTEN)
|
||||
target_link_options(stl_decoder PRIVATE
|
||||
${MUJOCO_MACOS_LINK_OPTIONS}
|
||||
${EXTRA_LINK_OPTIONS}
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS stl_decoder
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_BINDIR}/mujoco_plugin"
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -187,6 +187,12 @@ int main(int argc, char** argv) {
|
||||
nthread = mjMAX(1, mjMIN(maxthread, nthread));
|
||||
npoolthread = mjMAX(1, mjMIN(maxthread, npoolthread));
|
||||
|
||||
// load plugins from MUJOCO_PLUGIN_DIR if set
|
||||
const char* plugin_dir = std::getenv("MUJOCO_PLUGIN_DIR");
|
||||
if (plugin_dir) {
|
||||
mj_loadAllPluginLibraries(plugin_dir, nullptr);
|
||||
}
|
||||
|
||||
// get filename, determine file type
|
||||
std::string filename(argv[1]);
|
||||
bool binary = (filename.find(".mjb") != std::string::npos); // NOLINT
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
|
||||
mujoco_test(
|
||||
user_model_test
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"MUJOCO_PLUGIN_DIR=$<TARGET_FILE_DIR:obj_decoder>"
|
||||
ADDITIONAL_LINK_LIBRARIES absl::str_format
|
||||
)
|
||||
|
||||
@@ -28,10 +31,16 @@ mujoco_test(
|
||||
|
||||
mujoco_test(
|
||||
user_flex_test
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"MUJOCO_PLUGIN_DIR=$<TARGET_FILE_DIR:obj_decoder>"
|
||||
)
|
||||
|
||||
mujoco_test(
|
||||
user_mesh_test
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"MUJOCO_PLUGIN_DIR=$<TARGET_FILE_DIR:obj_decoder>"
|
||||
ADDITIONAL_LINK_LIBRARIES absl::str_format
|
||||
)
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ mujoco_test(xml_api_test)
|
||||
|
||||
mujoco_test(
|
||||
xml_native_reader_test
|
||||
PROPERTIES
|
||||
ENVIRONMENT
|
||||
"MUJOCO_PLUGIN_DIR=$<TARGET_FILE_DIR:obj_decoder>"
|
||||
)
|
||||
|
||||
mujoco_test(xml_utils_test)
|
||||
|
||||
+1
-6
@@ -60,11 +60,6 @@ set_target_properties(mujoco_wasm PROPERTIES
|
||||
OUTPUT_NAME "mujoco"
|
||||
)
|
||||
|
||||
# Link the mujoco library as a whole archive to avoid losing plugin
|
||||
# registration such as obj_decoder and stl_decoder.
|
||||
target_link_libraries(mujoco_wasm PRIVATE
|
||||
-Wl,--whole-archive mujoco -Wl,--no-whole-archive
|
||||
ccd lodepng tinyxml2 qhullstatic_r
|
||||
)
|
||||
target_link_libraries(mujoco_wasm ccd lodepng mujoco tinyxml2 qhullstatic_r obj_decoder stl_decoder)
|
||||
|
||||
install(TARGETS mujoco_wasm DESTINATION ${DIVISIBLE_INSTALL_BIN_DIR})
|
||||
|
||||
@@ -53,11 +53,6 @@ add_executable(mujoco_wasm_benchmark ${MUJOCO_WASM_FILES})
|
||||
|
||||
set_target_properties(mujoco_wasm_benchmark PROPERTIES LINK_FLAGS "${EMCC_LINKER_FLAGS_STR}")
|
||||
|
||||
# Link the mujoco library as a whole archive to avoid losing plugin
|
||||
# registration such as obj_decoder and stl_decoder.
|
||||
target_link_libraries(mujoco_wasm_benchmark PRIVATE
|
||||
-Wl,--whole-archive mujoco -Wl,--no-whole-archive
|
||||
ccd lodepng tinyxml2 qhullstatic_r
|
||||
)
|
||||
target_link_libraries(mujoco_wasm_benchmark ccd lodepng mujoco tinyxml2 qhullstatic_r obj_decoder stl_decoder)
|
||||
|
||||
install(TARGETS mujoco_wasm_benchmark DESTINATION ${DIVISIBLE_INSTALL_BIN_DIR})
|
||||
|
||||
Reference in New Issue
Block a user