shithub: femtolisp

ref: 6818b86eb85580ed3634afe2a0c97c411022778f
dir: /meson.build/

View raw version
project(
	'femtolisp',
	'c',
	version: '0.999',
	meson_version: '>=1.1.0',
	default_options: [
		'c_std=c2x',
		'warning_level=3',
		'buildtype=debugoptimized',
		'b_ndebug=if-release'
		#'b_coverage=true',
	],
)

add_project_arguments(
	#'-Wconversion',
	#'-Wsign-conversion',
	'-Wmissing-prototypes',
	'-Werror=odr',
	'-Werror=strict-aliasing',
	'-Wno-parentheses',
	'-Wno-overlength-strings',
	'-D_DEFAULT_SOURCE',
	'-DCOMPUTED_GOTO',
	language: 'c',
)

src = [
	'3rd/mt19937-64.c',
	'3rd/mp/mpadd.c',
	'3rd/mp/mpaux.c',
	'3rd/mp/mpcmp.c',
	'3rd/mp/mpdigdiv.c',
	'3rd/mp/mpdiv.c',
	'3rd/mp/mpfmt.c',
	'3rd/mp/mpleft.c',
	'3rd/mp/mplogic.c',
	'3rd/mp/mpmul.c',
	'3rd/mp/mpright.c',
	'3rd/mp/mpsub.c',
	'3rd/mp/mptobe.c',
	'3rd/mp/mptober.c',
	'3rd/mp/mptod.c',
	'3rd/mp/mptoi.c',
	'3rd/mp/mptoui.c',
	'3rd/mp/mptouv.c',
	'3rd/mp/mptov.c',
	'3rd/mp/mpvecadd.c',
	'3rd/mp/mpveccmp.c',
	'3rd/mp/mpvecdigmuladd.c',
	'3rd/mp/mpvecsub.c',
	'3rd/mp/mpvectscmp.c',
	'3rd/mp/strtomp.c',
	'3rd/mp/u16.c',
	'3rd/spooky.c',
	'3rd/utf/rune.c',
	'3rd/utf/runeistype.c',
	'3rd/utf/runetotype.c',
	'3rd/utf/utfnlen.c',
	'bitvector.c',
	'builtins.c',
	'cvalues.c',
	'equal.c',
	'equalhash.c',
	'flisp.c',
	'flmain.c',
	'hashing.c',
	'htable.c',
	'ios.c',
	'iostream.c',
	'main_posix.c',
	'operators.c',
	'print.c',
	'ptrhash.c',
	'random.c',
	'read.c',
	'string.c',
	'table.c',
	'terminal_posix.c',
	'time_posix.c',
	'types.c',
	'utf8.c',
]

cc = meson.get_compiler('c')

if cc.get_id() == 'clang'
	add_project_arguments(
		'-D__wchar_t=__please_no_wchar_t_thank_you',
		'-Wno-gnu-offsetof-extensions',
		language: 'c',
	)
else
	add_project_arguments(
		'-Werror=lto-type-mismatch',
		language: 'c',
	)
endif

sixel = get_option('sixel')

if sixel.disabled()
	libsixel_dep = []
	src += ['sixel_disabled.c']
else
	libsixel = dependency('libsixel', required: sixel)
	if libsixel.found()
		src += ['sixel.c']
		libsixel_dep = [libsixel]
	elif
		src += ['sixel_disabled.c']
	endif
endif

math = cc.find_library('m', required: false)

boot = custom_target(
	'boot',
	capture: true,
	input: [
		'flisp.boot',
	],
	output: [
		'flisp.boot.h',
	],
	command: [
		'boot2h.sh', '@INPUT@',
	],
)

builtins = custom_target(
	'builtins',
	capture: true,
	input: [
		src,
	],
	output: [
		'builtin_fns.h',
	],
	command: [
		'builtins2h.sh', '@INPUT@',
	],
)

flisp = executable(
	'flisp',
	sources: [
		src,
		boot,
		builtins,
	],
	dependencies: [
		math,
	] + libsixel_dep,
	include_directories: include_directories(
		'3rd',
		'3rd/mp',
		'3rd/utf',
		'posix',
	),
)

tests_dir = join_paths(meson.current_source_dir(), 'test')

test('argv', flisp, args: ['argv.lsp'], workdir: tests_dir)
test('hash', flisp, args: ['hashtest.lsp'], workdir: tests_dir)
test('perf', flisp, args: ['perf.lsp'], workdir: tests_dir)
test('tme', flisp, args: ['tme.lsp'], workdir: tests_dir)
test('torture', flisp, args: ['torture.scm'], workdir: tests_dir)
test('torus', flisp, args: ['torus.lsp'], workdir: tests_dir)
test('unit', flisp, args: ['unittest.lsp'], workdir: tests_dir)