only use bundled tinyxml2 in CMake when configured to do so (#3806)

This commit is contained in:
Oliver Stöneberg 2022-02-06 13:02:52 +01:00 committed by GitHub
parent a15a227b73
commit 974dd5d49f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 7 deletions

View File

@ -27,7 +27,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install libxml2-utils
sudo apt-get install z3 libz3-dev
sudo apt-get install libz3-dev libtinyxml2-dev
sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev qt5-default
- name: Fix missing z3_version.h
@ -45,6 +45,20 @@ jobs:
python -m pip install pip --upgrade
python -m pip install pytest
- name: CMake build on ubuntu (with GUI / system tinyxml2)
if: contains(matrix.os, 'ubuntu')
run: |
mkdir cmake.output.tinyxml2
cd cmake.output.tinyxml2
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off ..
cmake --build . -- -j$(nproc)
cd ..
- name: Run CMake test (system tinyxml2)
if: contains(matrix.os, 'ubuntu')
run: |
cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc)
- name: CMake build on ubuntu (with GUI)
if: contains(matrix.os, 'ubuntu')
run: |

View File

@ -35,7 +35,7 @@ if (WIN32 AND NOT BORLAND)
endif()
endif()
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
target_link_libraries(cppcheck tinyxml2)
target_link_libraries(cppcheck ${tinyxml2_LIBRARY})
endif()
add_dependencies(cppcheck copy_cfg)

View File

@ -1,11 +1,13 @@
qt5_wrap_cpp(test-benchmark-simple_SRC benchmarksimple.h)
add_custom_target(build-testbenchmark-simple-deps SOURCES ${test-benchmark-simple_SRC})
add_dependencies(gui-build-deps build-testbenchmark-simple-deps)
if(USE_BUNDLED_TINYXML2)
list(APPEND test-benchmark-simple_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
endif()
add_executable(benchmark-simple
${test-benchmark-simple_SRC}
benchmarksimple.cpp
$<TARGET_OBJECTS:lib_objs>
$<TARGET_OBJECTS:tinyxml2_objs>
$<TARGET_OBJECTS:simplecpp_objs>
)
target_include_directories(benchmark-simple PRIVATE ${CMAKE_SOURCE_DIR}/lib)
@ -16,4 +18,7 @@ if (HAVE_RULES)
endif()
if (USE_Z3)
target_link_libraries(benchmark-simple ${Z3_LIBRARIES})
endif()
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
target_link_libraries(benchmark-simple ${tinyxml2_LIBRARY})
endif()

View File

@ -22,4 +22,7 @@ if (HAVE_RULES)
endif()
if (USE_Z3)
target_link_libraries(test-xmlreportv2 ${Z3_LIBRARIES})
endif()
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
target_link_libraries(test-xmlreportv2 ${tinyxml2_LIBRARY})
endif()

View File

@ -1,11 +1,19 @@
if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_executable(fuzz-client EXCLUDE_FROM_ALL
set(fuzz-client_SRC
main.cpp
type2.cpp
)
if(USE_BUNDLED_TINYXML2)
list(APPEND fuzz-client_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
endif()
add_executable(fuzz-client EXCLUDE_FROM_ALL
${fuzz-client_SRC}
$<TARGET_OBJECTS:simplecpp_objs>
$<TARGET_OBJECTS:tinyxml2_objs>
$<TARGET_OBJECTS:lib_objs>)
target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals/tinyxml2 ${CMAKE_SOURCE_DIR}/externals)
target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals)
if(USE_BUNDLED_TINYXML2)
target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/externals/tinyxml2/)
endif()
target_compile_options(fuzz-client PRIVATE -fsanitize=fuzzer)
# TODO: target_link_options() requires CMake >= 3.13
#target_link_options(fuzz-client PRIVATE -fsanitize=fuzzer)
@ -16,6 +24,9 @@ if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (USE_Z3)
target_link_libraries(fuzz-client PRIVATE ${Z3_LIBRARIES})
endif()
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
target_link_libraries(fuzz-client PRIVATE tinyxml2)
endif()
add_executable(translate EXCLUDE_FROM_ALL
translate.cpp

View File

@ -26,7 +26,7 @@ if (BUILD_TESTS)
endif()
endif()
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
target_link_libraries(testrunner tinyxml2)
target_link_libraries(testrunner ${tinyxml2_LIBRARY})
endif()
if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)