Import('env child external library config_header install_or_link')
import os

external(env,'geode',default=1,required=1,libs=['geode'],headers=['geode/utility/config.h'])
external(env,'zlib',libs=['z'],headers=['zlib.h'])
external(env,'lzma',libs=['lzma'],headers=['lzma.h'],required=1)
external(env,'snappy',libs=['snappy'],headers=['snappy.h'],required=1)
external(env,'papi',libs=['papi'],headers=['papi.h'],flags=['PENTAGO_PAPI'])

if env['use_mpi']:
  child(env,'mpi')

generated = ['gen/%s'%f for f in 'tables.h tables.cpp'.split()]
generated = env.Command(generated,'base/precompute.py','$SOURCE --prefix ${TARGET.dir}')
install_or_link(env,os.path.join(env['prefix_include'],os.path.dirname(generated[0].srcnode().path)),generated[0])

env = env.Clone(need_zlib=1,need_lzma=1,need_snappy=1,need_papi=1)
env.Append(CPPPATH=['.'],CXXFLAGS='-Wno-invalid-offsetof')
config_header(env,'config.h')
library(env,'pentago_core',[],extra=['gen/tables.cpp'],skip=['mpi'])
