Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3432,3 +3432,26 @@ function(ROOTTEST_LINKER_LIBRARY library)
${CMAKE_CURRENT_BINARY_DIR}/lib${library}.lib)
endif()
endfunction()

#---------------------------------------------------------------------------------------------------
# ROOT_GET_CLANG_LIBRARIES( clang_libraries )
#
# this function is used to collect the required libraries when building ROOT with external
# LLVM & Clang, like in Conda for example.
#---------------------------------------------------------------------------------------------------
function (ROOT_GET_CLANG_LIBRARIES clang_libraries)
set(found_libraries "")
FILE(GLOB clangLibs ${LLVM_LIBRARY_DIR}/clang*.lib)
foreach(lib_path IN LISTS clangLibs)
get_filename_component(lib_name ${lib_path} NAME)
if (NOT ${lib_name} IN_LIST found_libraries)
list(APPEND found_libraries ${lib_name})
endif()
endforeach(lib_path)
foreach(extra_lib "LLVMFrontendDriver.lib" "LLVMFrontendHLSL.lib" "Version.lib")
if (NOT ${extra_lib} IN_LIST found_libraries)
list(APPEND found_libraries ${extra_lib})
endif()
endforeach(extra_lib)
SET(${clang_libraries} "${found_libraries}" PARENT_SCOPE)
endfunction(ROOT_GET_CLANG_LIBRARIES)
5 changes: 5 additions & 0 deletions core/clingutils/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ endif()

if(NOT builtin_clang)
link_directories("${LLVM_LIBRARY_DIR}")
if(MSVC)
set(clang_libraries)
ROOT_GET_CLANG_LIBRARIES(clang_libraries)
list(APPEND CLING_LIBRARIES "${clang_libraries}")
endif()
endif()

ROOT_ADD_UNITTEST_DIR(Core ${CLING_LIBRARIES} $<TARGET_OBJECTS:ClingUtils>)
18 changes: 12 additions & 6 deletions core/metacling/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,18 @@ add_dependencies(MetaCling CLING clangCppInterOp)

if(NOT builtin_clang)
set(prefixed_link_libraries)
foreach(dep ${CLING_DEPEND_LIBS})
if("${dep}" MATCHES "^clang")
set(dep "${LLVM_LIBRARY_DIR}/lib${dep}.a")
endif()
list(APPEND prefixed_link_libraries "${dep}")
endforeach()
if(MSVC)
set(clang_libraries)
ROOT_GET_CLANG_LIBRARIES(clang_libraries)
list(APPEND prefixed_link_libraries "${clang_libraries}")
else()
foreach(dep ${CLING_DEPEND_LIBS})
if("${dep}" MATCHES "^clang")
set(dep "${LLVM_LIBRARY_DIR}/${dep}.a")
endif()
list(APPEND prefixed_link_libraries "${dep}")
endforeach()
endif()
set(LINK_LIBS "${prefixed_link_libraries}")
link_directories("${LLVM_LIBRARY_DIR}")
endif()
Expand Down
6 changes: 5 additions & 1 deletion core/rootcling_stage1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ endif()
if(builtin_clang)
set(CLING_LIBRARIES "clingMetaProcessor")
else()
list(APPEND CLING_LIBRARIES ${CLING_DEPEND_LIBS})
set(clang_libraries)
if(MSVC)
ROOT_GET_CLANG_LIBRARIES(clang_libraries)
endif()
list(APPEND CLING_LIBRARIES ${CLING_DEPEND_LIBS} "${clang_libraries}")
link_directories("${LLVM_LIBRARY_DIR}")
endif()

Expand Down
Loading