diff --git a/CMakeLists.txt b/CMakeLists.txt index fe51ae753..7a4a19948 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ PROJECT ( YUV C CXX ) # "C" is required even for C++ projects CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) -OPTION( TEST "Built unit tests" OFF ) +OPTION( UNIT_TEST "Built unit tests" OFF ) SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) SET ( ly_src_dir ${ly_base_dir}/source ) @@ -52,25 +52,23 @@ if (JPEG_FOUND) add_definitions( -DHAVE_JPEG ) endif() -if(TEST) - if (NOT CMAKE_CROSSCOMPILING) - find_library(GTEST_LIBRARY gtest) - if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND") - set(GTEST_SRC_DIR /usr/src/gtest CACHE STRING "Location of gtest sources") - if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc) - message(STATUS "building gtest from sources in ${GTEST_SRC_DIR}") - set(gtest_sources ${GTEST_SRC_DIR}/src/gtest-all.cc) - add_library(gtest STATIC ${gtest_sources}) - include_directories(${GTEST_SRC_DIR}) - include_directories(${GTEST_SRC_DIR}/include) - set(GTEST_LIBRARY gtest) - else() - message(FATAL_ERROR "TEST is set but unable to find gtest library") - endif() +if(UNIT_TEST) + find_library(GTEST_LIBRARY gtest) + if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND") + set(GTEST_SRC_DIR /usr/src/gtest CACHE STRING "Location of gtest sources") + if (CMAKE_CROSSCOMPILING) + set(GTEST_SRC_DIR third_party/googletest/src/googletest) + endif() + if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc) + message(STATUS "building gtest from sources in ${GTEST_SRC_DIR}") + set(gtest_sources ${GTEST_SRC_DIR}/src/gtest-all.cc) + add_library(gtest STATIC ${gtest_sources}) + include_directories(${GTEST_SRC_DIR}) + include_directories(${GTEST_SRC_DIR}/include) + set(GTEST_LIBRARY gtest) + else() + message(FATAL_ERROR "UNIT_TEST is set but unable to find gtest library") endif() - else() - add_subdirectory(third_party/googletest/src) - set(GTEST_LIBRARY gtest) endif() add_executable(libyuv_unittest ${ly_unittest_sources}) diff --git a/docs/getting_started.md b/docs/getting_started.md index 37ffc7478..b19f00093 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -231,7 +231,7 @@ If you don't have prebuilt clang and riscv64 qemu, run the script to download so After running script, clang & qemu are built in `build-toolchain-qemu/riscv-clang/` & `build-toolchain-qemu/riscv-qemu/`. ### Cross-compile for RISC-V target - cmake -B out/Release/ -DTEST=ON \ + cmake -B out/Release/ -DUNIT_TEST=ON \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_TOOLCHAIN_FILE="./riscv_script/riscv-clang.cmake" \ -DTOOLCHAIN_PATH={TOOLCHAIN_PATH} \ diff --git a/include/libyuv/row.h b/include/libyuv/row.h index 53a8d8a6f..6e973bcfe 100644 --- a/include/libyuv/row.h +++ b/include/libyuv/row.h @@ -757,7 +757,7 @@ extern "C" { #define HAS_RAWTOYJROW_LASX #endif -#if !defined(LIBYUV_DISABLE_RVV) && defined(__riscv) +#if !defined(LIBYUV_DISABLE_RVV) && defined(__riscv_vector) #define HAS_AB64TOARGBROW_RVV #define HAS_AR64TOARGBROW_RVV #define HAS_ARGBTOAB64ROW_RVV diff --git a/riscv_script/run_qemu.sh b/riscv_script/run_qemu.sh index c492f3f89..080af3b19 100755 --- a/riscv_script/run_qemu.sh +++ b/riscv_script/run_qemu.sh @@ -9,7 +9,7 @@ QEMU_PREFIX_PATH="${QEMU_PREFIX_PATH:-../../build-toolchain-qemu/riscv-qemu/}" if [ "${USE_RVV}" = "ON" ];then QEMU_OPTION="-cpu rv64,zba=true,zbb=true,zbc=true,zbs=true,v=true,vlen=512,elen=64,vext_spec=v1.0 -L ${TOOLCHAIN_PATH}/sysroot" else - QEMU_OPTION="-cpu rv64,zba=true,zbb=true,zbc=true,zbs=true,v=true -L ${TOOLCHAIN_PATH}/sysroot" + QEMU_OPTION="-cpu rv64,zba=true,zbb=true,zbc=true,zbs=true -L ${TOOLCHAIN_PATH}/sysroot" fi $QEMU_PREFIX_PATH/bin/qemu-riscv64 $QEMU_OPTION $@ diff --git a/source/row_rvv.cc b/source/row_rvv.cc index 0ca4740b3..956ed9f95 100644 --- a/source/row_rvv.cc +++ b/source/row_rvv.cc @@ -19,7 +19,7 @@ #include "libyuv/row.h" -#if !defined(LIBYUV_DISABLE_RVV) && defined(__riscv) +#if !defined(LIBYUV_DISABLE_RVV) && defined(__riscv_vector) #include #ifdef __cplusplus @@ -323,4 +323,4 @@ void MergeXRGBRow_RVV(const uint8_t* src_r, } // namespace libyuv #endif -#endif // !defined(LIBYUV_DISABLE_RVV) && defined(__riscv) +#endif // !defined(LIBYUV_DISABLE_RVV) && defined(__riscv_vector)