Skip to content

Commit 592ce79

Browse files
committed
fixing windows build
1 parent 21dabf7 commit 592ce79

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed

.github/workflows/windows-build.yml

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ jobs:
1717
- uses: actions/checkout@v4
1818
name: Checkout the repository
1919

20-
# Step 2: Setup CMake
20+
# Step 2: Setup Visual Studio Build Tools
21+
- name: Setup Visual Studio Build Tools
22+
uses: microsoft/setup-msbuild@v1.3.1
23+
24+
# Step 3: Setup CMake
2125
- name: Setup CMake
2226
uses: jwlawson/actions-setup-cmake@v1.14
2327
with:
2428
cmake-version: 3.28.0
2529

26-
# Step 3: Setup Ninja
30+
# Step 4: Setup Ninja
2731
- name: Setup Ninja
2832
uses: actions/setup-python@v5
2933
with:
@@ -34,25 +38,28 @@ jobs:
3438
python -m pip install ninja
3539
echo "$env:LOCALAPPDATA\Python\Python311\Scripts" >> $env:GITHUB_PATH
3640
37-
# Step 4: Verify tools availability
41+
# Step 5: Verify tools availability
3842
- name: Verify tools
3943
run: |
4044
cmake --version
4145
ninja --version
46+
cl
47+
echo "Using Visual Studio compiler:"
48+
cl 2>&1 | Select-String "Microsoft"
4249
43-
# Step 5: Configure CMake
50+
# Step 6: Configure CMake with Visual Studio
4451
- name: Configure CMake
45-
run: cmake -S . -G "Ninja Multi-Config" -B build -DCMAKE_CXX_FLAGS="/W3"
52+
run: cmake -S . -G "Ninja Multi-Config" -B build -DCMAKE_CXX_FLAGS="/W3" -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl
4653

47-
# Step 6: Build with CMake
54+
# Step 7: Build with CMake
4855
- name: Build with CMake
4956
run: cmake --build build --config Release
5057

51-
# Step 7: Verify if build files are generated
58+
# Step 8: Verify if build files are generated
5259
- name: List build directory contents
5360
run: Get-ChildItem -Path build -Recurse | Select-Object Name, FullName
5461

55-
# Step 8: Generate Doxygen documentation
62+
# Step 9: Generate Doxygen documentation
5663
- name: Generate Doxygen documentation
5764
run: |
5865
# Install Doxygen if not available
@@ -61,18 +68,18 @@ jobs:
6168
}
6269
doxygen Doxyfile
6370
64-
# Step 9: Verify if documentation files are generated
71+
# Step 10: Verify if documentation files are generated
6572
- name: List documentation directory contents
6673
run: Get-ChildItem -Path docs -Recurse | Select-Object Name, FullName
6774

68-
# Step 10: Upload documentation as an artifact (if files exist)
75+
# Step 11: Upload documentation as an artifact (if files exist)
6976
- name: Upload documentation
7077
uses: actions/upload-artifact@v4
7178
with:
7279
name: cpp_documentation_windows
7380
path: docs
7481

75-
# Step 11: Upload build artifacts as an artifact (if files exist)
82+
# Step 12: Upload build artifacts as an artifact (if files exist)
7683
- name: Upload build artifacts
7784
uses: actions/upload-artifact@v4
7885
with:
@@ -89,7 +96,11 @@ jobs:
8996
- uses: actions/checkout@v4
9097
name: Checkout the repository
9198

92-
# Step 2: Create a GitHub release using the version tag (e.g., v1.0.0, v1.0.1)
99+
# Step 2: Setup Visual Studio Build Tools
100+
- name: Setup Visual Studio Build Tools
101+
uses: microsoft/setup-msbuild@v1.3.1
102+
103+
# Step 3: Create a GitHub release using the version tag (e.g., v1.0.0, v1.0.1)
93104
- name: Create Release
94105
id: create_release
95106
uses: actions/create-release@v1
@@ -103,7 +114,7 @@ jobs:
103114
draft: false
104115
prerelease: false
105116

106-
# Step 3: Upload build artifacts to release
117+
# Step 4: Upload build artifacts to release
107118
- name: Upload build artifacts to release
108119
uses: actions/upload-release-asset@v1
109120
with:
@@ -112,7 +123,7 @@ jobs:
112123
asset_name: main_windows.exe # Adjust this to name the artifact file
113124
asset_content_type: application/octet-stream
114125

115-
# Step 4: Upload documentation to release
126+
# Step 5: Upload documentation to release
116127
- name: Upload documentation to release
117128
uses: actions/upload-release-asset@v1
118129
with:

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ add_executable(race_condition src/multithreading/race_condition.cpp)
181181
target_link_libraries(race_condition ${THREADING_LIB})
182182

183183
add_executable(unique_lock src/multithreading/unique_lock.cpp)
184-
target_link_libraries(unique_lock -pthread)
184+
target_link_libraries(unique_lock ${THREADING_LIB})
185185

186186
add_executable(lock_guard src/multithreading/lock_guard.cpp)
187-
target_link_libraries(lock_guard -pthread)
187+
target_link_libraries(lock_guard ${THREADING_LIB})
188188

189189
add_executable(thread_pool src/multithreading/thread_pool.cpp)
190190
#target_link_libraries(thread_pool -pthread)
@@ -294,7 +294,7 @@ add_executable(std_invoke src/std_invoke.cpp)
294294
add_executable(structured_binding_declaration src/structured_binding_declaration.cpp)
295295

296296
add_executable(asynchronous_programming src/asynchronous_programming.cpp)
297-
target_link_libraries(asynchronous_programming -pthread)
297+
target_link_libraries(asynchronous_programming ${THREADING_LIB})
298298

299299
add_executable(circular_dependency src/class/circular_dependency/circular_dependency.cpp src/class/circular_dependency/classA.cpp src/class/circular_dependency/classB.cpp)
300300

0 commit comments

Comments
 (0)