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

lib{PoseLib}: libul{PoseLib}: {hxx cxx}{** -poselib -version} hxx{poselib version} $impl_libs $intf_libs
libs{PoseLib}: def{PoseLib}: include = ($cxx.target.system == 'win32-msvc')
def{PoseLib}: libul{PoseLib}

in.symbol = '@'

hxx{poselib}: in{poselib}
{
  PROJECT_NAME_UPPERCASE = $string.ucase($project)
  LIB_INCLUDES_STRING = $regex.merge($path.relative($filesystem.path_search("$src_base/**.h"), $src_root), '(.+)', '#include <\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 == 'mingw32')
{
  cxx.loptions += -Wl,--export-all-symbols
  obj{**}: cxx.coptions += -Wa,-mbig-obj
}

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

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

# 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
}
