[HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (#117017)
[llvm-project.git] / clang-tools-extra / clangd / xpc / cmake / modules / CreateClangdXPCFramework.cmake
blobd5ba44962dd52859ee625150f06f96c69b5c52f5
1 # Creates the ClangdXPC framework.
2 macro(create_clangd_xpc_framework target name)
3   set(CLANGD_FRAMEWORK_LOCATION "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${name}.framework")
4   set(CLANGD_FRAMEWORK_OUT_LOCATION "${CLANGD_FRAMEWORK_LOCATION}/Versions/A")
6   # Create the framework info PLIST.
7   set(CLANGD_XPC_FRAMEWORK_NAME "${name}")
8   configure_file(
9     "${CLANGD_XPC_SOURCE_DIR}/cmake/Info.plist.in"
10     "${CLANGD_XPC_BINARY_DIR}/${name}.Info.plist")
12   set(CLANGD_XPC_SERVICE_NAME "clangd")
13   set(CLANGD_XPC_SERVICE_OUT_LOCATION
14       "${CLANGD_FRAMEWORK_OUT_LOCATION}/XPCServices/${CLANGD_XPC_SERVICE_NAME}.xpc/Contents")
16   # Create the XPC service info PLIST.
17   set(CLANGD_XPC_SERVICE_BUNDLE_NAME "org.llvm.${CLANGD_XPC_SERVICE_NAME}")
18   configure_file(
19     "${CLANGD_XPC_SOURCE_DIR}/cmake/XPCServiceInfo.plist.in"
20     "${CLANGD_XPC_BINARY_DIR}/${name}Service.Info.plist")
22   # Create the custom command
23   add_custom_command(OUTPUT ${CLANGD_FRAMEWORK_LOCATION}
24     # Copy the PLIST.
25     COMMAND ${CMAKE_COMMAND} -E copy
26       "${CLANGD_XPC_BINARY_DIR}/${name}.Info.plist"
27       "${CLANGD_FRAMEWORK_OUT_LOCATION}/Resources/Info.plist"
29     # Copy the framework binary.
30     COMMAND ${CMAKE_COMMAND} -E copy
31        "$<TARGET_FILE:${target}>"
32        "${CLANGD_FRAMEWORK_OUT_LOCATION}/${name}"
34     # Copy the XPC Service PLIST.
35     COMMAND ${CMAKE_COMMAND} -E copy
36       "${CLANGD_XPC_BINARY_DIR}/${name}Service.Info.plist"
37       "${CLANGD_XPC_SERVICE_OUT_LOCATION}/Info.plist"
39     # Copy the Clangd binary.
40     COMMAND ${CMAKE_COMMAND} -E copy
41       "$<TARGET_FILE:clangd>"
42       "${CLANGD_XPC_SERVICE_OUT_LOCATION}/MacOS/clangd"
44      COMMAND ${CMAKE_COMMAND} -E create_symlink "A"
45      "${CLANGD_FRAMEWORK_LOCATION}/Versions/Current"
47      COMMAND ${CMAKE_COMMAND} -E create_symlink
48      "Versions/Current/Resources"
49      "${CLANGD_FRAMEWORK_LOCATION}/Resources"
51      COMMAND ${CMAKE_COMMAND} -E create_symlink
52      "Versions/Current/XPCServices"
53      "${CLANGD_FRAMEWORK_LOCATION}/XPCServices"
55      COMMAND ${CMAKE_COMMAND} -E create_symlink
56      "Versions/Current/${name}"
57      "${CLANGD_FRAMEWORK_LOCATION}/${name}"
59     DEPENDS
60       "${CLANGD_XPC_BINARY_DIR}/${name}.Info.plist"
61       "${CLANGD_XPC_BINARY_DIR}/${name}Service.Info.plist"
62       clangd
63     COMMENT "Creating ClangdXPC framework"
64     VERBATIM
65   )
67   add_custom_target(
68     ClangdXPC
69     DEPENDS
70     ${target}
71     ${CLANGD_FRAMEWORK_LOCATION}
72   )
74   set_property(
75     TARGET ClangdXPC
76     APPEND
77     PROPERTY ADDITIONAL_CLEAN_FILES ${CLANGD_FRAMEWORK_LOCATION}
78   )
80   # clangd is already signed as a standalone executable, so it must be forced.
81   llvm_codesign(ClangdXPC BUNDLE_PATH "${CLANGD_FRAMEWORK_OUT_LOCATION}/XPCServices/${CLANGD_XPC_SERVICE_NAME}.xpc/" FORCE)
82   # ClangdXPC library is already signed as a standalone library, so it must be forced.
83   llvm_codesign(ClangdXPC BUNDLE_PATH "${CLANGD_FRAMEWORK_LOCATION}" FORCE)
84 endmacro(create_clangd_xpc_framework)