mirror of
https://github.com/opencv/opencv.git
synced 2025-07-24 14:06:27 +08:00

hal/riscv-rvv: refactor the building process #27301 Current hal/riscv-rvv is built with all headers without building an object. This slows down the compilation progress, especially when re-compiling for minor changes in those headers (~170 files need to be re-compiled). This patch solves the problem. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
27 lines
1.2 KiB
CMake
27 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION ${MIN_VER_CMAKE} FATAL_ERROR)
|
|
|
|
set(RVV_HAL_INCLUDE_DIR include)
|
|
set(RVV_HAL_SOURCE_DIR src)
|
|
|
|
file(GLOB rvv_hal_headers RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "${RVV_HAL_INCLUDE_DIR}/*.hpp")
|
|
file(GLOB rvv_hal_sources RELATIVE "${CMAKE_CURRENT_LIST_DIR}" "${RVV_HAL_SOURCE_DIR}/**/*.cpp")
|
|
|
|
set(HAL_LIB_NAME "rvv_hal")
|
|
add_library(${HAL_LIB_NAME} STATIC)
|
|
target_sources(${HAL_LIB_NAME} PRIVATE ${rvv_hal_headers} ${rvv_hal_sources})
|
|
|
|
set_target_properties(${HAL_LIB_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH})
|
|
if(NOT BUILD_SHARED_LIBS)
|
|
ocv_install_target(${HAL_LIB_NAME} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
|
|
endif()
|
|
target_include_directories(${HAL_LIB_NAME} PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${CMAKE_SOURCE_DIR}/modules/core/include
|
|
${CMAKE_SOURCE_DIR}/modules/imgproc/include) # ${CMAKE_SOURCE_DIR}/modules/features2d/include
|
|
|
|
set(RVV_HAL_FOUND TRUE CACHE INTERNAL "")
|
|
set(RVV_HAL_VERSION "0.0.1" CACHE INTERNAL "")
|
|
set(RVV_HAL_LIBRARIES ${HAL_LIB_NAME} CACHE INTERNAL "")
|
|
set(RVV_HAL_HEADERS "rvv_hal.hpp" CACHE INTERNAL "")
|
|
set(RVV_HAL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "")
|