File tree 4 files changed +40
-40
lines changed
4 files changed +40
-40
lines changed Original file line number Diff line number Diff line change @@ -449,7 +449,7 @@ enable_testing()
449
449
450
450
# ---[ Build variables set within the cmake tree
451
451
include (cmake/BuildVariables.cmake)
452
- set (CAFFE2_WHITELIST "" CACHE STRING "A whitelist file of files that one should build." )
452
+ set (CAFFE2_ALLOWLIST "" CACHE STRING "A allowlist file of files that one should build." )
453
453
454
454
# Set default build type
455
455
if (NOT CMAKE_BUILD_TYPE )
@@ -499,8 +499,8 @@ if(USE_VULKAN_SHADERC_RUNTIME)
499
499
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_VULKAN_SHADERC_RUNTIME" )
500
500
endif ()
501
501
502
- # ---[ Whitelist file if whitelist is specified
503
- include (cmake/Whitelist .cmake)
502
+ # ---[ Allowlist file if allowlist is specified
503
+ include (cmake/Allowlist .cmake)
504
504
505
505
# ---[ Set link flag, handle additional deps for gcc 4.8 and above
506
506
if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8.0 AND NOT ANDROID)
Original file line number Diff line number Diff line change @@ -142,12 +142,12 @@ if(NOT INTERN_BUILD_MOBILE OR BUILD_CAFFE2_MOBILE)
142
142
add_subdirectory (transforms)
143
143
endif ()
144
144
145
- # Advanced: if we have white list specified, we will do intersections for all
145
+ # Advanced: if we have allow list specified, we will do intersections for all
146
146
# main lib srcs.
147
- if (CAFFE2_WHITELISTED_FILES )
148
- caffe2_do_whitelist (Caffe2_CPU_SRCS CAFFE2_WHITELISTED_FILES )
149
- caffe2_do_whitelist (Caffe2_GPU_SRCS CAFFE2_WHITELISTED_FILES )
150
- caffe2_do_whitelist (Caffe2_HIP_SRCS CAFFE2_WHITELISTED_FILES )
147
+ if (CAFFE2_ALLOWLISTED_FILES )
148
+ caffe2_do_allowlist (Caffe2_CPU_SRCS CAFFE2_ALLOWLISTED_FILES )
149
+ caffe2_do_allowlist (Caffe2_GPU_SRCS CAFFE2_ALLOWLISTED_FILES )
150
+ caffe2_do_allowlist (Caffe2_HIP_SRCS CAFFE2_ALLOWLISTED_FILES )
151
151
endif ()
152
152
153
153
# Debug messages - if you want to get a list of source files, enable the
Original file line number Diff line number Diff line change
1
+
2
+ if (__caffe2_allowlist_included)
3
+ return ()
4
+ endif ()
5
+
6
+ set (__caffe2_allowlist_included TRUE )
7
+
8
+ set (CAFFE2_ALLOWLISTED_FILES)
9
+ if (NOT CAFFE2_ALLOWLIST)
10
+ return ()
11
+ endif ()
12
+
13
+ # First read the allowlist file and break it by line.
14
+ file (READ "${CAFFE2_ALLOWLIST} " allowlist_content)
15
+ # Convert file contents into a CMake list
16
+ string (REGEX REPLACE "\n " ";" allowlist_content ${allowlist_content} )
17
+
18
+ foreach (item ${allowlist_content} )
19
+ file (GLOB_RECURSE tmp ${item} )
20
+ set (CAFFE2_ALLOWLISTED_FILES ${CAFFE2_ALLOWLISTED_FILES} ${tmp} )
21
+ endforeach ()
22
+
23
+ macro (caffe2_do_allowlist output allowlist)
24
+ set (_tmp)
25
+ foreach (item ${${output} })
26
+ list (FIND ${allowlist} ${item} _index)
27
+ if (${_index} GREATER -1)
28
+ set (_tmp ${_tmp} ${item} )
29
+ endif ()
30
+ endforeach ()
31
+ set (${output} ${_tmp} )
32
+ endmacro ()
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments