project('lunch-games', 'd', 'c')


windows = import('windows')
python3 = find_program('python3')


lunch_src = files(
    'source/lunch/app.d',
    'source/lunch/color.d',
    'source/lunch/conf.d',
    'source/lunch/http.d',
    'source/lunch/launch.d',
    'source/lunch/logger.d',
    'source/lunch/term.d',
    'source/lunch/ui.d',
    'source/lunch/update.d',
)

toml_src = files(
    'source/toml/datetime.d',
    'source/toml/package.d',
    'source/toml/serialize.d',
    'source/toml/toml.d',
)

luad_src = files(
    'source/luad/c/all.d',
    'source/luad/c/lauxlib.d',
    'source/luad/c/lua.d',
    'source/luad/c/luaconf.d',
    'source/luad/c/lualib.d',
    'source/luad/c/tostring.d',
    'source/luad/conversions/arrays.d',
    'source/luad/conversions/assocarrays.d',
    'source/luad/conversions/classes.d',
    'source/luad/conversions/functions.d',
    'source/luad/conversions/structs.d',
    'source/luad/conversions/variant.d',
    'source/luad/all.d',
    'source/luad/base.d',
    'source/luad/dynamic.d',
    'source/luad/error.d',
    'source/luad/lfunction.d',
    'source/luad/lmodule.d',
    'source/luad/package.d',
    'source/luad/stack.d',
    'source/luad/state.d',
    'source/luad/table.d',
    'source/luad/testing.d',
)

lua_src = files(
    'source/lua/lapi.c',
    'source/lua/lauxlib.c',
    'source/lua/lbaselib.c',
    'source/lua/lcode.c',
    'source/lua/ldblib.c',
    'source/lua/ldebug.c',
    'source/lua/ldo.c',
    'source/lua/ldump.c',
    'source/lua/lfunc.c',
    'source/lua/lgc.c',
    'source/lua/linit.c',
    'source/lua/liolib.c',
    'source/lua/llex.c',
    'source/lua/lmathlib.c',
    'source/lua/lmem.c',
    'source/lua/loadlib.c',
    'source/lua/lobject.c',
    'source/lua/lopcodes.c',
    'source/lua/loslib.c',
    'source/lua/lparser.c',
    'source/lua/lstate.c',
    'source/lua/lstring.c',
    'source/lua/lstrlib.c',
    'source/lua/ltable.c',
    'source/lua/ltablib.c',
    'source/lua/ltm.c',
    'source/lua/lundump.c',
    'source/lua/lvm.c',
    'source/lua/lzio.c',
)


d_source = lunch_src + toml_src + luad_src
c_source = lua_src

source = d_source + c_source

includes = include_directories('source')

lunch = static_library('lunch', lunch_src, include_directories: includes)
toml = static_library('toml', toml_src, include_directories: includes)
luad = static_library('luad', luad_src, include_directories: includes)
lua  = static_library('lua',  lua_src,  include_directories: includes)


run_command(python3, files('prebuild.py'), check: true)
subdir('games')
