diff --git a/meson.build b/meson.build index 80cf24f..b83796e 100644 --- a/meson.build +++ b/meson.build @@ -88,11 +88,21 @@ if get_option('static_link') link_args += ['-static'] endif +ant_link_args = link_args +if get_option('linker_map') + ant_linkmap = meson.project_build_root() + '/ant.linkmap' + if host_machine.system() == 'darwin' + ant_link_args += ['-Wl,-map,' + ant_linkmap] + else + ant_link_args += ['-Wl,-Map=' + ant_linkmap] + endif +endif + executable( 'ant', files('src/main.c', 'src/watch.c') + [messages_h], dependencies: libant_dep, - link_args: link_args, + link_args: ant_link_args, export_dynamic: true ) diff --git a/meson/meson.build b/meson/meson.build index 36b6a37..1734025 100644 --- a/meson/meson.build +++ b/meson/meson.build @@ -4,6 +4,7 @@ message(' optimization: ' + get_option('optimization')) message(' debug: ' + (get_option('debug') ? 'true' : 'false')) message(' b_lto: ' + (get_option('b_lto') ? 'true' : 'false')) message(' strip: ' + (get_option('strip') ? 'true' : 'false')) +message(' linker_map: ' + (get_option('linker_map') ? 'true' : 'false')) if get_option('buildtype') != 'release' warning('Building in non-release mode. For best performance, use --buildtype=release') diff --git a/meson_options.txt b/meson_options.txt index 2703137..ceb5227 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,5 @@ option('jit', type: 'boolean', value: true, description: 'enable JIT compiler') option('static_link', type: 'boolean', value: false, description: 'statically link the binary') +option('linker_map', type: 'boolean', value: false, description: 'emit a linker map for the ant binary') option('build_timestamp', type: 'string', value: '', description: 'build timestamp (defaults to current time if empty)') option('deps_prefix_cmake', type: 'string', value: '', description: 'prefix path for finding dependencies in cmake subprojects')