Skip to content

Commit c4ef80a

Browse files
fix(core): make core library build on windows
1 parent 701f97f commit c4ef80a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

core/include/measurement.hpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
#include <string>
55

6+
#ifdef CODSPEED_INSTRUMENTATION
67
#include "callgrind.h"
8+
#endif
79

810
inline std::string get_version() {
911
#ifdef CODSPEED_VERSION
@@ -13,6 +15,7 @@ inline std::string get_version() {
1315
#endif
1416
}
1517

18+
#ifdef CODSPEED_INSTRUMENTATION
1619
inline bool measurement_is_instrumented() { return RUNNING_ON_VALGRIND; }
1720

1821
inline void measurement_set_metadata() {
@@ -30,5 +33,12 @@ __attribute__((always_inline)) inline void measurement_stop(
3033
CALLGRIND_STOP_INSTRUMENTATION;
3134
CALLGRIND_DUMP_STATS_AT(name.c_str());
3235
};
36+
#else
37+
// Stub implementations for non-instrumentation builds
38+
inline bool measurement_is_instrumented() { return false; }
39+
inline void measurement_set_metadata() {}
40+
inline void measurement_start() {}
41+
inline void measurement_stop(const std::string &name) {}
42+
#endif
3343

3444
#endif // MEASUREMENT_H

core/src/uri.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ std::string extract_lambda_namespace(const std::string &pretty_func) {
4646
return extract_namespace_clang(pretty_func);
4747
#elif __GNUC__
4848
return extract_namespace_gcc(pretty_func);
49+
#elif _MSC_VER
50+
// MSVC doesn't support __PRETTY_FUNCTION__ in the same way
51+
// Return empty string as fallback for Windows
52+
return {};
4953
#else
5054
#error "Unsupported compiler"
5155
#endif

0 commit comments

Comments
 (0)