intf_libs = # Interface dependencies.
impl_libs = # Implementation dependencies.
import intf_libs += Eigen%lib{Eigen}

lib{PoseLib}: {hxx cxx}{** -poselib -version} hxx{poselib version} $impl_libs $intf_libs

headers =
for h : {hxx}{** -poselib -version}
{
  headers += '#include <'$project/$directory($h)$name($h).h'>'
}

in.symbol = '@'

hxx{poselib}: in{poselib}
{
  PROJECT_NAME_UPPERCASE = $string.ucase($project)
  LIB_INCLUDES_STRING = $regex.merge($headers, '(.+)', '\1\n')
}

hxx{version}: in{version}
{ 
  PROJECT_NAME_UPPERCASE = $string.ucase($project)
  MAJOR_VERSION = $version.major
  MINOR_VERSION = $version.minor
  PATCH_VERSION = $version.patch
  PROJECT_VERSION = $version.project
}

# Build options.
#
cxx.poptions =+ "-I$out_root" "-I$src_root"

if ($cxx.target.system == 'win32-msvc')
  obj{robust/bundle}: cxx.coptions += /bigobj#

obja{*}: cxx.poptions += -DPOSELIB_STATIC_BUILD
objs{*}: cxx.poptions += -DPOSELIB_SHARED_BUILD

# Export options.
#
lib{PoseLib}:
{
  cxx.export.poptions = "-I$out_root" "-I$src_root"
  cxx.export.libs = $intf_libs
}

liba{PoseLib}: cxx.export.poptions += -DPOSELIB_STATIC
libs{PoseLib}: cxx.export.poptions += -DPOSELIB_SHARED

# For pre-releases use the complete version to make sure they cannot
# be used in place of another pre-release or the final version. See
# the version module for details on the version.* variable values.
#
if $version.pre_release
  lib{PoseLib}: bin.lib.version = "-$version.project_id"
else
  lib{PoseLib}: bin.lib.version = "-$version.major.$version.minor"

# Install into the PoseLib/ subdirectory of, say, /usr/include/
# recreating subdirectories.
#
{hxx}{*}:
{
  install         = include/PoseLib/
  install.subdirs = true
}
