[AMDGPU][AsmParser][NFC] Translate parsed MIMG instructions to MCInsts automatically.
[llvm-project.git] / clang-tools-extra / clangd / xpc / cmake / modules / CreateClangdXPCFramework.cmake
blob46738a204ace140e743d51f188188d95dc7313d8
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   # clangd is already signed as a standalone executable, so it must be forced.
75   llvm_codesign(ClangdXPC BUNDLE_PATH "${CLANGD_FRAMEWORK_OUT_LOCATION}/XPCServices/${CLANGD_XPC_SERVICE_NAME}.xpc/" FORCE)
76   # ClangdXPC library is already signed as a standalone library, so it must be forced.
77   llvm_codesign(ClangdXPC BUNDLE_PATH "${CLANGD_FRAMEWORK_LOCATION}" FORCE)
78 endmacro(create_clangd_xpc_framework)