File: CMakeLists.txt

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (71 lines) | stat: -rw-r--r-- 2,482 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
add_custom_target("copy-legacy-layouts" ALL)

function(add_layout_copying sdk arch bootstrapping)
  set(platform "${SWIFT_SDK_${sdk}_LIB_SUBDIR}")

  set(input "${SWIFT_SOURCE_DIR}/stdlib/toolchain/legacy_layouts/${platform}/layouts-${arch}.yaml")
  get_bootstrapping_path(lib_dir ${SWIFTLIB_DIR} "${bootstrapping}")
  set(output "${lib_dir}/${platform}/layouts-${arch}.yaml")

  if(NOT "${bootstrapping}" STREQUAL "")
    set(target_suffix "-bootstrapping${bootstrapping}")
  endif()
  set(copy_target "copy-legacy-layouts-${platform}-${arch}${target_suffix}")
  set(stdlib_target "swift-stdlib-${platform}-${arch}")

  if(EXISTS "${input}")
    # Copy the input file to the build directory.
    add_custom_command(
      OUTPUT "${output}"
      DEPENDS "${input}"
      COMMAND "${CMAKE_COMMAND}" -E copy "${input}" "${output}")

    # Define a target for this so that we can depend on it when
    # building Swift sources.
    add_custom_target(
      "${copy_target}"
      DEPENDS "${output}"
      SOURCES "${input}")

    # Make sure we ultimately always do this as part of building the
    # standard library. In practice we'll do this earlier if at least
    # one Swift source file has changed.
    if(TARGET "${stdlib_target}")
      add_dependencies("${stdlib_target}" "${copy_target}")
    endif()

    swift_install_in_component(
      FILES "${input}"
      DESTINATION "lib/swift/${platform}/"
      COMPONENT compiler)
  else()
    # Add a dummy target that does nothing so we can still depend on it
    # later without checking if the input files exist.
    add_custom_target("${copy_target}")
  endif()

  add_dependencies("copy-legacy-layouts" "${copy_target}")

endfunction()


foreach(sdk ${SWIFT_SDKS})
  foreach(arch ${SWIFT_SDK_${sdk}_ARCHITECTURES} ${SWIFT_SDK_${sdk}_MODULE_ARCHITECTURES})
    add_layout_copying(${sdk} ${arch} "")
  endforeach()
endforeach()

if(BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
  # The resource dir for bootstrapping0 may be used explicitly
  # to cross compile for other architectures, so we would need
  # to have all the legacy layouts in there
  foreach(arch
          ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCHITECTURES}
          ${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_MODULE_ARCHITECTURES})
    # Bootstrapping - level 0
    add_layout_copying( ${SWIFT_HOST_VARIANT_SDK} ${arch} "0")
  endforeach()

  # Bootstrapping - level 1
  add_layout_copying( ${SWIFT_HOST_VARIANT_SDK} ${SWIFT_HOST_VARIANT_ARCH} "1")
endif()