Skip to content

Commit

Permalink
Drop the internal vendored version of TinyXML2
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <mjcarroll@intrinsic.ai>
  • Loading branch information
mjcarroll committed Oct 12, 2023
1 parent 669c4ec commit f8a5c3b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4,630 deletions.
20 changes: 3 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ if(WIN32)
false)
endif()

#--------------------------------------
# Option: Should we use our internal copy of tinyxml2?
if(UNIX OR APPLE)
option(USE_EXTERNAL_TINYXML2 "Use a system-installed version of tinyxml2" ON)
elseif(WIN32)
# For backward compatibility, this option on Windows by default is OFF
option(USE_EXTERNAL_TINYXML2 "Use a system-installed version of tinyxml2" OFF)
endif()


#============================================================================
# Search for project-specific dependencies
#============================================================================
Expand All @@ -59,13 +49,9 @@ set(GZ_UTILS_VER ${gz-utils2_VERSION_MAJOR})

#--------------------------------------
# Find Tinyxml2
if(USE_EXTERNAL_TINYXML2)
gz_find_package(TINYXML2 PRETTY tinyxml2
REQUIRED_BY graphics
PRIVATE_FOR graphics)
else()
message(STATUS "Skipping search for tinyxml2 and using an internal version\n")
endif()
gz_find_package(TINYXML2 PRETTY tinyxml2
REQUIRED_BY graphics
PRIVATE_FOR graphics)

#--------------------------------------
# Find dependencies that we ignore for Visual Studio
Expand Down
51 changes: 9 additions & 42 deletions graphics/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,47 +39,14 @@ if(${GzAssimp_VERSION} STRLESS "5.2.0")
endif()


if(USE_EXTERNAL_TINYXML2)

# If we are using an external copy of tinyxml2, add its imported target
target_link_libraries(${graphics_target}
PRIVATE
TINYXML2::TINYXML2)

# The collada exporter test uses tinyxml2, so we must link it if we're using
# an external copy. The graphics target considers tinyxml2 to be a private
# dependency, so it will not automatically get linked to this test.
if(TARGET UNIT_ColladaExporter_TEST)
target_link_libraries(UNIT_ColladaExporter_TEST TINYXML2::TINYXML2)
endif()

else()

# Otherwise, add its source directory to our target's PRIVATE include
# directories. We do not want this to be visible to consumers of
# gz-common.
target_include_directories(${graphics_target}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2)

if(TARGET UNIT_ColladaExporter_TEST)

# If we are using the internal copy of tinyxml2, then the collada exporter
# test needs to be pointed to the internal tinyxml2 include directory.
target_include_directories(UNIT_ColladaExporter_TEST PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2)
# We also need to add this as a source file to the collada exporter test's
# target, because we do not export the tinyxml2 symbols that get generated
# in the gz-common library. Therefore, the collada exporter test
# cannot link to those symbols and must generate its own.
target_sources(UNIT_ColladaExporter_TEST PRIVATE tinyxml2/tinyxml2.cpp)

endif()

endif()
# If we are using an external copy of tinyxml2, add its imported target
target_link_libraries(${graphics_target}
PRIVATE
TINYXML2::TINYXML2)

# define of tinxml2 major version >= 6
# https://github.com/gazebosim/gz-common/issues/28
if (NOT TINYXML2_VERSION VERSION_LESS "6.0.0")
message(STATUS "TINYXML2_VERSION ${TINYXML2_VERSION} >= 6.0.0")
target_compile_definitions(${graphics_target}
PRIVATE "TINYXML2_MAJOR_VERSION_GE_6")
# The collada exporter test uses tinyxml2, so we must link it if we're using
# an external copy. The graphics target considers tinyxml2 to be a private
# dependency, so it will not automatically get linked to this test.
if(TARGET UNIT_ColladaExporter_TEST)
target_link_libraries(UNIT_ColladaExporter_TEST TINYXML2::TINYXML2)
endif()
1 change: 0 additions & 1 deletion graphics/src/tinyxml2/VERSION_3.0.0

This file was deleted.

Loading

0 comments on commit f8a5c3b

Please sign in to comment.