mirror of
https://github.com/google/brotli.git
synced 2024-11-24 20:40:13 +00:00
67f059eaf5
* build: add cross-compilation support to make Set CROSS_COMPILE when running make to use the selected cross compilation toolchain, such as arm-linux-gnueabihf, or aarch64-linux-gnu. Testing requires the presence of qemu - 'qemu-$(ARCH)' will be executed, where ARCH is the first part of the toolchain triplet. * build: add cross-compilation support to cmake If C_COMPILER/CXX_COMPILER/CC/CXX are found to have cross-compilation triplets in front of the compiler, then qemu will be used to execute the tests. * CI: add arm-linux-gnueabihf-gcc builder to Travis The version of qemu available in Ubuntu trusty (as provided by Travis) appears to have a bug in qemu-aarch64, which leads to the compatibility tests failing on some inputs, erroneously rejecting the input as corrupt. Once Travis supports xenial, we could add an aarch64-gnu-linux-gcc builder as well. * CI: propagate cmake errors out of .travis.sh Seems like even if cmake fails, the error isn't picked up by Travis.
37 lines
1.1 KiB
CMake
37 lines
1.1 KiB
CMake
set(ENV{QEMU_LD_PREFIX} "${BROTLI_WRAPPER_LD_PREFIX}")
|
|
|
|
execute_process(
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
COMMAND ${BROTLI_WRAPPER} ${BROTLI_CLI} --force --quality=${QUALITY} ${INPUT} --output=${OUTPUT}.br
|
|
RESULT_VARIABLE result
|
|
ERROR_VARIABLE result_stderr)
|
|
if(result)
|
|
message(FATAL_ERROR "Compression failed: ${result_stderr}")
|
|
endif()
|
|
|
|
execute_process(
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
COMMAND ${BROTLI_WRAPPER} ${BROTLI_CLI} --force --decompress ${OUTPUT}.br --output=${OUTPUT}.unbr
|
|
RESULT_VARIABLE result)
|
|
if(result)
|
|
message(FATAL_ERROR "Decompression failed")
|
|
endif()
|
|
|
|
function(test_file_equality f1 f2)
|
|
if(NOT CMAKE_VERSION VERSION_LESS 2.8.7)
|
|
file(SHA512 "${f1}" f1_cs)
|
|
file(SHA512 "${f2}" f2_cs)
|
|
if(NOT "${f1_cs}" STREQUAL "${f2_cs}")
|
|
message(FATAL_ERROR "Files do not match")
|
|
endif()
|
|
else()
|
|
file(READ "${f1}" f1_contents)
|
|
file(READ "${f2}" f2_contents)
|
|
if(NOT "${f1_contents}" STREQUAL "${f2_contents}")
|
|
message(FATAL_ERROR "Files do not match")
|
|
endif()
|
|
endif()
|
|
endfunction()
|
|
|
|
test_file_equality("${INPUT}" "${OUTPUT}.unbr")
|