Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit 9ee9a0a

Browse files
committed
在 vs 2020 上进行调试.
1 parent c665fcd commit 9ee9a0a

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

CMakePresets.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"version": 2,
3+
"configurePresets": [
4+
{
5+
"name": "linux-default",
6+
"displayName": "Linux Debug",
7+
"description": "Target the Windows Subsystem for Linux (WSL) or a remote Linux system.",
8+
"generator": "Ninja",
9+
"binaryDir": "${sourceDir}/out/build/${presetName}",
10+
"cacheVariables": {
11+
"CMAKE_BUILD_TYPE": "Debug",
12+
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
13+
"MIRAI_CPP_BUILD_EXAMPLES": true
14+
},
15+
"vendor": {
16+
"microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Linux" ] },
17+
"microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" }
18+
}
19+
},
20+
{
21+
"name": "windows-default",
22+
"displayName": "Windows x64 Debug",
23+
"description": "Target Windows with the Visual Studio development environment.",
24+
"generator": "Ninja",
25+
"binaryDir": "${sourceDir}/out/build/${presetName}",
26+
"architecture": {
27+
"value": "x64",
28+
"strategy": "external"
29+
},
30+
"cacheVariables": {
31+
"CMAKE_BUILD_TYPE": "Debug",
32+
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
33+
"MIRAI_CPP_BUILD_EXAMPLES": true
34+
},
35+
"vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } }
36+
}
37+
]
38+
}

examples/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ endif(MSVC)
1010
macro(api_exe target)
1111
add_executable(${target} ${target}.cpp)
1212
target_link_libraries(${target} mirai-cpp)
13-
# gcc 要连接 pthread
1413
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
15-
target_link_libraries(${target} pthread)
14+
# 链接 pthread
15+
target_link_libraries(${target} pthread)
16+
# 静态链接 libgcc 和 libstdc++
17+
target_link_libraries(${target} -static-libgcc -static-libstdc++)
1618
endif()
1719
endmacro()
1820

0 commit comments

Comments
 (0)