Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common bazel cxx toolchain for Linux and Mac #1

Merged
merged 52 commits into from
Aug 3, 2017
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
4279f48
Initial import.
sayrer Jul 20, 2017
ff05708
Delete .DS_Store
sayrer Jul 20, 2017
87424ea
Add .gitignore
sayrer Jul 20, 2017
7826a68
space patrol
sayrer Jul 21, 2017
f5ec2cb
Add script to generate WORKSPACE.
sayrer Jul 21, 2017
431fef7
Better python
sayrer Jul 22, 2017
ca6db21
Move sysroot BUILD file
sayrer Jul 22, 2017
2eb8356
Working sysroot download.
sayrer Jul 22, 2017
e1faabb
generate workspace from script
sayrer Jul 22, 2017
00fabc3
Rename main script.
sayrer Jul 22, 2017
afd19e4
Add gtest.BUILD
sayrer Jul 22, 2017
c43aaad
Working mac build
sayrer Jul 23, 2017
7ab8fea
Remove old cc wrapper.sh
sayrer Jul 23, 2017
68a0cbc
Adjust CROSSTOOL verbosity
sayrer Jul 23, 2017
fa2413c
A few more tests.
sayrer Jul 23, 2017
f13a1e2
Add travis file
sayrer Jul 23, 2017
87684d9
Change to trusty for now
sayrer Jul 23, 2017
0029001
Remove java 9
sayrer Jul 23, 2017
58b2749
Adjust package names
sayrer Jul 23, 2017
ddb9f07
Remove moar Java
sayrer Jul 23, 2017
9391e37
Update gtest template, require stdlib on linux
sayrer Jul 23, 2017
69ee417
Fix BUILD file
sayrer Jul 23, 2017
bb6c6af
Unset gcc/g++
sayrer Jul 23, 2017
bd66bf0
nostdlib
sayrer Jul 23, 2017
d8f7c99
Change link style of stdlib
sayrer Jul 23, 2017
902b5f6
Remove link options
sayrer Jul 23, 2017
749225a
verbose compile
sayrer Jul 24, 2017
7e9a7ed
Fix defines for libcxx
sayrer Jul 24, 2017
aa98226
Try adding osx to .travis.yml
sayrer Jul 24, 2017
61584f8
Fix travis syntax
sayrer Jul 24, 2017
d4f624f
Too many builds
sayrer Jul 24, 2017
ac392d0
Try adding a .bzl file to load the repositories.
sayrer Jul 26, 2017
56a3b28
Add BUILD file.
sayrer Jul 26, 2017
2e97881
Fix BUILD for repos.
sayrer Jul 26, 2017
dbe4658
Add BUILD file for stdlib
sayrer Jul 26, 2017
e7c51eb
Fix .bzl typo
sayrer Jul 26, 2017
414e8d4
Update generate script
sayrer Aug 2, 2017
b64e018
Moving build files around.
sayrer Aug 2, 2017
50c6067
Move toolchain build files.
sayrer Aug 2, 2017
a5883ea
Update .gitignore
sayrer Aug 2, 2017
3ce8edc
Remove BUILD file for old dir
sayrer Aug 2, 2017
f07b238
Fix quotation style
sayrer Aug 2, 2017
10ba322
Generated with scripts/generate_workspace.py
sayrer Aug 2, 2017
0609dfb
Fix sysroot
sayrer Aug 2, 2017
fb608ff
Address comment from lucas on status code checks.
sayrer Aug 3, 2017
c3b9933
Adjust visibility of tool_wrappers
sayrer Aug 3, 2017
d0d24b3
Add argparse
sayrer Aug 3, 2017
229c7a3
Merge branch 'add_mac' of https://github.com/vsco/bazel-toolchains in…
sayrer Aug 3, 2017
6544031
Only ignore the system c++ include directories.
sayrer Aug 3, 2017
4800e54
Add system frameworks.
sayrer Aug 3, 2017
4fe8c10
Fix exception
sayrer Aug 3, 2017
36ed347
Update README.md
sayrer Aug 3, 2017
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/.DS_Store
**/*.pyc
bazel-*
34 changes: 34 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
matrix:
include:
- os: linux
dist: trusty
sudo: required
language: java
- os: osx
osx_image: xcode8.3
language: java

env:
global:
- BAZEL_VERSION=0.5.2

before_install:
- echo $TRAVIS_OS_NAME;
- unset CC
- unset CXX
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get autoremove openjdk-9-jre-headless openjdk-9-jdk oracle-java9-installer; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get purge openjdk-9-jre-headless openjdk-9-jdk oracle-java9-installer; fi
- mkdir -p ${HOME}/bazel/install
- pushd ${HOME}/bazel/install
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then wget --no-clobber https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel_${BAZEL_VERSION}-linux-x86_64.deb; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo dpkg -i bazel_${BAZEL_VERSION}-linux-x86_64.deb; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install bazel; fi
- popd

script:
- bazel test --crosstool_top=//tools/cpp:default-toolchain //src/...

notifications:
email: false
slack: false
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# bazel-toolchains
## Prequisites

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that prequisite might not be a word


On macOS, run `xcode-select --install` in Terminal.

## Running the Python scripts

The files in the `scripts/` directory are written in Python. Follow these [instructions](http://docs.python-guide.org/en/latest/starting/installation/) to install a version of Python that comes with the necessary tools for installation of third party libraries. On macOS, this means `brew install python`, and then following the instructions printed by `brew info python`.

Once that's working, type `pip install requests` to install the necessary dependencies.

From the root of this repository, type `python scripts/generate_workspace.py --rev=""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is missing a trailing `.

13 changes: 13 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Chromium toolchain corresponding to Chromium 61.0.3153.4

load("//toolchains:repositories.bzl", "bazel_toolchains_repositories")
bazel_toolchains_repositories()

# GTest
new_http_archive(
name = "gtest",
url = "https://github.com/google/googletest/archive/release-1.8.0.zip",
sha256 = "f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf",
build_file = "build_files/gtest.BUILD",
strip_prefix = "googletest-release-1.8.0/googletest",
)
5 changes: 5 additions & 0 deletions build_files/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
filegroup(
name = "build_files",
srcs = glob(["*.BUILD"]),
visibility = ["//visibility:public"],
)
17 changes: 17 additions & 0 deletions build_files/gtest.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cc_library(
name = "main",
srcs = glob(
["src/*.cc"],
exclude = ["src/gtest-all.cc"]
),
hdrs = glob([
"include/**/*.h",
"src/*.h"
]),
copts = [
'-Iexternal/gtest/include',
'-Wno-unused-const-variable',
],
linkopts = ["-v"],
visibility = ["//visibility:public"],
)
95 changes: 95 additions & 0 deletions build_files/org_chromium_binutils_linux_x64.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package(default_visibility = ["//visibility:public"])

