diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2021-03-16 14:46:49 +0100 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2021-03-16 14:46:49 +0100 |
commit | 90040647a069a43c69e948f82694fa37b54610f2 (patch) | |
tree | 45c0a3bec4032f603c8f66c0ee2334e3564e07dd | |
parent | 4fe97af983213de24cb53cae9abd75458d57d088 (diff) |
Meson build: Make it possible to use cairomm as a subproject
cairo and sigc++ can be subprojects of cairomm.
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | cairomm/meson.build | 8 | ||||
-rw-r--r-- | data/meson.build | 5 | ||||
-rw-r--r-- | docs/reference/meson.build | 8 | ||||
-rw-r--r-- | examples/meson.build | 4 | ||||
-rw-r--r-- | meson.build | 16 | ||||
-rw-r--r-- | subprojects/cairo.wrap | 8 | ||||
-rw-r--r-- | subprojects/sigc++-3.0.wrap | 8 | ||||
-rw-r--r-- | tests/meson.build | 4 |
9 files changed, 49 insertions, 14 deletions
diff --git a/Makefile.am b/Makefile.am index f78ac02..63bf2f1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -50,6 +50,8 @@ EXTRA_DIST = \ docs/reference/meson.build \ cairomm/meson.build \ examples/meson.build \ + subprojects/cairo.wrap \ + subprojects/sigc++-3.0.wrap \ tests/meson.build \ untracked/README diff --git a/cairomm/meson.build b/cairomm/meson.build index 1c3304b..488e4fd 100644 --- a/cairomm/meson.build +++ b/cairomm/meson.build @@ -2,7 +2,7 @@ # Input: cairomm_build_dep, cairomm_pcname, cairomm_libversion, cairomm_rc, # is_msvc, cairomm_libname, macos_darwin_versions -# Output: source_h_files, cairomm_dep +# Output: source_h_files, cairomm_own_dep # There are no built source files in cairomm. @@ -89,9 +89,9 @@ cairomm_library = library(cairomm_libname, install: true, ) -# This is useful in the main project when cairomm is used as a subproject. -# It's also used when building example programs and test programs. -cairomm_dep = declare_dependency( +# This is used when building example programs and test programs. +# It's also a part of cairomm_dep, when cairomm is a subproject. +cairomm_own_dep = declare_dependency( link_with: cairomm_library, include_directories: extra_include_dirs, dependencies: cairomm_build_dep diff --git a/data/meson.build b/data/meson.build index 509ed36..90813aa 100644 --- a/data/meson.build +++ b/data/meson.build @@ -2,7 +2,7 @@ # Input: install_prefix, install_libdir, install_datadir, install_includedir, # install_pkgconfigdir, cairomm_pcname, cairomm_api_version, -# cairomm_requires, msvc14x_toolset_ver +# cairomm_requires, msvc14x_toolset_ver, cairo_dep # Output: - pkg_conf_data = configuration_data() @@ -33,6 +33,9 @@ foreach cairomm_mod : ['ft', 'pdf', 'png', 'ps', 'quartz', 'quartz-font', # Install the module only if there is a corresponding cairo module. if cairo_dep.type_name() == 'pkgconfig' do_install = dependency('cairo-' + cairomm_mod, required: false).found() + elif cairo_dep.type_name() == 'internal' + do_install = dependency('cairo-' + cairomm_mod, fallback: 'cairo', + required: false).found() else if cairomm_mod == 'png' do_install = cpp_compiler.has_function('cairo_surface_write_to_png', diff --git a/docs/reference/meson.build b/docs/reference/meson.build index ba8a41a..91bf6e2 100644 --- a/docs/reference/meson.build +++ b/docs/reference/meson.build @@ -3,7 +3,7 @@ # Input: project_build_root, project_source_root, cairomm_pcname, # build_documentation, source_h_files, install_datadir, python3, # doc_reference_py -# Output: install_docdir, install_devhelpdir, book_name +# Output: install_docdir, install_devhelpdir, book_name, tag_file # There are no built source files in cairomm. @@ -16,9 +16,9 @@ docinstall_flags = [] foreach module : tag_file_modules depmod = dependency(module, required: false) if depmod.found() - doxytagfile = depmod.get_pkgconfig_variable('doxytagfile') - htmlrefpub = depmod.get_pkgconfig_variable('htmlrefpub', default: '') - htmlrefdir = depmod.get_pkgconfig_variable('htmlrefdir', default: '') + doxytagfile = depmod.get_variable(pkgconfig: 'doxytagfile', internal: 'doxytagfile') + htmlrefpub = depmod.get_variable(pkgconfig: 'htmlrefpub', internal: 'htmlrefpub', default_value: '') + htmlrefdir = depmod.get_variable(pkgconfig: 'htmlrefdir', internal: 'htmlrefdir', default_value: '') if htmlrefpub == '' htmlrefpub = htmlrefdir elif htmlrefdir == '' diff --git a/examples/meson.build b/examples/meson.build index 1f60aea..c383432 100644 --- a/examples/meson.build +++ b/examples/meson.build @@ -1,6 +1,6 @@ # examples -# input: cairomm_dep, build_examples +# input: cairomm_own_dep, build_examples examples = [ # [[dir-name], exe-name, [sources]] @@ -26,7 +26,7 @@ foreach ex : examples executable(ex_name, ex_sources, cpp_args: '-DCAIROMM_DISABLE_DEPRECATED', - dependencies: cairomm_dep, + dependencies: cairomm_own_dep, gui_app: false, build_by_default: build_examples ) diff --git a/meson.build b/meson.build index 5b25206..66d10c7 100644 --- a/meson.build +++ b/meson.build @@ -6,7 +6,8 @@ project('cairomm', 'cpp', default_options: [ 'cpp_std=c++17', ], - meson_version: '>= 0.50.0', # required for python3.path() + meson_version: '>= 0.54.0', # required for meson.override_dependency() + # and dep.get_variable(internal:) ) cairomm_api_version = '1.16' @@ -283,6 +284,19 @@ if not meson.is_subproject() 'untracked' / 'build_scripts', dont_distribute, ) +else + # This is a subproject. + cairomm_dep = declare_dependency( + dependencies: cairomm_own_dep, + variables: { + 'doxytagfile': tag_file.full_path(), + 'htmlrefdir': install_prefix / install_docdir / 'reference' / 'html', + 'htmlrefpub': 'http://www.cairographics.org/documentation/cairomm/reference' + } + ) + + # A main project that looks for cairomm_pcname.pc shall find cairomm_dep. + meson.override_dependency(cairomm_pcname, cairomm_dep) endif # Print a summary. diff --git a/subprojects/cairo.wrap b/subprojects/cairo.wrap new file mode 100644 index 0000000..954daa3 --- /dev/null +++ b/subprojects/cairo.wrap @@ -0,0 +1,8 @@ +[wrap-git] +directory=cairo +url=https://gitlab.freedesktop.org/cairo/cairo.git +revision=master +depth=1 + +[provide] +dependency_names = cairo diff --git a/subprojects/sigc++-3.0.wrap b/subprojects/sigc++-3.0.wrap new file mode 100644 index 0000000..8d8c543 --- /dev/null +++ b/subprojects/sigc++-3.0.wrap @@ -0,0 +1,8 @@ +[wrap-git] +directory=libsigcplusplus +url=https://github.com/libsigcplusplus/libsigcplusplus.git +revision=master +depth=1 + +[provide] +dependency_names = sigc++-3.0 diff --git a/tests/meson.build b/tests/meson.build index 530eb73..9aa6742 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -1,6 +1,6 @@ # tests -# input: cairomm_dep, build_tests, can_test, test_dep, USE_SHARED_BOOST +# input: cairomm_own_dep, build_tests, can_test, test_dep, USE_SHARED_BOOST cairomm_tests_extra_cppargs = [] if USE_SHARED_BOOST @@ -34,7 +34,7 @@ if can_test boost_test_modname_flag = [ '-DBOOST_TEST_MODULE=@0@'.format(ex[1]) ] exe_file = executable(ex_name, ex_sources, cpp_args: ex[3] + boost_test_modname_flag + cairomm_tests_extra_cppargs, - dependencies: [cairomm_dep, test_dep], + dependencies: [cairomm_own_dep, test_dep], gui_app: false, build_by_default: build_tests, ) |