1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-26 15:13:16 +00:00

Make meson build file do cross compilation.

This commit is contained in:
Calvin Rose 2019-06-02 17:05:17 -04:00
parent 1b7a9def25
commit 22eb8372dd

View File

@ -18,7 +18,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE. # IN THE SOFTWARE.
project('janet', 'c', default_options : ['c_std=c99']) project('janet', 'c', default_options : ['c_std=c99'], version : '1.0.0')
# Global settings # Global settings
janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet') janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet')
@ -36,7 +36,7 @@ add_project_link_arguments('-rdynamic', language : 'c')
incdir = include_directories('src/include') incdir = include_directories('src/include')
# Building generated sources # Building generated sources
xxd = executable('xxd', 'tools/xxd.c') xxd = executable('xxd', 'tools/xxd.c', native : true)
gen = generator(xxd, gen = generator(xxd,
output : '@BASENAME@.gen.c', output : '@BASENAME@.gen.c',
arguments : ['@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@']) arguments : ['@INPUT@', '@OUTPUT@', '@EXTRA_ARGS@'])
@ -114,7 +114,8 @@ mainclient_src = [
janet_boot = executable('janet-boot', core_src, boot_src, boot_gen, janet_boot = executable('janet-boot', core_src, boot_src, boot_gen,
include_directories : incdir, include_directories : incdir,
c_args : '-DJANET_BOOTSTRAP', c_args : '-DJANET_BOOTSTRAP',
dependencies : [m_dep, dl_dep]) dependencies : [m_dep, dl_dep],
native : true)
# Build core image # Build core image
core_image = custom_target('core_image', core_image = custom_target('core_image',
@ -126,24 +127,34 @@ libjanet = shared_library('janet', core_src, core_image,
include_directories : incdir, include_directories : incdir,
dependencies : [m_dep, dl_dep], dependencies : [m_dep, dl_dep],
install : true) install : true)
janet_mainclient = executable('janet', core_src, core_image, init_gen, mainclient_src, janet_mainclient = executable('janet', core_src, core_image, init_gen, mainclient_src,
include_directories : incdir, include_directories : incdir,
dependencies : [m_dep, dl_dep], dependencies : [m_dep, dl_dep],
install : true) install : true)
if meson.is_cross_build()
janet_nativeclient = executable('janet-native', core_src, core_image, init_gen, mainclient_src,
include_directories : incdir,
dependencies : [m_dep, dl_dep],
native : true)
else
janet_nativeclient = janet_mainclient
endif
# Documentation # Documentation
docs = custom_target('docs', docs = custom_target('docs',
input : ['tools/gendoc.janet'], input : ['tools/gendoc.janet'],
output : ['doc.html'], output : ['doc.html'],
capture : true, capture : true,
command : [janet_mainclient, '@INPUT@']) command : [janet_nativeclient, '@INPUT@'])
# Amalgamated source # Amalgamated source
amalg = custom_target('amalg', amalg = custom_target('amalg',
input : ['tools/amalg.janet', core_headers, core_src, core_image], input : ['tools/amalg.janet', core_headers, core_src, core_image],
output : ['janet.c'], output : ['janet.c'],
capture : true, capture : true,
command : [janet_mainclient, '@INPUT@']) command : [janet_nativeclient, '@INPUT@'])
# Amalgamated client # Amalgamated client
janet_amalgclient = executable('janet-amalg', amalg, init_gen, mainclient_src, janet_amalgclient = executable('janet-amalg', amalg, init_gen, mainclient_src,
@ -162,11 +173,11 @@ test_files = [
'test/suite6.janet' 'test/suite6.janet'
] ]
foreach t : test_files foreach t : test_files
test(t, janet_mainclient, args : files([t]), workdir : meson.current_source_dir()) test(t, janet_nativeclient, args : files([t]), workdir : meson.current_source_dir())
endforeach endforeach
# Repl # Repl
run_target('repl', command : [janet_mainclient]) run_target('repl', command : [janet_nativeclient])
# Installation # Installation
install_man('janet.1') install_man('janet.1')