File: CMakeLists.txt

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (75 lines) | stat: -rw-r--r-- 2,939 bytes parent folder | download | duplicates (6)
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

# This function generates a "unique" identifier based on various properties
# given as arguments. The idea is to encode all ABI-affecting properties
# in that identifier, so that we can store ABI information and associate it
# to a specific ABI configuration.
#
# Right now, this is done by using the ABI identifier as the filename containing
# the list of symbols exported by libc++ for that configuration, however we could
# make it more sophisticated if the number of ABI-affecting parameters grew.
function(cxx_abi_list_identifier result triple abi_library abi_version unstable exceptions new_delete_in_libcxx)
  set(abi_properties)

  if ("${triple}" MATCHES "darwin")
    # Ignore the major, minor, and patchlevel versions of darwin targets.
    string(REGEX REPLACE "darwin[0-9]+\\.[0-9]+\\.[0-9]+" "darwin" triple "${triple}")
  elseif("${triple}" MATCHES "freebsd")
    # Ignore the major and minor versions of freebsd targets.
    string(REGEX REPLACE "freebsd[0-9]+\\.[0-9]+" "freebsd" triple "${triple}")
  endif()
  list(APPEND abi_properties "${triple}")
  list(APPEND abi_properties "${abi_library}")
  list(APPEND abi_properties "v${abi_version}")
  if (${unstable})
    list(APPEND abi_properties "unstable")
  else()
    list(APPEND abi_properties "stable")
  endif()
  if (${exceptions})
    list(APPEND abi_properties "exceptions")
  else()
    list(APPEND abi_properties "noexceptions")
  endif()
  if (${new_delete_in_libcxx})
    list(APPEND abi_properties "new_in_libcxx")
  else()
    list(APPEND abi_properties "no_new_in_libcxx")
  endif()

  list(JOIN abi_properties "." tmp)
  set(${result} "${tmp}" PARENT_SCOPE)
endfunction()

cxx_abi_list_identifier(abi_list_identifier
  "${LIBCXX_TARGET_TRIPLE}"
  "${LIBCXX_CXX_ABI_LIBNAME}"
  "${LIBCXX_ABI_VERSION}"
  "${LIBCXX_ABI_UNSTABLE}"
  "${LIBCXX_ENABLE_EXCEPTIONS}"
  "${LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS}"
)

if (TARGET cxx_shared)
  set(abi_list_file "${CMAKE_CURRENT_SOURCE_DIR}/${abi_list_identifier}.abilist")

  if (EXISTS "${abi_list_file}")
    add_custom_target(check-cxx-abilist
      "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/sym_diff.py"
          --only-stdlib-symbols
          --strict "${abi_list_file}"
          $<TARGET_FILE:cxx_shared>
      DEPENDS cxx_shared
      COMMENT "Testing libc++'s exported symbols against the ABI list")
  else()
    message(STATUS "ABI list file not generated for configuration ${abi_list_identifier}, `check-cxx-abilist` will not be available.")
  endif()

  add_custom_target(generate-cxx-abilist
    COMMAND "${Python3_EXECUTABLE}" "${LIBCXX_SOURCE_DIR}/utils/generate_abi_list.py"
            --output "${abi_list_file}"
            "$<TARGET_FILE:cxx_shared>"
    DEPENDS cxx_shared
    COMMENT "Generating the ABI list file for configuration ${abi_list_identifier}")
else()
  message(STATUS "Not building a shared library for libc++ -- the ABI list targets will not be available.")
endif()