Skip to content

Commit 7b2bfbc

Browse files
committed
[WindowsBuild] Guide up to Swift Driver
1 parent 1ae7b7f commit 7b2bfbc

File tree

1 file changed

+160
-53
lines changed

1 file changed

+160
-53
lines changed

docs/WindowsBuild.md

Lines changed: 160 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -350,138 +350,245 @@ Test Foundation:
350350
cmake --build S:\b\4 --target test
351351
```
352352

353-
### SwiftSystem (without tests)
353+
### LLBuild
354354

355355
```cmd
356356
cmake -B S:\b\6 ^
357-
-D BUILD_SHARED_LIBS=YES ^
358357
-D CMAKE_BUILD_TYPE=RelWithDebInfo ^
359358
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
360359
361-
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
362-
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
360+
-D CMAKE_CXX_COMPILER=S:/b/1/bin/clang-cl.exe ^
361+
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy -Xclang -fno-split-cold-code" ^
363362
-D CMAKE_MT=mt ^
364363
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
365364
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
366365
366+
-D LLBUILD_SUPPORT_BINDINGS=Swift ^
367367
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
368+
-D dispatch_DIR=S:\b\3\cmake\modules ^
369+
-D Foundation_DIR=S:\b\4\cmake\modules ^
370+
371+
-D CMAKE_TOOLCHAIN_FILE=S:\vcpkg\scripts\buildsystems\vcpkg.cmake ^
372+
373+
-D LIT_EXECUTABLE=S:\llvm-project\llvm\utils\lit\lit.py ^
374+
-D FILECHECK_EXECUTABLE=S:\b\1\bin\FileCheck.exe ^
368375
369376
-G Ninja ^
370-
-S S:\swift-system
377+
-S S:\llbuild
371378
372379
cmake --build S:\b\6
373380
```
374381

375-
### TSC (without tests)
382+
Test LLBuild:
376383

377384
```cmd
378-
cmake -B S:\b\7 ^
385+
cmake --build S:\b\6 --target test
386+
```
387+
388+
### Toolchain dependencies
389+
390+
We're building the following libraries with `Release` preset and without tests here because they're independent packages that are directly or indirectly depended by Swift Driver, SwiftPM or SourceKit-LSP. For developing these libraries, use SwiftPM instead.
391+
392+
#### Yams (used by Swift Driver)
393+
394+
```cmd
395+
cmake -B S:\b\7\Yams ^
379396
-D BUILD_SHARED_LIBS=YES ^
380-
-D CMAKE_BUILD_TYPE=RelWithDebInfo ^
397+
-D CMAKE_BUILD_TYPE=Release ^
381398
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
382399
383400
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
384-
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
401+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy /DYAML_DECLARE_EXPORT /DWIN32" ^
385402
-D CMAKE_MT=mt ^
386403
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
387404
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
388405
389406
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
390407
-D dispatch_DIR=S:\b\3\cmake\modules ^
391408
-D Foundation_DIR=S:\b\4\cmake\modules ^
392-
-D SwiftSystem_DIR=S:\b\6\cmake\modules ^
393409
394-
-D CMAKE_TOOLCHAIN_FILE=S:\vcpkg\scripts\buildsystems\vcpkg.cmake ^
410+
-D BUILD_TESTING=NO ^
395411
396412
-G Ninja ^
397-
-S S:\swift-tools-support-core
413+
-S S:\yams
398414
399-
cmake --build S:\b\7
415+
cmake --build S:\b\7\Yams
400416
```
401417

402-
### llbuild
418+
#### Argument Parser (used by Swift Driver and SwiftPM)
403419

404420
```cmd
405-
cmake -B S:\b\6 ^
421+
cmake -B S:\b\7\ArgumentParser ^
406422
-D BUILD_SHARED_LIBS=YES ^
407-
-D CMAKE_BUILD_TYPE=RelWithDebInfo ^
408-
-D CMAKE_INSTALL_PREFIX=C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr ^
409-
-D CMAKE_CXX_COMPILER=S:/b/1/bin/clang-cl.exe ^
410-
-D CMAKE_CXX_FLAGS="-Xclang -fno-split-cold-code" ^
423+
-D CMAKE_BUILD_TYPE=Release ^
424+
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
425+
411426
-D CMAKE_MT=mt ^
427+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
428+
412429
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
413-
-D LLBUILD_SUPPORT_BINDINGS=Swift ^
414-
-D dispatch_DIR=S:\b\2\cmake\modules ^
415-
-D Foundation_DIR=S:\b\3\cmake\modules ^
416-
-D SQLite3_INCLUDE_DIR=S:\Library\sqlite-3.28.0\usr\include ^
417-
-D SQLite3_LIBRARY=S:\Library\sqlite-3.28.0\usr\lib\sqlite3.lib ^
430+
-D dispatch_DIR=S:\b\3\cmake\modules ^
431+
-D Foundation_DIR=S:\b\4\cmake\modules ^
432+
433+
-D BUILD_EXAMPLES=NO ^
434+
-D BUILD_TESTING=NO ^
435+
418436
-G Ninja ^
419-
-S S:\swift-llbuild
437+
-S S:\swift-argument-parser
420438
421-
ninja -C S:\b\6
439+
cmake --build S:\b\7\ArgumentParser
422440
```
423441

424-
Add llbuild to your path:
442+
#### Swift System (used by Swift Driver and SwiftPM)
425443

426444
```cmd
427-
path S:\b\6\bin;%PATH%
445+
cmake -B S:\b\7\SwiftSystem ^
446+
-D BUILD_SHARED_LIBS=YES ^
447+
-D CMAKE_BUILD_TYPE=Release ^
448+
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
449+
450+
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
451+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
452+
-D CMAKE_MT=mt ^
453+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
454+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
455+
456+
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
457+
458+
-G Ninja ^
459+
-S S:\swift-system
460+
461+
cmake --build S:\b\7\SwiftSystem
428462
```
429463

430-
### Yams
464+
#### Swift Crypto (used by SwiftPM)
431465

432466
```cmd
433-
cmake -B S:\b\7 ^
467+
cmake -B S:\b\7\SwiftCrypto ^
434468
-D BUILD_SHARED_LIBS=YES ^
435469
-D CMAKE_BUILD_TYPE=Release ^
436-
-D CMAKE_INSTALL_PREFIX=C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr ^
470+
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
471+
472+
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
473+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
437474
-D CMAKE_MT=mt ^
475+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
476+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
477+
438478
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
439-
-D dispatch_DIR=S:\b\2\cmake\modules ^
440-
-D Foundation_DIR=S:\b\3\cmake\modules ^
441-
-D XCTest_DIR=S:\b\4\cmake\modules ^
479+
-D dispatch_DIR=S:\b\3\cmake\modules ^
480+
-D Foundation_DIR=S:\b\4\cmake\modules ^
481+
442482
-G Ninja ^
443-
-S S:\Yams
483+
-S S:\swift-crypto
444484
445-
ninja -C S:\b\7
485+
cmake --build S:\b\7\SwiftCrypto
446486
```
447487

448-
### ArgumentParser
488+
#### Swift Collections (used by SwiftPM)
449489

450490
```cmd
451-
cmake -B S:\b\8 ^
491+
cmake -B S:\b\7\SwiftCollections ^
452492
-D BUILD_SHARED_LIBS=YES ^
453493
-D CMAKE_BUILD_TYPE=Release ^
454-
-D CMAKE_INSTALL_PREFIX=C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr ^
494+
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
495+
496+
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
497+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
455498
-D CMAKE_MT=mt ^
499+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
500+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
501+
456502
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
457-
-D dispatch_DIR=S:\b\2\cmake\modules ^
458-
-D Foundation_DIR=S:\b\3\cmake\modules ^
459-
-D XCTest_DIR=S:\b\4\cmake\modules ^
503+
504+
-D BUILD_TESTING=NO ^
505+
460506
-G Ninja ^
461-
-S S:\swift-argument-parser
507+
-S S:\swift-collections
462508
463-
ninja -C S:\b\8
509+
cmake --build S:\b\7\SwiftCollections
464510
```
465511

466-
### SwiftDriver
512+
#### IndexStoreDB (used by SourceKit-LSP)
467513

468514
```cmd
469-
cmake -B S:\b\9 ^
515+
cmake -B S:\b\7\IndexStoreDB ^
470516
-D BUILD_SHARED_LIBS=YES ^
471517
-D CMAKE_BUILD_TYPE=Release ^
472-
-D CMAKE_INSTALL_PREFIX=C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr ^
518+
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
519+
520+
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
521+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
522+
-D CMAKE_CXX_COMPILER=S:/b/1/bin/clang-cl.exe ^
523+
-D CMAKE_CXX_FLAGS="/GS- /Oy /Gw /Gy" ^
473524
-D CMAKE_MT=mt ^
525+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
526+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
527+
474528
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
475-
-D dispatch_DIR=S:\b\2\cmake\modules ^
476-
-D Foundation_DIR=S:\b\3\cmake\modules ^
477-
-D TSC_DIR=S:\b\5\cmake\modules ^
529+
-D dispatch_DIR=S:\b\3\cmake\modules ^
530+
-D Foundation_DIR=S:\b\4\cmake\modules ^
531+
532+
-D BUILD_TESTING=NO ^
533+
534+
-G Ninja ^
535+
-S S:\indexstore-db
536+
537+
cmake --build S:\b\7\IndexStoreDB
538+
```
539+
540+
### TSC (without tests)
541+
542+
```cmd
543+
cmake -B S:\b\8 ^
544+
-D CMAKE_BUILD_TYPE=RelWithDebInfo ^
545+
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
546+
547+
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
548+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
549+
-D CMAKE_MT=mt ^
550+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
551+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
552+
553+
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
554+
-D dispatch_DIR=S:\b\3\cmake\modules ^
555+
-D Foundation_DIR=S:\b\4\cmake\modules ^
556+
-D SwiftSystem_DIR=S:\b\7\SwiftSystem\cmake\modules ^
557+
558+
-D CMAKE_TOOLCHAIN_FILE=S:\vcpkg\scripts\buildsystems\vcpkg.cmake ^
559+
560+
-G Ninja ^
561+
-S S:\swift-tools-support-core
562+
563+
cmake --build S:\b\8
564+
```
565+
566+
### Swift Driver (without tests)
567+
568+
```cmd
569+
cmake -B S:\b\9 ^
570+
-D CMAKE_BUILD_TYPE=RelWithDebInfo ^
571+
-D CMAKE_INSTALL_PREFIX=S:\b\toolchain\usr ^
572+
573+
-D CMAKE_C_COMPILER=S:/b/1/bin/clang-cl.exe ^
574+
-D CMAKE_C_FLAGS="/GS- /Oy /Gw /Gy" ^
575+
-D CMAKE_MT=mt ^
576+
-D CMAKE_EXE_LINKER_FLAGS="/INCREMENTAL:NO" ^
577+
-D CMAKE_SHARED_LINKER_FLAGS="/INCREMENTAL:NO" ^
578+
579+
-D CMAKE_Swift_COMPILER=S:/b/1/bin/swiftc.exe ^
580+
-D dispatch_DIR=S:\b\3\cmake\modules ^
581+
-D Foundation_DIR=S:\b\4\cmake\modules ^
478582
-D LLBuild_DIR=S:\b\6\cmake\modules ^
479-
-D Yams_DIR=S:\b\7\cmake\modules ^
480-
-D ArgumentParser_DIR=S:\b\8\cmake\modules ^
583+
-D Yams_DIR=S:\b\7\Yams\cmake\modules ^
584+
-D SwiftSystem_DIR=S:\b\7\SwiftSystem\cmake\modules ^
585+
-D ArgumentParser_DIR=S:\b\7\ArgumentParser\cmake\modules ^
586+
-D TSC_DIR=S:\b\8\cmake\modules ^
587+
481588
-G Ninja ^
482589
-S S:\swift-driver
483590
484-
ninja -C S:\b\9
591+
cmake --build S:\b\9
485592
```
486593

487594
### SwiftPM

0 commit comments

Comments
 (0)