Skip to content

Commit

Permalink
Buck build support (#110)
Browse files Browse the repository at this point in the history
*  * Added support for Buck build

*  * Added Buck build to the Travis file

*  * Fixed syntax error in Travis file

*  * Fixed casing of Buck target for eathread

*  * Fixed Homebrew install path in Travis

* Split brew install steps in case of time-outs

*  * Pull ant out as brew install

*  * Switched to cpp11 by default

*  * Added build flavours based on travis platforms

*  * Locked version to cpp14

*  * Linux to cpp11

*  * Add -v

*  * Added Linuxbrew gcc for Buck

*  * Fixed syntax error

*  * Attempt to split buck build and cmake build on Travis

*  * Fixed syntax errors

*  * Fixed missing paren

*  * Removed CMake build when running Buck build on Travis

*  * Fixed syntax error
  • Loading branch information
njlr authored and rparolin committed Jun 20, 2017
1 parent 7b790f5 commit e5b0dc0
Show file tree
Hide file tree
Showing 11 changed files with 302 additions and 42 deletions.
8 changes: 8 additions & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[cxx]
cxxflags = -std=c++14

[cxx#linux-x86_64]
cxxflags = -std=c++14

[cxx#macosx-x86_64]
cxxflags = -std=c++14
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,10 @@ MinSizeRel/*
build*/*
Testing/*
%ALLUSERSPROFILE%/*

# Buck
/buck-out/
/.buckd/
/buckaroo/
.buckconfig.local
BUCKAROO_DEPS
128 changes: 88 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,113 @@ os:
- linux
- osx

compiler:
- gcc
- clang
compiler:
- gcc
- clang

env:
- EASTL_CONFIG=Debug
- EASTL_CONFIG=Release
- EASTL_CONFIG=Debug
- EASTL_CONFIG=Release

addons:
apt:
sources:
- ubuntu-toolchain-r-test
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- g++-4.8
- clang
- gcc-4.8
- g++-4.8
- clang

matrix:
include:
- compiler: clang "debug build with clang3.9"
env: EASTL_CONFIG=Debug USE_CLANG_39=yes
os: osx
- compiler: clang "release build with clang3.9"
- compiler: clang "release build with clang3.9"
env: EASTL_CONFIG=Release USE_CLANG_39=yes
os: osx
- compiler: clang "build with Buck"
env: USE_BUCK=yes
os: osx
- compiler: gcc "build with Buck"
env: USE_BUCK=yes
os: linux
exclude:
- os: osx
compiler: gcc
- os: osx
compiler: gcc

install:
# Linux Setup
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8" ;fi ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$PWD/cmake-3.1.3-Linux-x86_64/bin:$PATH ;fi
# OSX Setup
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -xzf cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export PATH=$PWD/cmake-3.1.3-Darwin-x86_64/CMake.app/Contents/bin:$PATH ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then export CLANG_URL=http://releases.llvm.org/3.9.0/clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then wget --no-check-certificate $CLANG_URL ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then tar -xzf clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then export CLANG_39_PATH=$(PWD)/clang+llvm-3.9.0-x86_64-apple-darwin/ ;fi
# Linux Setup
# CMake
- if [[ "$TRAVIS_OS_NAME" == "linux" && ! -n "$USE_BUCK" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && ! -n "$USE_BUCK" ]]; then tar -xzf cmake-3.1.3-Linux-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export PATH=$PWD/cmake-3.1.3-Linux-x86_64/bin:$PATH ;fi
# GCC
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" = "g++" ]]; then export CXX="g++-4.8" CC="gcc-4.8" ;fi
# Linuxbrew
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then test -d $HOME/.linuxbrew/bin || git clone https://github.com/Linuxbrew/brew.git $HOME/.linuxbrew ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then PATH="$HOME/.linuxbrew/bin:$PATH" ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo 'export PATH="$HOME/.linuxbrew/bin:$PATH"' >>~/.bash_profile ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export MANPATH="$(brew --prefix)/share/man:$MANPATH" ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export INFOPATH="$(brew --prefix)/share/info:$INFOPATH" ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then brew --version ;fi
# Linuxbrew GCC
- if [[ "$TRAVIS_OS_NAME" == "linux" && -n "$USE_BUCK" ]]; then brew install gcc ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && -n "$USE_BUCK" ]]; then which gcc ;fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && -n "$USE_BUCK" ]]; then gcc --version ;fi

# OSX Setup
# CMake
- if [[ "$TRAVIS_OS_NAME" == "osx" && ! -n "$USE_BUCK" ]]; then wget --no-check-certificate http://cmake.org/files/v3.1/cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && ! -n "$USE_BUCK" ]]; then tar -xzf cmake-3.1.3-Darwin-x86_64.tar.gz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && ! -n "$USE_BUCK" ]]; then export PATH=$PWD/cmake-3.1.3-Darwin-x86_64/CMake.app/Contents/bin:$PATH ;fi
# Clang 3.9
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then export CLANG_URL=http://releases.llvm.org/3.9.0/clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then wget --no-check-certificate $CLANG_URL ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then tar -xzf clang+llvm-3.9.0-x86_64-apple-darwin.tar.xz ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" && -n "$USE_CLANG_39" ]]; then export CLANG_39_PATH=$(PWD)/clang+llvm-3.9.0-x86_64-apple-darwin/ ;fi
# Homebrew
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then test -d $HOME/.homebrew/bin || git clone https://github.com/Homebrew/brew.git $HOME/.homebrew ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then PATH="$HOME/.homebrew/bin:$PATH" ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then echo 'export PATH="$HOME/.homebrew/bin:$PATH"' >>~/.bash_profile ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export MANPATH="$(brew --prefix)/share/man:$MANPATH" ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export INFOPATH="$(brew --prefix)/share/info:$INFOPATH" ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew --version ;fi

# Universal Setup
# Buck
- if [[ -n "$USE_BUCK" ]]; then brew install ant ;fi
- if [[ -n "$USE_BUCK" ]]; then brew tap facebook/fb ;fi
- if [[ -n "$USE_BUCK" ]]; then brew install buck ;fi
- if [[ -n "$USE_BUCK" ]]; then buck --version ;fi

before_script:
- if [[ -n "$USE_CLANG_39" ]]; then export PATH="${CLANG_39_PATH}/bin:$PATH" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CC="clang" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CXX="clang++" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CXXFLAGS="$CXXFLAGS -I${CLANG_39_PATH}/include -std=c++11 -stdlib=libc++" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export LDFLAGS="$LDFLAGS -L${CLANG_39_PATH}/lib" ;fi
- mkdir build_$EASTL_CONFIG
- cd build_$EASTL_CONFIG
- cmake .. -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON
- cmake --build . --config $EASTL_CONFIG
- if [[ -n "$USE_CLANG_39" ]]; then export PATH="${CLANG_39_PATH}/bin:$PATH" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CC="clang" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CXX="clang++" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export CXXFLAGS="$CXXFLAGS -I${CLANG_39_PATH}/include -std=c++11 -stdlib=libc++" ;fi
- if [[ -n "$USE_CLANG_39" ]]; then export LDFLAGS="$LDFLAGS -L${CLANG_39_PATH}/lib" ;fi
- if [[ ! -n "$USE_BUCK" ]]; then mkdir build_$EASTL_CONFIG ;fi
- if [[ ! -n "$USE_BUCK" ]]; then cd build_$EASTL_CONFIG ;fi
- if [[ ! -n "$USE_BUCK" ]]; then cmake .. -DEASTL_BUILD_BENCHMARK:BOOL=ON -DEASTL_BUILD_TESTS:BOOL=ON ;fi
- if [[ ! -n "$USE_BUCK" ]]; then cmake --build . --config $EASTL_CONFIG ;fi

script:
# Run Tests
- cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/test
- ctest -C $EASTL_CONFIG -V || exit 1
# Run Benchmarks
- cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/benchmark
- ctest -C $EASTL_CONFIG -V || exit 1
# Run the Buck build and tests
- if [[ -n "$USE_BUCK" ]]; then buck build :eastl ;fi
- if [[ -n "$USE_BUCK" ]]; then buck run :test-runner ;fi
# Run Tests
- if [[ ! -n "$USE_BUCK" ]]; then cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/test ;fi
- if [[ ! -n "$USE_BUCK" ]]; then ctest -C $EASTL_CONFIG -V || exit 1 ;fi
# Run Benchmarks
- if [[ ! -n "$USE_BUCK" ]]; then cd $TRAVIS_BUILD_DIR/build_$EASTL_CONFIG/benchmark ;fi
- if [[ ! -n "$USE_BUCK" ]]; then ctest -C $EASTL_CONFIG -V || exit 1 ;fi

branches:
except:
- gh-pages

cache:
directories:
- $HOME/.linuxbrew/
- $HOME/.homebrew/
84 changes: 84 additions & 0 deletions BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
cxx_library(
name = 'eastl',
header_namespace = 'EASTL',
exported_headers = subdir_glob([
('include/EASTL', '**/*.h'),
]),
srcs = glob([
'source/**/*.cpp',
]),
compiler_flags = [
'-DEASTL_OPENSOURCE=1',
'-DEASTL_THREAD_SUPPORT_AVAILABLE=0',
],
licenses = [
'LICENSE',
],
visibility = [
'PUBLIC',
],
deps = [
'//test/packages/EABase:eabase',
],
)

