272905eced
Clang allows third party shared libraries to provide user-defined extensions. For example, a custom libTemplateInstantiation.so can visualize all template instantiation chains in clang. To enable it one needs to pass a set of options such as -fplugin. Cling should be able to inherently work with clang plugins. However, cling still does not make full use of the clang driver where the plugin setup is handled. This patch enables plugins in cling and extends them in some aspects. In particular, cling allows loading of plugins from shared libraries but also if they are linked to the same library where cling is. This is very useful in cases where cling runs itself in a shared library (eg libCling). Users of libCling (such as ROOT) prefer to keep all llvm and clang related symbols local to avoid symbol clashes if there is another version of clang and llvm linked against a package. This can be done by dlopen-ing libCling with RTLD_LOCAL visibility mode. Then the only way for clang plugins to work in this scenario is to be linked to libCling. Patch by Aleksandr Efremov and me.
32 lines
1.1 KiB
CMake
32 lines
1.1 KiB
CMake
#-------------------------------------------------------------------------------
|
|
# CLING - the C++ LLVM-based InterpreterG :)
|
|
#
|
|
# This file is dual-licensed: you can choose to license it under the University
|
|
# of Illinois Open Source License or the GNU Lesser General Public License. See
|
|
# LICENSE.TXT for details.
|
|
#-------------------------------------------------------------------------------
|
|
if (CLING_INCLUDE_TESTS OR CLING_BUILD_PLUGINS)
|
|
add_subdirectory(example)
|
|
endif()
|
|
|
|
if (CLING_BUILD_PLUGINS)
|
|
# # If we drop a compatible cmake project in this folder we should automatically
|
|
# # pick it up and build it.
|
|
# function(LISTSUBDIRS result curdir)
|
|
# file(GLOB children RELATIVE ${curdir} ${curdir}/*)
|
|
# set(dirlist "")
|
|
# foreach(child ${children})
|
|
# if(IS_DIRECTORY ${curdir}/${child})
|
|
# list(APPEND dirlist ${child})
|
|
# endif()
|
|
# endforeach()
|
|
# set(${result} ${dirlist} PARENT_SCOPE)
|
|
# endfunction()
|
|
#
|
|
# LISTSUBDIRS(subdirs ${CMAKE_CURRENT_SOURCE_DIR}/plugins/)
|
|
# foreach(subdir ${SUBDIRS})
|
|
# add_subdirectory(${subdir})
|
|
# endforeach()
|
|
add_subdirectory(clad)
|
|
endif(CLING_BUILD_PLUGINS)
|