Skip to content

Commit 35a2b9a

Browse files
committed
Remove build for risc-v CPUs.
1 parent a8c6188 commit 35a2b9a

File tree

4 files changed

+26
-17
lines changed

4 files changed

+26
-17
lines changed

opencv/CMakeLists.txt

+14-13
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,22 @@ set(extra_defines -D_DEFAULT_SOURCE)
1919
# Final flags for C and C++:
2020
set(c_flags "${includes} ${extra_defines}")
2121
set(cxx_flags "${includes} ${extra_defines}")
22-
## These flags for lates GCC to enable -DCV_INT32_T_IS_LONG_INT=ON
23-
# set(c_flags "${includes} ${extra_defines} -DCV_INT32_T_IS_LONG_INT=ON")
24-
# set(cxx_flags "${includes} ${extra_defines} -DCV_INT32_T_IS_LONG_INT=ON")
22+
23+
set(common_flags "-ggdb -ffunction-sections -fdata-sections")
2524

2625
# Calculate flags for optimizations, assertions, debug info:
27-
#if(COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
28-
# set(assert_flags "-DNDEBUG")
29-
#else()
30-
# set(assert_flags "-DDEBUG -D_DEBUG")
31-
#endif()
26+
if(COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
27+
set(assert_flags "-DNDEBUG")
28+
else()
29+
set(assert_flags "-DDEBUG -D_DEBUG")
30+
endif()
3231

33-
set(assert_flags "${assert_flags} -DDEBUG -D_DEBUG -ffunction-sections -fdata-sections")
32+
if(CONFIG_IDF_TARGET_ARCH_XTENSA)
33+
set(assert_flags "${assert_flags} -mlongcalls")
34+
endif()
3435

3536
if(CONFIG_COMPILER_OPTIMIZATION_DEFAULT)
36-
set(opt_flags "-Og -ggdb -mlongcalls ${assert_flags}")
37+
set(opt_flags "-Og ${common_flags} ${assert_flags}")
3738
set(opt_args -DCMAKE_BUILD_TYPE=Debug
3839
-DCMAKE_C_FLAGS_DEBUG=${opt_flags}
3940
-DCMAKE_CXX_FLAGS_DEBUG=${opt_flags})
@@ -42,20 +43,20 @@ elseif(CONFIG_COMPILER_OPTIMIZATION_SIZE)
4243
# however OpenCV CMake files only handle Debug and Release
4344
# (see e.g. opencv/cmake/OpenCVCompilerOptions.cmake).
4445
# So we redefine the flags for Release instead.
45-
set(opt_flags "-Os -ggdb -mlongcalls ${assert_flags}")
46+
set(opt_flags "-Os ${common_flags} ${assert_flags}")
4647
set(opt_args -DCMAKE_BUILD_TYPE=Release
4748
-DCMAKE_C_FLAGS_RELEASE=${opt_flags}
4849
-DCMAKE_CXX_FLAGS_RELEASE=${opt_flags})
4950
elseif(COMPILER_OPTIMIZATION_PERF)
5051
# Currently OpenCV fails to compile at -O2 level on Xtensa due to a compiler issue,
5152
# details in https://github.com/jcmvbkbc/gcc-xtensa/issues/14.
5253
# Compiling at -O3 happens to be okay.
53-
set(opt_flags "-O3 -ggdb -mlongcalls ${assert_flags}")
54+
set(opt_flags "-O3 ${common_flags} ${assert_flags}")
5455
set(opt_args -DCMAKE_BUILD_TYPE=Release
5556
-DCMAKE_C_FLAGS_RELEASE=${opt_flags}
5657
-DCMAKE_CXX_FLAGS_RELEASE=${opt_flags})
5758
elseif(COMPILER_OPTIMIZATION_NONE)
58-
set(opt_flags "-O0 -ggdb -mlongcalls ${assert_flags}")
59+
set(opt_flags "-O0 ${common_flags} ${assert_flags}")
5960
set(opt_args -DCMAKE_BUILD_TYPE=Debug
6061
-DCMAKE_C_FLAGS_DEBUG=${opt_flags}
6162
-DCMAKE_CXX_FLAGS_DEBUG=${opt_flags})

opencv/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# OpenCV library build for esp-idf
2-
This project used to build and include OpenCV library into the esp-idf as a component.
2+
This project used to build and include OpenCV library into the esp-idf as a component for esp32, esp32s2 and esp32s3 CPUs.
33
Now the opencv could be build with IDF version 4.4.
44
This component was tested with opencv V 4.6.0
5-
The build is working on Linux machines.
5+
The build is working only on Linux machines.
66

77
More details about OpenCV can be found [here](https://opencv.org/).

opencv/idf_component.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ description: OpenCV build for esp-idf
33
url: https://github.com/espressif/idf-extra-components/tree/master/opencv
44
dependencies:
55
idf: "==4.4"
6+
targets:
7+
- esp32
8+
- esp32s2
9+
- esp32s3

test_app/CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ endif()
1414

1515
# 2.1. Add here if the component is compatible with IDF == v4.3
1616
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_EQUAL "4.3")
17-
list(APPEND EXTRA_COMPONENT_DIRS ../opencv)
17+
if((${IDF_TARGET} STREQUAL "esp32") OR (${IDF_TARGET} STREQUAL "esp32s2") OR (${IDF_TARGET} STREQUAL "esp32s3"))
18+
list(APPEND EXTRA_COMPONENT_DIRS ../opencv)
19+
endif()
1820
endif()
1921

2022
# 2.2. Add here if the component is compatible with IDF == v4.4
2123
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_EQUAL "4.4")
22-
list(APPEND EXTRA_COMPONENT_DIRS ../opencv)
24+
if((${IDF_TARGET} STREQUAL "esp32") OR (${IDF_TARGET} STREQUAL "esp32s2") OR (${IDF_TARGET} STREQUAL "esp32s3"))
25+
list(APPEND EXTRA_COMPONENT_DIRS ../opencv)
26+
endif()
2327
endif()
2428

2529
# 3. Add here if the component is compatible with IDF >= v5.0

0 commit comments

Comments
 (0)