From dac862127a2875d0f45d589e1c89069d72e8abf5 Mon Sep 17 00:00:00 2001 From: Zentrik Date: Wed, 9 Oct 2024 20:39:04 +0100 Subject: [PATCH] [ittapi] Check out branch only if ITTAPI is cloned In claude we trust Fix by not setting working directory as ittapi source dir might not exist. Also, quote paths in case of whitespace --- .../IntelJITEvents/CMakeLists.txt | 4 +-- .../IntelJITProfiling/CMakeLists.txt | 30 ++++++++++--------- .../Orc/TargetProcess/CMakeLists.txt | 4 +-- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt index 56c529c08937c5..08ce4c9399f171 100644 --- a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt @@ -1,8 +1,8 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ) if(NOT DEFINED ITTAPI_SOURCE_DIR) - set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}) + set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}/ittapi) endif() -include_directories( ${ITTAPI_SOURCE_DIR}/ittapi/include/ ) +include_directories( ${ITTAPI_SOURCE_DIR}/include/ ) add_llvm_component_library(LLVMIntelJITEvents IntelJITEventListener.cpp diff --git a/llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt b/llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt index 0aedadc65df05f..bf6416b7a48e2d 100644 --- a/llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt @@ -9,26 +9,28 @@ if(NOT DEFINED ITTAPI_GIT_TAG) endif() if(NOT DEFINED ITTAPI_SOURCE_DIR) - set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}) + set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}/ittapi) endif() -if(NOT EXISTS ${ITTAPI_SOURCE_DIR}/ittapi) - execute_process(COMMAND ${GIT_EXECUTABLE} clone ${ITTAPI_GIT_REPOSITORY} - WORKING_DIRECTORY ${ITTAPI_SOURCE_DIR} - RESULT_VARIABLE GIT_CLONE_RESULT) +if(NOT EXISTS "${ITTAPI_SOURCE_DIR}") + execute_process( + COMMAND "${GIT_EXECUTABLE}" clone "${ITTAPI_GIT_REPOSITORY}" "${ITTAPI_SOURCE_DIR}" + RESULT_VARIABLE GIT_CLONE_RESULT + ) if(NOT GIT_CLONE_RESULT EQUAL "0") - message(FATAL_ERROR "git clone ${ITTAPI_GIT_REPOSITORY} failed with ${GIT_CLONE_RESULT}, please clone ${ITTAPI_GIT_REPOSITORY}") + message(FATAL_ERROR "git clone ${ITTAPI_GIT_REPOSITORY} failed with ${GIT_CLONE_RESULT}, please clone ${ITTAPI_GIT_REPOSITORY} manually") endif() -endif() -execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${ITTAPI_GIT_TAG} - WORKING_DIRECTORY ${ITTAPI_SOURCE_DIR}/ittapi - RESULT_VARIABLE GIT_CHECKOUT_RESULT) -if(NOT GIT_CHECKOUT_RESULT EQUAL "0") - message(FATAL_ERROR "git checkout ${ITTAPI_GIT_TAG} failed with ${GIT_CHECKOUT_RESULT}, please checkout ${ITTAPI_GIT_TAG} at ${ITTAPI_SOURCE_DIR}/ittapi") + execute_process( + COMMAND "${GIT_EXECUTABLE}" -C "${ITTAPI_SOURCE_DIR}" checkout "${ITTAPI_GIT_TAG}" + RESULT_VARIABLE GIT_CHECKOUT_RESULT + ) + if(NOT GIT_CHECKOUT_RESULT EQUAL "0") + message(FATAL_ERROR "git checkout ${ITTAPI_GIT_TAG} failed with ${GIT_CHECKOUT_RESULT}, please checkout ${ITTAPI_GIT_TAG} at ${ITTAPI_SOURCE_DIR} manually") + endif() endif() -include_directories( ${ITTAPI_SOURCE_DIR}/ittapi/include/ ) +include_directories( ${ITTAPI_SOURCE_DIR}/include/ ) if( HAVE_LIBDL ) set(LLVM_INTEL_JIT_LIBS ${CMAKE_DL_LIBS}) @@ -39,7 +41,7 @@ set(LLVM_INTEL_JIT_LIBS ${LLVM_PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS}) add_llvm_component_library(LLVMIntelJITProfiling jitprofiling.c - ${ITTAPI_SOURCE_DIR}/ittapi/src/ittnotify/ittnotify_static.c + ${ITTAPI_SOURCE_DIR}/src/ittnotify/ittnotify_static.c LINK_LIBS ${LLVM_INTEL_JIT_LIBS} diff --git a/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt b/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt index 03677d610cbb76..308d7012c42314 100644 --- a/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt +++ b/llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt @@ -7,9 +7,9 @@ if( LLVM_USE_INTEL_JITEVENTS ) set(intel_jit_profiling IntelJITProfiling) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../IntelJITProfiling) if(NOT DEFINED ITTAPI_SOURCE_DIR) - set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}) + set(ITTAPI_SOURCE_DIR ${PROJECT_BINARY_DIR}/ittapi) endif() - include_directories(${ITTAPI_SOURCE_DIR}/ittapi/include/ ) + include_directories(${ITTAPI_SOURCE_DIR}/include/ ) endif() add_llvm_component_library(LLVMOrcTargetProcess