Ver código fonte

CMake updates (#1357)

Sources added to the cmsis-nn static library should with added with
scope PRIVATE. Else they will be exported and built by the other
target linking the library.

Compile options should be set per target.

Change-Id: Ib5c5ce1db8f7baa28bba411be7eea955f5a3af29

Co-authored-by: Kristofer Jonsson <kristofer.jonsson@arm.com>
Måns Nilsson 4 anos atrás
pai
commit
8f6fcd019c

+ 1 - 3
CMSIS/NN/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -24,8 +24,6 @@ set(CMSIS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../..")
 
 option(BUILD_CMSIS_NN_FUNCTIONS "Build CMSIS-NN Source." ON)
 
-add_compile_options(-Ofast)
-
 if(BUILD_CMSIS_NN_FUNCTIONS)
     add_subdirectory(Source)
 endif()

+ 2 - 2
CMSIS/NN/Source/ActivationFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,4 +17,4 @@
 #
 
 file(GLOB SRC "./*_s8.c")
-target_sources(cmsis-nn PUBLIC ${SRC})
+target_sources(cmsis-nn PRIVATE ${SRC})

+ 2 - 2
CMSIS/NN/Source/BasicMathFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,4 +17,4 @@
 #
 
 file(GLOB SRC "./*_*.c")
-target_sources(cmsis-nn PUBLIC ${SRC})
+target_sources(cmsis-nn PRIVATE ${SRC})

+ 3 - 1
CMSIS/NN/Source/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -49,6 +49,8 @@ list(APPEND CMAKE_MODULE_PATH ${NN}/Source)
 
 add_library(cmsis-nn STATIC)
 
+target_compile_options(cmsis-nn PRIVATE -Ofast)
+
 ### Includes
 target_include_directories(cmsis-nn PUBLIC "${NN}/Include")
 target_include_directories(cmsis-nn PUBLIC "${ROOT}/CMSIS/Core/Include")

+ 2 - 2
CMSIS/NN/Source/ConcatenationFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,4 +17,4 @@
 #
 
 file(GLOB SRC "./*_*.c")
-target_sources(cmsis-nn PUBLIC ${SRC})
+target_sources(cmsis-nn PRIVATE ${SRC})

+ 2 - 2
CMSIS/NN/Source/ConvolutionFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,7 +17,7 @@
 #
 
 file(GLOB SRC "./*_s8*.c")
-target_sources(cmsis-nn PUBLIC arm_convolve_s16.c arm_convolve_wrapper_s16.c arm_convolve_fast_s16.c ${SRC})
+target_sources(cmsis-nn PRIVATE arm_convolve_s16.c arm_convolve_wrapper_s16.c arm_convolve_fast_s16.c ${SRC})
 
 
 

+ 2 - 2
CMSIS/NN/Source/FullyConnectedFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,5 +17,5 @@
 #
 
 file(GLOB SRC "./*_s8.c")
-target_sources(cmsis-nn PUBLIC ${SRC} arm_fully_connected_s16.c)
+target_sources(cmsis-nn PRIVATE ${SRC} arm_fully_connected_s16.c)
 

+ 2 - 2
CMSIS/NN/Source/NNSupportFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,7 +17,7 @@
 #
 
 file(GLOB SRC "./*_s8.c")
-target_sources(cmsis-nn PUBLIC ${SRC} arm_q7_to_q15_with_offset.c
+target_sources(cmsis-nn PRIVATE ${SRC} arm_q7_to_q15_with_offset.c
                                       arm_nn_mat_mul_kernel_s16.c
                                       arm_q7_to_q15_with_offset.c
                                       arm_nn_mat_mul_kernel_s16.c

+ 2 - 2
CMSIS/NN/Source/PoolingFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,6 +17,6 @@
 #
 
 file(GLOB SRC "./*_s8.c")
-target_sources(cmsis-nn PUBLIC ${SRC})
+target_sources(cmsis-nn PRIVATE ${SRC})
 
 

+ 2 - 2
CMSIS/NN/Source/ReshapeFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,4 +17,4 @@
 #
 
 file(GLOB SRC "./*_*.c")
-target_sources(cmsis-nn PUBLIC ${SRC})
+target_sources(cmsis-nn PRIVATE ${SRC})

+ 2 - 2
CMSIS/NN/Source/SVDFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,4 +17,4 @@
 #
 
 file(GLOB SRC "./*_s8.c")
-target_sources(cmsis-nn PUBLIC ${SRC})
+target_sources(cmsis-nn PRIVATE ${SRC})

+ 2 - 2
CMSIS/NN/Source/SoftmaxFunctions/CMakeLists.txt

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2019-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2019-2021 Arm Limited.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -17,4 +17,4 @@
 #
 
 file(GLOB SRC "./*_s8.c")
-target_sources(cmsis-nn PUBLIC ${SRC})
+target_sources(cmsis-nn PRIVATE ${SRC})