shithub: femtolisp

ref: 4ca4045c4d9956882813aba344b0b9430063e3e8
dir: /meson.build/

View raw version
project(
	'femtolisp',
	'c',
	version: '0.999',
	default_options: [
		'c_std=c2x',
		'warning_level=3',
		'buildtype=debugoptimized',
		#'b_coverage=true',
	],
)

add_project_arguments(
	#'-Wconversion',
	#'-Wsign-conversion',
	'-Wmissing-prototypes',
	'-Werror=odr',
	'-Werror=strict-aliasing',
	'-Wno-parentheses',
	'-Wno-overlength-strings',
	'-D_DEFAULT_SOURCE',
	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/mp/u32.c',
	'3rd/mp/u64.c',
	'3rd/utf/rune.c',
	'3rd/utf/runeistype.c',
	'3rd/utf/runetotype.c',
	'3rd/utf/utfnlen.c',
	'bitvector-ops.c',
	'bitvector.c',
	'builtins.c',
	'cvalues.c',
	'dump.c',
	'equal.c',
	'equalhash.c',
	'flisp.c',
	'flmain.c',
	'hashing.c',
	'htable.c',
	'ios.c',
	'iostream.c',
	'llt.c',
	'main_posix.c',
	'operators.c',
	'print.c',
	'ptrhash.c',
	'random.c',
	'read.c',
	'string.c',
	'table.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',
		language: 'c',
	)
else
	add_project_arguments(
		'-Werror=lto-type-mismatch',
		language: 'c',
	)
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@',
	],
)

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