Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
folly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
folly
Commits
5ab9aa60
Commit
5ab9aa60
authored
Oct 16, 2018
by
Eric Niebler
Committed by
Facebook Github Bot
Oct 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable Travis-ci integration (#30)
fbshipit-source-id: 909a2c1037c4ef9cf81bbb7279bd891a2b93c546
parent
199c7fdf
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
322 additions
and
16 deletions
+322
-16
folly/experimental/pushmi/.travis.yml
folly/experimental/pushmi/.travis.yml
+199
-0
folly/experimental/pushmi/CMakeLists.txt
folly/experimental/pushmi/CMakeLists.txt
+6
-1
folly/experimental/pushmi/examples/for_each/for_each_2.cpp
folly/experimental/pushmi/examples/for_each/for_each_2.cpp
+2
-2
folly/experimental/pushmi/examples/reduce/reduce_2.cpp
folly/experimental/pushmi/examples/reduce/reduce_2.cpp
+1
-1
folly/experimental/pushmi/include/pushmi.h
folly/experimental/pushmi/include/pushmi.h
+7
-5
folly/experimental/pushmi/include/pushmi/piping.h
folly/experimental/pushmi/include/pushmi/piping.h
+3
-3
folly/experimental/pushmi/include/pushmi/traits.h
folly/experimental/pushmi/include/pushmi/traits.h
+1
-2
folly/experimental/pushmi/include/pushmi/trampoline.h
folly/experimental/pushmi/include/pushmi/trampoline.h
+4
-2
folly/experimental/pushmi/install_libcxx.sh
folly/experimental/pushmi/install_libcxx.sh
+99
-0
No files found.
folly/experimental/pushmi/.travis.yml
0 → 100644
View file @
5ab9aa60
# Copyright Louis Dionne 2013-2016
# Copyright Gonzalo BG 2014-2017
# Copyright Julian Becker 2015
# Copyright Manu Sánchez 2015
# Copyright Casey Carter 2015-2017
# Copyright Eric Niebler 2015-2016
# Copyright Paul Fultz II 2015-2016
# Copyright Jakub Szuppe 2016.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt)
# Adapted from various sources, including:
# - Louis Dionne's Hana: https://github.com/ldionne/hana
# - Paul Fultz II's FIT: https://github.com/pfultz2/Fit
language
:
cpp
script
:
cmake
env
:
global
:
-
DEPS_DIR=${TRAVIS_BUILD_DIR}/deps
cache
:
directories
:
-
${DEPS_DIR}/cmake-${CMAKE_VERSION}
matrix
:
include
:
# - env: BUILD_TYPE=Release CPP=14 SYSTEM_LIBCXX=On
# os: osx
# compiler: clang
# clang 5 C++11/14/1z Debug/Release libc++, 11 Debug libstdc++
-
env
:
CLANG_VERSION=6.0 BUILD_TYPE=Debug CPP=14 LIBCXX=On
os
:
linux
addons
:
&clang6
apt
:
packages
:
-
clang-6.0
sources
:
-
llvm-toolchain-trusty-6.0
-
ubuntu-toolchain-r-test
-
env
:
CLANG_VERSION=6.0 BUILD_TYPE=Release CPP=14 LIBCXX=On
os
:
linux
addons
:
*clang6
-
env
:
CLANG_VERSION=6.0 BUILD_TYPE=Debug CPP=17 LIBCXX=On
os
:
linux
addons
:
*clang6
-
env
:
CLANG_VERSION=6.0 BUILD_TYPE=Release CPP=17 LIBCXX=On
os
:
linux
addons
:
*clang6
# gcc-6 C++11/14/1z Debug/Release
-
env
:
GCC_VERSION=6 BUILD_TYPE=Debug CPP=14
os
:
linux
addons
:
&gcc6
apt
:
packages
:
-
g++-6
sources
:
-
ubuntu-toolchain-r-test
-
env
:
GCC_VERSION=6 BUILD_TYPE=Release CPP=14
os
:
linux
addons
:
*gcc6
-
env
:
GCC_VERSION=6 BUILD_TYPE=Debug CPP=17
os
:
linux
addons
:
*gcc6
-
env
:
GCC_VERSION=6 BUILD_TYPE=Release CPP=17
os
:
linux
addons
:
*gcc6
-
env
:
GCC_VERSION=6 BUILD_TYPE=Debug CPP=17 CONCEPTS=On
os
:
linux
addons
:
*gcc6
-
env
:
GCC_VERSION=6 BUILD_TYPE=Release CPP=17 CONCEPTS=On
os
:
linux
addons
:
*gcc6
# gcc-7 C++11/14/1z Debug/Release
-
env
:
GCC_VERSION=7 BUILD_TYPE=Debug CPP=14
os
:
linux
addons
:
&gcc7
apt
:
packages
:
-
g++-7
sources
:
-
ubuntu-toolchain-r-test
-
env
:
GCC_VERSION=7 BUILD_TYPE=Release CPP=14
os
:
linux
addons
:
*gcc7
-
env
:
GCC_VERSION=7 BUILD_TYPE=Debug CPP=17
os
:
linux
addons
:
*gcc7
-
env
:
GCC_VERSION=7 BUILD_TYPE=Release CPP=17
os
:
linux
addons
:
*gcc7
-
env
:
GCC_VERSION=7 BUILD_TYPE=Debug CPP=17 CONCEPTS=On
os
:
linux
addons
:
*gcc7
-
env
:
GCC_VERSION=7 BUILD_TYPE=Release CPP=17 CONCEPTS=On
os
:
linux
addons
:
*gcc7
# gcc-8 C++11/14/1z Debug/Release
-
env
:
GCC_VERSION=8 BUILD_TYPE=Debug CPP=14
os
:
linux
addons
:
&gcc8
apt
:
packages
:
-
g++-8
sources
:
-
ubuntu-toolchain-r-test
-
env
:
GCC_VERSION=8 BUILD_TYPE=Release CPP=14
os
:
linux
addons
:
*gcc8
-
env
:
GCC_VERSION=8 BUILD_TYPE=Debug CPP=17
os
:
linux
addons
:
*gcc8
-
env
:
GCC_VERSION=8 BUILD_TYPE=Release CPP=17
os
:
linux
addons
:
*gcc8
-
env
:
GCC_VERSION=8 BUILD_TYPE=Debug CPP=17 CONCEPTS=On
os
:
linux
addons
:
*gcc8
-
env
:
GCC_VERSION=8 BUILD_TYPE=Release CPP=17 CONCEPTS=On
os
:
linux
addons
:
*gcc8
# Install dependencies
before_install
:
-
export CHECKOUT_PATH=`pwd`;
-
|
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew update
brew install gnu-sed --with-default-names
brew install gnu-which --with-default-names
fi
-
|
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
if [ -z "$(ls -A ${DEPS_DIR}/cmake-${CMAKE_VERSION}/cached)" ]; then
CMAKE_URL="https://cmake.org/files/v3.6/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
mkdir -p ${DEPS_DIR}/cmake-${CMAKE_VERSION}
travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C ${DEPS_DIR}/cmake-${CMAKE_VERSION}
touch ${DEPS_DIR}/cmake-${CMAKE_VERSION}/cached
else
echo "Using cached cmake version ${CMAKE_VERSION}."
fi
export PATH="${DEPS_DIR}/cmake-${CMAKE_VERSION}/bin:${PATH}"
else
if ! brew ls --version cmake &>/dev/null; then brew install cmake; fi
fi
-
if [ -n "$GCC_VERSION" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
-
if [ -n "$CLANG_VERSION" ]; then export CXX="clang++-${CLANG_VERSION}" CC="clang-${CLANG_VERSION}"; fi
-
which $CXX
-
which $CC
-
$CXX --version
-
if [ "$ASAN" == "On" ]; then export SANITIZER="Address;Undefined"; fi
-
if [ "$MSAN" == "On" ]; then export SANITIZER="MemoryWithOrigins"; fi
-
if [ -n "$CLANG_VERSION" ]; then sudo PATH="${PATH}" CXX="$CXX" CC="$CC" ./install_libcxx.sh; fi
install
:
-
cd $CHECKOUT_PATH
-
mkdir -p build
-
cd build
-
|
if [ "$LIBCXX" == "On" ]; then
CXX_FLAGS="${CXX_FLAGS} -stdlib=libc++ -nostdinc++ -cxx-isystem /usr/include/c++/v1/ -Wno-unused-command-line-argument"
CXX_LINKER_FLAGS="${CXX_LINKER_FLAGS} -lc++abi"
fi
# Required to test the C++ compiler since libc++ is compiled with ASan enabled:
-
if [ -n "$CLANG_VERSION" -a "$ASAN" == "On" -a "$LIBCXX" == "On" ]; then CXX_FLAGS="${CXX_FLAGS} -fsanitize=address"; fi
# Required to test the C++ compiler since libc++ is compiled with MSan enabled:
-
if [ -n "$CLANG_VERSION" -a "$MSAN" == "On" -a "$LIBCXX" == "On" ]; then CXX_FLAGS="${CXX_FLAGS} -fsanitize=memory"; fi
-
if [ -n "$GCC_VERSION" -a "$CONCEPTS" == "On" ]; then CXX_FLAGS="${CXX_FLAGS} -fconcepts"; fi
-
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_CXX_FLAGS="${CXX_FLAGS}" -DCMAKE_EXE_LINKER_FLAGS="${CXX_LINKER_FLAGS}" -DCMAKE_CXX_STANDARD=$CPP -DPUSHMI_CONCEPTS=$CONCEPTS -Wdev
-
make -j2 VERBOSE=1
script
:
-
ctest -j2 -VV ${CTEST_FLAGS}
notifications
:
email
:
false
folly/experimental/pushmi/CMakeLists.txt
View file @
5ab9aa60
...
@@ -69,8 +69,13 @@ endif(PUSHMI_USE_CONCEPTS_EMULATION)
...
@@ -69,8 +69,13 @@ endif(PUSHMI_USE_CONCEPTS_EMULATION)
target_compile_options
(
pushmi INTERFACE
target_compile_options
(
pushmi INTERFACE
$<$<CXX_COMPILER_ID:GNU>:-ftemplate-backtrace-limit=0>
)
$<$<CXX_COMPILER_ID:GNU>:-ftemplate-backtrace-limit=0>
)
if
(
PUSHMI_CONCEPTS
)
target_compile_options
(
pushmi INTERFACE $<$<CXX_COMPILER_ID:GNU>:-fconcepts>
)
endif
()
add_custom_target
(
buildSingleHeader COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_SOURCE_DIR
}
/buildSingleHeader.cmake WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
add_custom_target
(
buildSingleHeader
COMMAND
${
CMAKE_COMMAND
}
-P
${
CMAKE_CURRENT_SOURCE_DIR
}
/buildSingleHeader.cmake
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
add_dependencies
(
pushmi buildSingleHeader
)
add_dependencies
(
pushmi buildSingleHeader
)
install
(
install
(
...
...
folly/experimental/pushmi/examples/for_each/for_each_2.cpp
View file @
5ab9aa60
...
@@ -35,8 +35,8 @@ auto naive_executor_bulk_target(Executor e, Allocator a = Allocator{}) {
...
@@ -35,8 +35,8 @@ auto naive_executor_bulk_target(Executor e, Allocator a = Allocator{}) {
std
::
atomic
<
decltype
(
init
(
input
))
>
,
// accumulation
std
::
atomic
<
decltype
(
init
(
input
))
>
,
// accumulation
std
::
atomic
<
std
::
size_t
>
,
// pending
std
::
atomic
<
std
::
size_t
>
,
// pending
std
::
atomic
<
std
::
size_t
>
// exception count (protects assignment to first exception)
std
::
atomic
<
std
::
size_t
>
// exception count (protects assignment to first exception)
>>
(
allocState
,
std
::
exception_ptr
{},
std
::
move
(
out
),
std
::
move
(
selector
),
std
::
move
(
func
)
,
init
(
std
::
move
(
input
)),
1
,
0
);
>>
(
allocState
,
std
::
exception_ptr
{},
std
::
move
(
out
),
std
::
move
(
selector
),
(
decltype
(
func
)
&&
)
func
,
init
(
std
::
move
(
input
)),
1
,
0
);
e
|
op
::
submit
([
e
,
sb
,
se
,
shared_state
](
auto
){
e
|
op
::
submit
([
e
,
sb
,
se
,
shared_state
](
auto
){
auto
stepDone
=
[](
auto
shared_state
){
auto
stepDone
=
[](
auto
shared_state
){
// pending
// pending
if
(
--
std
::
get
<
5
>
(
*
shared_state
)
==
0
)
{
if
(
--
std
::
get
<
5
>
(
*
shared_state
)
==
0
)
{
...
...
folly/experimental/pushmi/examples/reduce/reduce_2.cpp
View file @
5ab9aa60
...
@@ -37,7 +37,7 @@ auto naive_executor_bulk_target(Executor e, Allocator a = Allocator{}) {
...
@@ -37,7 +37,7 @@ auto naive_executor_bulk_target(Executor e, Allocator a = Allocator{}) {
std
::
atomic
<
decltype
(
init
(
input
))
>
,
// accumulation
std
::
atomic
<
decltype
(
init
(
input
))
>
,
// accumulation
std
::
atomic
<
std
::
size_t
>
,
// pending
std
::
atomic
<
std
::
size_t
>
,
// pending
std
::
atomic
<
std
::
size_t
>
// exception count (protects assignment to first exception)
std
::
atomic
<
std
::
size_t
>
// exception count (protects assignment to first exception)
>>
(
allocState
,
std
::
exception_ptr
{},
std
::
move
(
out
),
std
::
move
(
selector
),
std
::
move
(
func
)
,
init
(
std
::
move
(
input
)),
1
,
0
);
>>
(
allocState
,
std
::
exception_ptr
{},
std
::
move
(
out
),
std
::
move
(
selector
),
(
decltype
(
func
)
&&
)
func
,
init
(
std
::
move
(
input
)),
1
,
0
);
e
|
op
::
submit
([
e
,
sb
,
se
,
shared_state
](
auto
){
e
|
op
::
submit
([
e
,
sb
,
se
,
shared_state
](
auto
){
auto
stepDone
=
[](
auto
shared_state
){
auto
stepDone
=
[](
auto
shared_state
){
// pending
// pending
...
...
folly/experimental/pushmi/include/pushmi.h
View file @
5ab9aa60
...
@@ -2411,14 +2411,14 @@ auto on_submit(Fns... fns) -> on_submit_fn<Fns...> {
...
@@ -2411,14 +2411,14 @@ auto on_submit(Fns... fns) -> on_submit_fn<Fns...> {
//#include "traits.h"
//#include "traits.h"
namespace
pushmi
{
PUSHMI_TEMPLATE
(
class
In
,
class
Op
)
PUSHMI_TEMPLATE
(
class
In
,
class
Op
)
(
requires
pushmi
::
Invocable
<
Op
&
,
In
>
)
(
requires
defer
::
Sender
<
std
::
decay_t
<
In
>>
&&
defer
::
Invocable
<
Op
&
,
In
>
)
decltype
(
auto
)
operator
|
(
In
&&
in
,
Op
op
)
{
decltype
(
auto
)
operator
|
(
In
&&
in
,
Op
op
)
{
return
op
((
In
&&
)
in
);
return
op
((
In
&&
)
in
);
}
}
namespace
pushmi
{
PUSHMI_INLINE_VAR
constexpr
struct
pipe_fn
{
PUSHMI_INLINE_VAR
constexpr
struct
pipe_fn
{
#if __cpp_fold_expressions >= 201603
#if __cpp_fold_expressions >= 201603
template
<
class
T
,
class
...
FN
>
template
<
class
T
,
class
...
FN
>
...
@@ -4704,6 +4704,8 @@ namespace pushmi {
...
@@ -4704,6 +4704,8 @@ namespace pushmi {
struct
recurse_t
{};
struct
recurse_t
{};
constexpr
const
recurse_t
recurse
{};
constexpr
const
recurse_t
recurse
{};
struct
_pipeable_sender_
{};
namespace
detail
{
namespace
detail
{
PUSHMI_INLINE_VAR
constexpr
struct
ownordelegate_t
{}
const
ownordelegate
{};
PUSHMI_INLINE_VAR
constexpr
struct
ownordelegate_t
{}
const
ownordelegate
{};
...
@@ -4723,7 +4725,7 @@ template <class E = std::exception_ptr>
...
@@ -4723,7 +4725,7 @@ template <class E = std::exception_ptr>
class
trampoline
;
class
trampoline
;
template
<
class
E
=
std
::
exception_ptr
>
template
<
class
E
=
std
::
exception_ptr
>
class
delegator
{
class
delegator
:
_pipeable_sender_
{
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
public:
public:
...
@@ -4742,7 +4744,7 @@ class delegator {
...
@@ -4742,7 +4744,7 @@ class delegator {
};
};
template
<
class
E
=
std
::
exception_ptr
>
template
<
class
E
=
std
::
exception_ptr
>
class
nester
{
class
nester
:
_pipeable_sender_
{
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
public:
public:
...
...
folly/experimental/pushmi/include/pushmi/piping.h
View file @
5ab9aa60
...
@@ -6,14 +6,14 @@
...
@@ -6,14 +6,14 @@
#include "traits.h"
#include "traits.h"
namespace
pushmi
{
PUSHMI_TEMPLATE
(
class
In
,
class
Op
)
PUSHMI_TEMPLATE
(
class
In
,
class
Op
)
(
requires
pushmi
::
Invocable
<
Op
&
,
In
>
)
(
requires
defer
::
Sender
<
std
::
decay_t
<
In
>>
&&
defer
::
Invocable
<
Op
&
,
In
>
)
decltype
(
auto
)
operator
|
(
In
&&
in
,
Op
op
)
{
decltype
(
auto
)
operator
|
(
In
&&
in
,
Op
op
)
{
return
op
((
In
&&
)
in
);
return
op
((
In
&&
)
in
);
}
}
namespace
pushmi
{
PUSHMI_INLINE_VAR
constexpr
struct
pipe_fn
{
PUSHMI_INLINE_VAR
constexpr
struct
pipe_fn
{
#if __cpp_fold_expressions >= 201603
#if __cpp_fold_expressions >= 201603
template
<
class
T
,
class
...
FN
>
template
<
class
T
,
class
...
FN
>
...
...
folly/experimental/pushmi/include/pushmi/traits.h
View file @
5ab9aa60
...
@@ -194,7 +194,6 @@ PUSHMI_CONCEPT_DEF(
...
@@ -194,7 +194,6 @@ PUSHMI_CONCEPT_DEF(
#if __cpp_lib_invoke >= 201411
#if __cpp_lib_invoke >= 201411
using
std
::
invoke
;
using
std
::
invoke
;
using
std
::
invoke_result_t
;
#else
#else
PUSHMI_TEMPLATE
(
class
F
,
class
...
As
)
PUSHMI_TEMPLATE
(
class
F
,
class
...
As
)
(
requires
requires
(
(
requires
requires
(
...
@@ -212,10 +211,10 @@ decltype(auto) invoke(F f, As&&...as)
...
@@ -212,10 +211,10 @@ decltype(auto) invoke(F f, As&&...as)
noexcept
(
noexcept
(
std
::
declval
<
decltype
(
std
::
mem_fn
(
f
))
>
()((
As
&&
)
as
...)))
{
noexcept
(
noexcept
(
std
::
declval
<
decltype
(
std
::
mem_fn
(
f
))
>
()((
As
&&
)
as
...)))
{
return
std
::
mem_fn
(
f
)((
As
&&
)
as
...);
return
std
::
mem_fn
(
f
)((
As
&&
)
as
...);
}
}
#endif
template
<
class
F
,
class
...
As
>
template
<
class
F
,
class
...
As
>
using
invoke_result_t
=
using
invoke_result_t
=
decltype
(
pushmi
::
invoke
(
std
::
declval
<
F
>
(),
std
::
declval
<
As
>
()...));
decltype
(
pushmi
::
invoke
(
std
::
declval
<
F
>
(),
std
::
declval
<
As
>
()...));
#endif
PUSHMI_CONCEPT_DEF
(
PUSHMI_CONCEPT_DEF
(
template
(
class
F
,
class
...
Args
)
template
(
class
F
,
class
...
Args
)
...
...
folly/experimental/pushmi/include/pushmi/trampoline.h
View file @
5ab9aa60
...
@@ -16,6 +16,8 @@ namespace pushmi {
...
@@ -16,6 +16,8 @@ namespace pushmi {
struct
recurse_t
{};
struct
recurse_t
{};
constexpr
const
recurse_t
recurse
{};
constexpr
const
recurse_t
recurse
{};
struct
_pipeable_sender_
{};
namespace
detail
{
namespace
detail
{
PUSHMI_INLINE_VAR
constexpr
struct
ownordelegate_t
{}
const
ownordelegate
{};
PUSHMI_INLINE_VAR
constexpr
struct
ownordelegate_t
{}
const
ownordelegate
{};
...
@@ -35,7 +37,7 @@ template <class E = std::exception_ptr>
...
@@ -35,7 +37,7 @@ template <class E = std::exception_ptr>
class
trampoline
;
class
trampoline
;
template
<
class
E
=
std
::
exception_ptr
>
template
<
class
E
=
std
::
exception_ptr
>
class
delegator
{
class
delegator
:
_pipeable_sender_
{
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
public:
public:
...
@@ -54,7 +56,7 @@ class delegator {
...
@@ -54,7 +56,7 @@ class delegator {
};
};
template
<
class
E
=
std
::
exception_ptr
>
template
<
class
E
=
std
::
exception_ptr
>
class
nester
{
class
nester
:
_pipeable_sender_
{
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
using
time_point
=
typename
trampoline
<
E
>::
time_point
;
public:
public:
...
...
folly/experimental/pushmi/install_libcxx.sh
0 → 100755
View file @
5ab9aa60
#!/usr/bin/env bash
TRUNK_VERSION
=
"6.0.0"
set
-e
# The pattern of clang --version is: clang version X.Y.Z (sometimes, see below).
COMPILER_VERSION_OUTPUT
=
"
$(
$CXX
--version
)
"
arr
=(
${
COMPILER_VERSION_OUTPUT
// /
}
)
COMPILER
=
"
${
arr
[0]
}
"
VERSION
=
"
${
arr
[2]
}
"
case
$COMPILER
in
"clang"
)
# Some Ubuntu clang builds are advertised as "just clang", but the
# Version still follows the pattern: 3.6.2-svn240577-1~exp1
# echo "Compiler is clang :)"
arr2
=(
${
VERSION
//-/
}
)
VERSION
=
"
${
arr2
[0]
}
"
;;
"Ubuntu"
)
# Ubuntu renames _some_ (not all) of its clang compilers, the pattern of
# clang --version is then:
# Ubuntu clang version 3.6.2-svn240577-1~exp1
COMPILER
=
"
${
arr
[1]
}
"
VERSION
=
"
${
arr
[3]
}
"
arr2
=(
${
VERSION
//-/
}
)
VERSION
=
"
${
arr2
[0]
}
"
;;
*
)
echo
"case did not match: compiler:
${
COMPILER
}
"
exit
1
;;
esac
if
[
${
COMPILER
}
!=
"clang"
]
;
then
echo
"Error: trying to install libc++ for a compiler that is not clang:
${
COMPILER
}
"
exit
1
fi
if
[
-z
${
VERSION
+x
}
]
;
then
echo
"libc++ version is not set. To set the libc++ version: ./install_libcxx.sh -v X.Y.Z"
exit
4
fi
if
[
${
VERSION
}
==
$TRUNK_VERSION
]
;
then
echo
"Fetching libc++ and libc++abi tip-of-trunk..."
# Checkout LLVM sources
git clone
--depth
=
1 https://github.com/llvm-mirror/llvm.git llvm-source
git clone
--depth
=
1 https://github.com/llvm-mirror/libcxx.git llvm-source/projects/libcxx
git clone
--depth
=
1 https://github.com/llvm-mirror/libcxxabi.git llvm-source/projects/libcxxabi
else
echo
"Fetching libc++/libc++abi version:
${
VERSION
}
..."
LLVM_URL
=
"http://releases.llvm.org/
${
VERSION
}
/llvm-
${
VERSION
}
.src.tar.xz"
LIBCXX_URL
=
"http://releases.llvm.org/
${
VERSION
}
/libcxx-
${
VERSION
}
.src.tar.xz"
LIBCXXABI_URL
=
"http://releases.llvm.org/
${
VERSION
}
/libcxxabi-
${
VERSION
}
.src.tar.xz"
curl
-O
$LLVM_URL
curl
-O
$LIBCXX_URL
curl
-O
$LIBCXXABI_URL
mkdir
llvm-source
mkdir
llvm-source/projects
mkdir
llvm-source/projects/libcxx
mkdir
llvm-source/projects/libcxxabi
tar
-xf
llvm-
${
VERSION
}
.src.tar.xz
-C
llvm-source
--strip-components
=
1
tar
-xf
libcxx-
${
VERSION
}
.src.tar.xz
-C
llvm-source/projects/libcxx
--strip-components
=
1
tar
-xf
libcxxabi-
${
VERSION
}
.src.tar.xz
-C
llvm-source/projects/libcxxabi
--strip-components
=
1
fi
mkdir
llvm-build
cd
llvm-build
# - libc++ versions < 4.x do not have the install-cxxabi and install-cxx targets
# - only ASAN is enabled for clang/libc++ versions < 4.x
if
[[
$VERSION
==
*
"3."
*
]]
;
then
cmake
-DCMAKE_C_COMPILER
=
${
CC
}
-DCMAKE_CXX_COMPILER
=
${
CXX
}
\
-DCMAKE_BUILD_TYPE
=
RelWithDebInfo
-DCMAKE_INSTALL_PREFIX
=
/usr
\
../llvm-source
if
[[
$SANITIZER
==
"Address;Undefined"
]]
;
then
ASAN_FLAGS
=
"-fsanitize=address"
cmake
-DCMAKE_CXX_FLAGS
=
"
${
ASAN_FLAGS
}
"
-DCMAKE_EXE_LINKER_FLAGS
=
"
${
ASAN_FLAGS
}
"
../llvm-source
fi
make cxx
-j2
VERBOSE
=
1
sudo cp
-r
lib/
*
/usr/lib/
sudo cp
-r
include/c++ /usr/include/
else
cmake
-DCMAKE_C_COMPILER
=
${
CC
}
-DCMAKE_CXX_COMPILER
=
${
CXX
}
\
-DCMAKE_BUILD_TYPE
=
RelWithDebInfo
-DCMAKE_INSTALL_PREFIX
=
/usr
\
-DLIBCXX_ABI_UNSTABLE
=
ON
\
-DLLVM_USE_SANITIZER
=
${
SANITIZER
}
\
../llvm-source
make cxx
-j2
VERBOSE
=
1
sudo
make install-cxxabi install-cxx
fi
exit
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment