3 # Input: sigcxx_build_dep, sigcxx_pcname, sigcxx_libversion, sigcxx_api_version,
4 # install_includedir, project_source_root, sigc_res, python3,
5 # handle_built_files, maintainer_mode, can_add_dist_script
6 # Output: source_h_files, built_h_files, sigcxx_own_dep, built_files_root,
13 'functors' / 'slot_base.cc',
20 'reference_wrapper.h',
29 'adaptors' / 'adaptors.h',
30 'adaptors' / 'bound_argument.h',
33 'functors' / 'functors.h',
34 'functors' / 'slot_base.h',
37 # .m4 files to build .h files from.
43 m4_template = files('macros' / 'template.macros.m4')
44 m4_include_dir = meson.current_source_dir() / 'macros'
46 source_h_files = sigc_h_files + adaptors_h_files + functors_h_files
48 built_h_files = sigc_h_m4_files
51 # Force meson+ninja to generate source files before anything is compiled.
52 # Compilation must depend on these targets.
53 built_cc_file_targets = []
54 built_h_file_targets = []
57 subdir('adaptors/lambda')
60 install_headers('sigc++.h', subdir: sigcxx_pcname / 'sigc++')
61 install_headers(sigc_h_files, subdir: sigcxx_pcname / 'sigc++')
62 install_headers(adaptors_h_files, subdir: sigcxx_pcname / 'sigc++' / 'adaptors')
63 install_headers(functors_h_files, subdir: sigcxx_pcname / 'sigc++' / 'functors')
65 untracked_sigcxx = 'untracked' / 'sigc++'
66 src_untracked_sigcxx = project_source_root / untracked_sigcxx
68 extra_sigc_cppflags = []
69 extra_sigc_objects = []
71 # Make sure we are exporting the symbols from the DLL
73 extra_sigc_cppflags += ['-DSIGC_BUILD', '-D_WINDLL']
76 # Build the .rc file for Windows builds and link to it
77 if host_machine.system() == 'windows'
78 windows = import('windows')
79 sigc_res = windows.compile_resources(sigc_rc)
80 extra_sigc_objects += sigc_res
85 # Maintainer mode. Generate .h and .cc files from .m4 files in macros/ directory.
86 # .h and .cc files are also generated in subdirectories.
88 # docs/reference/meson.build needs this.
89 built_files_root = project_build_root
91 foreach file : sigc_h_m4_files
92 built_h_file_targets += custom_target(file,
93 input: 'macros' / file + '.m4',
96 python3, handle_built_files, 'build_from_m4',
101 depend_files: m4_template,
102 build_by_default: maintainer_mode,
107 extra_include_dirs = ['..']
108 sigcxx_library = library('sigc-' + sigcxx_api_version,
109 source_cc_files, built_cc_file_targets, built_h_file_targets,
111 version: sigcxx_libversion,
112 darwin_versions: darwin_versions,
113 cpp_args: extra_sigc_cppflags,
114 implicit_include_directories: false,
115 include_directories: extra_include_dirs,
116 dependencies: sigcxx_build_dep,
120 built_h_cc_dir = meson.current_build_dir()
122 else # not maintainer_mode
124 # Not maintainer mode. Compile built source code files in
125 # project_source_root/untracked/sigc++.
127 # docs/reference/meson.build needs this.
128 built_files_root = project_source_root / 'untracked'
131 # 1. The source code comes from a tarball, where the built files
132 # are stored in project_source_root/untracked.
133 # There are no built files in the build tree.
134 # 2. Files have been built in the build tree. Then maintainer_mode has
135 # been changed from true to false. Files that are missing or not up to date
136 # in project_source_root/untracked are copied from the build tree.
138 # Try to copy built source code files to the source tree.
140 python3, handle_built_files, 'copy_built_files',
141 meson.current_build_dir(),
142 src_untracked_sigcxx,
143 built_h_files + built_cc_files,
147 untracked_built_cc_files = []
148 foreach file : built_cc_files
149 untracked_built_cc_files += '..' / 'untracked' / 'sigc++' / file
152 extra_include_dirs = [ '..', '..' / 'untracked' ]
153 sigcxx_library = library('sigc-' + sigcxx_api_version,
154 source_cc_files, untracked_built_cc_files,
156 version: sigcxx_libversion,
157 darwin_versions: darwin_versions,
158 cpp_args: extra_sigc_cppflags,
159 implicit_include_directories: false,
160 include_directories: extra_include_dirs,
161 dependencies: sigcxx_build_dep,
165 built_h_cc_dir = src_untracked_sigcxx
169 # Install built .h files.
170 meson.add_install_script(
171 python3, handle_built_files, 'install_built_h_files',
173 install_includedir / sigcxx_pcname / 'sigc++', # subdir below {prefix}
177 if can_add_dist_script
178 # Distribute built files.
179 meson.add_dist_script(
180 python3, handle_built_files, 'dist_built_files',
183 built_h_files + built_cc_files,
187 # This is used when building example programs and test programs.
188 # It's also a part of sigcxx_dep, when libsigc++ is a subproject.
189 sigcxx_own_dep = declare_dependency(
190 sources: built_h_file_targets,
191 link_with: sigcxx_library,
192 include_directories: extra_include_dirs,
193 dependencies: sigcxx_build_dep