Skip to content

Commit 974dd5d

Browse files
authored
only use bundled tinyxml2 in CMake when configured to do so (danmar#3806)
1 parent a15a227 commit 974dd5d

File tree

6 files changed

+40
-7
lines changed

6 files changed

+40
-7
lines changed

.github/workflows/CI-unixish.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
run: |
2828
sudo apt-get update
2929
sudo apt-get install libxml2-utils
30-
sudo apt-get install z3 libz3-dev
30+
sudo apt-get install libz3-dev libtinyxml2-dev
3131
sudo apt-get install qtbase5-dev qttools5-dev libqt5charts5-dev qt5-default
3232
3333
- name: Fix missing z3_version.h
@@ -45,6 +45,20 @@ jobs:
4545
python -m pip install pip --upgrade
4646
python -m pip install pytest
4747
48+
- name: CMake build on ubuntu (with GUI / system tinyxml2)
49+
if: contains(matrix.os, 'ubuntu')
50+
run: |
51+
mkdir cmake.output.tinyxml2
52+
cd cmake.output.tinyxml2
53+
cmake -G "Unix Makefiles" -DUSE_Z3=On -DHAVE_RULES=On -DBUILD_TESTS=On -DBUILD_GUI=On -DWITH_QCHART=On -DUSE_BUNDLED_TINYXML2=Off ..
54+
cmake --build . -- -j$(nproc)
55+
cd ..
56+
57+
- name: Run CMake test (system tinyxml2)
58+
if: contains(matrix.os, 'ubuntu')
59+
run: |
60+
cmake --build cmake.output.tinyxml2 --target check -- -j$(nproc)
61+
4862
- name: CMake build on ubuntu (with GUI)
4963
if: contains(matrix.os, 'ubuntu')
5064
run: |

cli/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if (WIN32 AND NOT BORLAND)
3535
endif()
3636
endif()
3737
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
38-
target_link_libraries(cppcheck tinyxml2)
38+
target_link_libraries(cppcheck ${tinyxml2_LIBRARY})
3939
endif()
4040

4141
add_dependencies(cppcheck copy_cfg)

gui/test/benchmark/simple/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
qt5_wrap_cpp(test-benchmark-simple_SRC benchmarksimple.h)
22
add_custom_target(build-testbenchmark-simple-deps SOURCES ${test-benchmark-simple_SRC})
33
add_dependencies(gui-build-deps build-testbenchmark-simple-deps)
4+
if(USE_BUNDLED_TINYXML2)
5+
list(APPEND test-benchmark-simple_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
6+
endif()
47
add_executable(benchmark-simple
58
${test-benchmark-simple_SRC}
69
benchmarksimple.cpp
710
$<TARGET_OBJECTS:lib_objs>
8-
$<TARGET_OBJECTS:tinyxml2_objs>
911
$<TARGET_OBJECTS:simplecpp_objs>
1012
)
1113
target_include_directories(benchmark-simple PRIVATE ${CMAKE_SOURCE_DIR}/lib)
@@ -16,4 +18,7 @@ if (HAVE_RULES)
1618
endif()
1719
if (USE_Z3)
1820
target_link_libraries(benchmark-simple ${Z3_LIBRARIES})
21+
endif()
22+
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
23+
target_link_libraries(benchmark-simple ${tinyxml2_LIBRARY})
1924
endif()

gui/test/xmlreportv2/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,7 @@ if (HAVE_RULES)
2222
endif()
2323
if (USE_Z3)
2424
target_link_libraries(test-xmlreportv2 ${Z3_LIBRARIES})
25+
endif()
26+
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
27+
target_link_libraries(test-xmlreportv2 ${tinyxml2_LIBRARY})
2528
endif()

oss-fuzz/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2-
add_executable(fuzz-client EXCLUDE_FROM_ALL
2+
set(fuzz-client_SRC
33
main.cpp
44
type2.cpp
5+
)
6+
if(USE_BUNDLED_TINYXML2)
7+
list(APPEND fuzz-client_SRC $<TARGET_OBJECTS:tinyxml2_objs>)
8+
endif()
9+
add_executable(fuzz-client EXCLUDE_FROM_ALL
10+
${fuzz-client_SRC}
511
$<TARGET_OBJECTS:simplecpp_objs>
6-
$<TARGET_OBJECTS:tinyxml2_objs>
712
$<TARGET_OBJECTS:lib_objs>)
8-
target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals/tinyxml2 ${CMAKE_SOURCE_DIR}/externals)
13+
target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp ${CMAKE_SOURCE_DIR}/externals)
14+
if(USE_BUNDLED_TINYXML2)
15+
target_include_directories(fuzz-client PRIVATE ${CMAKE_SOURCE_DIR}/externals/tinyxml2/)
16+
endif()
917
target_compile_options(fuzz-client PRIVATE -fsanitize=fuzzer)
1018
# TODO: target_link_options() requires CMake >= 3.13
1119
#target_link_options(fuzz-client PRIVATE -fsanitize=fuzzer)
@@ -16,6 +24,9 @@ if (ENABLE_OSS_FUZZ AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1624
if (USE_Z3)
1725
target_link_libraries(fuzz-client PRIVATE ${Z3_LIBRARIES})
1826
endif()
27+
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
28+
target_link_libraries(fuzz-client PRIVATE tinyxml2)
29+
endif()
1930

2031
add_executable(translate EXCLUDE_FROM_ALL
2132
translate.cpp

test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if (BUILD_TESTS)
2626
endif()
2727
endif()
2828
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
29-
target_link_libraries(testrunner tinyxml2)
29+
target_link_libraries(testrunner ${tinyxml2_LIBRARY})
3030
endif()
3131

3232
if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)

0 commit comments

Comments
 (0)