# -*- mode: python -*-

setup_sdk()

if 'PREFIX' in os.environ:
    prefix = os.path.join(os.environ['PREFIX'], 'inst')
else:
    prefix = os.path.join(os.environ['HOME'], 'gnucash', 'inst')

checkoutroot = os.path.join(os.path.dirname(prefix), 'src')
buildroot = os.path.join(os.path.dirname(prefix), 'build')
moduleset = "https://github.com/gnucash/gnucash-on-osx/raw/master/modulesets/gnucash.modules"

_modules_deps = ['pygments', 'meta-gtk-osx-bootstrap', 'meta-gtk-osx-gtk3',
                'meta-gtk-osx-python-gtk3', 'openSP', 'libofx', 'aqbanking',
                'libdbi-drivers', 'shared-mime-info', 'iso-codes', 'guile22',
                'swig', 'boost', 'googletest', 'webkit2gtk3']
_modules_stable = ['pygments', 'meta-gtk-osx-bootstrap',
                  'gnucash', 'gnucash-docs']
_modules_stable = ['pygments', 'meta-gtk-osx-bootstrap',
                  'gnucash', 'gnucash-docs']
_modules_git = ['pygments', 'meta-gtk-osx-bootstrap',
               'gnucash-git', 'gnucash-docs-git']

#set modules to the _modules variable above corresponding you what you need.
modules = _modules_stable

_pypathenv = {'PYTHON':os.path.join(prefix, 'bin', 'python3')}
module_extra_env['pycairo'] = _pypathenv
module_extra_env['pygobject3'] = _pypathenv

module_extra_env['icu'] = {'CXXFLAGS':os.environ['CXXFLAGS'] + ' -std=c++17'}
module_extra_env['boost'] = {'CXXFLAGS':os.environ['CXXFLAGS'] + ' -std=c++17'}
append_autogenargs("libofx", "--with-opensp-includes=" + prefix + "/include/OpenSP --with-opensp-libs=" + prefix + "/lib")

append_autogenargs("OpenSP", "--enable-shared") #To override the global --disable-shared
append_autogenargs("libdbi-drivers", "--with-dbi-incdir=" + prefix + "/include --with-dbi-libdir=" + prefix + "/lib")
module_makeargs["aqbanking"]="-j1"
os.environ['CC_FOR_BUILD'] = os.environ['CC']
os.environ['CPP_FOR_BUILD'] = os.environ['CC']
os.environ['CFLAGS_FOR_BUILD'] = os.environ['CFLAGS']
module_cmakeargs['boost'] = '-DCMAKE_CXX_FLAGS="' + os.environ['CXXFLAGS'] + ' -std=c++17"'

