Skip to content

Commit 10b937f

Browse files
build: Add support for Windows
1 parent 9e9cd72 commit 10b937f

File tree

2 files changed

+51
-7
lines changed

2 files changed

+51
-7
lines changed

indexer/os/BUILD

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
# NOTE(ref: based-on-sorbet): Based on Sorbet's common/os package.
22
cc_library(
33
name = "os",
4-
srcs = [
5-
"Os.h",
6-
"Os.cc",
7-
] + select({
8-
"@platforms//os:linux": ["Linux.cc"],
9-
"@platforms//os:macos": ["macOS.cc"],
10-
}),
4+
srcs = glob(["*.cc", "*.h"], allow_empty=False),
115
hdrs = [
126
"Os.h",
137
],

indexer/os/Windows.cc

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#ifdef _WIN32
2+
3+
#include <string>
4+
5+
#include <libloaderapi.h>
6+
#include <processthreadsapi.h>
7+
#include <windows.h>
8+
#include <windef.h>
9+
10+
#include "indexer/os/Os.h"
11+
12+
namespace scip_clang {
13+
14+
std::string exec(std::string cmd) {
15+
// FIXME(def: windows-support) Implement this if needed for addr2line
16+
return "";
17+
}
18+
19+
std::string addr2line(std::string_view programName, void const *const *addr,
20+
int count) {
21+
// FIXME(def: windows-support)
22+
return "";
23+
}
24+
25+
std::string getProgramName() {
26+
char buf[MAX_PATH];
27+
GetModuleFileNameA(nullptr, buf, MAX_PATH);
28+
return buf;
29+
}
30+
31+
bool setCurrentThreadName(std::string_view name) {
32+
std::wstring wstr = std::wstring(name.begin(), name.end());
33+
SetThreadDescription(GetCurrentThread(), wstr.c_str());
34+
return true;
35+
}
36+
37+
bool amIBeingDebugged() {
38+
// FIXME(def: windows-support)
39+
return false;
40+
}
41+
42+
bool stopInDebugger() {
43+
// FIXME(def: windows-support)
44+
return false;
45+
}
46+
47+
} // namespace scip_clang
48+
49+
50+
#endif

0 commit comments

Comments
 (0)