Skip to content

Commit 3ebb30f

Browse files
author
dashuai
committed
add support for windows
1 parent 22d261f commit 3ebb30f

File tree

19 files changed

+65
-70
lines changed

19 files changed

+65
-70
lines changed

.github/workflows/windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: windows
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ master ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ master ]
88

99
env:
1010
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
-----------------
44

5-
[![CMake](https://github.com/qdslovelife/bustub/actions/workflows/codev.yml/badge.svg)](https://github.com/qdslovelife/bustub/actions/workflows/codev.yml)
5+
[![linux](https://github.com/qdslovelife/bustub/actions/workflows/codev.yml/badge.svg)](https://github.com/qdslovelife/bustub/actions/workflows/codev.yml)
6+
[![windows](https://github.com/qdslovelife/bustub/actions/workflows/windows.yml/badge.svg)](https://github.com/qdslovelife/bustub/actions/workflows/windows.yml)
67
[![codecov](https://codecov.io/gh/qdslovelife/bustub/branch/master/graph/badge.svg?token=6Y2ZTDH9E1)](https://codecov.io/gh/qdslovelife/bustub)
78
[![Language grade: C/C++](https://img.shields.io/lgtm/grade/cpp/g/qdslovelife/bustub.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/qdslovelife/bustub/context:cpp)
89

@@ -23,7 +24,7 @@ BusTub is a disk-oriented relational database management system built at [Carneg
2324

2425
To ensure that you have the proper packages on your machine, run the following script to automatically install them.
2526

26-
Note: This script will install GTest using [vcpkg](https://github.com/microsoft/vcpkg). If you don't like it, you can modify the script and CMakeLists.txt and use it the way you prefer.
27+
Note: This script will install GTest using [vcpkg](https://github.com/microsoft/vcpkg).
2728

2829
```
2930
$ sudo build_support/packages.sh
@@ -38,6 +39,16 @@ $ cmake -DCMAKE_BUILD_TYPE=Debug -GNinja ..
3839
$ ninja
3940
```
4041

42+
### Windows
43+
44+
```
45+
$ .\build_support\packages.bat
46+
```
47+
48+
Use visual studio to open the folder, then you're done.
49+
50+
Note: The version of visual studio I am using is [Visual Studio Community 2022 preview](https://visualstudio.microsoft.com/zh-hans/vs/)
51+
4152
## Format
4253

4354
```

src/catalog/table_generator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ std::vector<Value> TableGenerator::GenNumericValues(ColumnInsertMeta *col_meta,
3434

3535
std::default_random_engine generator;
3636
// TODO(Amadou): Break up in two branches if this is too weird.
37-
std::conditional_t<std::is_integral_v<CppType>, std::uniform_int_distribution<>,
38-
std::uniform_real_distribution<>>
37+
std::conditional_t<std::is_integral_v<CppType>, std::uniform_int_distribution<>, std::uniform_real_distribution<>>
3938
distribution(static_cast<CppType>(col_meta->min_), static_cast<CppType>(col_meta->max_));
4039
for (uint32_t i = 0; i < count; i++) {
4140
values.emplace_back(Value(col_meta->type_, distribution(generator)));

src/common/config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace bustub {
1818
__declspec(dllexport) std::atomic<bool> enable_logging(false);
1919
#else
2020
std::atomic<bool> enable_logging(false);
21-
#endif // defined(_MSC_VER)
21+
#endif // defined(_MSC_VER)
2222

2323
#if defined(_MSC_VER)
2424
__declspec(dllexport) std::chrono::duration<int64_t> log_timeout(1);

src/include/buffer/buffer_pool_manager_instance.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ class BufferPoolManagerInstance : public BufferPoolManager {
133133
/** Array of buffer pool pages. */
134134
Page *pages_;
135135
/** Pointer to the disk manager. */
136-
DiskManager *disk_manager_ [[maybe_unused]];
136+
DiskManager *disk_manager_[[maybe_unused]];
137137
/** Pointer to the log manager. */
138-
LogManager *log_manager_ [[maybe_unused]];
138+
LogManager *log_manager_[[maybe_unused]];
139139
/** Page table for keeping track of buffer pool pages. */
140140
std::unordered_map<page_id_t, frame_id_t> page_table_;
141141
/** Replacer to find unpinned pages for replacement. */

src/include/common/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extern std::chrono::milliseconds cycle_detection_interval;
2626
__declspec(dllimport) extern std::atomic<bool> enable_logging;
2727
#else
2828
extern std::atomic<bool> enable_logging;
29-
#endif // defined(_MSC_VER)
29+
#endif // defined(_MSC_VER)
3030

3131
/** If ENABLE_LOGGING is true, the log should be flushed to disk every LOG_TIMEOUT. */
3232
#if defined(_MSC_VER)

src/include/concurrency/transaction_manager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ class TransactionManager {
102102
}
103103

104104
std::atomic<txn_id_t> next_txn_id_{0};
105-
LockManager *lock_manager_ [[maybe_unused]];
106-
LogManager *log_manager_ [[maybe_unused]];
105+
LockManager *lock_manager_[[maybe_unused]];
106+
LogManager *log_manager_[[maybe_unused]];
107107

108108
/** The global transaction latch is used for checkpointing. */
109109
ReaderWriterLatch global_txn_latch_;

src/include/recovery/checkpoint_manager.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class CheckpointManager {
3535
void EndCheckpoint();
3636

3737
private:
38-
TransactionManager *transaction_manager_ [[maybe_unused]];
39-
LogManager *log_manager_ [[maybe_unused]];
40-
BufferPoolManager *buffer_pool_manager_ [[maybe_unused]];
38+
TransactionManager *transaction_manager_[[maybe_unused]];
39+
LogManager *log_manager_[[maybe_unused]];
40+
BufferPoolManager *buffer_pool_manager_[[maybe_unused]];
4141
};
4242

4343
} // namespace bustub

src/include/recovery/log_manager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ class LogManager {
6464

6565
std::mutex latch_;
6666

67-
std::thread *flush_thread_ [[maybe_unused]];
67+
std::thread *flush_thread_[[maybe_unused]];
6868

6969
std::condition_variable cv_;
7070

71-
DiskManager *disk_manager_ [[maybe_unused]];
71+
DiskManager *disk_manager_[[maybe_unused]];
7272
};
7373

7474
} // namespace bustub

src/include/recovery/log_recovery.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ class LogRecovery {
4242
bool DeserializeLogRecord(const char *data, LogRecord *log_record);
4343

4444
private:
45-
DiskManager *disk_manager_ [[maybe_unused]];
46-
BufferPoolManager *buffer_pool_manager_ [[maybe_unused]];
45+
DiskManager *disk_manager_[[maybe_unused]];
46+
BufferPoolManager *buffer_pool_manager_[[maybe_unused]];
4747

4848
/** Maintain active transactions and its corresponding latest lsn. */
4949
std::unordered_map<txn_id_t, lsn_t> active_txn_;
5050
/** Mapping the log sequence number to log file offset for undos. */
5151
std::unordered_map<lsn_t, int> lsn_mapping_;
5252

53-
int offset_ [[maybe_unused]];
53+
int offset_[[maybe_unused]];
5454
char *log_buffer_;
5555
};
5656

0 commit comments

Comments
 (0)