-
Notifications
You must be signed in to change notification settings - Fork 23
Add CMake build #73
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
Add CMake build #73
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Swift.org open source project | ||
## | ||
## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
## Licensed under Apache License v2.0 with Runtime Library Exception | ||
## | ||
## See https://swift.org/LICENSE.txt for license information | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
cmake_minimum_required(VERSION 3.26...3.29) | ||
project(Subprocess LANGUAGES C Swift) | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") | ||
|
||
add_compile_options("$<$<COMPILE_LANGUAGE:Swift>:SHELL:-package-name ${PROJECT_NAME}>") | ||
|
||
include(InstallExternalDependencies) | ||
|
||
add_subdirectory(Sources) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Swift.org open source project | ||
## | ||
## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
## Licensed under Apache License v2.0 with Runtime Library Exception | ||
## | ||
## See https://swift.org/LICENSE.txt for license information | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
add_library(Subprocess) | ||
|
||
add_subdirectory(_SubprocessCShims) | ||
add_subdirectory(Subprocess) | ||
|
||
target_compile_options(Subprocess PRIVATE | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature StrictConcurrency>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature NonescapableTyeps>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature LifetimeDependence>" | ||
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Span>") | ||
|
||
target_link_libraries(Subprocess PRIVATE SystemPackage) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Swift.org open source project | ||
## | ||
## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
## Licensed under Apache License v2.0 with Runtime Library Exception | ||
## | ||
## See https://swift.org/LICENSE.txt for license information | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
target_sources(Subprocess PRIVATE | ||
Execution.swift | ||
Buffer.swift | ||
Error.swift | ||
Teardown.swift | ||
Result.swift | ||
IO/Output.swift | ||
IO/Input.swift | ||
Span+Subprocess.swift | ||
AsyncBufferSequence.swift | ||
API.swift | ||
SubprocessFoundation/Span+SubprocessFoundation.swift | ||
SubprocessFoundation/Output+Foundation.swift | ||
SubprocessFoundation/Input+Foundation.swift | ||
Configuration.swift) | ||
|
||
if(WIN32) | ||
target_sources(Subprocess PRIVATE Platforms/Subprocess+Windows.swift) | ||
elseif(LINUX OR ANDROID) | ||
target_sources(Subprocess PRIVATE | ||
Platforms/Subprocess+Linux.swift | ||
Platforms/Subprocess+Unix.swift) | ||
elseif(APPLE) | ||
target_sources(Subprocess PRIVATE | ||
Platforms/Subprocess+Darwin.swift | ||
Platforms/Subprocess+Unix.swift) | ||
endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Swift.org open source project | ||
## | ||
## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
## Licensed under Apache License v2.0 with Runtime Library Exception | ||
## | ||
## See https://swift.org/LICENSE.txt for license information | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
target_sources(Subprocess PRIVATE process_shims.c) | ||
|
||
target_include_directories(Subprocess PRIVATE | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module _SubprocessCShims { | ||
header "process_shims.h" | ||
header "target_conditionals.h" | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the Swift.org open source project | ||
## | ||
## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
## Licensed under Apache License v2.0 with Runtime Library Exception | ||
## | ||
## See https://swift.org/LICENSE.txt for license information | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
include_guard() | ||
|
||
# TODO: Use find_package to find a pre-built SwiftSystem | ||
|
||
include(FetchContent) | ||
|
||
FetchContent_Declare(SwiftSystem | ||
GIT_REPOSITORY https://github.com/apple/swift-system.git | ||
GIT_TAG a34201439c74b53f0fd71ef11741af7e7caf01e1 # 1.4.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shahmishal @owenv FYI since we're currently trying to get this to 1.5.0. |
||
GIT_SHALLOW YES) | ||
list(APPEND dependencies SwiftSystem) | ||
|
||
|
||
if(dependencies) | ||
FetchContent_MakeAvailable(${dependencies}) | ||
endif() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.