diff --git a/.gitignore b/.gitignore
index 8c30e28f53..008f26a798 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,39 @@
+# OS Files
+[Tt]humbs.db
+*.DS_Store
+
+# Visual Studio Files
+# Visual Studio Files
+*.[Oo]bj
+*.user
+*.aps
+*.pch
+*.vspscc
+*.vssscc
+*_i.c
+*_p.c
+*.ncb
+*.suo
+*.tlb
+*.tlh
+*.bak
+*.[Cc]ache
+*.ilk
+*.log
+*.lib
+*.sbr
+*.sdf
+*.opensdf
+*.unsuccessfulbuild
+*.vc.opendb
+*.VC.db
+ipch/
+[Oo]bj/
+[Bb]in
+[Dd]ebug*/
+[Rr]elease*/
+.vs/
+
*.a
*.so
*.so.?*
diff --git a/msvc/google-benchmark-test.vcxproj b/msvc/google-benchmark-test.vcxproj
new file mode 100644
index 0000000000..0e366b598a
--- /dev/null
+++ b/msvc/google-benchmark-test.vcxproj
@@ -0,0 +1,113 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ {ABB7BEF8-2C48-4967-A703-7B6FB9AB831F}
+ Win32Proj
+ googlebenchmarktest
+ 10.0.17763.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)$(Configuration)\$(Platform)\
+ $(OutDir)$(ProjectName)\
+
+
+ false
+ $(SolutionDir)$(Configuration)\$(Platform)\
+ $(OutDir)$(ProjectName)\
+
+
+
+
+
+ Level3
+ Disabled
+ WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ $(SolutionDir)\..\include;%(AdditionalIncludeDirectories)
+ true
+ VectorCall
+
+
+ Console
+ DebugFastLink
+ Default
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)
+ $(SolutionDir)\..\include;%(AdditionalIncludeDirectories)
+ false
+ true
+ VectorCall
+
+
+ Console
+ DebugFastLink
+ true
+ true
+ Default
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {ef4de73e-ee11-4128-93eb-60b07e650ef2}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/msvc/google-benchmark-test.vcxproj.filters b/msvc/google-benchmark-test.vcxproj.filters
new file mode 100644
index 0000000000..3900d7e50d
--- /dev/null
+++ b/msvc/google-benchmark-test.vcxproj.filters
@@ -0,0 +1,40 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/msvc/google-benchmark.sln b/msvc/google-benchmark.sln
new file mode 100644
index 0000000000..42e989ab7d
--- /dev/null
+++ b/msvc/google-benchmark.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.28917.182
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "google-benchmark", "google-benchmark.vcxproj", "{EF4DE73E-EE11-4128-93EB-60B07E650EF2}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "google-benchmark-test", "google-benchmark-test.vcxproj", "{ABB7BEF8-2C48-4967-A703-7B6FB9AB831F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EF4DE73E-EE11-4128-93EB-60B07E650EF2}.Debug|x64.ActiveCfg = Debug|x64
+ {EF4DE73E-EE11-4128-93EB-60B07E650EF2}.Debug|x64.Build.0 = Debug|x64
+ {EF4DE73E-EE11-4128-93EB-60B07E650EF2}.Release|x64.ActiveCfg = Release|x64
+ {EF4DE73E-EE11-4128-93EB-60B07E650EF2}.Release|x64.Build.0 = Release|x64
+ {ABB7BEF8-2C48-4967-A703-7B6FB9AB831F}.Debug|x64.ActiveCfg = Debug|x64
+ {ABB7BEF8-2C48-4967-A703-7B6FB9AB831F}.Debug|x64.Build.0 = Debug|x64
+ {ABB7BEF8-2C48-4967-A703-7B6FB9AB831F}.Release|x64.ActiveCfg = Release|x64
+ {ABB7BEF8-2C48-4967-A703-7B6FB9AB831F}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {505CCB90-4F4F-4672-9E2B-2E2267BFE369}
+ EndGlobalSection
+EndGlobal
diff --git a/msvc/google-benchmark.vcxproj b/msvc/google-benchmark.vcxproj
new file mode 100644
index 0000000000..80fe63affa
--- /dev/null
+++ b/msvc/google-benchmark.vcxproj
@@ -0,0 +1,145 @@
+
+
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {EF4DE73E-EE11-4128-93EB-60B07E650EF2}
+ Win32Proj
+ 10.0.17763.0
+
+
+
+ StaticLibrary
+ true
+ v142
+
+
+ StaticLibrary
+ false
+ v142
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)$(Configuration)\$(Platform)\
+ $(OutDir)$(ProjectName)\
+
+
+ true
+ $(SolutionDir)$(Configuration)\$(Platform)\
+ $(OutDir)$(ProjectName)\
+
+
+
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;GOOGLEBENCHMARK_EXPORTS;%(PreprocessorDefinitions)
+ MultiThreadedDebugDLL
+ Level3
+ ProgramDatabase
+ Disabled
+ $(SolutionDir)\..\include;%(AdditionalIncludeDirectories)
+ true
+ VectorCall
+
+
+ true
+ Windows
+ %(AdditionalLibraryDirectories)
+ %(AdditionalDependencies)
+
+
+ false
+
+
+
+
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;GOOGLEBENCHMARK_EXPORTS;%(PreprocessorDefinitions)
+ MultiThreadedDLL
+ Level3
+ ProgramDatabase
+ $(SolutionDir)\..\include;%(AdditionalIncludeDirectories)
+ false
+ true
+ VectorCall
+
+
+ true
+ Windows
+ true
+ true
+
+
+ false
+
+
+
+
+
+
\ No newline at end of file
diff --git a/msvc/google-benchmark.vcxproj.filters b/msvc/google-benchmark.vcxproj.filters
new file mode 100644
index 0000000000..c677f97e23
--- /dev/null
+++ b/msvc/google-benchmark.vcxproj.filters
@@ -0,0 +1,150 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav
+
+
+
+
+ Header Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
\ No newline at end of file
diff --git a/msvc/portability_macros.props b/msvc/portability_macros.props
new file mode 100644
index 0000000000..ae09db81fe
--- /dev/null
+++ b/msvc/portability_macros.props
@@ -0,0 +1,14 @@
+
+
+
+
+
+ <_PropertySheetDisplayName>google_benchmark_portability_macros
+
+
+
+ HAVE_STD_REGEX;%(PreprocessorDefinitions)
+
+
+
+
\ No newline at end of file
diff --git a/msvc/windows_libraries.props b/msvc/windows_libraries.props
new file mode 100644
index 0000000000..87f98314fc
--- /dev/null
+++ b/msvc/windows_libraries.props
@@ -0,0 +1,14 @@
+
+
+
+
+
+ <_PropertySheetDisplayName>google_benchmark_windows_libraries
+
+
+
+ shlwapi.lib;%(AdditionalDependencies)
+
+
+
+
\ No newline at end of file
diff --git a/principia_make.sh b/principia_make.sh
new file mode 100644
index 0000000000..8876429273
--- /dev/null
+++ b/principia_make.sh
@@ -0,0 +1,8 @@
+cmake \
+ -DCMAKE_C_COMPILER:FILEPATH=`which clang` \
+ -DCMAKE_CXX_COMPILER:FILEPATH=`which clang++` \
+ -DCMAKE_C_FLAGS="${C_FLAGS?}" \
+ -DCMAKE_CXX_FLAGS="${CXX_FLAGS?}" \
+ -DBENCHMARK_ENABLE_GTEST_TESTS=OFF \
+ .
+make -j8
diff --git a/principia_variable_overrides.sh b/principia_variable_overrides.sh
new file mode 100644
index 0000000000..4d546b5b97
--- /dev/null
+++ b/principia_variable_overrides.sh
@@ -0,0 +1 @@
+PRINCIPIA_MACOS_CXX_FLAGS=
diff --git a/src/benchmark_register.cc b/src/benchmark_register.cc
index a85a4b44d8..75dabc8c7a 100644
--- a/src/benchmark_register.cc
+++ b/src/benchmark_register.cc
@@ -323,7 +323,7 @@ Benchmark* Benchmark::ArgNames(const std::vector& names) {
Benchmark* Benchmark::DenseRange(int64_t start, int64_t limit, int step) {
CHECK(ArgsCnt() == -1 || ArgsCnt() == 1);
- CHECK_GE(start, 0);
+ CHECK_GT(step, 0);
CHECK_LE(start, limit);
for (int64_t arg = start; arg <= limit; arg += step) {
args_.push_back({arg});
diff --git a/src/check.h b/src/check.h
index f5f8253f80..0d28d1f5c6 100644
--- a/src/check.h
+++ b/src/check.h
@@ -11,7 +11,7 @@
namespace benchmark {
namespace internal {
-typedef void(AbortHandlerT)();
+typedef void(__cdecl AbortHandlerT)();
inline AbortHandlerT*& GetAbortHandler() {
static AbortHandlerT* handler = &std::abort;
@@ -59,7 +59,7 @@ class CheckHandler {
: ::benchmark::internal::CheckHandler(#b, __FILE__, __func__, __LINE__) \
.GetLog())
#else
-#define CHECK(b) ::benchmark::internal::GetNullLogInstance()
+#define CHECK(b) while (false) ::benchmark::internal::GetNullLogInstance()
#endif
// clang-format off
diff --git a/src/log.h b/src/log.h
index 47d0c35c01..c9c0df0590 100644
--- a/src/log.h
+++ b/src/log.h
@@ -9,7 +9,7 @@
namespace benchmark {
namespace internal {
-typedef std::basic_ostream&(EndLType)(std::basic_ostream&);
+typedef std::basic_ostream&(__cdecl EndLType)(std::basic_ostream&);
class LogType {
friend LogType& GetNullLogInstance();
diff --git a/test/basic_test.cc b/test/basic_test.cc
index d07fbc00b1..37ac320da7 100644
--- a/test/basic_test.cc
+++ b/test/basic_test.cc
@@ -133,4 +133,6 @@ static_assert(std::is_same<
typename std::iterator_traits::value_type,
typename benchmark::State::StateIterator::value_type>::value, "");
+#if !defined(_MSC_VER)
BENCHMARK_MAIN();
+#endif
diff --git a/test/benchmark_test.cc b/test/benchmark_test.cc
index 3cd4f5565f..14bccaed47 100644
--- a/test/benchmark_test.cc
+++ b/test/benchmark_test.cc
@@ -242,4 +242,6 @@ BENCHMARK(BM_DenseThreadRanges)->Arg(1)->DenseThreadRange(1, 3);
BENCHMARK(BM_DenseThreadRanges)->Arg(2)->DenseThreadRange(1, 4, 2);
BENCHMARK(BM_DenseThreadRanges)->Arg(3)->DenseThreadRange(5, 14, 3);
+#if !defined(_MSC_VER)
BENCHMARK_MAIN();
+#endif
diff --git a/test/fixture_test.cc b/test/fixture_test.cc
index 1462b10f02..f77b90d381 100644
--- a/test/fixture_test.cc
+++ b/test/fixture_test.cc
@@ -46,4 +46,6 @@ BENCHMARK_DEFINE_F(MyFixture, Bar)(benchmark::State& st) {
BENCHMARK_REGISTER_F(MyFixture, Bar)->Arg(42);
BENCHMARK_REGISTER_F(MyFixture, Bar)->Arg(42)->ThreadPerCpu();
+#if !defined(_MSC_VER)
BENCHMARK_MAIN();
+#endif
diff --git a/test/main.cpp b/test/main.cpp
new file mode 100644
index 0000000000..eb154e312e
--- /dev/null
+++ b/test/main.cpp
@@ -0,0 +1,5 @@
+#include "benchmark/benchmark.h"
+
+#if defined(_MSC_VER)
+BENCHMARK_MAIN();
+#endif
diff --git a/test/map_test.cc b/test/map_test.cc
index dbf7982a36..3268a890af 100644
--- a/test/map_test.cc
+++ b/test/map_test.cc
@@ -54,4 +54,6 @@ BENCHMARK_DEFINE_F(MapFixture, Lookup)(benchmark::State& state) {
}
BENCHMARK_REGISTER_F(MapFixture, Lookup)->Range(1 << 3, 1 << 12);
+#if !defined(_MSC_VER)
BENCHMARK_MAIN();
+#endif
diff --git a/test/multiple_ranges_test.cc b/test/multiple_ranges_test.cc
index c64acabc25..e98ffdd40c 100644
--- a/test/multiple_ranges_test.cc
+++ b/test/multiple_ranges_test.cc
@@ -94,4 +94,6 @@ static void BM_MultipleRanges(benchmark::State& st) {
}
BENCHMARK(BM_MultipleRanges)->Ranges({{5, 5}, {6, 6}});
+#if !defined(_MSC_VER)
BENCHMARK_MAIN();
+#endif
diff --git a/test/options_test.cc b/test/options_test.cc
index fdec69174e..949bcc881a 100644
--- a/test/options_test.cc
+++ b/test/options_test.cc
@@ -62,4 +62,6 @@ void BM_explicit_iteration_count(benchmark::State& state) {
}
BENCHMARK(BM_explicit_iteration_count)->Iterations(42);
+#if !defined(_MSC_VER)
BENCHMARK_MAIN();
+#endif
diff --git a/test/templated_fixture_test.cc b/test/templated_fixture_test.cc
index fe9865cc77..26a7fc9a69 100644
--- a/test/templated_fixture_test.cc
+++ b/test/templated_fixture_test.cc
@@ -4,25 +4,27 @@
#include
#include
-template
-class MyFixture : public ::benchmark::Fixture {
- public:
- MyFixture() : data(0) {}
+template
+class MyTemplatedFixture : public ::benchmark::Fixture {
+public:
+ MyTemplatedFixture() : data(0) {}
T data;
};
-BENCHMARK_TEMPLATE_F(MyFixture, Foo, int)(benchmark::State& st) {
+BENCHMARK_TEMPLATE_F(MyTemplatedFixture, Foo, int)(benchmark::State &st) {
for (auto _ : st) {
data += 1;
}
}
-BENCHMARK_TEMPLATE_DEFINE_F(MyFixture, Bar, double)(benchmark::State& st) {
+BENCHMARK_TEMPLATE_DEFINE_F(MyTemplatedFixture, Bar, double)(benchmark::State& st) {
for (auto _ : st) {
data += 1.0;
}
}
-BENCHMARK_REGISTER_F(MyFixture, Bar);
+BENCHMARK_REGISTER_F(MyTemplatedFixture, Bar);
+#if !defined(_MSC_VER)
BENCHMARK_MAIN();
+#endif