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
2 changes: 1 addition & 1 deletion compilation_flags.file
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%define lto_build_flags -flto -fipa-icf -flto-odr-type-merging -fno-fat-lto-objects -Wodr
#Special architecture related flags
%if "%{?arch_build_flags:set}" != "set"
%ifarch ppc64le
%define arch_build_flags -mcpu=power8 -mtune=power8 --param=l1-cache-size=64 --param=l1-cache-line-size=128 --param=l2-cache-size=512
Expand Down
13 changes: 13 additions & 0 deletions compilation_flags_lto.file
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#Enable/disable LTO builds
%define enable_lto 0

#LTO related flags
%ifarch ppc64le
%undefine enable_lto
%define enable_lto 0
%endif
%if "%{enable_lto}" == "1"
%define lto_build_flags -flto -fipa-icf -flto-odr-type-merging -fno-fat-lto-objects -Wodr
%else
%define lto_build_flags %{nil}
%endif
37 changes: 26 additions & 11 deletions dd4hep.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### RPM external dd4hep v01-23x
## INCLUDE compilation_flags
## INCLUDE compilation_flags_lto

%define tag 5c3b494f047ee025b2e32303c16ad854bfbb342d
%define branch master
Expand All @@ -9,32 +11,45 @@ Source: git+https://github.com/%{github_user}/DD4hep.git?obj=%{branch}/%{tag}&ex
BuildRequires: cmake
Requires: root boost clhep xerces-c geant4

%if "%{?arch_build_flags}"
%define build_flags -fPIC %{arch_build_flags} %{lto_build_flags}
%else
%define build_flags -fPIC %{lto_build_flags}
%endif

%define cmake_fixed_args \\\
-DCMAKE_INSTALL_PREFIX='%{i}' \\\
-DCMAKE_CXX_FLAGS="%{build_flags}" \\\
-DCMAKE_STATIC_LIBRARY_CXX_FLAGS="%{build_flags}" \\\
-DCMAKE_STATIC_LIBRARY_C_FLAGS="%{build_flags}" \\\
-DBoost_NO_BOOST_CMAKE=ON \\\
-DDD4HEP_USE_XERCESC=ON \\\
-DDD4HEP_USE_PYROOT=ON \\\
-DCMAKE_AR=$(which gcc-ar) \\\
-DCMAKE_RANLIB=$(which gcc-ranlib) \\\
-DCMAKE_CXX_STANDARD=17 \\\
-DCMAKE_BUILD_TYPE=Release \\\
-DDD4HEP_USE_GEANT4_UNITS=ON \\\
-DXERCESC_ROOT_DIR=${XERCES_C_ROOT} \\\
-DCMAKE_PREFIX_PATH="${CLHEP_ROOT};${XERCES_C_ROOT}"

%prep

%setup -n %{n}-%{realversion}

%build

export BOOST_ROOT
CMAKE_ARGS="-DCMAKE_INSTALL_PREFIX='%{i}' \
-DBoost_NO_BOOST_CMAKE=ON \
-DDD4HEP_USE_XERCESC=ON \
-DXERCESC_ROOT_DIR=${XERCES_C_ROOT} \
-DDD4HEP_USE_PYROOT=ON \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_BUILD_TYPE=Release \
-DDD4HEP_USE_GEANT4_UNITS=ON \
-DCMAKE_PREFIX_PATH=${CLHEP_ROOT};${XERCES_C_ROOT}"

#Build normal Shared D4Hep without Geant4
rm -rf ../build; mkdir ../build; cd ../build
cmake $CMAKE_ARGS -DBUILD_SHARED_LIBS=ON ../%{n}-%{realversion}
cmake %{cmake_fixed_args} -DBUILD_SHARED_LIBS=ON ../%{n}-%{realversion}
make %{makeprocesses} VERBOSE=1
make install

#Building DDG4 static
rm -rf ../build-g4; mkdir ../build-g4; cd ../build-g4
cmake $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DDD4HEP_USE_GEANT4=ON ../%{n}-%{realversion}
cmake %{cmake_fixed_args} -DBUILD_SHARED_LIBS=OFF -DDD4HEP_USE_GEANT4=ON ../%{n}-%{realversion}
cd DDG4
make %{makeprocesses} VERBOSE=1
for lib in $(ls ../lib/libDDG4*.a | sed 's|.a$||'); do
Expand Down
18 changes: 9 additions & 9 deletions geant4.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### RPM external geant4 10.7.2
## INCLUDE compilation_flags
## INCLUDE compilation_flags_lto
%define use_vecgeom 1
%define tag %{realversion}
%define branch geant4-10.7-release
Expand All @@ -17,6 +18,11 @@ Requires: vecgeom
Requires: zlib

%define keep_archives true
%if "%{?arch_build_flags}"
%define build_flags -fPIC %{arch_build_flags} %{lto_build_flags}
%else
%define build_flags -fPIC %{lto_build_flags}
%endif

%prep
%setup -n %{n}.%{realversion}
Expand All @@ -37,15 +43,9 @@ export VecGeom_DIR=${VECGEOM_ROOT}/lib/cmake/VecGeom

