#! /usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006 (ita)

# Creates a simple program with a custom compiler:
# ih.coin -> ih.cpp -> ih.o


# This file is not a module, and all the code
# from it will be executed upon compile step
#
# This is really the content of a "def build(bld):" function definition
#
# By contrast, only functions can be defined in a wscript
#


# a program that links using the GLIB library, defined in the configuration
# it also processes coin files, defined in the dang.py module (coin hook)
obj = bld.new_task_gen('cxx', 'program')
obj.source='''
main.cpp ih.coin
'''
obj.includes='. ..'
obj.defines='bidule=34'
obj.uselib='GLIB DEFTEST'
obj.target='testprogram2'


# a shared library, with a version number -> libshlib1.so.4.2.1
obj = bld.new_task_gen('cc', 'shlib')
obj.source='''
stuff.c
'''
obj.includes='. ..'
obj.target='shlib1'
obj.vnum='4.2.1'
obj.want_libtool=1

#############################################

# A few object files
obj = bld.new_task_gen('cxx', 'objects')
obj.source="f1.cpp f2.cpp"
obj.includes="."
obj.defines="DEBUG=1"
obj.target="gruik"

# A program using the object files
obj = bld.new_task_gen('cxx', 'program')
obj.source="m1.cpp"
obj.includes="."
obj.uselib="GL"
obj.target="m1"
obj.add_objects="gruik"

# Another program using the object files too
obj = bld.new_task_gen('cxx', 'program')
obj.source="m2.cpp"
obj.includes="."
obj.target="m2"
obj.add_objects="gruik"

import misc
obj = bld.new_task_gen('subst')
obj.source = 'foo.in'
obj.target = 'foo.desktop'
obj.dict = {'TEST': 'OK', 'not': 'used'}
obj.fun = misc.subst_func

obj.install_path = '${PREFIX}/test'

