sol2/meson.build

61 lines
1.5 KiB
Meson
Raw Permalink Normal View History

project('sol3', 'cpp')
2018-06-06 15:02:37 +08:00
# Find lua dependency
if get_option('lua_cpp')
lua_cpp = 'true'
else
lua_cpp = 'false'
endif
lua_dep = dependency('lua', fallback: [ 'lua', 'lua_dep' ], default_options: [ 'lua_cpp=' + lua_cpp ])
# Set compiler flags if we're compiling lua as C++.
compile_args = []
if get_option('lua_cpp')
compile_args = [ '-DSOL_USING_CXX_LUA=1' ]
endif
# Expose standard dependency.
sol2_dep = declare_dependency(
include_directories: include_directories('./include'),
2018-06-06 15:02:37 +08:00
compile_args: compile_args,
dependencies: [ lua_dep ],
)
# Single header targets requested.
if get_option('single')
# Check if we have python installed (required for creating single).
python = find_program('python3', required: false)
if not python.found()
python = find_program('python', required: false)
endif
if not python.found()
error('Could not locate Python. Python is required when building a single header.')
endif
# List all headers that the single header comprises of.
cmd = run_command(python, 'list_headers.py')
2018-06-06 15:02:37 +08:00
if cmd.returncode() != 0
error('Could not list sol3 header files.')
2018-06-06 15:02:37 +08:00
endif
# Create our custom target to generate the single header file.
sol2_single = custom_target('sol2_single',
input: cmd.stdout().strip().split('\n'),
output: 'sol.hpp',
2019-05-24 07:12:15 +08:00
command: [ python, files('single/single.py'), '--input', './include', '--output', '@OUTPUT@' ]
2018-06-06 15:02:37 +08:00
)
# Expose the dependency.
sol2_dep = declare_dependency(
sources: [ sol2_single ],
compile_args: compile_args,
dependencies: [ lua_dep ],
)
2019-05-24 07:12:15 +08:00
endif