Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop the internal vendored version of TinyXML2 #542

Merged
merged 8 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
59 changes: 9 additions & 50 deletions graphics/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
gz_get_libsources_and_unittests(sources gtest_sources)


if(NOT USE_EXTERNAL_TINYXML2)
# If we are using our internal copy of tinyxml2, then add its
# source file.
message(STATUS "Adding tinyxml2 source files")
list(APPEND sources ${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp)
endif()


gz_add_component(graphics SOURCES ${sources} GET_TARGET_NAME graphics_target)

target_link_libraries(${graphics_target}
Expand Down Expand Up @@ -39,47 +31,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