Added LSP file auto-generator
CMake will auto generate compile-commands.json file to help LSP find symbols. this file is gitignored and will be regenerated each build nothing else was changed, should work on any system, but please test
This commit is contained in:
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
.build
|
.build
|
||||||
.vscode
|
.vscode
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
compile_commands.json
|
||||||
@@ -91,3 +91,11 @@ add_custom_command(TARGET kernel.elf POST_BUILD
|
|||||||
COMMAND ${LLVM_OBJCOPY} -O binary kernel.elf kernel.bin
|
COMMAND ${LLVM_OBJCOPY} -O binary kernel.elf kernel.bin
|
||||||
COMMENT "kernel.elf -> kernel.bin"
|
COMMENT "kernel.elf -> kernel.bin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# --- SourceKit-LSP: generate compile_commands.json for Swift ---
|
||||||
|
set(_COMMON_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../Common")
|
||||||
|
set(_BRIDGING_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/Source/BridgingHeader.h")
|
||||||
|
|
||||||
|
file(GENERATE OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/compile_commands.json"
|
||||||
|
CONTENT "[\n {\n \"file\": \"${SWIFT_SOURCES}\",\n \"directory\": \"${CMAKE_CURRENT_BINARY_DIR}\",\n \"arguments\": [\n \"${SWIFTC}\",\n \"-target\", \"aarch64-none-none-elf\",\n \"-enable-experimental-feature\", \"Embedded\",\n \"-parse-as-library\",\n \"-wmo\",\n \"-O\",\n \"-Xcc\", \"-fno-stack-protector\",\n \"-Xcc\", \"-I${_COMMON_DIR}\",\n \"-import-bridging-header\", \"${_BRIDGING_HEADER}\",\n \"-resource-dir\", \"${SWIFT_RESOURCE_DIR}\",\n \"${SWIFT_SOURCES}\"\n ]\n }\n]\n"
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user