Skip to content

Commit

Permalink
CMake stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimcn committed Jul 19, 2019
1 parent c449834 commit b3bcf83
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 60 deletions.
20 changes: 11 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"configurations": [
{
"name": "extension",
"preLaunchTask": "dev_debugging",
"preLaunchTask": "make dev_debugging",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}/build"
"--extensionDevelopmentPath=${workspaceRoot}/build",
"${workspaceFolder}/debuggee"
],
"stopOnEntry": false,
"sourceMaps": true,
Expand All @@ -34,7 +35,7 @@
},
{
"name": "codelldb on Linux",
"preLaunchTask": "codelldb",
"preLaunchTask": "make codelldb",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/adapter2/codelldb",
Expand All @@ -56,7 +57,7 @@
},
{
"name": "codelldb on OSX",
"preLaunchTask": "codelldb",
"preLaunchTask": "make codelldb",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/adapter2/codelldb",
Expand All @@ -78,7 +79,7 @@
},
{
"name": "codelldb on Windows",
"preLaunchTask": "codelldb",
"preLaunchTask": "make codelldb",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/build/adapter2/codelldb",
Expand All @@ -103,7 +104,7 @@
"name": "codelldb on Windows+cppvsdbg",
"type": "cppvsdbg",
"request": "launch",
"preLaunchTask": "codelldb",
"preLaunchTask": "make codelldb",
"program": "${workspaceFolder}/build/adapter2/codelldb.exe",
"args": [
"--preload=${workspaceFolder}/build/lldb/bin/liblldb.dll",
Expand Down Expand Up @@ -137,7 +138,7 @@
},
{
"name": "test codelldb",
"preLaunchTask": "check_codelldb",
"preLaunchTask": "make dev_debugging",
"type": "lldb",
"request": "launch",
"cargo": {
Expand Down Expand Up @@ -166,7 +167,7 @@
},
{
"name": "tests",
"preLaunchTask": "tests",
"preLaunchTask": "make tests",
"type": "node",
"request": "launch",
"cwd": "${workspaceRoot}/build",
Expand All @@ -184,7 +185,8 @@
//"TARGET_TRIPLE": "x86_64-pc-windows-gnu",
"RUST_LOG": "error,codelldb=debug",
"RUST_BACKTRACE": "full",
"NODE_PATH": "${workspaceRoot}/build"
"NODE_PATH": "${workspaceRoot}/build",
"DEBUG_SERVER": "4711"
},
"sourceMaps": true,
"outFiles": [
Expand Down
73 changes: 41 additions & 32 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,65 +19,96 @@
],
"tasks": [
{
"label": "dev_debugging",
"label": "make dev_debugging",
"args": [
"dev_debugging"
]
},
{
"label": "tests",
"label": "make tests",
"args": [
"dev_debugging"
]
},
{
"label": "lldb",
"label": "make lldb",
"args": [
"lldb"
]
},
{
"label": "adapter",
"label": "make adapter",
"args": [
"adapter"
]
},
{
"label": "codelldb",
"label": "make codelldb",
"args": [
"codelldb"
]
},
{
"label": "debuggee",
"label": "make debuggee",
"args": [
"debuggee"
]
},
{
"label": "extension",
"label": "make extension",
"args": [
"extension"
]
},
{
"label": "check_codelldb",
"label": "make check_codelldb",
"args": [
"check_codelldb"
]
},
{
"label": "doc_lldb",
"label": "make doc_lldb",
"args": [
"doc_lldb"
]
},
{
"label": "test_codelldb",
"label": "make test_codelldb",
"args": [
"test_codelldb"
]
},
{
"label": "make cargo_test",
"args": [
"cargo_test"
]
},
{
"label": "make vsix_portable",
"args": [
"vsix_portable"
]
},
{
"label": "make vsix_full",
"args": [
"vsix_full"
]
},
{
"label": "make vsix_extracted",
"args": [
"vsix_extracted"
]
},
{
"label": "cargo check",
"command": "cargo",
"args": [
"check"
]
},
{
"label": "cargo expand",
"command": "cargo",
Expand All @@ -102,12 +133,6 @@
"label": "Start extension host (dev VSCode)",
"command": "${workspaceFolder}/../vscode/scripts/code.sh --extensionDevelopmentPath=${workspaceFolder}/build ${workspaceFolder}/debuggee",
},
{
"label": "vsix_extracted",
"args": [
"vsix_extracted"
]
},
{
"type": "shell",
"label": "Start extension host on extracted vsix",
Expand Down Expand Up @@ -160,21 +185,5 @@
"${file}"
]
},
{
"label": "cargo build example pyo3",
"command": "cargo",
"args": [
"build",
"--example",
"pyo3"
],
},
{
"label": "cargo check",
"command": "cargo",
"args": [
"check"
]
}
]
}
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ cmake .. -DLLDB_ROOT=<path to LLDB directory>
- `debuggee` - build the debuggee project (used for debbugging and tests).
- `adapter` - build classic adapter.
- `codelldb` - build native adapter.
- `check_codelldb` - run `cargo check` on codelldb crate.
- `cargo_test` - run `cargo test` on all codelldb crates.
- `dev_debugging` - build extension, adapters, debuggee and other stuff needed for debugging extension directly out of the build directory.
After building this target you can run `code --extensionDevelopmentPath=${workspaceFolder}/build` to try out the extension.
- `check_` { `classic` | `bundled` | `native` } - build and test the specified adapter type.
Expand Down
17 changes: 15 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ if (NOT ${Result} EQUAL 0)
message(FATAL_ERROR "npm intall failed: ${Result}")
endif()

