vendor: OpenCV 5.0.0 snapshot at 40738fb16ceddb5fb3fea747585f7ce6abb0605b
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
# This file is part of OpenCV project.
|
||||
# It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
# of this distribution and at http://opencv.org/license.html
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR AArch64)
|
||||
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
set(PORT_FILE ${CMAKE_SOURCE_DIR}/platforms/semihosting/include/aarch64_semihosting_port.hpp)
|
||||
|
||||
set(COMMON_FLAGS "--specs=rdimon.specs -DOPENCV_INCLUDE_PORT_FILE=\\\"${PORT_FILE}\\\"")
|
||||
|
||||
set(CMAKE_AR ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-ar${CMAKE_EXECUTABLE_SUFFIX})
|
||||
set(CMAKE_ASM_COMPILER ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-gcc${CMAKE_EXECUTABLE_SUFFIX})
|
||||
set(CMAKE_C_COMPILER ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-gcc${CMAKE_EXECUTABLE_SUFFIX})
|
||||
set(CMAKE_CXX_COMPILER ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-g++${CMAKE_EXECUTABLE_SUFFIX})
|
||||
set(CMAKE_LINKER ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-ld${CMAKE_EXECUTABLE_SUFFIX})
|
||||
set(CMAKE_OBJCOPY ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-objcopy${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
||||
set(CMAKE_RANLIB ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-ranlib${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
||||
set(CMAKE_SIZE ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-size${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
||||
set(CMAKE_STRIP ${SEMIHOSTING_TOOLCHAIN_PATH}aarch64-none-elf-strip${CMAKE_EXECUTABLE_SUFFIX} CACHE INTERNAL "")
|
||||
set(CMAKE_C_FLAGS ${COMMON_FLAGS} CACHE INTERNAL "")
|
||||
set(CMAKE_CXX_FLAGS ${COMMON_FLAGS} CACHE INTERNAL "")
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
set(OPENCV_SEMIHOSTING ON)
|
||||
set(OPENCV_DISABLE_THREAD_SUPPORT ON)
|
||||
set(OPENCV_DISABLE_FILESYSTEM_SUPPORT ON)
|
||||
set(BUILD_SHARED_LIBS OFF)
|
||||
set(OPENCV_FORCE_3RDPARTY_BUILD OFF)
|
||||
|
||||
|
||||
# Enable newlib.
|
||||
add_definitions(-D_GNU_SOURCE)
|
||||
|
||||
add_definitions(-D_POSIX_PATH_MAX=0)
|
||||
@@ -0,0 +1,42 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
#ifndef AARCH64_BAREMETAL_PORT_HPP
|
||||
#define AARCH64_BAREMETAL_PORT_HPP
|
||||
|
||||
#include <malloc.h> // Needed for `memalign`.
|
||||
#include <sys/errno.h> // Needed for `ENOMEM`.
|
||||
|
||||
// -std=c++11 is missing the following definitions when targeting
|
||||
// semihosting on aarch64.
|
||||
#if __cplusplus == 201103L
|
||||
#include <cmath>
|
||||
#define M_PI 3.14159265358979323846
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
|
||||
namespace std {
|
||||
inline double cbrt(double x) {
|
||||
return ::cbrt(x);
|
||||
}
|
||||
inline double copysign(double mag, double sgn) {
|
||||
return ::copysign(mag, sgn);
|
||||
}
|
||||
} //namespace std
|
||||
#endif // __cplusplus == 201103L
|
||||
|
||||
extern "C" {
|
||||
// Redirect the implementation of `posix_memalign` to `memalign`
|
||||
// as the former is
|
||||
// missing at link time. https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html
|
||||
__attribute__((weak)) int posix_memalign(void **memptr, size_t alignment, size_t size) {
|
||||
void * ptr = memalign(alignment, size);
|
||||
if (ptr != NULL) {
|
||||
*memptr = ptr;
|
||||
return 0;
|
||||
}
|
||||
return ENOMEM;
|
||||
}
|
||||
} // extern "C"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user