cmake ../%{n}.%{realversion} \
-DCMAKE_CXX_COMPILER="g++" \
%if "%{?arch_build_flags}"
-DCMAKE_CXX_FLAGS="-fPIC %{arch_build_flags}" \
-DCMAKE_STATIC_LIBRARY_CXX_FLAGS="-fPIC %{arch_build_flags}" \
-DCMAKE_STATIC_LIBRARY_C_FLAGS="-fPIC %{arch_build_flags}" \
%else
-DCMAKE_CXX_FLAGS="-fPIC" \
-DCMAKE_STATIC_LIBRARY_CXX_FLAGS="-fPIC" \
-DCMAKE_STATIC_LIBRARY_C_FLAGS="-fPIC" \
%endif
-DCMAKE_CXX_FLAGS="%{build_flags}" \
-DCMAKE_STATIC_LIBRARY_CXX_FLAGS="%{build_flags}" \
-DCMAKE_STATIC_LIBRARY_C_FLAGS="%{build_flags}" \
-DCMAKE_AR=$(which gcc-ar) \
-DCMAKE_RANLIB=$(which gcc-ranlib) \
-DCMAKE_INSTALL_PREFIX:PATH="%i" \
Expand Down
7 changes: 5 additions & 2 deletions scram-project-build.file
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### FILE scram-project-build
## NO_AUTO_DEPENDENCY
## INCLUDE compilation_flags_lto
# FIXME: support building all platforms together like scram does?
# FIXME: automatic sub-packages for "doc" etc?
%define cmssw_libs biglib/%{cmsplatf} lib/%{cmsplatf}
Expand Down Expand Up @@ -53,7 +54,7 @@ BuildRequires: dwz
%endif

%if "%{?configtag:set}" != "set"
%define configtag V07-03-11
%define configtag V07-03-12
%endif

%if "%{?cvssrc:set}" != "set"
Expand Down Expand Up @@ -116,7 +117,9 @@ rm -rf config %{srctree} poison

cd %_builddir
echo %{configtag} > %_builddir/config/config_tag
%_builddir/config/updateConfig.py -p %{ucprojtype} -v %v -s $SCRAMV1_VERSION -t ${%{toolconf}} --keys SCRAM_COMPILER=%{scram_compiler} \
%_builddir/config/updateConfig.py -p %{ucprojtype} -v %v -s $SCRAMV1_VERSION -t ${%{toolconf}} \
--keys SCRAM_COMPILER=%{scram_compiler} \
--keys ENABLE_LTO=%{enable_lto} \
%if "%{?gitcommit:set}" == "set"
--keys PROJECT_GIT_HASH=%{gitcommit}
%else
Expand Down
4 changes: 4 additions & 0 deletions scram-tools.file/tool-env.file
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## INCLUDE compilation_flags
## INCLUDE compilation_flags_lto
## INCLUDE cuda-flags

export ROOT_CXXMODULES="0"
Expand All @@ -16,5 +17,8 @@ export COMPILER_CXXFLAGS="%{arch_build_flags}"
export ORACLE_ENV_ROOT=""
export CUDA_FLAGS="%{nvcc_cuda_flags}"
export CUDA_HOST_CXXFLAGS="%{nvcc_stdcxx}"
%if "%{?lto_build_flags}"
export LTO_FLAGS="%{lto_build_flags}"
%endif
if [ $(echo ' %requiredtools ' | grep ' python3 ' |wc -l) -gt 0 ] ; then export PYTHON3_LIB_SITE_PACKAGES ; fi
if [ $(echo ' %requiredtools ' | grep ' python ' |wc -l) -gt 0 ] ; then export PYTHON_LIB_SITE_PACKAGES ; fi
1 change: 1 addition & 0 deletions scram-tools.file/tools/gcc/gcc-cxxcompiler.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<flags CXXFLAGS="-Werror=return-local-addr -Wnon-virtual-dtor"/>
<flags CXXFLAGS="-Werror=switch -fdiagnostics-show-option"/>
<flags CXXFLAGS="-Wno-unused-local-typedefs -Wno-attributes -Wno-psabi"/>
<flags LTO_FLAGS="@LTO_FLAGS@"/>
<flags LDFLAGS="@GCC_LDFLAGS@"/>
<flags CXXSHAREDFLAGS="@GCC_SHAREDFLAGS@"/>
<flags LD_UNIT="@GCC_LD_UNIT@"/>
Expand Down
5 changes: 4 additions & 1 deletion vecgeom.spec
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### RPM external vecgeom v1.1.17
## INCLUDE compilation_flags
## INCLUDE compilation_flags_lto
%define tag ed9a40412c354652262ec80af449f5531206e52c
Source: git+https://gitlab.cern.ch/VecGeom/VecGeom.git?obj=master/%{tag}&export=%{n}-%{realversion}&output=/%{n}-%{realversion}.tgz
BuildRequires: cmake gmake
Expand Down Expand Up @@ -32,7 +33,9 @@ cmake ../%{n}-%{realversion} \
-DCMAKE_VERBOSE_MAKEFILE=TRUE \
-DCMAKE_CXX_STANDARD=17 \
%if "%{?arch_build_flags}"
-DCMAKE_CXX_FLAGS="%{arch_build_flags}" \
-DCMAKE_CXX_FLAGS="%{arch_build_flags} %{lto_build_flags}" \
%else
-DCMAKE_CXX_FLAGS="%{lto_build_flags}" \
%endif
-DGEANT4=OFF

Expand Down