# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem      1.0
PortGroup       cmake 1.1
PortGroup       github 1.0

github.setup    google benchmark 1.9.1 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name            google-benchmark
revision        0
checksums       rmd160  3d598796c611d25267358246f9af9bd1e9e394b3 \
                sha256  6e8bd8a610ad0c6814af4b3ae930517dd00fa69caf6f6f4667270fae8d47b53d \
                size    255170

categories      devel
maintainers     nomaintainer
license         Apache-2

description     Google's microbenchmark support library for C++
long_description \
                Google's microbenchmark support library for C++.
homepage        https://google.github.io/benchmark/

compiler.cxx_standard   2017

# Clear optflags; controlled by project, via cmake build type
configure.optflags

if {[variant_isset debug]} {
    cmake.build_type Debug
} else {
    cmake.build_type RelWithDebInfo
}

configure.args-append \
                    -DBENCHMARK_ENABLE_TESTING=OFF \
                    -DBUILD_SHARED_LIBS=ON

variant static description "Build static library" {
  configure.args-replace \
                    -DBUILD_SHARED_LIBS=ON \
                    -DBUILD_SHARED_LIBS=OFF
}

# Disable warnings to work around the following:
#
# src/benchmark_api_internal.cc:46:29: error: ISO C++11 does not support the 'q' gnu_printf length modifier [-Wno-error=format]
# 46 |     name_.args += StrFormat("%" PRId64, arg);
configure.args-append \
                    -DBENCHMARK_ENABLE_WERROR=OFF \
                    -DBENCHMARK_FORCE_WERROR=OFF

# Ignore prerelease versions
github.livecheck.regex  {([^"-]+)}
