Skip to content
Snippets Groups Projects
Commit 0b68eb2d authored by Graeme Stewart's avatar Graeme Stewart
Browse files

External/AtlasTBB deleted from master

parent 84747782
No related branches found
No related tags found
No related merge requests found
# $Id: CMakeLists.txt 725898 2016-02-24 13:10:11Z krasznaa $
#
# CMake configuration for the build of TBB.
#
# Set the package's name:
atlas_subdir( AtlasTBB )
# In release recompilation mode finish here:
if( ATLAS_RELEASE_MODE )
return()
endif()
# Configure two versions of the InstallTBB script. One for installing
# TBB in the build area, and one for installing it into the installation
# area.
set( SOURCE_DIR ${CMAKE_BINARY_DIR}/src/AtlasTBB )
set( INSTALL_DIR ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM} )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/InstallTBB.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/InstallTBB.build.cmake @ONLY )
set( INSTALL_DIR ${CMAKE_INSTALL_PREFIX} )
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/InstallTBB.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/InstallTBB.install.cmake @ONLY )
# Build TBB for the build area:
ExternalProject_Add( AtlasTBB
PREFIX ${CMAKE_BINARY_DIR}
URL ${CMAKE_CURRENT_SOURCE_DIR}/src/tbb42_20131003oss_src.tar.gz
CONFIGURE_COMMAND true
BUILD_IN_SOURCE 1
COMMAND make
INSTALL_COMMAND ${CMAKE_COMMAND}
-Dinstall_dir=${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}
-Dsource_dir=<SOURCE_DIR>
-P ${CMAKE_CURRENT_BINARY_DIR}/InstallTBB.build.cmake
)
add_dependencies( Package_AtlasTBB AtlasTBB )
# Install TBB:
install( SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/InstallTBB.install.cmake )
# $Id: InstallTBB.cmake.in 725898 2016-02-24 13:10:11Z krasznaa $
#
# Script used in the installation of TBB into both the build and the
# install area.
#
# Collect the libraries built:
file( GLOB release_libs @SOURCE_DIR@/build/*_release/lib* )
file( GLOB debug_libs @SOURCE_DIR@/build/*_debug/lib* )
# Install the libraries:
file( INSTALL ${release_libs}
DESTINATION @INSTALL_DIR@/@CMAKE_INSTALL_LIBDIR@
USE_SOURCE_PERMISSIONS )
if( "@CMAKE_BUILD_TYPE@" STREQUAL "Debug" OR
"@CMAKE_BUILD_TYPE@" STREQUAL "RelWithDebInfo" )
file( INSTALL ${debug_libs}
DESTINATION @INSTALL_DIR@/@CMAKE_INSTALL_LIBDIR@
USE_SOURCE_PERMISSIONS )
endif()
# Install the headers:
file( INSTALL @SOURCE_DIR@/include/
DESTINATION @INSTALL_DIR@/include
USE_SOURCE_PERMISSIONS )
--- include/tbb/pipeline.h-orig 2015-06-23 05:17:49.000000001 +0200
+++ include/tbb/pipeline.h 2015-06-23 05:17:58.000000001 +0200
@@ -342,7 +342,7 @@
template<> struct tbb_trivially_copyable <float> { enum { value = !tbb_large_object<float>::value }; };
template<> struct tbb_trivially_copyable <double> { enum { value = !tbb_large_object<double>::value }; };
#else
-#if __GNUC__==4 && __GNUC_MINOR__>=4 && __GXX_EXPERIMENTAL_CXX0X__
+#if __GNUC__==4 && __GNUC_MINOR__>=4 && __GXX_EXPERIMENTAL_CXX0X__ || __clang__
template<typename T> struct tbb_trivially_copyable { enum { value = std::has_trivial_copy_constructor<T>::value }; };
#else
template<typename T> struct tbb_trivially_copyable { enum { value = std::is_trivially_copyable<T>::value }; };
#
#
from PyCmt.pkgbuild.cmmi import *
pkg_name= "tbb"
pkg_ver = "42_20131003oss"
pkg_src = "%(pkg_root)s/src/%(pkg_name)s%(pkg_ver)s_src.tar.gz"
# defaults from cmmi are fine for those:
#pkg_install_dir = "%(CMTINSTALLAREA)s/%(tag)s"
#pkg_install_dir = "/tmp/binet/foo-hdf5"
def configure(self):
env = self.env
msg = self.msg
sh = self.sh
env['compiler'] = env['compiler'].replace('lcg-', '')
tmp=env['gcc-version']
env['compiler'] = env['compiler'].replace('-'+tmp, '')
pkg_install_dir = self['pkg_install_dir']
env['CPPFLAGS'] = env["CPPFLAGS"].replace('"','')
env['CFLAGS'] = env['CFLAGS'].replace('-ansi', '-std=c99')
#env['CXXFLAGS'] = env['CXXFLAGS'].replace('-ansi', '-std=c++0x')
# tbb can't compile otherwise...
env['CFLAGS'] = env['CFLAGS'].replace('-pedantic', '')
env['CXXFLAGS'] = env['CXXFLAGS'].replace('-pedantic', '')
env['cfg'] = 'release'
env['arch'] = 'x86_64' if 'x86_64' in env['CMTCONFIG'] else 'i686'
sh.chdir("%(pkg_build_dir)s/%(pkg_name)s%(pkg_ver)s" % self.env)
# fix missing config file for clang
os.system("sed -e 's#CPLUS = g++#CPLUS = clang++#g;s#CONLY = gcc#CONLY = clang#g' build/linux.gcc.inc > build/linux.clang.inc")
os.system('patch -p0 < %s/cmt/clang.patch' % self.pkg_root)
cmd = [
"make",
"info",
]
self.run(cmd)
return
def build(self):
env = self.env
msg = self.msg
sh = self.sh
env['cfg'] = 'release'
env['arch'] = 'x86_64' if 'x86_64' in env['CMTCONFIG'] else 'i686'
sh.chdir("%(pkg_build_dir)s/%(pkg_name)s%(pkg_ver)s" % self.env)
cmd = [
"make",
"tbb", "tbbmalloc", "tbbproxy",
]
self.run(cmd)
return
def install(self):
env = self.env
msg = self.msg
sh = self.sh
sh.chdir("%(pkg_build_dir)s/%(pkg_name)s%(pkg_ver)s" % self.env)
import glob
import os
import shutil
import sys
if 'linux' in sys.platform.lower():
libs = glob.glob("%(pkg_build_dir)s/%(pkg_name)s%(pkg_ver)s/build/linux_*_release/*.so*"%env)
elif 'darwin' in sys.platform.lower():
libs = glob.glob("%(pkg_build_dir)s/%(pkg_name)s%(pkg_ver)s/build/macosx_*_release/*.so*"%env)
else:
raise RuntimeError("unknown platform [%s]" % sys.platform)
if len(libs) <= 0:
raise RuntimeError("no libraries found to be installed !")
libdir = "%(pkg_install_dir)s/lib" % env
try:
if not os.path.exists(libdir):
os.makedirs(libdir)
except OSError:
# typical race condition on os.path...
pass
for lib in libs:
shutil.copy2(lib, libdir)
hdrdir = "%(pkg_install_dir)s/include" % env
try:
if not os.path.exists(hdrdir):
os.makedirs(hdrdir)
except OSError:
# typical race condition on os.path...
pass
hdrdir = "%(pkg_install_dir)s/include/tbb" % env
try:
if os.path.exists(hdrdir):
shutil.rmtree(hdrdir, ignore_errors=True)
except OSError:
# typical race condition on os.path...
pass
shutil.copytree("include/tbb", hdrdir)
## automatically generated CMT requirements file
package AtlasTBB
author binet
## for athena policies: this has to be the first use statement
use AtlasPolicy AtlasPolicy-*
## for external policies
use ExternalPolicy ExternalPolicy-* External
use PyCmt PyCmt-* Tools -no_auto_imports
# includes are installed under InstallArea/$(CMTCONFIG)/include
include_dirs none
macro AtlasTBB_linkopts "-ltbb"
private
apply_pattern make_pkgbuild \
name=tbb \
file=pkgbuild_tbb.py
end_private
private
application test-tbb test-tbb.cxx
macro_append test-tbb_dependencies " make_pkgbuild_tbb"
end_private
/* hello-tbb.cpp */
#include <iostream>
#include <tbb/parallel_for.h>
using namespace tbb;
class Hello
{
public:
void operator()(int x) const {
std::cout << "Hello world [" << x << "]\n";
}
};
int main()
{
// parallelizing:
// for(int i = 0; i < 2; ++i) { ... }
parallel_for(0, 2, 1, Hello());
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment