Back to home page

EIC code displayed by LXR

 
 

    


Warning, /acts/Plugins/FpeMonitoring/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 add_library(ActsPluginFpeMonitoring SHARED src/FpeMonitor.cpp)
0002 target_include_directories(
0003     ActsPluginFpeMonitoring
0004     PUBLIC
0005         $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
0006         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
0007 )
0008 
0009 target_link_libraries(ActsPluginFpeMonitoring PUBLIC ActsCore)
0010 
0011 # Fpe flags
0012 set(_fpe_options "")
0013 
0014 include(CheckCXXSourceCompiles)
0015 
0016 find_library(dl_LIBRARY dl)
0017 find_package(Backtrace)
0018 find_program(addr2line_EXECUTABLE addr2line)
0019 if(APPLE)
0020     list(APPEND _fpe_options -D_GNU_SOURCE)
0021 else()
0022     if(dl_LIBRARY)
0023         target_link_libraries(ActsPluginFpeMonitoring PUBLIC ${dl_LIBRARY})
0024 
0025         set(_backtrace_setup_complete FALSE)
0026 
0027         find_path(
0028             boost_stacktrace_include
0029             NAMES "boost/stacktrace.hpp"
0030             REQUIRED
0031         )
0032         if(Backtrace_FOUND)
0033             # check if we need to link against bracktrace or not
0034             set(backtrace_include "")
0035 
0036             file(
0037                 WRITE
0038                 "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0039                 "
0040         #include <boost/stacktrace.hpp>
0041         int main() {}
0042         "
0043             )
0044 
0045             message(CHECK_START "Does backtrace work with the default include")
0046 
0047             try_compile(
0048                 _backtrace_default_header
0049                 "${CMAKE_BINARY_DIR}"
0050                 "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0051                 LINK_LIBRARIES ${dl_LIBRARY}
0052                 CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
0053                 COMPILE_DEFINITIONS -DBOOST_STACKTRACE_USE_BACKTRACE
0054                 OUTPUT_VARIABLE __OUTPUT
0055             )
0056 
0057             if(_backtrace_default_header)
0058                 message(CHECK_PASS "yes")
0059             else()
0060                 message(CHECK_FAIL "no")
0061 
0062                 file(GLOB hints "/usr/lib/gcc/*/*/include")
0063                 find_file(backtrace_header NAMES "backtrace.h" HINTS ${hints})
0064 
0065                 if(${backtrace_header} STREQUAL "backtrace_header-NOTFOUND")
0066                     message(STATUS "Could not find backtrace header file")
0067                 else()
0068                     set(backtrace_include
0069                         "-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=\"${backtrace_header}\""
0070                     )
0071 
0072                     file(
0073                         WRITE
0074                         "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0075                         "
0076             #include <boost/stacktrace.hpp>
0077             int main() {}
0078             "
0079                     )
0080 
0081                     message(
0082                         CHECK_START
0083                         "Does backtrace work with explicit include"
0084                     )
0085 
0086                     try_compile(
0087                         _backtrace_explicit_header
0088                         "${CMAKE_BINARY_DIR}"
0089                         "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0090                         LINK_LIBRARIES ${dl_LIBRARY}
0091                         CMAKE_FLAGS
0092                             "-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
0093                         COMPILE_DEFINITIONS
0094                             -DBOOST_STACKTRACE_USE_BACKTRACE
0095                             ${backtrace_include}
0096                         OUTPUT_VARIABLE __OUTPUT
0097                     )
0098 
0099                     if(_backtrace_explicit_header)
0100                         message(CHECK_PASS "yes")
0101                         list(APPEND _fpe_options "${backtrace_include}")
0102                     else()
0103                         message(CHECK_FAIL "no")
0104                     endif()
0105                 endif()
0106             endif()
0107 
0108             file(
0109                 WRITE
0110                 "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0111                 "#include <boost/stacktrace.hpp>\n"
0112                 "#include <iostream>\n"
0113                 "int main() { std::cout << boost::stacktrace::stacktrace(); }\n"
0114             )
0115 
0116             message(CHECK_START "Does backtrace work without linker flag")
0117             try_compile(
0118                 _backtrace_nolink
0119                 "${CMAKE_BINARY_DIR}"
0120                 "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0121                 LINK_LIBRARIES ${dl_LIBRARY}
0122                 CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
0123                 COMPILE_DEFINITIONS
0124                     -DBOOST_STACKTRACE_USE_BACKTRACE
0125                     ${backtrace_include}
0126                 OUTPUT_VARIABLE __OUTPUT
0127             )
0128 
0129             if(_backtrace_nolink)
0130                 message(CHECK_PASS "yes")
0131                 set(_backtrace_setup_complete TRUE)
0132             else()
0133                 message(CHECK_FAIL "no")
0134 
0135                 file(
0136                     WRITE
0137                     "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0138                     "#include <boost/stacktrace.hpp>\n"
0139                     "#include <iostream>\n"
0140                     "int main() { std::cout << boost::stacktrace::stacktrace(); }\n"
0141                 )
0142 
0143                 message(CHECK_START "Does backtrace work with linker flag")
0144                 try_compile(
0145                     _backtrace_link
0146                     "${CMAKE_BINARY_DIR}"
0147                     "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/backtrace.cpp"
0148                     LINK_LIBRARIES backtrace ${dl_LIBRARY}
0149                     CMAKE_FLAGS
0150                         "-DINCLUDE_DIRECTORIES=${boost_stacktrace_include}"
0151                     COMPILE_DEFINITIONS
0152                         -DBOOST_STACKTRACE_USE_BACKTRACE
0153                         ${backtrace_include}
0154                     OUTPUT_VARIABLE __OUTPUT
0155                 )
0156 
0157                 if(_backtrace_link)
0158                     message(CHECK_PASS "yes")
0159                     list(APPEND _fpe_options -DBOOST_STACKTRACE_USE_BACKTRACE)
0160                     target_link_libraries(
0161                         ActsPluginFpeMonitoring
0162                         PUBLIC backtrace
0163                     )
0164 
0165                     set(_backtrace_setup_complete TRUE)
0166                 else()
0167                     message(CHECK_FAIL "no")
0168                 endif()
0169             endif()
0170         endif()
0171 
0172         if(NOT _backtrace_setup_complete)
0173             message(STATUS "Unable to set up stacktrace setup: use noop")
0174             list(APPEND _fpe_options -BOOST_STACKTRACE_USE_NOOP)
0175         endif()
0176     endif()
0177 endif()
0178 
0179 target_compile_options(ActsPluginFpeMonitoring PUBLIC "${_fpe_options}")
0180 
0181 install(
0182     TARGETS ActsPluginFpeMonitoring
0183     EXPORT ActsPluginFpeMonitoringTargets
0184     LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
0185 )
0186 install(DIRECTORY include/Acts DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})