Skip to content

[swift-inspect] support CMake build for Linux #78277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 19, 2024

Conversation

andrurogerz
Copy link
Contributor

Purpose

Enable building swift-inspect on Linux using CMake.

Overview

  • Update CMakeLists.txt to include Linux libraries and sources
  • Add -Xcc -D_GNU_SOURCE to CMAKE_Swift_FLAGS so process_vm_readv is visible
  • Add #pragma once to system headers to avoid recursive include
  • Update README.md with Linux CMake instructions

Background

PR #77938 added Linux support to swift-inspect, but only supported building with SwiftPM. This PR brings it to parity with Windows which also supports CMake build.

Validation

Built on Fedora 41 workstation with CMake Version 3.30.5 and Swift version 6.02.

$ cd ~/src/swift
$ cmake -S ./tools/swift-inspect -B ./build -G Ninja -D ArgumentParser_DIR=~/src/swift-argument-parser/build/cmake/modules -D CMAKE_Swift_FLAGS="-Xcc -I$(git rev-parse --show-toplevel)/include/swift/SwiftRemoteMirror"
$ cmake --build build

@andrurogerz andrurogerz requested a review from compnerd December 18, 2024 22:07
@compnerd
Copy link
Member

@swift-ci please test

@compnerd compnerd merged commit b0123bc into swiftlang:main Dec 19, 2024
5 checks passed
@andrurogerz andrurogerz deleted the swift-inspect-linux-cmake branch December 19, 2024 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants