Skip to content

Commit

Permalink
[ittapi] Check out branch only if ITTAPI is cloned
Browse files Browse the repository at this point in the history
In claude we trust

Fix by not setting working directory as ittapi source dir might not exist. Also, quote paths in case of whitespace
  • Loading branch information
Zentrik authored and giordano committed Oct 11, 2024
1 parent 8e56593 commit dac8621
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
4 changes: 2 additions & 2 deletions llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
30 changes: 16 additions & 14 deletions llvm/lib/ExecutionEngine/IntelJITProfiling/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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}

Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dac8621

Please sign in to comment.