Skip to content

Commit e941551

Browse files
committed
cmake
1 parent 32b3135 commit e941551

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ string(COMPARE EQUAL ${CMAKE_SYSTEM_NAME} Windows CMAKE_INSTALL_DEFAULT)
3737
option(USE_CMAKE_INSTALL
3838
"Install build products using cmake's install() instead of the bootstrap script's install()"
3939
${CMAKE_INSTALL_DEFAULT})
40-
40+
4141
if(BUILD_SHARED_LIBS)
4242
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
4343
endif()
@@ -53,6 +53,7 @@ if(FIND_PM_DEPS)
5353
find_package(ArgumentParser CONFIG REQUIRED)
5454
find_package(SwiftCrypto CONFIG REQUIRED)
5555
find_package(SwiftDriver CONFIG REQUIRED)
56+
find_package(SwiftCollections CONFIG REQUIRED)
5657
endif()
5758

5859
find_package(dispatch QUIET)

CONTRIBUTING.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ For example, if the latest tag is 1.1.3:
164164
$> git clone https://github.com/apple/swift-crypto --branch 1.1.3
165165
```
166166

167+
5. Clone [swift-collections](https://github.com/apple/swift-collections) beside the SwiftPM directory and check out tag with the [latest version](https://github.com/apple/swift-collections/tags).
168+
169+
For example, if the latest tag is 0.0.3:
170+
```bash
171+
$> git clone https://github.com/apple/swift-collections --branch 0.0.3
172+
```
173+
167174
#### Building
168175

169176
```bash
@@ -374,4 +381,3 @@ $> swift package update
374381
```
375382
Alternatively, if you are using Xcode, you can update to the latest version of all packages:
376383
**Xcode App** > *File* > *Swift Packages* > *Update to Latest Package Versions*
377-

Utilities/Docker/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ services:
3636
- ../../../swift-argument-parser:/code/swift-argument-parser:z
3737
- ../../../swift-driver:/code/swift-driver:z
3838
- ../../../swift-crypto:/code/swift-crypto:z
39+
- ../../../swift-collections:/code/swift-collections:z
3940
- ../../../swift-llbuild:/code/llbuild:z
4041
working_dir: /code/swift-package-manager
4142
cap_drop:

Utilities/bootstrap

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def parse_global_args(args):
174174
args.swift_argument_parser_source_dir = os.path.join(args.project_root, "..", "swift-argument-parser")
175175
args.swift_driver_source_dir = os.path.join(args.project_root, "..", "swift-driver")
176176
args.swift_crypto_source_dir = os.path.join(args.project_root, "..", "swift-crypto")
177+
args.swift_collections_source_dir = os.path.join(args.project_root, "..", "swift-collections")
177178
args.source_root = os.path.join(args.project_root, "Sources")
178179

179180
if platform.system() == 'Darwin':
@@ -322,6 +323,7 @@ def build(args):
322323
build_swift_argument_parser(args)
323324
build_swift_driver(args)
324325
build_swift_crypto(args)
326+
build_swift_collections(args)
325327
build_swiftpm_with_cmake(args)
326328

327329
build_swiftpm_with_swiftpm(args,integrated_swift_driver=False)
@@ -561,7 +563,7 @@ def build_swift_driver(args):
561563
cmake_flags.append("-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target)
562564

563565
build_with_cmake(args, cmake_flags, args.swift_driver_source_dir, args.swift_driver_build_dir)
564-
566+
565567
def build_swift_crypto(args):
566568
note("Building SwiftCrypto")
567569
args.swift_crypto_build_dir = os.path.join(args.target_dir, "swift-crypto")
@@ -573,6 +575,17 @@ def build_swift_crypto(args):
573575

574576
build_with_cmake(args, cmake_flags, args.swift_crypto_source_dir, args.swift_crypto_build_dir)
575577

578+
def build_swift_collections(args):
579+
note("Building SwiftCollctions")
580+
args.swift_collections_build_dir = os.path.join(args.target_dir, "swift-collections")
581+
582+
cmake_flags = []
583+
if platform.system() == 'Darwin':
584+
cmake_flags.append("-DCMAKE_C_FLAGS=-target %s%s" % (get_build_target(args), g_macos_deployment_target))
585+
cmake_flags.append("-DCMAKE_OSX_DEPLOYMENT_TARGET=%s" % g_macos_deployment_target)
586+
587+
build_with_cmake(args, cmake_flags, args.swift_collections_source_dir, args.swift_collections_build_dir)
588+
576589
def add_rpath_for_cmake_build(args, rpath):
577590
"Adds the given rpath to the CMake-built swift-build"
578591
swift_build = os.path.join(args.bootstrap_dir, "bin/swift-build")
@@ -591,6 +604,7 @@ def build_swiftpm_with_cmake(args):
591604
"-DArgumentParser_DIR=" + os.path.join(args.swift_argument_parser_build_dir, "cmake/modules"),
592605
"-DSwiftDriver_DIR=" + os.path.join(args.swift_driver_build_dir, "cmake/modules"),
593606
"-DSwiftCrypto_DIR=" + os.path.join(args.swift_crypto_build_dir, "cmake/modules"),
607+
"-DSwiftCollections_DIR=" + os.path.join(args.swift_collections_build_dir, "cmake/modules"),
594608
]
595609

596610
if platform.system() == 'Darwin':
@@ -607,6 +621,7 @@ def build_swiftpm_with_cmake(args):
607621
add_rpath_for_cmake_build(args, os.path.join(args.swift_argument_parser_build_dir, "lib"))
608622
add_rpath_for_cmake_build(args, os.path.join(args.swift_driver_build_dir, "lib"))
609623
add_rpath_for_cmake_build(args, os.path.join(args.swift_crypto_build_dir, "lib"))
624+
add_rpath_for_cmake_build(args, os.path.join(args.swift_collections_build_dir, "lib"))
610625

611626
def build_swiftpm_with_swiftpm(args, integrated_swift_driver):
612627
"""Builds SwiftPM using the version of SwiftPM built with CMake."""
@@ -705,6 +720,7 @@ def get_swiftpm_env_cmd(args):
705720
os.path.join(args.swift_argument_parser_build_dir, "lib"),
706721
os.path.join(args.swift_driver_build_dir, "lib"),
707722
os.path.join(args.swift_crypto_build_dir, "lib"),
723+
os.path.join(args.swift_collections_build_dir, "lib"),
708724
] + args.target_info["paths"]["runtimeLibraryPaths"])
709725

710726
if platform.system() == 'Darwin':

0 commit comments

Comments
 (0)