Skip to content

Commit 78ff6e4

Browse files
committed
compile_commands.json from cmake, misc cleanup
1 parent fa3520a commit 78ff6e4

File tree

4 files changed

+38
-74
lines changed

4 files changed

+38
-74
lines changed

cpp/.clangd

Lines changed: 0 additions & 36 deletions
This file was deleted.

cpp/.vscode/launch.json

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
},
2222
{
2323
"description": "Add safe path for auto-loading debug build",
24-
"text": "add-auto-load-safe-path ${workspaceFolder}/build-debug",
24+
"text": "add-auto-load-safe-path ${workspaceFolder}/build/debug",
2525
"ignoreFailures": true
2626
}
2727
]
2828
},
2929
{
30-
"name": "Profile Benchmark (RelWithDebInfo)",
30+
"name": "Profile Benchmark (Release)",
3131
"type": "cppdbg",
3232
"request": "launch",
33-
"program": "${workspaceFolder}/build-relwithdebinfo/bench/${input:benchmarkExecutable}",
33+
"program": "${workspaceFolder}/build/release/bench/${input:benchmarkExecutable}",
3434
"args": [],
3535
"stopAtEntry": false,
3636
"cwd": "${workspaceFolder}",
@@ -45,8 +45,8 @@
4545
"ignoreFailures": true
4646
},
4747
{
48-
"description": "Add safe path for auto-loading RelWithDebInfo build",
49-
"text": "add-auto-load-safe-path ${workspaceFolder}/build-relwithdebinfo",
48+
"description": "Add safe path for auto-loading release build",
49+
"text": "add-auto-load-safe-path ${workspaceFolder}/build/release",
5050
"ignoreFailures": true
5151
}
5252
]
@@ -55,7 +55,7 @@
5555
"name": "Debug Test",
5656
"type": "cppdbg",
5757
"request": "launch",
58-
"program": "${workspaceFolder}/build-debug/tests/${input:testExecutable}",
58+
"program": "${workspaceFolder}/build/debug/tests/${input:testExecutable}",
5959
"args": [],
6060
"stopAtEntry": false,
6161
"cwd": "${workspaceFolder}",
@@ -71,7 +71,7 @@
7171
},
7272
{
7373
"description": "Add safe path for auto-loading debug build",
74-
"text": "add-auto-load-safe-path ${workspaceFolder}/build-debug",
74+
"text": "add-auto-load-safe-path ${workspaceFolder}/build/debug",
7575
"ignoreFailures": true
7676
}
7777
]
@@ -95,8 +95,7 @@
9595
"description": "Select test executable",
9696
"type": "pickString",
9797
"options": [
98-
"testeval",
99-
"unit_tests"
98+
"testeval"
10099
]
101100
}
102101
]

cpp/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,33 @@ if(JSONLOGIC_ENABLE_TESTS)
7474

7575
add_subdirectory(tests)
7676
endif()
77+
78+
# Create symlink to compile_commands.json for clangd
79+
set(COMPILE_COMMANDS_SOURCE "${CMAKE_BINARY_DIR}/compile_commands.json")
80+
set(COMPILE_COMMANDS_LINK "${CMAKE_SOURCE_DIR}/build/compile_commands.json")
81+
82+
# Ensure the build directory exists
83+
file(MAKE_DIRECTORY "${CMAKE_SOURCE_DIR}/build")
84+
85+
# Create or update the symlink
86+
if(EXISTS "${COMPILE_COMMANDS_SOURCE}")
87+
# Remove existing symlink/file if it exists
88+
if(EXISTS "${COMPILE_COMMANDS_LINK}")
89+
file(REMOVE "${COMPILE_COMMANDS_LINK}")
90+
endif()
91+
92+
# Create new symlink
93+
execute_process(
94+
COMMAND ${CMAKE_COMMAND} -E create_symlink
95+
"${COMPILE_COMMANDS_SOURCE}"
96+
"${COMPILE_COMMANDS_LINK}"
97+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/build"
98+
RESULT_VARIABLE symlink_result
99+
)
100+
101+
if(symlink_result EQUAL 0)
102+
message(STATUS "Created symlink: ${COMPILE_COMMANDS_LINK} -> ${COMPILE_COMMANDS_SOURCE}")
103+
else()
104+
message(WARNING "Failed to create compile_commands.json symlink")
105+
endif()
106+
endif()

cpp/tests/run-tests.sh

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)