diff --git a/.gitignore b/.gitignore index 01f9cb9..567609b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ build/ -.vscode/ \ No newline at end of file diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..202c2b8 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,13 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compileCommands": "${workspaceFolder}/build/compile_commands.json" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..be0c888 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,30 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(lldb) Launch", // 配置名称,将会在启动配置的下拉菜单中显示 + "type": "lldb", // 配置类型,不同编程语言不同,该项由CodeLLDB插件提供 + "request": "launch", // 可以为launch(启动)或attach(附加) + "program": "${command:cmake.launchTargetPath}", // 将要进行调试的程序的路径,这里通过cmake-tools插件自动指定 + "args": [], // 程序调试时传递给程序的命令行参数,一般设为空 + "stopAtEntry": false, // 设为true时程序将暂停在程序入口处,相当于在main上打断点 + "cwd": "${workspaceFolder}", // ${workspaceFolder}调试程序时的工作目录,此为工作区文件夹;改成${fileDirname}可变为文件所在目录 + "environment": [], // 环境变量 + "externalConsole": false, // 使用单独的cmd窗口,与其它IDE一致;为false时使用内置终端 + "internalConsoleOptions": "neverOpen", // 如果不设为neverOpen,调试时会跳到“调试控制台”选项卡,你应该不需要对gdb/lldb手动输命令吧? + "MIMode": "lldb", // 指定连接的调试器,可以为gdb或lldb,因为使用llvm工具链,所以使用lldb + "miDebuggerPath": "/usr/bin/lldb", // lldb调试器路径,通过在终端输入 which lldb 命令得到 + "setupCommands": [ + { // 模板自带,好像可以更好地显示STL容器的内容 + "description": "Enable pretty-printing for lldb", + "text": "-enable-pretty-printing", + "ignoreFailures": false + } + ], + "preLaunchTask": "taskBuild" // 调试前执行的任务,一般为编译程序。与tasks.json的label相对应,或者是CMake任务,CMake: build + } + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b2e4290 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,9 @@ +{ + "files.associations": { + "unordered_map": "cpp", + "vector": "cpp", + "array": "cpp", + "iostream": "cpp" + }, + "C_Cpp.default.compilerPath": "/usr/bin/clang++" +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..6887b02 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "tasks": [ + { + "label": "taskBuild", // 任务名称,与launch.json的preLaunchTask相对应 + "type": "shell", // 可以为process或shell + "command": "cmake --build build", // 要使用的编译器,C语言用clang + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": ["$clang"], + "detail": "Generated task by CMake Tools." + }, + { + "label": "run", + "type": "shell", + "dependsOn": "build", + "command": "${command:cmake.launchTargetPath}", // 将要进行运行的程序的路径,这里通过cmake-tools插件自动指定 + "group": { + "kind": "test", + "isDefault": true + } + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 659df4e..a775ff1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,8 @@ project(algoim CXX C) set(CMAKE_STANDARD 17) +set(CMAKE_EXPORT_COMPILECOMMANDS ON) + include_directories(algoim) # find_package(LAPACK REQUIRED)