import os ;

# get our library tagging rules. 
import hhitagging ;

# The path constant TOP allows to refer to a target using the expression <library>$(TOP)//lib_boost_system in child
# Jamfiles.
path-constant TOP : . ;

## begin of boost SDK hooks ##



## uncomment the following two lines to enable usage of boost library

#path-constant BOOST_SDK_ROOT : ../Boost_1_41_0 ;
#path-constant BOOST_LIB_DEFS : ./BoostBuild/src/lib/boost ;



#path-constant BOOST_LIB_DEFS : ./BoostAddon/src/lib/boost ;

# extract the boost version ID and make it avialable in all subprojects/Jamfiles.
path-constant SCRIPT_DIR : ./BoostBuild/bin ;
#constant BOOST_SDK_VERSION : [ SHELL "$(SCRIPT_DIR)/get_boost_version.pl $(BOOST_SDK_ROOT)" ] ;
#constant BOOST_SDK_MAJOR_VERSION : [ MATCH "^([^.]+)[.][^.]+[.]" : $(BOOST_SDK_VERSION) ] ;
#constant BOOST_SDK_MINOR_VERSION : [ MATCH "^[^.]+[.]([^.]+)[.]" : $(BOOST_SDK_VERSION) ] ;
#constant BOOST_SDK_BUILD_VERSION : [ MATCH "^[^.]+[.][^.]+[.]([^.]+)" : $(BOOST_SDK_VERSION) ] ;

# HOWTO example: 
# 
# Add  <library>$(BOOST_LIB_DEFS)//lib_boost_thread
#
# to the project requirements if you use the boost thread library.
# The location of the Jamfile within the project tree does not matter.

## end of boost SDK hooks ##

# EXAMPLES:
# example to version only Dvbh
#local lib-version-info = [ hhitagging.get-lib-version-info VideoCodec/src/lib/VideoCodec ] ;

# example to version two libraries  MSysLib and Dvbh
#local lib-version-info = [ hhitagging.get-lib-version-info MSysLib/src/lib/MSysLib VideoCodec/src/lib/VideoCodec ] ;
# EXAMPLES END


local build-dir-base = build ;
local inst-dir-base = . ;
local inst-dir ;
local build-dir = $(build-dir-base) ;

local toolset-subdir = [ hhitagging.get-toolset-dir-suffix ] ;
local inst-bin-dir = [ hhitagging.get-default-inst-dir $(inst-dir-base)/bin/$(toolset-subdir) ] ;
local inst-lib-dir = [ hhitagging.get-default-inst-dir $(inst-dir-base)/lib/$(toolset-subdir) ] ;

project
  : requirements
    <threading>multi
    
    #add one global include for all boost libraries
    <include>$(BOOST_SDK_ROOT)
    
    # set global defines include path
#    <include>./BoostAddon/include

    # disable auto-linking for all targets here,
    # primarily because it caused troubles with V2
    <os>NT,<toolset>msvc:<define>BOOST_ALL_NO_LIB=1
    
    # these values are set in the precompiled headers
    <os>NT,<toolset>msvc:<define>_WIN32_WINNT=0x0501
    <os>NT,<toolset>msvc:<define>WIN32
    
    #required to build shared libraries that are linked to static libraries
    #<os>LINUX,<toolset>gcc:<cflags>-fPIC
    <os>LINUX,<toolset>gcc:<cflags>-ffloat-store
    <os>LINUX,<toolset>gcc:<cflags>-fdiagnostics-show-option

    # the following line disables a warning that is wrongly triggered by gcc 4.4.1
    <os>LINUX,<toolset>gcc:<cflags>-Wno-strict-aliasing
    
    <os>LINUX:<warnings>on
    <os>LINUX:<warnings-as-errors>on

    <tag>@hhitagging.taglibs
  : build-dir ./build
  : default-build release
  ;

#constant MSYSLIB_REQUIREMENTS : <link>shared ;
#build-project MSysLib/src/lib/MSysLib ;
#build-project MSysLib/src/lib/ToolLib ;

build-project VideoCodec/src/lib/VideoCodecToolsLib ;
build-project VideoCodec/src/lib/VideoCommonLib ;
#build-project VideoCodec/src/lib/VideoEncoderLib ;
#build-project VideoCodec/src/lib/VideoDecoderLib ;

build-project VideoCodec/src/app/VideoEncoder ;
build-project VideoCodec/src/app/VideoDecoder ;

#build-project VideoCodec/src/sample/VideoCodecSample ;
#build-project VideoCodec/src/app/VideoCodecApp ;
#if [ os.name ] = NT
#{
#	build-project VideoCodec/src/app/VideoCodecWin32App ;
#}

install install-bin 
  : 
    VideoCodec/src/app/VideoEncoder//VideoEncoder
    VideoCodec/src/app/VideoDecoder//VideoDecoder
  : 
    <install-dependencies>on 
    <install-type>EXE

    <variant>release,<link>shared:<location>$(inst-bin-dir)/release-shared
    <variant>release,<link>static:<location>$(inst-bin-dir)/release-static
    <variant>debug,<link>shared:<location>$(inst-bin-dir)/debug-shared
    <variant>debug,<link>static:<location>$(inst-bin-dir)/debug-static
    <variant>profile,<link>shared:<location>$(inst-bin-dir)/profile-shared
    <variant>profile,<link>static:<location>$(inst-bin-dir)/profile-static
  ;
explicit install-bin ;

install install-shared-lib 
  : 
    VideoCodec/src/app/VideoEncoder//VideoEncoder
    VideoCodec/src/app/VideoDecoder//VideoDecoder
  : 
    <install-dependencies>on
    <install-type>SHARED_LIB
    
    <os>NT,<variant>release,<link>shared:<location>$(inst-bin-dir)/release-shared
    <os>NT,<variant>release,<link>static:<location>$(inst-bin-dir)/release-static
    <os>NT,<variant>debug,<link>shared:<location>$(inst-bin-dir)/debug-shared
    <os>NT,<variant>debug,<link>static:<location>$(inst-bin-dir)/debug-static
    <os>NT,<variant>profile,<link>shared:<location>$(inst-bin-dir)/profile-shared
    <os>NT,<variant>profile,<link>static:<location>$(inst-bin-dir)/profile-static
    
    <os>LINUX:<location>$(inst-lib-dir)
  ;
explicit install-shared-lib ; 

# the default install rule (exe + dll/so only)
alias install : install-bin install-shared-lib ;

explicit install ;