cxx_library(
name = 'test',
header_namespace = '',
exported_headers = subdir_glob([
('test/source', '**/*.h'),
]),
srcs = glob([
'test/source/**/*.cpp',
], excludes = [
'test/source/main.cpp',
]),
compiler_flags = [
'-DEASTL_OPENSOURCE=1',
'-DEASTL_THREAD_SUPPORT_AVAILABLE=0',
],
deps = [
'//:eastl',
'//test/packages/EAAssert:eaassert',
'//test/packages/EABase:eabase',
'//test/packages/EAMain:eamain',
'//test/packages/EAStdC:eastdc',
'//test/packages/EATest:eatest',
'//test/packages/EAThread:eathread',
],
)

cxx_binary(
name = 'test-runner',
srcs = glob([
'test/source/main.cpp',
]),
compiler_flags = [
'-DEASTL_OPENSOURCE=1',
'-DEASTL_THREAD_SUPPORT_AVAILABLE=0',
],
deps = [
'//:test',
],
)

cxx_binary(
name = 'benchmark',
header_namespace = '',
headers = subdir_glob([
('benchmark/source', '**/*.h'),
]),
srcs = glob([
'benchmark/source/**/*.cpp',
]),
compiler_flags = [
'-DEASTL_OPENSOURCE=1',
'-DEASTL_THREAD_SUPPORT_AVAILABLE=0',
],
deps = [
'//:eastl',
'//:test',
'//test/packages/EAStdC:eastdc',
'//test/packages/EATest:eatest',
],
)
26 changes: 24 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Your pull request should:
* tests should be minimal and stable
* fail before your fix is applied
* pass the test suite
* code formatting is encoded in clang format
* code formatting is encoded in clang format
* limit using clang format on new code
* do not deviate from style already established in the files

