it builds with gcc and clang for amd64
The build for prime is broken, but the whole build shell script mess
needs redoing, so it'll get fixed then.
diff --git a/aos/build/aos.gypi b/aos/build/aos.gypi
index 9dc2f51..c45c041 100644
--- a/aos/build/aos.gypi
+++ b/aos/build/aos.gypi
@@ -15,6 +15,29 @@
'so_dir': '<(PRODUCT_DIR)/lib',
# the directory that executables that depend on <(EXTERNALS):gtest get put into
'test_dir': '<(PRODUCT_DIR)/tests',
+ 'variables': {
+ 'conditions': [
+ ['PLATFORM=="linux"', {
+ 'compiler': 'gcc',
+ 'aos_architecture': 'arm',
+ },
+ ], ['PLATFORM=="linux-amd64-clang"', {
+ 'compiler': 'clang',
+ 'aos_architecture': 'amd64',
+ },
+ ], ['PLATFORM=="linux-clang"', {
+ 'compiler': 'gcc',
+ 'aos_architecture': 'arm',
+ },
+ ], ['PLATFORM=="linux-amd64"', {
+ 'compiler': 'gcc',
+ 'aos_architecture': 'amd64',
+ },
+ ],
+ ],
+ },
+ 'aos_architecture%': '<(aos_architecture)',
+ 'compiler%': '<(compiler)',
},
'conditions': [
['OS=="crio"', {
@@ -22,17 +45,24 @@
['CC', '<!(readlink -f <(AOS)/build/crio_cc)'],
['CXX', '<!(readlink -f <(AOS)/build/crio_cxx)'],
],
- }, {
- 'conditions': [
- ['PLATFORM!="linux-amd64"', {
- 'make_global_settings': [
- ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
- ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
- ],
- },
- ],
- ],
}
+ ], ['PLATFORM=="linux"', {
+ 'make_global_settings': [
+ ['CC', '<!(which arm-linux-gnueabihf-gcc-4.7)'],
+ ['CXX', '<!(which arm-linux-gnueabihf-g++-4.7)'],
+ ],
+ },
+ ], ['PLATFORM=="linux-clang"', {
+ # TODO(brians): Make this one actually work.
+ },
+ ], ['PLATFORM=="linux-amd64-clang"', {
+ 'make_global_settings': [
+ ['CC', '<!(which clang)'],
+ ['CXX', '<!(which clang++)'],
+ ],
+ },
+ ], ['PLATFORM=="linux-amd64"', {
+ },
],
],
'target_defaults': {
@@ -177,14 +207,7 @@
],
'cflags': [
'-pthread',
-
- '-Wunused-local-typedefs',
-
- # Give macro stack traces when they blow up.
- # TODO(brians): Re-enable this once they fix the bug where it
- # sometimes doesn't show you the top-most (aka most useful)
- # line of code.
- #'-ftrack-macro-expansion',
+ '-fno-exceptions',
],
'cflags_cc': [
'-std=gnu++11',
@@ -196,6 +219,25 @@
'-lm',
'-lrt',
],
+ 'conditions': [
+ ['compiler=="gcc"', {
+ 'cflags': [
+ '-Wunused-local-typedefs',
+ ],
+ },
+ ], ['compiler=="clang"', {
+ 'cflags': [
+ '-fcolor-diagnostics',
+ ],
+ 'defines': [
+ # To work around <http://llvm.org/bugs/show_bug.cgi?id=13530>.
+ '__float128=void',
+ # This tells clang's optimizer the same thing.
+ '__builtin_assume_aligned(p, a)=(((uintptr_t(p) % (a)) == 0) ? (p) : (__builtin_unreachable(), (p)))',
+ ],
+ },
+ ],
+ ],
}
]
],
diff --git a/aos/build/build.sh b/aos/build/build.sh
index d716bd2..6bea1e6 100755
--- a/aos/build/build.sh
+++ b/aos/build/build.sh
@@ -17,7 +17,7 @@
export WIND_BASE=${WIND_BASE:-"/usr/local/powerpc-wrs-vxworks/wind_base"}
-[ "${PLATFORM}" == "crio" -o "${PLATFORM}" == "linux" -o "${PLATFORM}" == "linux-amd64" ] || ( echo Platform "(${PLATFORM})" must be '"crio", "linux", or "linux-amd64"'. ; exit 1 )
+#[ "${PLATFORM}" == "crio" -o "${PLATFORM}" == "linux" -o "${PLATFORM}" == "linux-amd64" ] || ( echo Platform "(${PLATFORM})" must be '"crio", "linux", or "linux-amd64"'. ; exit 1 )
[ "${DEBUG}" == "yes" -o "${DEBUG}" == "no" ] || ( echo Debug "(${DEBUG})" must be '"yes" or "no"'. ; exit 1 )
AOS=`dirname $0`/..
diff --git a/aos/build/externals.gyp b/aos/build/externals.gyp
index 264bdbb..2277edc 100644
--- a/aos/build/externals.gyp
+++ b/aos/build/externals.gyp
@@ -5,13 +5,8 @@
# TODO(brians): Would we not have to do this hackery if we named it externals_path etc?
'externals': '<(AOS)/../output/downloaded',
'externals_abs': '<!(readlink -f ../../output/downloaded)',
- 'conditions': [['PLATFORM=="linux-amd64"', {
- 'compiled': '<(externals)/../compiled-amd64',
- 'compiled_abs': '<(externals_abs)/../compiled-amd64',
- }, {
- 'compiled': '<(externals)/../compiled-arm',
- 'compiled_abs': '<(externals_abs)/../compiled-arm',
- }]],
+ 'compiled': '<(externals)/../compiled-<(aos_architecture)',
+ 'compiled_abs': '<(externals_abs)/../compiled-<(aos_architecture)',
# These versions have to be kept in sync with the ones in download_externals.sh.
'eigen_version': '3.2.1',
@@ -60,10 +55,17 @@
'include_dirs': [
'<(AOS)/externals/WPILib',
],
+ 'defines': [
+ # Clang doesn't like having register in the hton* macros.
+ 'register=',
+ ],
'direct_dependent_settings': {
'include_dirs': [
'<(AOS)/externals/WPILib',
],
+ 'defines': [
+ 'register=',
+ ],
},
},
{
diff --git a/aos/build/prime-build.sh b/aos/build/prime-build.sh
index 9ae3c3e..f1aea44 100755
--- a/aos/build/prime-build.sh
+++ b/aos/build/prime-build.sh
@@ -18,22 +18,30 @@
OTHER_ARGS="$@"
build_platform() {
- PLATFORM=$1
- OUT_NAME=$2
- HUMAN_NAME=$3
+ PLATFORM=$1
+ OUT_NAME=$2
+ HUMAN_NAME=$3
- echo "Building code for ${HUMAN_NAME}..." 1>&2
- ../../aos/build/build.sh ${PLATFORM} prime.gyp no ${OUT_NAME} "${OTHER_ARGS}"
- if [[ $? -ne 0 ]]; then
- echo "Building code for ${HUMAN_NAME} failed!" 1>&2
- exit 1
- fi
- echo "Building code for ${HUMAN_NAME} succeeded." 1>&2
+ echo "Building code with clang for ${HUMAN_NAME}..." 1>&2
+ ../../aos/build/build.sh ${PLATFORM}-clang prime.gyp no ${OUT_NAME}-clang "${OTHER_ARGS}"
+ if [[ $? -ne 0 ]]; then
+ echo "Building code with clang for ${HUMAN_NAME} failed!" 1>&2
+ exit 1
+ fi
+ echo "Building code with clang for ${HUMAN_NAME} succeeded." 1>&2
+
+ echo "Building code for ${HUMAN_NAME}..." 1>&2
+ ../../aos/build/build.sh ${PLATFORM} prime.gyp no ${OUT_NAME} "${OTHER_ARGS}"
+ if [[ $? -ne 0 ]]; then
+ echo "Building code for ${HUMAN_NAME} failed!" 1>&2
+ exit 1
+ fi
+ echo "Building code for ${HUMAN_NAME} succeeded." 1>&2
}
if [[ ! ${NO_TARGET} ]]; then
- build_platform linux prime target
+ build_platform linux prime target
fi
if [[ ! ${NO_AMD64} ]]; then
- build_platform linux-amd64 prime-amd64 amd64
+ build_platform linux-amd64 prime-amd64 amd64
fi