diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e06fde4..e9c97475 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,7 +151,7 @@ if(EMSCRIPTEN) endif() -target_compile_definitions(mujoco PRIVATE _GNU_SOURCE CCD_STATIC_DEFINE MUJOCO_DLL_EXPORTS -DMC_IMPLEM_ENABLE) +target_compile_definitions(mujoco PRIVATE _GNU_SOURCE MUJOCO_DLL_EXPORTS -DMC_IMPLEM_ENABLE) if(MUJOCO_ENABLE_AVX_INTRINSICS) target_compile_definitions(mujoco PUBLIC mjUSEPLATFORMSIMD) endif() @@ -174,9 +174,9 @@ target_link_libraries( mujoco PRIVATE ccd lodepng - qhullstatic_r - tinyobjloader - tinyxml2 + Qhull::qhull_r + tinyobjloader::tinyobjloader + tinyxml2::tinyxml2 ) set_target_properties( diff --git a/cmake/MujocoDependencies.cmake b/cmake/MujocoDependencies.cmake index 34be423f..1106d7ed 100644 --- a/cmake/MujocoDependencies.cmake +++ b/cmake/MujocoDependencies.cmake @@ -90,7 +90,7 @@ set(BUILD_SHARED_LIBS CACHE INTERNAL "Build SHARED libraries" ) -if(NOT TARGET lodepng) +if(0) FetchContent_Declare( lodepng GIT_REPOSITORY https://github.com/lvandeve/lodepng.git @@ -114,6 +114,7 @@ if(NOT TARGET lodepng) endif() endif() +if(0) if(NOT TARGET marchingcubecpp) FetchContent_Declare( marchingcubecpp @@ -127,6 +128,23 @@ if(NOT TARGET marchingcubecpp) include_directories(${marchingcubecpp_SOURCE_DIR}) endif() endif() +endif() + +findorfetch( + USE_SYSTEM_PACKAGE + ON + PACKAGE_NAME + lodepng + LIBRARY_NAME + lodepng + GIT_REPO + https://github.com/lvandeve/lodepng.git + GIT_TAG + ${MUJOCO_DEP_VERSION_lodepng} + TARGETS + lodepng + EXCLUDE_FROM_ALL +) set(QHULL_ENABLE_TESTING OFF) # Patch changes in https://github.com/qhull/qhull/pull/173.patch @@ -136,32 +154,40 @@ set(QHULL_PATCH_COMMAND findorfetch( USE_SYSTEM_PACKAGE - OFF + ON PACKAGE_NAME - qhull + Qhull LIBRARY_NAME - qhull + Qhull GIT_REPO https://github.com/qhull/qhull.git GIT_TAG ${MUJOCO_DEP_VERSION_qhull} TARGETS - qhull + Qhull EXCLUDE_FROM_ALL PATCH_COMMAND ${QHULL_PATCH_COMMAND} ) # MuJoCo includes a file from libqhull_r which is not exported by the qhull include directories. # Add it to the target. +if(0) target_include_directories( qhullstatic_r INTERFACE $ ) target_compile_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) target_link_options(qhullstatic_r PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) +endif() + +include_directories( + ${Qhull_DIR}/../../include + ${Qhull_DIR}/../../include/libqhull_r + ${Qhull_DIR}/../../include/marchingcubecpp +) set(tinyxml2_BUILD_TESTING OFF) findorfetch( USE_SYSTEM_PACKAGE - OFF + ON PACKAGE_NAME tinyxml2 LIBRARY_NAME @@ -174,8 +200,10 @@ findorfetch( tinyxml2 EXCLUDE_FROM_ALL ) +if(0) target_compile_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) target_link_options(tinyxml2 PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) +endif() # update cmake_minimum_required version for compatibility with newer version of cmake if(NOT DEFINED CMAKE_POLICY_VERSION_MINIMUM) @@ -184,7 +212,7 @@ if(NOT DEFINED CMAKE_POLICY_VERSION_MINIMUM) endif() findorfetch( USE_SYSTEM_PACKAGE - OFF + ON PACKAGE_NAME tinyobjloader LIBRARY_NAME @@ -202,7 +230,7 @@ if(CMAKE_POLICY_VERSION_MINIMUM_LOCALLY_DEFINED) unset(CMAKE_POLICY_VERSION_MINIMUM_LOCALLY_DEFINED) endif() -if(NOT TARGET trianglemeshdistance) +if(0) FetchContent_Declare( trianglemeshdistance GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/TriangleMeshDistance.git @@ -226,6 +254,18 @@ if(NOT TARGET trianglemeshdistance) endif() endif() +findorfetch( + USE_SYSTEM_PACKAGE + ON + PACKAGE_NAME + trianglemeshdistance + LIBRARY_NAME + trianglemeshdistance + TARGETS + trianglemeshdistance + EXCLUDE_FROM_ALL +) + set(ENABLE_DOUBLE_PRECISION ON) set(CCD_HIDE_ALL_SYMBOLS ON) @@ -241,7 +281,7 @@ if(NOT DEFINED CMAKE_POLICY_VERSION_MINIMUM) endif() findorfetch( USE_SYSTEM_PACKAGE - OFF + ON PACKAGE_NAME ccd LIBRARY_NAME @@ -259,11 +299,14 @@ if(CMAKE_POLICY_VERSION_MINIMUM_LOCALLY_DEFINED) unset(CMAKE_POLICY_VERSION_MINIMUM) unset(CMAKE_POLICY_VERSION_MINIMUM_LOCALLY_DEFINED) endif() +if(0) target_compile_options(ccd PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) target_link_options(ccd PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) +endif() # libCCD has an unconditional `#define _CRT_SECURE_NO_WARNINGS` on Windows. # TODO(stunya): Remove this after https://github.com/danfis/libccd/pull/77 is merged. +if(0) if(WIN32) if(MSVC) # C4005 is the MSVC equivalent of -Wmacro-redefined. @@ -272,6 +315,7 @@ if(WIN32) target_compile_options(ccd PRIVATE -Wno-macro-redefined) endif() endif() +endif() if(MUJOCO_BUILD_TESTS OR MUJOCO_BUILD_STUDIO OR MUJOCO_USE_FILAMENT) set(ABSL_PROPAGATE_CXX_STD ON) diff --git a/simulate/cmake/SimulateDependencies.cmake b/simulate/cmake/SimulateDependencies.cmake index 7885f5f9..01db1dbc 100644 --- a/simulate/cmake/SimulateDependencies.cmake +++ b/simulate/cmake/SimulateDependencies.cmake @@ -86,7 +86,7 @@ findorfetch( GIT_TAG ${MUJOCO_DEP_VERSION_glfw3} TARGETS - glfw + glfw3 EXCLUDE_FROM_ALL ) @@ -98,7 +98,7 @@ if(MUJOCO_EXTRAS_STATIC_GLFW) unset(BUILD_SHARED_LIBS_OLD) endif() -if(NOT SIMULATE_STANDALONE AND NOT MUJOCO_SIMULATE_USE_SYSTEM_GLFW) +if(0) target_compile_options(glfw PRIVATE ${MUJOCO_MACOS_COMPILE_OPTIONS}) target_link_options(glfw PRIVATE ${MUJOCO_MACOS_LINK_OPTIONS}) endif() diff --git a/src/user/user_mesh.cc b/src/user/user_mesh.cc index 8c46840b..27711d66 100644 --- a/src/user/user_mesh.cc +++ b/src/user/user_mesh.cc @@ -34,7 +34,7 @@ #include #include "user/user_api.h" -#include +#include #ifdef MUJOCO_TINYOBJLOADER_IMPL #define TINYOBJLOADER_IMPLEMENTATION