File: Resync.cmake

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (84 lines) | stat: -rw-r--r-- 2,714 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# This CMake script keeps the files in the new standard library build in sync
# with the existing standard library.

# TODO: Once the migration is completed, we can delete this file

cmake_minimum_required(VERSION 3.21)

# Where the standard library lives today
set(StdlibSources "${CMAKE_CURRENT_LIST_DIR}/../stdlib")

message(STATUS "Source dir: ${StdlibSources}")

# Copy the files under the "name" directory in the standard library into the new
# location under Runtimes
function(copy_library_sources name from_prefix to_prefix)
  message(STATUS "${name}[${StdlibSources}/${from_prefix}/${name}] -> ${to_prefix}/${name} ")

  set(full_to_prefix "${CMAKE_CURRENT_LIST_DIR}/${to_prefix}")

  file(GLOB_RECURSE filenames
    FOLLOW_SYMLINKS
    LIST_DIRECTORIES FALSE
    RELATIVE "${StdlibSources}/${from_prefix}"
    "${StdlibSources}/${from_prefix}/${name}/*.swift"
    "${StdlibSources}/${from_prefix}/${name}/*.h"
    "${StdlibSources}/${from_prefix}/${name}/*.cpp"
    "${StdlibSources}/${from_prefix}/${name}/*.c"
    "${StdlibSources}/${from_prefix}/${name}/*.mm"
    "${StdlibSources}/${from_prefix}/${name}/*.m"
    "${StdlibSources}/${from_prefix}/${name}/*.def"
    "${StdlibSources}/${from_prefix}/${name}/*.gyb"
    "${StdlibSources}/${from_prefix}/${name}/*.apinotes"
    "${StdlibSources}/${from_prefix}/${name}/*.yaml"
    "${StdlibSources}/${from_prefix}/${name}/*.inc"
    "${StdlibSources}/${from_prefix}/${name}/*.modulemap"
    "${StdlibSources}/${from_prefix}/${name}/*.json")

  foreach(file ${filenames})
    # Get and create the directory
    get_filename_component(dirname ${file} DIRECTORY)
    file(MAKE_DIRECTORY "${full_to_prefix}/${dirname}")
    file(COPY_FILE
      "${StdlibSources}/${from_prefix}/${file}"         # From
      "${full_to_prefix}/${file}"                       # To
      RESULT _output
      ONLY_IF_DIFFERENT)
    if(_output)
      message(SEND_ERROR
        "Copy ${from_prefix}/${file} -> ${full_to_prefix}/${file} Failed: ${_output}")
    endif()
  endforeach()
endfunction()

# Directories in the existing standard library that make up the Core project

# Copy shared core headers
copy_library_sources(include "" "Core")

# Copy magic linker symbols
copy_library_sources("linker-support" "" "Core")

set(CoreLibs
  LLVMSupport
  SwiftShims
  runtime
  CompatibilityOverride
  stubs
  CommandLineSupport
  core)

  # Add these as we get them building
  # core
  # Concurrency
  # SwiftOnoneSUpport
  # CommandLineSupport
  # Demangling
  # runtime)

foreach(library ${CoreLibs})
  copy_library_sources(${library} "public" "Core")
endforeach()

# TODO: Add source directories for the platform overlays, supplemental
# libraries, and test support libraries.