CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
87 lines
3.3 KiB
CMake
87 lines
3.3 KiB
CMake
cmake_minimum_required(VERSION 3.20.0)
|
|
include(CheckCXXCompilerFlag)
|
|
include(CheckIncludeFiles)
|
|
include(GNUInstallDirs)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
project(libbolt_rt_project)
|
|
|
|
check_include_files(elf.h HAVE_ELF_H)
|
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
|
|
|
add_library(bolt_rt_instr STATIC
|
|
instr.cpp
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
|
)
|
|
set_target_properties(bolt_rt_instr PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}")
|
|
add_library(bolt_rt_hugify STATIC
|
|
hugify.cpp
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
|
)
|
|
set_target_properties(bolt_rt_hugify PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}")
|
|
|
|
if(NOT BOLT_BUILT_STANDALONE)
|
|
add_custom_command(TARGET bolt_rt_instr POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libbolt_rt_instr.a" "${LLVM_LIBRARY_DIR}")
|
|
add_custom_command(TARGET bolt_rt_hugify POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libbolt_rt_hugify.a" "${LLVM_LIBRARY_DIR}")
|
|
endif()
|
|
|
|
set(BOLT_RT_FLAGS
|
|
-ffreestanding
|
|
-fno-exceptions
|
|
-fno-rtti
|
|
-fno-stack-protector
|
|
-fPIC
|
|
# Runtime currently assumes omitted frame pointers for functions marked __attribute((naked)).
|
|
# Protect against distros adding -fno-omit-frame-pointer and compiling with GCC.
|
|
# Refs: llvm/llvm-project#148595 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77882
|
|
-fomit-frame-pointer
|
|
)
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
|
|
set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS}
|
|
-mno-sse
|
|
-mgeneral-regs-only)
|
|
endif()
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
|
|
set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS})
|
|
endif()
|
|
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
|
|
check_cxx_compiler_flag("-mno-outline-atomics" CXX_SUPPORTS_OUTLINE_ATOMICS)
|
|
if (CXX_SUPPORTS_OUTLINE_ATOMICS)
|
|
set(BOLT_RT_FLAGS ${BOLT_RT_FLAGS}
|
|
-mno-outline-atomics
|
|
-mgeneral-regs-only)
|
|
endif()
|
|
endif()
|
|
|
|
# Don't let the compiler think it can create calls to standard libs
|
|
target_compile_options(bolt_rt_instr PRIVATE ${BOLT_RT_FLAGS})
|
|
target_include_directories(bolt_rt_instr PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
target_compile_options(bolt_rt_hugify PRIVATE ${BOLT_RT_FLAGS})
|
|
target_include_directories(bolt_rt_hugify PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
install(TARGETS bolt_rt_instr DESTINATION "lib${LLVM_LIBDIR_SUFFIX}")
|
|
install(TARGETS bolt_rt_hugify DESTINATION "lib${LLVM_LIBDIR_SUFFIX}")
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang.*" AND CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
add_library(bolt_rt_instr_osx STATIC
|
|
instr.cpp
|
|
${CMAKE_CURRENT_BINARY_DIR}/config.h
|
|
)
|
|
set_target_properties(bolt_rt_instr_osx PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "lib${LLVM_LIBDIR_SUFFIX}")
|
|
target_include_directories(bolt_rt_instr_osx PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
|
target_compile_options(bolt_rt_instr_osx PRIVATE
|
|
-target x86_64-apple-darwin19.6.0
|
|
${BOLT_RT_FLAGS})
|
|
install(TARGETS bolt_rt_instr_osx DESTINATION "lib${LLVM_LIBDIR_SUFFIX}")
|
|
|
|
if(NOT BOLT_BUILT_STANDALONE)
|
|
add_custom_command(TARGET bolt_rt_instr_osx POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/libbolt_rt_instr_osx.a" "${LLVM_LIBRARY_DIR}")
|
|
endif()
|
|
endif()
|