From 49ae8a6d19732ce6e81c15eb7427a484b6c42efb Mon Sep 17 00:00:00 2001 From: Mike Wallio Date: Thu, 24 Aug 2023 10:33:20 -0400 Subject: [PATCH 1/3] Add win32-arm64 to supported platforms Co-authored-by: Kagami Sascha Rosylight --- .github/workflows/build.yml | 10 +++++++++- adapter/CMakeLists.txt | 16 +++++++++++++--- cmake/toolchain-aarch64-windows-gnu.cmake | 3 +++ cmake/toolchain-aarch64-windows-msvc.cmake | 3 +++ package.json | 3 ++- 5 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 cmake/toolchain-aarch64-windows-gnu.cmake create mode 100644 cmake/toolchain-aarch64-windows-msvc.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ea52762..5ee00112 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,10 +78,17 @@ jobs: - os: Windows image: windows-latest lldb_triple: x86_64-windows-msvc - rust_toolchain: x86_64-pc-windows-gnu + rust_toolchain: x86_64-pc-windows-msvc rust_targets: x86_64-pc-windows-msvc platformid: win32-x64 + - os: Windows + image: windows-11-arm + lldb_triple: aarch64-windows-msvc + rust_toolchain: aarch64-pc-windows-msvc + rust_targets: aarch64-pc-windows-msvc + platformid: win32-arm64 + name: ${{ matrix.os }} ${{ matrix.platformid }} runs-on: ${{ matrix.image }} @@ -163,6 +170,7 @@ jobs: cat build/CMakeCache.txt - name: Build + shell: cmd run: | cmake --build build --target vsix_full mv build/codelldb-full.vsix build/codelldb-${{ matrix.platformid }}.vsix diff --git a/adapter/CMakeLists.txt b/adapter/CMakeLists.txt index 9cbac2b4..2a88e877 100644 --- a/adapter/CMakeLists.txt +++ b/adapter/CMakeLists.txt @@ -3,7 +3,17 @@ include(ExternalProject) add_subdirectory(scripts) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - find_file(MSDIA msdia140.dll PATHS "${CMAKE_SOURCE_DIR}" "$ENV{VSINSTALLDIR}/DIA SDK/bin/amd64" NO_DEFAULT_PATH) + if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") + set(_DIA_ARCH amd64) + set(_DIA_HEADER_ARCH x64) + elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ARM64") + set(_DIA_ARCH arm64) + set(_DIA_HEADER_ARCH ARM64) + else() + message(FATAL_ERROR "Unsupported processor: ${CMAKE_SYSTEM_PROCESSOR}") + endif() + + find_file(MSDIA msdia140.dll PATHS "${CMAKE_SOURCE_DIR}" "$ENV{VSINSTALLDIR}/DIA SDK/bin/${_DIA_ARCH}" NO_DEFAULT_PATH) if (NOT MSDIA) # Search again with default paths find_file(MSDIA msdia140.dll) endif() @@ -12,11 +22,11 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") message(FATAL_ERROR "msdia140.dll not found") else() execute_process(COMMAND dumpbin "/headers" "${MSDIA}" OUTPUT_VARIABLE OUTPUT) - if (OUTPUT MATCHES ".*machine \\(x64\\).*") + if (OUTPUT MATCHES ".*machine \\(${_DIA_HEADER_ARCH}\\).*") message ("Found MSDIA at ${MSDIA}") add_copy_file(DIAFiles "${MSDIA}" ${CMAKE_CURRENT_BINARY_DIR}/msdia140.dll) else() - message(FATAL_ERROR "Found MSDIA at ${MSDIA}, but it isn't an x64 binary.") + message(FATAL_ERROR "Found MSDIA at ${MSDIA}, but it isn't an ${_DIA_ARCH} binary.") endif() endif() endif() diff --git a/cmake/toolchain-aarch64-windows-gnu.cmake b/cmake/toolchain-aarch64-windows-gnu.cmake new file mode 100644 index 00000000..82079289 --- /dev/null +++ b/cmake/toolchain-aarch64-windows-gnu.cmake @@ -0,0 +1,3 @@ +set(LLVM_TRIPLE aarch64-pc-windows-gnu) +set(CMAKE_C_COMPILER gcc) +set(CMAKE_CXX_COMPILER g++) diff --git a/cmake/toolchain-aarch64-windows-msvc.cmake b/cmake/toolchain-aarch64-windows-msvc.cmake new file mode 100644 index 00000000..6a3c81aa --- /dev/null +++ b/cmake/toolchain-aarch64-windows-msvc.cmake @@ -0,0 +1,3 @@ +set(LLVM_TRIPLE aarch64-pc-windows-msvc) +set(CMAKE_C_COMPILER cl) +set(CMAKE_CXX_COMPILER cl) diff --git a/package.json b/package.json index 8280f3c3..383d8275 100644 --- a/package.json +++ b/package.json @@ -872,7 +872,8 @@ "darwin-x64": "codelldb-darwin-x64.vsix", "darwin-arm64": "codelldb-darwin-arm64.vsix", "win32-x64": "codelldb-win32-x64.vsix", - "win32-ia32": "codelldb-win32-x64.vsix" + "win32-ia32": "codelldb-win32-x64.vsix", + "win32-arm64": "codelldb-win32-arm64.vsix" } } } From 76a14642490f9cc6947426080c36ed10846a9950 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 1 Aug 2026 11:14:58 +0200 Subject: [PATCH 2/3] temp use forked lldb-build --- .github/workflows/build.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ee00112..67d11803 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -81,13 +81,15 @@ jobs: rust_toolchain: x86_64-pc-windows-msvc rust_targets: x86_64-pc-windows-msvc platformid: win32-x64 + vcvars: vcvars64 - os: Windows - image: windows-11-arm + image: windows-11-vs2026-arm lldb_triple: aarch64-windows-msvc rust_toolchain: aarch64-pc-windows-msvc rust_targets: aarch64-pc-windows-msvc platformid: win32-arm64 + vcvars: vcvarsarm64 name: ${{ matrix.os }} ${{ matrix.platformid }} runs-on: ${{ matrix.image }} @@ -143,14 +145,20 @@ jobs: if: ${{ matrix.os == 'Windows' }} shell: cmd run: | - call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" || call "C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" + call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\${{ matrix.vcvars }}.bat" || call "C:\Program Files (x86)\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\${{ matrix.vcvars }}.bat" set >> %GITHUB_ENV% - name: Download LLDB run: | + # This should go away once https://github.com/vadimcn/lldb-build/pull/3 lands + if [[ "${{ matrix.platformid }}" == "win32-arm64" ]]; then + LLDB_REPO_OWNER=saschanaz + else + LLDB_REPO_OWNER=vadimcn + fi export GH_TOKEN=${{ secrets.LLDB_BUILD_TOKEN }} gh release download ${{ env.lldb_release }} \ - --repo vadimcn/lldb-build \ + --repo $LLDB_REPO_OWNER/lldb-build \ --pattern "lldb--${{ matrix.lldb_triple }}.zip" \ --dir $RUNNER_TEMP From 06558fa62af23a74ea5a2509b69537b5d620fd93 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sat, 1 Aug 2026 18:15:21 +0200 Subject: [PATCH 3/3] use cmd to build for windows --- .github/workflows/build.yml | 15 +++++++++++++-- CMakeLists.txt | 17 ++++++++++++++--- cmake/toolchain-aarch64-windows-gnu.cmake | 3 --- cmake/toolchain-aarch64-windows-gnullvm.cmake | 3 +++ 4 files changed, 30 insertions(+), 8 deletions(-) delete mode 100644 cmake/toolchain-aarch64-windows-gnu.cmake create mode 100644 cmake/toolchain-aarch64-windows-gnullvm.cmake diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67d11803..81b02769 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,7 @@ jobs: rust_toolchain: x86_64-unknown-linux-gnu rust_targets: x86_64-unknown-linux-gnu platformid: linux-x64 + shell: bash - os: Linux image: ubuntu-latest @@ -51,6 +52,7 @@ jobs: rust_toolchain: x86_64-unknown-linux-gnu rust_targets: aarch64-unknown-linux-gnu platformid: linux-arm64 + shell: bash cross: true - os: Linux @@ -59,6 +61,7 @@ jobs: rust_toolchain: x86_64-unknown-linux-gnu rust_targets: armv7-unknown-linux-gnueabihf platformid: linux-armhf + shell: bash cross: true - os: MacOS @@ -67,6 +70,7 @@ jobs: rust_toolchain: x86_64-apple-darwin rust_targets: x86_64-apple-darwin platformid: darwin-x64 + shell: bash - os: MacOS image: macos-15 @@ -74,6 +78,7 @@ jobs: rust_toolchain: aarch64-apple-darwin rust_targets: aarch64-apple-darwin platformid: darwin-arm64 + shell: bash - os: Windows image: windows-latest @@ -82,6 +87,7 @@ jobs: rust_targets: x86_64-pc-windows-msvc platformid: win32-x64 vcvars: vcvars64 + shell: cmd - os: Windows image: windows-11-vs2026-arm @@ -90,10 +96,15 @@ jobs: rust_targets: aarch64-pc-windows-msvc platformid: win32-arm64 vcvars: vcvarsarm64 + shell: cmd name: ${{ matrix.os }} ${{ matrix.platformid }} runs-on: ${{ matrix.image }} + defaults: + run: + shell: ${{ matrix.shell }} + steps: - name: Checkout uses: actions/checkout@v4 @@ -143,12 +154,12 @@ jobs: - name: Setup (Windows) if: ${{ matrix.os == 'Windows' }} - shell: cmd run: | call "C:\Program Files\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\${{ matrix.vcvars }}.bat" || call "C:\Program Files (x86)\Microsoft Visual Studio\18\Enterprise\VC\Auxiliary\Build\${{ matrix.vcvars }}.bat" set >> %GITHUB_ENV% - name: Download LLDB + shell: bash run: | # This should go away once https://github.com/vadimcn/lldb-build/pull/3 lands if [[ "${{ matrix.platformid }}" == "win32-arm64" ]]; then @@ -163,6 +174,7 @@ jobs: --dir $RUNNER_TEMP - name: Configure + shell: bash run: | mkdir -p build cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \ @@ -178,7 +190,6 @@ jobs: cat build/CMakeCache.txt - name: Build - shell: cmd run: | cmake --build build --target vsix_full mv build/codelldb-full.vsix build/codelldb-${{ matrix.platformid }}.vsix diff --git a/CMakeLists.txt b/CMakeLists.txt index 6feb9b0b..b5742a36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -274,12 +274,19 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") COMMAND ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/debuggee ) else() + if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") + set(ToolchainTripleGnu x86_64-windows-gnu) + set(ToolchainTripleMsvc x86_64-windows-msvc) + elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ARM64") + set(ToolchainTripleGnu aarch64-windows-gnullvm) + set(ToolchainTripleMsvc aarch64-windows-msvc) + endif() # On Windows we want to check both GNU DWARF and MSVC PDB debug info kinds. message("Configuring debuggee") file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/debuggee) execute_process( COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}/debuggee -G${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchain-x86_64-windows-gnu.cmake + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchain-${ToolchainTripleGnu}.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/debuggee COMMAND_ERROR_IS_FATAL ANY ) @@ -287,7 +294,7 @@ else() file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/debuggee-msvc) execute_process( COMMAND ${CMAKE_COMMAND} ${CMAKE_SOURCE_DIR}/debuggee -G${CMAKE_GENERATOR} -DCMAKE_BUILD_TYPE=Debug - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchain-x86_64-windows-msvc.cmake + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_SOURCE_DIR}/cmake/toolchain-${ToolchainTripleMsvc}.cmake WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/debuggee-msvc COMMAND_ERROR_IS_FATAL ANY ) @@ -308,7 +315,11 @@ set(MochaTest ${NPM} run mocha -- ) if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - set(TestTriples x86_64-pc-windows-gnu x86_64-pc-windows-msvc) + if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64") + set(TestTriples x86_64-pc-windows-gnu x86_64-pc-windows-msvc) + elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "ARM64") + set(TestTriples aarch64-pc-windows-gnullvm aarch64-pc-windows-msvc) + endif() elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set(TestTriples x86_64-apple-darwin) else() diff --git a/cmake/toolchain-aarch64-windows-gnu.cmake b/cmake/toolchain-aarch64-windows-gnu.cmake deleted file mode 100644 index 82079289..00000000 --- a/cmake/toolchain-aarch64-windows-gnu.cmake +++ /dev/null @@ -1,3 +0,0 @@ -set(LLVM_TRIPLE aarch64-pc-windows-gnu) -set(CMAKE_C_COMPILER gcc) -set(CMAKE_CXX_COMPILER g++) diff --git a/cmake/toolchain-aarch64-windows-gnullvm.cmake b/cmake/toolchain-aarch64-windows-gnullvm.cmake new file mode 100644 index 00000000..ada342b5 --- /dev/null +++ b/cmake/toolchain-aarch64-windows-gnullvm.cmake @@ -0,0 +1,3 @@ +set(LLVM_TRIPLE aarch64-pc-windows-gnullvm) +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++)