# Extension package resources

add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_BINARY_DIR}/README.md)
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/CHANGELOG.md ${CMAKE_CURRENT_BINARY_DIR}/CHANGELOG.md)
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/images/lldb.png ${CMAKE_CURRENT_BINARY_DIR}/images/lldb.png)
add_copy_file(PackageFiles ${CMAKE_CURRENT_SOURCE_DIR}/syntaxes/disassembly.json ${CMAKE_CURRENT_BINARY_DIR}/syntaxes/disassembly.json)

# Classic adapter

file(GLOB_RECURSE Files
Expand All @@ -77,7 +84,9 @@ add_custom_target(adapter ALL

# For extension debugging

add_custom_target(dev_debugging DEPENDS adapter codelldb debuggee extension)
add_custom_target(dev_debugging
DEPENDS adapter codelldb debuggee extension ${PackageFiles}
)

# VSIX packages

Expand Down Expand Up @@ -225,13 +234,15 @@ foreach(AdapterType ${TestAdapters})
endforeach(TestTriple)

add_custom_target(check_${AdapterType} DEPENDS tests
COMMAND ${CMAKE_CTEST_COMMAND} -R ${AdapterType} --output-on-failure
COMMAND ${CMAKE_CTEST_COMMAND} -R ${AdapterType} --output-on-failure --verbose
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
USES_TERMINAL
)
add_dependencies(check check_${AdapterType})
endforeach(AdapterType)

add_dependencies(check_native cargo_test)

# Install

install(CODE "file(REMOVE_RECURSE \"${CMAKE_INSTALL_PREFIX}/vscode-lldb\")")
Expand All @@ -243,6 +254,8 @@ install(
# XtraClean

add_custom_target(xclean
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean
COMMAND ${CMAKE_COMMAND} -E remove_directory CMakeFiles
COMMAND ${CMAKE_COMMAND} -E remove_directory adapter
COMMAND ${CMAKE_COMMAND} -E remove_directory adapter2
COMMAND ${CMAKE_COMMAND} -E remove_directory debuggee
Expand Down
14 changes: 2 additions & 12 deletions adapter2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,7 @@ add_custom_target(codelldb ALL
USES_TERMINAL
)

add_custom_target(check_codelldb
COMMAND cargo check ${Features} --package=codelldb
USES_TERMINAL
)

add_custom_target(test_codelldb
COMMAND ${CMAKE_COMMAND} -E env RUST_BACKTRACE=1 cargo test ${Features} --package=codelldb
USES_TERMINAL
)

add_custom_target(doc_lldb
COMMAND ${CMAKE_COMMAND} -E env LLDB_ROOT=${LLDB_ROOT} cargo doc --package=lldb --no-deps
add_custom_target(cargo_test
COMMAND ${CMAKE_COMMAND} -E env RUST_BACKTRACE=1 cargo test ${Features} -p=lldb -p=debug-protocol -p=codelldb
USES_TERMINAL
)
11 changes: 7 additions & 4 deletions cmake/CopyFiles.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
# list(
# <list> ## list name
# add_copy_file(
# <list> ## list name to add output path to
# <input> ## source file path
# <output> ## destination file path
# )

# add_copy_files_to(
# <list> ## list name
# <list> ## list name to add output paths to
# <destination_dir> ## destination directory path
# <file0> <file1> ... ## list of files
# )

function(add_copy_file List Input Output)
if (IS_SYMLINK ${Input})
get_filename_component(InputDir ${Input} DIRECTORY)
get_filename_component(OutputDir ${Output} DIRECTORY)

get_filename_component(InputDir ${Input} DIRECTORY)
get_filename_component(InputDir ${InputDir} REALPATH)
get_filename_component(SymlinkTgt ${Input} REALPATH)
file(RELATIVE_PATH SymLinkTgtRel ${InputDir} ${SymlinkTgt})

add_custom_command(
OUTPUT ${Output}
PRE_BUILD
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@types/yauzl": "^2.9.0",
"typescript": "^3.5.0",
"mocha": "^6.1.0",
"source-map-support": "^0.5.12",
"memory-streams": "^0.1.3",
"vscode-debugprotocol": "^1.35.0",
"vscode-debugadapter-testsupport": "^1.35.0",
Expand Down

0 comments on commit b3bcf83

Please sign in to comment.