Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
91 changes: 51 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,65 @@ dist: trusty

linux64_addons:
addons: &linux64
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8

linux32_addons:
addons: &linux32
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- g++-4.8-multilib
- linux-libc-dev:i386
- libc6-dev-i386
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
- g++-4.8-multilib
- linux-libc-dev:i386
- libc6-dev-i386

linux64_cpp17addons:
addons: &linux64cpp17
apt:
sources:
- ubuntu-toolchain-r-test

# Set empty values for allow_failures to work
env:
env: TEST_COMMAND=$TRAVIS_BUILD_DIR/ci/build_and_run_tests.sh

matrix:
fast_finish: true
include:
- os: linux
env: EMSCRIPTEN=ON
addons: *linux64
- os: linux
compiler: clang
addons: *linux64
- os: linux
compiler: gcc
env: ARCH=x86 CMAKE_EXTRA=-DHAVE_LIBM=/lib32/libm.so.6
addons: *linux32
- os: osx
compiler: clang
fast_finish: true
include:
- os: linux
env: EMSCRIPTEN=ON TEST_COMMAND=$TRAVIS_BUILD_DIR/ci/build_and_run_tests.sh
addons: *linux64
- os: linux
compiler: clang
addons: *linux64
- os: linux
compiler: gcc
env: ARCH=x86 CMAKE_EXTRA=-DHAVE_LIBM=/lib32/libm.so.6 TEST_COMMAND=$TRAVIS_BUILD_DIR/ci/build_and_run_tests.sh
addons: *linux32
- os: osx
compiler: clang
- os: linux
compiler: gcc
env: CMAKE_EXTRA="-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS='-march=native'" TEST_COMMAND=$TRAVIS_BUILD_DIR/ci/build_and_run_tests.sh
addons: *linux64cpp17
dist: bionic
- os: linux
compiler: gcc
addons: *linux64cpp17
dist: bionic


before_install:
# Setting environement
- cd $TRAVIS_BUILD_DIR
- source ci/setup-travis.sh
- $CC --version
- $CXX --version
# Setting environement
- cd $TRAVIS_BUILD_DIR
- source ci/setup-travis.sh
- $CC --version
- $CXX --version

script:
- cd $TRAVIS_BUILD_DIR
- mkdir build && cd build
- $CMAKE_CONFIGURE cmake $CMAKE_ARGS $CMAKE_EXTRA ..
- make -j2
- ctest -j2 --output-on-failure
- bash $TRAVIS_BUILD_DIR/ci/travis-test-example.sh
- cd $TRAVIS_BUILD_DIR
- echo $TEST_COMMAND
- (eval "$TEST_COMMAND")
8 changes: 8 additions & 0 deletions ci/build_and_run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set -e
cd $TRAVIS_BUILD_DIR
mkdir build && cd build
$CMAKE_CONFIGURE cmake $CMAKE_ARGS $CMAKE_EXTRA ..
make -j2
ctest -j2 --output-on-failure
bash $TRAVIS_BUILD_DIR/ci/travis-test-example.sh
cd $TRAVIS_BUILD_DIR
14 changes: 11 additions & 3 deletions ci/setup-travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,17 @@ if [[ "$EMSCRIPTEN" == "ON" ]]; then
fi

if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ "$CC" == "gcc" ]]; then
export CC=gcc-4.8
export CXX=g++-4.8
if [[ "$TRAVIS_DIST" == "trusty" ]]; then
if [[ "$CC" == "gcc" ]]; then
export CC=gcc-4.8
export CXX=g++-4.8
fi
fi
if [[ "$TRAVIS_DIST" == "bionic" ]]; then
if [[ "$CC" == "gcc" ]]; then
export CC=gcc-7
export CXX=g++-7
fi
fi
fi

Expand Down
10 changes: 8 additions & 2 deletions include/mmtf/binary_decoder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,17 @@ namespace {

#ifndef __EMSCRIPTEN__
void assignBigendian4(void* dst, const char* src) {
*((uint32_t*)dst) = ntohl(*((uint32_t*)src));
uint32_t tmp;
std::memcpy(&tmp, src, sizeof(uint32_t));
tmp = ntohl(tmp);
std::memcpy(dst, &tmp, sizeof(uint32_t));
}

void assignBigendian2(void* dst, const char* src) {
*((uint16_t*)dst) = ntohs(*((uint16_t*)src));
uint16_t tmp;
std::memcpy(&tmp, src, sizeof(uint16_t));
tmp = ntohs(tmp);
std::memcpy(dst, &tmp, sizeof(uint16_t));
}
#else
// Need to avoid how emscripten handles memory
Expand Down