google/benchmark

Build Error w/ msvc-141 while targeting Universal Windows Platform

Open

#661 geöffnet am 24. Aug. 2018

Auf GitHub ansehen
 (5 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C++ (1.539 Forks)batch import
enhancementhelp wantedos:windows

Repository-Metriken

Stars
 (7.968 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 4T 2h) (19 gemergte PRs in 30 T)

Beschreibung

Summary

While attempting to build google/benchmark with cmake for a Windows UWP (Universal Windows Platform) target the following errors can be observed.

error

These symbols are disabled/undefined by VersionHelper.h:18 -- #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) Yet required in the sysinfo.cc:526 -- #elif defined BENCHMARK_OS_WINDOWS block.

Steps to reproduce

The above can be reproduced (so long as you have VS2017 or can compile with the MSVC v141 toolchain) with the following steps:

$ git clone https://github.com/google/benchmark.git
$ cd benchmark
$ mkdir -p build && cd build
$ cmake -G "Visual Studio 15" -DBENCHMARK_ENABLE_GTEST_TESTS=OFF -DCMAKE_BUILD_TYPE=RELEASE  -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0 ..

Note: the CMAKE_SYSTEM_NAME/VERSION settings drive the cmake config step for UWP apps

Then open the .sln in build/ and run a build.

Fix

  • The issue: bug

  • The fix: fix

Alternative

The frequency estimation in the block in question is sampling/inferring the MHz of the system (presumably for performance measures). As this particular block is platform(Windows Specific) wouldn't usage of the QueryPerformanceFreq() API (windows.h) be more appropriate/accurate ?

Happy to try and submit a PR for this if our thinking on this is correct and acceptable.

Contributor Guide