Skip to content

Commit 4b39bf0

Browse files
taliseinkjellahl
authored andcommitted
Meson build: Use libxml2 meson build as fallback
Fixes #67
1 parent ab5098e commit 4b39bf0

File tree

5 files changed

+7
-67
lines changed

5 files changed

+7
-67
lines changed

.github/workflows/meson-windows-2022.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
architecture: x64
2121

2222
- name: Configure
23-
run: meson setup --warnlevel 3 --werror -Dlibxml2_cmake:werror=false -Dmaintainer-mode=false _build
23+
run: meson setup --warnlevel 3 -Dlibxml2:warning_level=0 --werror -Dlibxml2:werror=false -Dlibxml2:python=false -Dmaintainer-mode=false _build
2424

2525
- name: Compile
2626
run: ninja -C _build
@@ -29,7 +29,7 @@ jobs:
2929
run: meson test -C _build
3030

3131
- name: Configure static
32-
run: meson setup --warnlevel 3 --werror -Dlibxml2_cmake:werror=false --default-library static -Dmaintainer-mode=false _build_static
32+
run: meson setup --warnlevel 3 -Dlibxml2:warning_level=0 --werror -Dlibxml2:werror=false -Dlibxml2:python=false --default-library static -Dmaintainer-mode=false _build_static
3333

3434
- name: Compile static
3535
run: ninja -C _build_static

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ EXTRA_DIST = \
3838
docs/reference/meson.build \
3939
examples/meson.build \
4040
libxml++/meson.build \
41-
subprojects/libxml2_cmake.wrap \
41+
subprojects/libxml2.wrap \
4242
subprojects/mm-common.wrap \
4343
tests/meson.build \
4444
tools/build_scripts/tutorial-custom-cmd.py \

libxml++/meson.build

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ if host_machine.system() == 'windows'
101101
windows = import('windows')
102102
xmlxx_res = windows.compile_resources(xmlxx_rc)
103103
extra_xmlxx_objects += xmlxx_res
104-
105-
if xml2_is_subproject
106-
xmlxx_all_deps += [winsock_dep, bcrypt_dep]
107-
endif
108104
endif
109105

110106
extra_include_dirs = ['..']

meson.build

Lines changed: 1 addition & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -110,75 +110,16 @@ xml2_req = '>= @0@'.format(xml2_min_ver)
110110
xml2_dep = dependency(
111111
['libxml-2.0', 'LibXml2'],
112112
version: xml2_req,
113-
required: host_machine.system() != 'windows'
113+
fallback: ['libxml2']
114114
)
115115

116-
# Setup CMake subproject for use, if needed
117-
if not xml2_dep.found()
118-
cmake = import('cmake')
119-
opt_var = cmake.subproject_options()
120-
build_shared = get_option('default_library') != 'static'
121-
iconv_dep = dependency('iconv', required: false)
122-
icu_i18n_dep = dependency('icu-i18n', 'ICU',
123-
components: 'in',
124-
required: false)
125-
icu_uc_dep = dependency('icu-uc', 'ICU',
126-
components: 'uc',
127-
required: false)
128-
lzma_dep = dependency(['liblzma','LibLZMA'], required: false)
129-
thread_dep = dependency('threads', required: false)
130-
zlib_dep = dependency('zlib', required: false)
131-
winsock_dep = cpp_compiler.find_library('ws2_32', required: false)
132-
bcrypt_dep = cpp_compiler.find_library('bcrypt', required: false)
133-
cmake_build_type = get_option('buildtype')
134-
if get_option('buildtype') == 'debugoptimized'
135-
cmake_build_type = 'RelWithDebInfo'
136-
elif get_option('buildtype') == 'minsize'
137-
cmake_build_type = 'MinSizeRel'
138-
elif get_option('buildtype') == 'plain'
139-
cmake_build_type = ''
140-
endif
141-
opt_var.add_cmake_defines({
142-
'BUILD_SHARED_LIBS': build_shared,
143-
'CMAKE_BUILD_TYPE': cmake_build_type,
144-
'CMAKE_MSVC_RUNTIME_LIBRARY': '',
145-
'CMAKE_C_FLAGS_INIT': '',
146-
'CMAKE_C_FLAGS_DEBUG': '',
147-
'CMAKE_C_FLAGS_RELEASE': '',
148-
'CMAKE_C_FLAGS_RELWITHDEBINFO': '',
149-
'CMAKE_C_FLAGS_MINSIZEREL': '',
150-
'LIBXML2_WITH_HTTP': host_machine.system() != 'windows' or winsock_dep.found(),
151-
'LIBXML2_WITH_ICONV': iconv_dep.found(),
152-
'LIBXML2_WITH_ICU': icu_i18n_dep.found() and icu_uc_dep.found(),
153-
'LIBXML2_WITH_LZMA': lzma_dep.found(),
154-
'LIBXML2_WITH_PYTHON': false,
155-
'LIBXML2_WITH_TESTS': build_tests,
156-
'LIBXML2_WITH_THREADS': thread_dep.found(),
157-
'LIBXML2_WITH_ZLIB': zlib_dep.found(),
158-
})
159-
xml2_sp = cmake.subproject('libxml2_cmake', options: opt_var)
160-
xml2_dep = xml2_sp.dependency('LibXml2')
161-
endif
162-
163-
xml2_is_subproject = xml2_dep.type_name() == 'internal'
164-
165-
if xml2_is_subproject and build_tests
166-
test('testchar', xml2_sp.target('testchar'))
167-
test('testdict', xml2_sp.target('testdict'))
168-
endif
169-
170116
xmlxx_requires = []
171117
libxml2_lib_pkgconfig = ''
172118

173119
# Put libxml-2.0 in the 'Requires:' section in the generated pkg-config file if
174120
# we found it by pkg-config
175121
if xml2_dep.type_name() == 'pkgconfig'
176122
xmlxx_requires += ['libxml-2.0', xml2_req]
177-
else
178-
libxml2_lib_pkgconfig = xml2_dep.get_variable(
179-
cmake: 'LIBXML2_LIBRARIES',
180-
default_value: 'LibXml2.lib',
181-
)
182123
endif
183124

184125
xmlxx_requires = ' '.join(xmlxx_requires)

subprojects/libxml2_cmake.wrap renamed to subprojects/libxml2.wrap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
url = https://gitlab.gnome.org/GNOME/libxml2.git
33
revision = master
44
depth = 1
5+
6+
[provide]
7+
dependency_names = libxml-2.0

0 commit comments

Comments
 (0)