[BOLT][CMake] Add merge-fdata to bolt component
authorAmir Ayupov <aaupov@fb.com>
Wed, 4 Jan 2023 01:39:55 +0000 (17:39 -0800)
committerAmir Ayupov <aaupov@fb.com>
Wed, 4 Jan 2023 01:40:36 +0000 (17:40 -0800)
Build and install `merge-fdata` tool as part of `bolt` component:
```
$ ninja bolt
# builds llvm-bolt, perf2bolt and merge-fdata

$ cmake --install . --component bolt --prefix $HOME/test-install-bolt
-- Install configuration: "Release"
-- Install configuration: "Release"
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_instr.a
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_hugify.a
-- Installing: /home/aaupov/test-install-bolt/lib/libbolt_rt_instr_osx.a
-- Installing: /home/aaupov/test-install-bolt/bin/llvm-bolt
-- Installing: /home/aaupov/test-install-bolt/bin/perf2bolt
-- Installing: /home/aaupov/test-install-bolt/bin/llvm-boltdiff
-- Installing: /home/aaupov/test-install-bolt/bin/merge-fdata
```

Fixes #57249.

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D139972

bolt/tools/merge-fdata/CMakeLists.txt

index 4bd2b52..9405acb 100644 (file)
@@ -10,6 +10,13 @@ add_bolt_tool(merge-fdata
 )
 set_target_properties(merge-fdata PROPERTIES FOLDER "BOLT")
 
+add_dependencies(bolt merge-fdata)
+install(PROGRAMS
+  ${CMAKE_BINARY_DIR}/bin/merge-fdata
+  DESTINATION ${CMAKE_INSTALL_BINDIR}
+  COMPONENT bolt
+  )
+
 # Emit relocations for BOLT meta test (bolt/test/runtime/meta-merge-fdata.test)
 if (BOLT_INCLUDE_TESTS AND UNIX AND NOT APPLE)
   target_link_options(merge-fdata PRIVATE LINKER:--emit-relocs)