filegroup(
name = "ar",
srcs = [
"bin/ar",
],
)

filegroup(
name = "as",
srcs = [
"bin/as",
],
)

filegroup(
name = "ld",
srcs = [
"bin/ld",
],
)

filegroup(
name = "ld.bfd",
srcs = [
"bin/ld.bfd",
],
)

filegroup(
name = "ld.gold",
srcs = [
"bin/ld.gold",
],
)

filegroup(
name = "nm",
srcs = [
"bin/nm",
],
)

filegroup(
name = "objcopy",
srcs = [
"bin/objcopy",
],
)

filegroup(
name = "objdump",
srcs = [
"bin/objdump",
],
)

filegroup(
name = "ranlib",
srcs = [
"bin/ranlib",
],
)

filegroup(
name = "readelf",
srcs = [
"bin/readelf",
],
)

filegroup(
name = "strip",
srcs = [
"bin/strip",
],
)

filegroup(
name = "binutils_components",
srcs = [
":ar",
":as",
":ld",
":ld.bfd",
":ld.gold",
":nm",
":objcopy",
":objdump",
":ranlib",
":readelf",
":strip",
],
)
21 changes: 21 additions & 0 deletions build_files/org_chromium_clang_linux_x64.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package(default_visibility = ["//visibility:public"])

filegroup(
name = "clang",
srcs = [
"bin/clang",
],
)

filegroup(
name = "lib",
srcs = glob(["lib/**"]),
)

filegroup(
name = "compiler_components",
srcs = [
":clang",
":lib",
],
)
27 changes: 27 additions & 0 deletions build_files/org_chromium_clang_mac.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package(default_visibility = ["//visibility:public"])

filegroup(
name = "clang",
srcs = [
"bin/clang",
],
)

filegroup(
name = "include",
srcs = glob(["include/**"]),
)

filegroup(
name = "lib",
srcs = glob(["lib/**"]),
)

filegroup(
name = "compiler_components",
srcs = [
":clang",
":include",
":lib",
],
)
88 changes: 88 additions & 0 deletions build_files/org_chromium_libcxx.BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
package(default_visibility = ["//visibility:public"])

filegroup(
name = "libcxx_includes",
srcs = glob(["include/**/*"])
)

cc_library(
name = "cxxlib",
copts = [
"-fPIC",
"-fstrict-aliasing",
"-nostdinc++",
"-std=c++11",
],
hdrs = glob(["src/support/runtime/*.ipp"]),
includes = ["include"],
defines = [
"_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
"_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
"_LIBCPP_BUILDING_LIBRARY",
"LIBCXX_BUILDING_LIBCXXABI"

# This resets the visibility to default only for the various
# flavors of operator new and operator delete. These symbols
# are weak and get overriden by Chromium-provided ones, but if
# these symbols had hidden visibility, this would make the
# Chromium symbols hidden too because elf visibility rules
# require that linkers use the least visible form when merging,
# and if this is hidden, then when we merge it with tcmalloc's
# operator new, hidden visibility would win. However, tcmalloc
# needs a visible operator new to also override operator new
# references from system libraries.
# TODO(lld): Ask lld for a --force-public-visibility flag or
# similar to that overrides the default elf merging rules, and
# make tcmalloc's gn config pass that to all its dependencies,
# then remove this override here.
#"_LIBCPP_OVERRIDABLE_FUNC_VIS=__attribute__((__visibility__(\"\"default\"\"")))",
],
srcs = [
"src/algorithm.cpp",
"src/any.cpp",
"src/bind.cpp",
"src/chrono.cpp",
"src/condition_variable.cpp",
"src/debug.cpp",
"src/exception.cpp",
"src/functional.cpp",
"src/future.cpp",
"src/hash.cpp",
"src/ios.cpp",
"src/iostream.cpp",
"src/locale.cpp",
"src/memory.cpp",
"src/mutex.cpp",
"src/new.cpp",
"src/optional.cpp",
"src/random.cpp",
"src/regex.cpp",
"src/shared_mutex.cpp",
"src/stdexcept.cpp",
"src/string.cpp",
"src/strstream.cpp",
"src/system_error.cpp",
"src/thread.cpp",
"src/typeinfo.cpp",
"src/utility.cpp",
"src/valarray.cpp",
"src/variant.cpp",
"src/include/atomic_support.h",
"src/include/config_elast.h",
],
deps = [
"@org_chromium_libcxxabi//:include",
]
)

cc_library(
name = "cxx",
hdrs = [
"libcxx_includes",
"@org_chromium_libcxxabi//:include",
],
deps = [
"@org_chromium_libcxxabi//:cxxabi",
":cxxlib"
],
)
Loading