Skip to content
Commits on Source (26)
......@@ -494,34 +494,40 @@ function( atlas_project )
# Set up Doxygen.
set( ATLAS_DOXYFILE_INPUT "${CMAKE_SOURCE_DIR}/Doxyfile.in"
CACHE FILEPATH "Path to the Doxyfile that needs to be configured" )
find_package( Doxygen QUIET )
if( EXISTS "${ATLAS_DOXYFILE_INPUT}" AND DOXYGEN_FOUND )
# Tell the user what's happening.
message( STATUS "Setting up the 'doc' target using Doxygen" )
# Collect the paths of all selected packages.
set( SELECTED_PACKAGES )
foreach( _pkgDir ${_selectedPackageDirs} )
file( RELATIVE_PATH _srcDir "${CMAKE_BINARY_DIR}"
"${CMAKE_SOURCE_DIR}/${_pkgDir}" )
set( SELECTED_PACKAGES "${SELECTED_PACKAGES} ${_srcDir}" )
endforeach()
# Specialise the project-specific Doxyfile.
set( _doxyfile "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Doxyfile" )
configure_file( "${ATLAS_DOXYFILE_INPUT}" "${_doxyfile}" @ONLY )
# Set up the custom command for calling Doxygen.
add_custom_target( doc
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh
${DOXYGEN_EXECUTABLE} "${_doxyfile}"
COMMENT "Generating Doxygen documentation"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" )
# Clean up.
unset( SELECTED_PACKAGES )
unset( _doxyfile )
if( EXISTS "${ATLAS_DOXYFILE_INPUT}" )
if( NOT DOXYGEN_EXECUTABLE )
find_package( Doxygen QUIET )
endif()
if ( DOXYGEN_EXECUTABLE )
# Tell the user what's happening.
message( STATUS "Setting up the 'doc' target using Doxygen" )
# Collect the paths of all selected packages.
set( SELECTED_PACKAGES )
foreach( _pkgDir ${_selectedPackageDirs} )
file( RELATIVE_PATH _srcDir "${CMAKE_BINARY_DIR}"
"${CMAKE_SOURCE_DIR}/${_pkgDir}" )
set( SELECTED_PACKAGES "${SELECTED_PACKAGES} ${_srcDir}" )
endforeach()
# Specialise the project-specific Doxyfile.
set( _doxyfile "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/Doxyfile" )
configure_file( "${ATLAS_DOXYFILE_INPUT}" "${_doxyfile}" @ONLY )
# Set up the custom command for calling Doxygen.
add_custom_target( doc
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh
${DOXYGEN_EXECUTABLE} "${_doxyfile}"
COMMENT "Generating Doxygen documentation"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}" )
# Clean up.
unset( SELECTED_PACKAGES )
unset( _doxyfile )
endif()
endif()
# Clean up.
......
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# This file collects the ATLAS CMake helper functions that set up the build and
# installation of all the different kinds of libraries that we create in offline
......@@ -818,8 +818,6 @@ function( atlas_generate_cliddb libName )
# Get the package's directory:
atlas_get_package_dir( pkgDir )
# The name of a possible input CLID file:
set( _inputClidFile ${CMAKE_CURRENT_BINARY_DIR}/dummy_clid.db )
# The name of the output CLID file:
set( _clidFile ${CMAKE_CURRENT_BINARY_DIR}/${libName}_clid.db )
......@@ -827,9 +825,8 @@ function( atlas_generate_cliddb libName )
add_custom_command( OUTPUT ${_clidFile}
COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_SHARE_OUTPUT_DIRECTORY}
COMMAND ${CMAKE_COMMAND} -E touch ${_inputClidFile}
COMMAND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh
genCLIDDB -p ${libName} -i ${_inputClidFile} -o ${_clidFile}
genCLIDDB -p ${libName} -o ${_clidFile}
DEPENDS genCLIDDB CLIDComps ${libName} )
# Create a target generating the file:
......
#!@BASH_EXECUTABLE@
#
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# This script is used by CTest to run the test @testName@ with the correct
# environment setup, and post processing.
#
# Transmit errors:
set -e
# Set up the runtime environment:
source @CMAKE_BINARY_DIR@/@ATLAS_PLATFORM@/setup.sh
......@@ -22,8 +19,7 @@ export ATLAS_CTEST_PACKAGE=@pkgName@
@PRE_EXEC_SCRIPT@
# Run the test:
@CMAKE_CURRENT_BINARY_DIR@/test-bin/@testName@.exe 2>&1 | tee @testName@.log; \
test ${PIPESTATUS[0]} -eq 0
@CMAKE_CURRENT_BINARY_DIR@/test-bin/@testName@.exe 2>&1 | tee @testName@.log
# Set the test's return code in the variable expected by post.sh:
export testStatus=${PIPESTATUS[0]}
......@@ -36,5 +32,9 @@ if [ -f @CMAKE_CURRENT_SOURCE_DIR@/share/@testName@.ref ] &&
@CMAKE_CURRENT_SOURCE_DIR@/share/@testName@.ref ../share/@testName@.ref
fi
# Run a post-exec script:
# Set exit code in case no post-processing follows:
default_return() { return $testStatus ; }
default_return
# Run a possible post-exec script:
@POST_EXEC_SCRIPT@
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# - Locate FastJet library and header files
# Defines:
......@@ -10,6 +10,7 @@
# FASTJET_<component>_LIBRARY
# FASTJET_LIBRARIES
# FASTJET_LIBRARY_DIRS
# FASTJET_CONFIG_SCRIPT
#
# Can be steered by FASTJET_LCGROOT.
#
......@@ -34,12 +35,27 @@ if( FASTJET_LIBRARIES )
unset( _gfortran )
endif()
# Find the fastjet-config script.
find_program( FASTJET_CONFIG_SCRIPT
NAMES fastjet-config
PATHS ${FASTJET_LCGROOT} PATH_SUFFIXES bin bin32 bin64
DOC "Path to the fastjet-config script to use" )
# Extract the version of FastJet from the script.
if( FASTJET_CONFIG_SCRIPT )
execute_process( COMMAND ${FASTJET_CONFIG_SCRIPT} --version
OUTPUT_VARIABLE FASTJET_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE )
endif()
# Handle the standard find_package arguments:
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( FastJet DEFAULT_MSG FASTJET_INCLUDE_DIR
FASTJET_LIBRARIES )
find_package_handle_standard_args( FastJet
FOUND_VAR FASTJET_FOUND
REQUIRED_VARS FASTJET_CONFIG_SCRIPT FASTJET_INCLUDE_DIR FASTJET_LIBRARIES
VERSION_VAR FASTJET_VERSION )
mark_as_advanced( FASTJET_FOUND FASTJET_INCLUDE_DIR FASTJET_INCLUDE_DIRS
FASTJET_LIBRARIES FASTJET_LIBRARY_DIRS )
FASTJET_LIBRARIES FASTJET_LIBRARY_DIRS FASTJET_CONFIG_SCRIPT )
# Set up the RPM dependency:
lcg_need_rpm( fastjet )
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# - Locate FastJetContrib package
# Defines:
......@@ -11,14 +11,14 @@
# FASTJETCONTRIB_LIBRARIES
# FASTJETCONTRIB_LIBRARY_DIRS
#
# Can be steered by FASTJETCONTRIB_ATROOT.
# Can be steered by FASTJETCONTRIB_LCGROOT.
#
# Include the helper code:
include( AtlasInternals )
# The LCG include(s):
include( LCGFunctions )
# Declare the module:
atlas_external_module( NAME FastJetContrib
lcg_external_module( NAME FastJetContrib
INCLUDE_SUFFIXES include
INCLUDE_NAMES fastjet/contrib/AxesFinder.hh
fastjet/contrib/AxesDefinition.hh
......@@ -26,7 +26,8 @@ atlas_external_module( NAME FastJetContrib
LIBRARY_SUFFIXES lib
DEFAULT_COMPONENTS ConstituentSubtractor JetFFMoments ScJet EnergyCorrelator
JetsWithoutJets SubjetCounting GenericSubtractor Nsubjettiness VariableR
JetCleanser RecursiveTools )
JetCleanser RecursiveTools
SEARCH_PATHS ${FJCONTRIB_LCGROOT} )
# Handle the standard find_package arguments:
include( FindPackageHandleStandardArgs )
......@@ -35,3 +36,6 @@ find_package_handle_standard_args( FastJetContrib DEFAULT_MSG
mark_as_advanced( FASTJETCONTRIB_FOUND FASTJETCONTRIB_INCLUDE_DIR
FASTJETCONTRIB_INCLUDE_DIRS FASTJETCONTRIB_LIBRARIES
FASTJETCONTRIB_LIBRARY_DIRS )
# Set up the RPM dependency:
lcg_need_rpm( fjcontrib FOUND_NAME FASTJETCONTRIB VERSION_NAME FJCONTRIB )
......@@ -50,5 +50,4 @@ index 5156f160..4d0670d3 100644
} // namespace Acts
-#include "Acts/Propagator/Propagator.ipp"
\ No newline at end of file
+#include "Acts/Propagator/Propagator.ipp"
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# The name of the package:
atlas_subdir( CheckerGccPlugins )
......@@ -79,6 +79,8 @@ CheckerGccPlugins_test( thread15 )
CheckerGccPlugins_test( thread16 )
CheckerGccPlugins_test( thread17 )
CheckerGccPlugins_test( thread18 )
CheckerGccPlugins_test( thread19 )
CheckerGccPlugins_test( thread20 )
CheckerGccPlugins_test( callcheck1 )
CheckerGccPlugins_test( callcheck2 )
CheckerGccPlugins_test( callcheck3 )
......
/home/sss/atlas/rootaccess/../test/thread19_test.cxx: In function 'void nts_class_test(const NTS&)':
/home/sss/atlas/rootaccess/../test/thread19_test.cxx:16:8: warning: Function 'void NTS::foo() const' in non-thread-safe class 'NTS' called from thread-safe function 'void nts_class_test(const NTS&)'; may not be thread-safe.
p.foo();
~~~~~^~
/home/sss/atlas/rootaccess/../test/thread19_test.cxx:11:8: note: Declared here:
void foo() const;
^~~
/home/sss/atlas/rootaccess/../test/thread19_test.cxx:16:8: note: See <https://gitlab.cern.ch/atlas/atlasexternals/tree/master/External/CheckerGccPlugins#thread_plugin>.
p.foo();
~~~~~^~
......@@ -25,6 +25,7 @@
#include <string>
#include "checker_gccplugins.h"
#include "tree.h"
#include "cp/cp-tree.h"
#include "diagnostic.h"
#include "print-tree.h"
#include "stringpool.h"
......@@ -212,8 +213,15 @@ bool check_thread_safety_p (tree decl)
}
tree attribs = DECL_ATTRIBUTES (decl);
if (attribs == NULL_TREE && TREE_CODE (decl) == TYPE_DECL)
// For a TYPE_DECL, look at the type attributes.
// Also, while one can declare attributes for a lambda, they attach
// to the _type_, not the function.
if (attribs == NULL_TREE && (LAMBDA_FUNCTION_P(decl) ||
TREE_CODE (decl) == TYPE_DECL))
{
attribs = TYPE_ATTRIBUTES (TREE_TYPE (decl));
}
// Check if attributes are present directly.
if (lookup_attribute ("not_thread_safe", attribs))
......
......@@ -4,7 +4,7 @@
* @date Sep, 2015
* @brief Check for possible thread-safety violations.
*
* Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
// FIXME: can i unify pointer_is_const_arg / expr_from_arg_p / expr_from_static_p / value_from_struct?
......@@ -211,12 +211,26 @@ const char* attr_names[NUM_ATTR] = {
typedef uint32_t Attributes_t;
Attributes_t get_attributes (tree decl)
Attributes_t get_attributes (tree t)
{
Attributes_t mask = 0;
for (unsigned i=0; i < NUM_ATTR; i++) {
if (lookup_attribute (attr_names[i], DECL_ATTRIBUTES (decl))) {
mask |= (1 << i);
tree attrlist = 0;
if (DECL_P (t))
{
attrlist = DECL_ATTRIBUTES (t);
}
else if (TYPE_P (t))
{
attrlist = TYPE_ATTRIBUTES (t);
}
if (attrlist)
{
for (unsigned i=0; i < NUM_ATTR; i++) {
if (lookup_attribute (attr_names[i], attrlist)) {
mask |= (1 << i);
}
}
}
return mask;
......@@ -868,18 +882,36 @@ void check_thread_safe_call (Attributes_t attribs,
inform (loc, "Declared here:");
CheckerGccPlugins::inform_url (gimple_location (stmt), url);
}
return;
}
else {
#if 0
if (warning_at (gimple_location (stmt), 0,
"Unchecked function %<%D%> called from thread-safe function %<%D%>; may not be thread-safe.",
fndecl, fun->decl))
{
inform (loc, "Declared here:");
CheckerGccPlugins::inform_url (gimple_location (stmt), url);
tree ctx = DECL_CONTEXT (fndecl);
if (RECORD_OR_UNION_TYPE_P (ctx))
{
Attributes_t clattribs = get_attributes (ctx);
if (has_attrib (clattribs, ATTR_NOT_THREAD_SAFE)) {
if (warning_at (gimple_location (stmt), 0,
"Function %<%D%> in non-thread-safe class %<%T%> called from thread-safe function %<%D%>; may not be thread-safe.",
fndecl, ctx, fun->decl))
{
inform (loc, "Declared here:");
CheckerGccPlugins::inform_url (gimple_location (stmt), url);
}
return;
}
#endif
}
#if 0
if (warning_at (gimple_location (stmt), 0,
"Unchecked function %<%D%> called from thread-safe function %<%D%>; may not be thread-safe.",
fndecl, fun->decl))
{
inform (loc, "Declared here:");
CheckerGccPlugins::inform_url (gimple_location (stmt), url);
}
#endif
}
......
// Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
// thread10_test: testing check_thread_safe_call
#include <string.h>
......
// Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration.
// thread19_test: testing check_thread_safe_call,
// calling function of class marked as not thread-safe.
#pragma ATLAS check_thread_safety
class [[ATLAS::not_thread_safe]] NTS
{
public:
void foo() const;
};
void nts_class_test (const NTS& p)
{
p.foo();
}
// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
// thread20_test: testing lambda handling in check_thread_safety_p.
#pragma ATLAS check_thread_safety
class KitManager {
public:
static void instance [[ATLAS::not_thread_safe]] ();
};
namespace {
bool registered = ( []() [[ATLAS::not_thread_safe]] {
KitManager::instance();
return true;
} ) ();
}
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# Package building the FastJet contrib libraries as part of the offline
# software build.
......@@ -19,6 +19,13 @@ endif()
set( _buildDir
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/FastJetContribBuild )
# Decide where to pick up FastJet from.
if( ATLAS_BUILD_FASTJET )
set( FASTJET_CONFIG_SCRIPT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/fastjet-config )
else()
find_package( FastJet )
endif()
# Set up the script used for configuring the build of FastJetConntrib.
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/configure.sh.in
${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/configure.sh @ONLY )
......@@ -44,13 +51,11 @@ ExternalProject_Add_Step( FastJetContrib forcedownload
COMMAND ${CMAKE_COMMAND} -E echo
"Forcing the re-download of FastJetContrib..."
DEPENDERS download )
add_dependencies( FastJetContrib FastJet )
if( ATLAS_BUILD_FASTJET )
add_dependencies( FastJetContrib FastJet )
endif()
add_dependencies( Package_FastJetContrib FastJetContrib )
# Set up its installation:
install( DIRECTORY ${_buildDir}/
DESTINATION . USE_SOURCE_PERMISSIONS OPTIONAL )
# Install its find-module:
install( FILES cmake/FindFastJetContrib.cmake
DESTINATION ${CMAKE_INSTALL_CMAKEDIR}/modules )
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# Script used for configuring the build of FastJetContrib.
#
./configure \
--fastjet-config=@CMAKE_RUNTIME_OUTPUT_DIRECTORY@/fastjet-config \
./configure --fastjet-config=@FASTJET_CONFIG_SCRIPT@ \
--prefix=@_buildDir@ CXXFLAGS="-fPIC -std=c++@CMAKE_CXX_STANDARD@"
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# CMake configuration file building HepMCAnalysis ad part of the
# offline build.
......@@ -15,6 +15,12 @@ endif()
# LCG packages that the build depends on:
find_package( HepMC )
find_package( ROOT )
if( ATLAS_BUILD_FASTJET )
set( _fastJetDir "${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}" )
else()
find_package( FastJet )
set( _fastJetDir "${FASTJET_LCGROOT}" )
endif()
# Temporary location for the build results:
set( _buildDir
......@@ -35,7 +41,7 @@ ExternalProject_Add( HepMCAnalysis
"No configuration step for HepMCAnalysis"
BUILD_COMMAND
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/atlas_build_run.sh make
HepMCdir=${HEPMC_LCGROOT} FastJetdir=${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}
HepMCdir=${HEPMC_LCGROOT} FastJetdir=${_fastJetDir}
ROOTSYS=${ROOT_LCGROOT} CLHEPdir=${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory lib/ ${_buildDir}/lib/
COMMAND ${CMAKE_COMMAND} -E copy_directory lib/
......@@ -43,7 +49,10 @@ ExternalProject_Add( HepMCAnalysis
COMMAND ${CMAKE_COMMAND} -E copy_directory include/ ${_buildDir}/include/
COMMAND ${CMAKE_COMMAND} -E copy_directory include/
${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ )
add_dependencies( HepMCAnalysis CLHEP FastJet )
add_dependencies( HepMCAnalysis CLHEP )
if( ATLAS_BUILD_FASTJET )
add_dependencies( HepMCAnalysis FastJet )
endif()
add_dependencies( Package_HepMCAnalysis HepMCAnalysis )
# Install HepMCAnalysis:
......
......@@ -7,3 +7,4 @@
# List the packages and (their version) one per line:
flake8==3.7.7
pyami==5.1.0
......@@ -111,6 +111,9 @@ option( ATLAS_BUILD_ROOT
# Tell CMake to build PyAnalysis.
option( ATLAS_BUILD_PYANALYSIS
"Build the PyAnalysis package as part of this project" TRUE )
# Tell CMake to build FastJet.
option( ATLAS_BUILD_FASTJET
"Build FastJet/FJContrib as part of this project" TRUE )
# Make CMake forget that it found any of these packages. (In case it did.)
# Since they could interfere with the environment setup of the project.
......
......@@ -40,6 +40,12 @@ list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/cmake )
# Set up CTest:
atlas_ctest_setup()
# "Standalone" packages to be built:
option( ATLAS_BUILD_DAVIX "Build Davix as part of the release" ON )
option( ATLAS_BUILD_XROOTD "Build XRootD as part of the release" ON )
option( ATLAS_BUILD_FASTJET
"Build FastJet/FJContrib as part of this project" ON )
# Set up the ATLAS project.
atlas_project( PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ )
......