mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 15:41:46 +00:00
a34c753fe7
Summary: Moves source files into separate components, and make explicit component dependency on each other, so LLVM build system knows how to build BOLT in BUILD_SHARED_LIBS=ON. Please use the -c merge.renamelimit=230 git option when rebasing your work on top of this change. To achieve this, we create a new library to hold core IR files (most classes beginning with Binary in their names), a new library to hold Utils, some command line options shared across both RewriteInstance and core IR files, a new library called Rewrite to hold most classes concerned with running top-level functions coordinating the binary rewriting process, and a new library called Profile to hold classes dealing with profile reading and writing. To remove the dependency from BinaryContext into X86-specific classes, we do some refactoring on the BinaryContext constructor to receive a reference to the specific backend directly from RewriteInstance. Then, the dependency on X86 or AArch64-specific classes is transfered to the Rewrite library. We can't have the Core library depend on targets because targets depend on Core (which would create a cycle). Files implementing the entry point of a tool are transferred to the tools/ folder. All header files are transferred to the include/ folder. The src/ folder was renamed to lib/. (cherry picked from FBD32746834)
33 lines
1.1 KiB
CMake
33 lines
1.1 KiB
CMake
include(ExternalProject)
|
|
|
|
set(BOLT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
set(BOLT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
set(CMAKE_CXX_STANDARD 14)
|
|
|
|
ExternalProject_Add(bolt_rt
|
|
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/runtime"
|
|
STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-stamps
|
|
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins
|
|
CMAKE_ARGS -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
|
-DCMAKE_INSTALL_PREFIX=${LLVM_BINARY_DIR}
|
|
# You might want to set this to True if actively developing bolt_rt, otherwise
|
|
# cmake will not rebuild it after source code changes
|
|
BUILD_ALWAYS True
|
|
)
|
|
|
|
include_directories( ${BOLT_SOURCE_DIR}/include )
|
|
|
|
install(CODE "execute_process\(COMMAND \${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=\${CMAKE_INSTALL_PREFIX} -P ${CMAKE_CURRENT_BINARY_DIR}/bolt_rt-bins/cmake_install.cmake \)"
|
|
COMPONENT bolt_rt)
|
|
|
|
add_llvm_install_targets(install-bolt_rt
|
|
DEPENDS bolt_rt
|
|
COMPONENT bolt_rt)
|
|
|
|
add_subdirectory(lib)
|
|
add_subdirectory(test)
|
|
add_subdirectory(tools)
|