Expand All @@ -28,7 +28,7 @@ EASTL uses CMake as its build system.
* Generate build scripts:
* cmake eastl_source_folder -DEASTL_BUILD_TESTS:BOOL=ON
* Build unit tests for "your_config":
* cmake --build . --config your_config
* cmake --build . --config your_config
* Run the unit tests for "your_config" from the test folder:
* cd test && ctest -C your_config

Expand Down Expand Up @@ -69,3 +69,25 @@ ctest -C MinSizeRel
popd
popd
```

### Building using Buck

EASTL can also be built using [Buck Build](https://www.buckbuild.com).

To build EASTL:

```bash=
buck build :eastl
```

To run the tests:

```bash=
buck run :test-runner
```

To run the benchmarks:

```bash=
buck run :benchmark
```
11 changes: 11 additions & 0 deletions test/packages/EAAssert/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prebuilt_cxx_library(
name = 'eaassert',
header_namespace = 'EAAssert',
header_only = True,
exported_headers = subdir_glob([
('include/EAAssert', '**/*.h'),
]),
visibility = [
'PUBLIC',
],
)
11 changes: 11 additions & 0 deletions test/packages/EABase/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prebuilt_cxx_library(
name = 'eabase',
header_namespace = 'EABase',
header_only = True,
exported_headers = subdir_glob([
('include/Common/EABase', '**/*.h'),
]),
visibility = [
'PUBLIC',
],
)
12 changes: 12 additions & 0 deletions test/packages/EAMain/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
prebuilt_cxx_library(
name = 'eamain',
header_namespace = 'EAMain',
header_only = True,
exported_headers = subdir_glob([
('include/EAMain', '**/*.h'),
('include/EAMain', '**/*.inl'),
]),
visibility = [
'PUBLIC',
],
)
21 changes: 21 additions & 0 deletions test/packages/EAStdC/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
cxx_library(
name = 'eastdc',
header_namespace = 'EAStdC',
exported_headers = subdir_glob([
('include/EAStdC', '**/*.h'),
]),
srcs = glob([
'source/**/*.cpp',
]),
compiler_flags = [
'-DEASTL_OPENSOURCE=1',
'-DEASTL_THREAD_SUPPORT_AVAILABLE=0',
],
visibility = [
'PUBLIC',
],
deps = [
'//test/packages/EAAssert:eaassert',
'//test/packages/EABase:eabase',
],
)
25 changes: 25 additions & 0 deletions test/packages/EATest/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cxx_library(
name = 'eatest',
header_namespace = 'EATest',
exported_headers = subdir_glob([
('include/EATest', '**/*.h'),
('include/EATest', '**/*.inl'),
]),
srcs = glob([
'source/**/*.cpp',
]),
compiler_flags = [
'-DEASTL_OPENSOURCE=1',
'-DEASTL_THREAD_SUPPORT_AVAILABLE=0',
],
visibility = [
'PUBLIC',
],
deps = [
'//:eastl',
'//test/packages/EABase:eabase',
'//test/packages/EAMain:eamain',
'//test/packages/EAStdC:eastdc',
'//test/packages/EAThread:eathread',
],
)
11 changes: 11 additions & 0 deletions test/packages/EAThread/BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prebuilt_cxx_library(
name = 'eathread',
header_namespace = 'eathread',
header_only = True,
exported_headers = subdir_glob([
('include/eathread', '**/*.h'),
]),
visibility = [
'PUBLIC',
],
)

0 comments on commit e5b0dc0

Please sign in to comment.