intf_libs = # Interface dependencies.
impl_libs = # Implementation dependencies.
#import xxxx_libs += libhello%lib{hello}

lib{meshoptimizer}: {hxx cxx}{**} $impl_libs $intf_libs

# Build options.
#
# Upstream includes its own header unqualified (#include "meshoptimizer.h"),
# so, unlike the generated default, the search path points at this
# subdirectory (out_base/src_base) rather than the package root.
#
cxx.poptions =+ "-I$out_base" "-I$src_base"

# Match upstream's CMakeLists.txt symbol export scheme for
# MESHOPT_BUILD_SHARED_LIBS.
#
objs{*}: cxx.poptions += -DMESHOPTIMIZER_ALLOC_EXPORT

if ($cxx.target.class == 'windows')
  objs{*}: cxx.poptions += '-DMESHOPTIMIZER_API=__declspec(dllexport)'
else
  objs{*}: cxx.poptions += '-DMESHOPTIMIZER_API=__attribute__((visibility("default")))'

if ($cxx.class == 'gcc')
  objs{*}: cxx.coptions += -fvisibility=hidden -fvisibility-inlines-hidden

# Export options.
#
lib{meshoptimizer}:
{
  cxx.export.poptions = "-I$out_base" "-I$src_base"
  cxx.export.libs = $intf_libs
}

libs{meshoptimizer}: cxx.export.poptions += -DMESHOPTIMIZER_ALLOC_EXPORT

if ($cxx.target.class == 'windows')
  libs{meshoptimizer}: cxx.export.poptions += '-DMESHOPTIMIZER_API=__declspec(dllimport)'
else
  libs{meshoptimizer}: cxx.export.poptions += '-DMESHOPTIMIZER_API=__attribute__((visibility("default")))'

# 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{meshoptimizer}: bin.lib.version = "-$version.project_id"
else
  lib{meshoptimizer}: bin.lib.version = "-$version.major.$version.minor"

# Upstream includes the header unqualified (<meshoptimizer.h>) and
# installs it directly into include/, not a library subdirectory.
#
hxx{*}:
{
  install         = include/
  install.subdirs = true
}
