Skip to content

Commit 0329a8a

Browse files
Cortex_m backend: Simplify CMSIS-NN build (pytorch#14463)
- Use FetchContent_MakeAvailable to define cmsis-nn target - Remove custom MVE definition. Instead use the one defined in CMSIS-NN Signed-off-by: Adrian Lundell <[email protected]>
1 parent 57ca96f commit 0329a8a

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

backends/cortex_m/CMakeLists.txt

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ set(CMSIS_NN_LOCAL_PATH
3636
# library is downloaded via FetchContent in the default/regular case.
3737
if(CMSIS_NN_LOCAL_PATH AND EXISTS "${CMSIS_NN_LOCAL_PATH}")
3838
message(STATUS "Using CMSIS-NN from specified path: ${CMSIS_NN_LOCAL_PATH}")
39-
add_subdirectory(${CMSIS_NN_LOCAL_PATH} cmsis_nn_build)
39+
add_subdirectory(${CMSIS_NN_LOCAL_PATH} _deps/cmsis_nn-build)
4040
else()
4141
# Use FetchContent with automatic fallback
4242
message(STATUS "Using CMSIS-NN via FetchContent")
@@ -48,23 +48,7 @@ else()
4848
GIT_SHALLOW TRUE
4949
)
5050

51-
FetchContent_GetProperties(cmsis_nn)
52-
if(NOT cmsis_nn_POPULATED)
53-
FetchContent_Populate(cmsis_nn)
54-
add_subdirectory(${cmsis_nn_SOURCE_DIR} ${cmsis_nn_BINARY_DIR})
55-
endif()
56-
endif()
57-
58-
# Add MVEI define to cmsis-nn target
59-
if(TARGET cmsis-nn)
60-
target_compile_definitions(cmsis-nn PUBLIC ARM_MATH_MVEI=1)
61-
get_target_property(CMSIS_NN_INCLUDES cmsis-nn INTERFACE_INCLUDE_DIRECTORIES)
62-
message(STATUS "CMSIS-NN include dirs: ${CMSIS_NN_INCLUDES}")
63-
else()
64-
message(
65-
FATAL_ERROR
66-
"CMSIS-NN target not found. Check your CMSIS_NN_LOCAL_PATH or network connection."
67-
)
51+
FetchContent_MakeAvailable(cmsis_nn)
6852
endif()
6953

7054
# Cortex-M ops kernel sources

0 commit comments

Comments
 (0)