Skip to content

Commit

Permalink
# This is a combination of 13 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

Update macros to detect mips64 and differentiate between x86 32/64.

# This is the commit message #2:

Fix Mips32 and add an alias for Mips32/64.

# This is the commit message #3:

Allow specifying cmake generator.

# This is the commit message #4:

Remove unavailable MSVC version and test Ninja on travis

# This is the commit message #5:

Add ninja build.

# This is the commit message #6:

Use Ninja by default

# This is the commit message #7:

Show tests output

# This is the commit message #8:

Defaulting env to Ninja in the build matrix

# This is the commit message #9:

Defaulting env to Ninja in the build matrix

# This is the commit message #10:

Do not use ninja on OSX

# This is the commit message #11:

Fix test output.

# This is the commit message #12:

Fix running tests

# This is the commit message #13:

Fix running tests
  • Loading branch information
gchatelet committed Jan 17, 2019
1 parent 543e043 commit abf08af
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 24 deletions.
20 changes: 13 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,47 @@ cache:
directories:
- $HOME/cpu_features_archives

addons:
apt:
packages:
- ninja-build

env:
global:
TOOLCHAIN=NATIVE
CMAKE_GENERATOR=Ninja

matrix:
include:
- os: linux
compiler: gcc
env:
TOOLCHAIN=NATIVE
TARGET=x86_64-linux-gnu
- os: linux
compiler: clang
env:
TOOLCHAIN=NATIVE
TARGET=x86_64-linux-gnu
- os: osx
compiler: gcc
env:
TOOLCHAIN=NATIVE
TARGET=x86_64-osx
CMAKE_GENERATOR="Unix Makefiles"
- os: osx
compiler: clang
env:
TOOLCHAIN=NATIVE
TARGET=x86_64-osx
CMAKE_GENERATOR="Unix Makefiles"
- os: windows
env:
TOOLCHAIN=NATIVE
TARGET=x86_64-windows
CMAKE_GENERATOR="Visual Studio 15 2017 Win64"
- os: linux-ppc64le
compiler: gcc
env:
TOOLCHAIN=NATIVE
TARGET=ppc64le-linux-gnu
- os: linux-ppc64le
compiler: clang
env:
TOOLCHAIN=NATIVE
TARGET=ppc64le-linux-gnu
# Toolchains for little-endian, 64-bit ARMv8 for GNU/Linux systems
- os: linux
Expand Down
34 changes: 26 additions & 8 deletions include/cpu_features_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@
// Architectures
////////////////////////////////////////////////////////////////////////////////

#if ((defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \
defined(__x86_64__)) && \
!defined(__pnacl__) && !defined(__CLR_VER))
#if defined(__pnacl__) || defined(__CLR_VER)
#define CPU_FEATURES_ARCH_VM
#endif

#if (defined(_M_IX86) || defined(__i386__)) && !defined(CPU_FEATURES_ARCH_VM)
#define CPU_FEATURES_ARCH_X86_32
#endif

#if (defined(_M_X64) || defined(__x86_64__)) && !defined(CPU_FEATURES_ARCH_VM)
#define CPU_FEATURES_ARCH_X86_64
#endif

#if defined(CPU_FEATURES_ARCH_X86_32) || defined(CPU_FEATURES_ARCH_X86_64)
#define CPU_FEATURES_ARCH_X86
#endif

Expand All @@ -37,7 +47,15 @@
#define CPU_FEATURES_ARCH_ANY_ARM
#endif

#if defined(__mips__)
#if defined(__mips64)
#define CPU_FEATURES_ARCH_MIPS64
#endif

#if defined(__mips__) && !defined(__mips64) // mips64 also declares __mips__
#define CPU_FEATURES_ARCH_MIPS32
#endif

#if defined(CPU_FEATURES_ARCH_MIPS32) || defined(CPU_FEATURES_ARCH_MIPS64)
#define CPU_FEATURES_ARCH_MIPS
#endif

Expand Down Expand Up @@ -83,10 +101,10 @@

#if defined(__cplusplus)
#define CPU_FEATURES_START_CPP_NAMESPACE \
namespace cpu_features { \
namespace cpu_features { \
extern "C" {
#define CPU_FEATURES_END_CPP_NAMESPACE \
} \
} \
}
#else
#define CPU_FEATURES_START_CPP_NAMESPACE
Expand All @@ -97,8 +115,8 @@
// Compiler flags
////////////////////////////////////////////////////////////////////////////////

// Use the following to check if a feature is known to be available at compile
// time. See README.md for an example.
// Use the following to check if a feature is known to be available at
// compile time. See README.md for an example.
#if defined(CPU_FEATURES_ARCH_X86)
#define CPU_FEATURES_COMPILED_X86_AES defined(__AES__)
#define CPU_FEATURES_COMPILED_X86_F16C defined(__F16C__)
Expand Down
16 changes: 7 additions & 9 deletions scripts/run_integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function integrate() {
esac

# Generating CMake configuration
cmake -H. -B"${BUILD_DIR}" ${DEFAULT_CMAKE_ARGS} ${CMAKE_ADDITIONAL_ARGS}
cmake -H. -B"${BUILD_DIR}" ${DEFAULT_CMAKE_ARGS} ${CMAKE_ADDITIONAL_ARGS} -G"${CMAKE_GENERATOR:-Unix Makefiles}"

# Building
cmake --build "${BUILD_DIR}" ${CMAKE_BUILD_ARGS}
Expand All @@ -97,17 +97,15 @@ function integrate() {
if [[ "${QEMU_ARCH}" == "DISABLED" ]]; then
return
fi
RUN_CMD=""
if [[ -n "${QEMU_ARCH}" ]]; then
installqemuifneeded
QEMU="${QEMU_INSTALL}/bin/qemu-${QEMU_ARCH} ${QEMU_ARGS}"
for test_binary in ${BUILD_DIR}/test/*_test; do
${QEMU} ${test_binary}
done
${QEMU} ${DEMO}
else
cmake --build "${BUILD_DIR}" ${CMAKE_TEST_ARGS}
${DEMO}
RUN_CMD="${QEMU_INSTALL}/bin/qemu-${QEMU_ARCH} ${QEMU_ARGS}"
fi
for test_binary in ${BUILD_DIR}/test/*_test; do
${RUN_CMD} ${test_binary} &
done
${RUN} ${DEMO}
}

function expand_linaro_config() {
Expand Down

0 comments on commit abf08af

Please sign in to comment.