@@ -801,6 +801,33 @@ if(NOT (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Windows))
801
801
endif ()
802
802
803
803
# When running CMake it must be ensured that all dependencies are correctly acquired.
804
+ # Gather syscall dependencies
805
+ list (APPEND SYSCALL_SCAN_DIRS ${ZEPHYR_BASE} /include ${ZEPHYR_BASE} /drivers ${ZEPHYR_BASE} /subsys/net)
806
+
807
+ if (CONFIG_APPLICATION_DEFINED_SYSCALL)
808
+ list (APPEND SYSCALL_INCLUDE_DIRS ${APPLICATION_SOURCE_DIR} )
809
+ endif ()
810
+
811
+ if (CONFIG_ZTEST)
812
+ list (APPEND SYSCALL_INCLUDE_DIRS ${ZEPHYR_BASE} /subsys/testsuite/ztest/include )
813
+
814
+ if (CONFIG_NO_OPTIMIZATIONS AND CONFIG_ZTEST_WARN_NO_OPTIMIZATIONS)
815
+ message (WARNING "Running tests with CONFIG_NO_OPTIMIZATIONS is generally "
816
+ "not supported and known to break in many cases due to stack overflow or "
817
+ "other problems. Please do not file issues about it unless the test is "
818
+ "specifically tuned to run in this configuration. To disable this warning "
819
+ "set CONFIG_ZTEST_WARN_NO_OPTIMIZATIONS=n." )
820
+ endif ()
821
+ endif ()
822
+
823
+ get_property (
824
+ syscalls_include_list
825
+ TARGET syscalls_interface
826
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES
827
+ )
828
+ list (APPEND SYSCALL_INCLUDE_DIRS ${syscalls_include_list} )
829
+
830
+ # Walk dependencies to find all subfolders
804
831
execute_process (
805
832
COMMAND
806
833
${PYTHON_EXECUTABLE}
@@ -813,7 +840,12 @@ execute_process(
813
840
file (STRINGS ${syscalls_subdirs_txt} PARSE_SYSCALLS_PATHS_DEPENDS ENCODING UTF-8)
814
841
815
842
# Each header file must be monitored as file modifications are not reflected on directory level.
816
- file (GLOB_RECURSE PARSE_SYSCALLS_HEADER_DEPENDS ${ZEPHYR_BASE} /include /*.h)
843
+ foreach (d IN LISTS SYSCALL_SCAN_DIRS SYSCALL_INCLUDE_DIRS)
844
+ list (APPEND glob_syscalls_headers
845
+ ${d} /*.h
846
+ )
847
+ endforeach ()
848
+ file (GLOB_RECURSE PARSE_SYSCALLS_HEADER_DEPENDS ${glob_syscalls_headers} )
817
849
818
850
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL Windows)
819
851
# On windows only adding/removing files or folders will be reflected in depends.
@@ -856,30 +888,12 @@ else()
856
888
set_property (DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${syscalls_subdirs_txt} )
857
889
endif ()
858
890
859
- # syscall declarations are searched for in the SYSCALL_INCLUDE_DIRS
860
- if (CONFIG_APPLICATION_DEFINED_SYSCALL)
861
- list (APPEND SYSCALL_INCLUDE_DIRS ${APPLICATION_SOURCE_DIR} )
862
- endif ()
863
-
864
- if (CONFIG_ZTEST)
865
- list (APPEND SYSCALL_INCLUDE_DIRS ${ZEPHYR_BASE} /subsys/testsuite/ztest/include )
866
-
867
- if (CONFIG_NO_OPTIMIZATIONS AND CONFIG_ZTEST_WARN_NO_OPTIMIZATIONS)
868
- message (WARNING "Running tests with CONFIG_NO_OPTIMIZATIONS is generally "
869
- "not supported and known to break in many cases due to stack overflow or "
870
- "other problems. Please do not file issues about it unless the test is "
871
- "specifically tuned to run in this configuration. To disable this warning "
872
- "set CONFIG_ZTEST_WARN_NO_OPTIMIZATIONS=n." )
873
- endif ()
874
-
875
- endif ()
876
-
877
- get_property (
878
- syscalls_include_list
879
- TARGET syscalls_interface
880
- PROPERTY INTERFACE_INCLUDE_DIRECTORIES
881
- )
882
- list (APPEND SYSCALL_INCLUDE_DIRS ${syscalls_include_list} )
891
+ # syscall declarations are searched for in the SYSCALL_SCAN_DIRS and SYSCALL_INCLUDE_DIRS
892
+ foreach (d ${SYSCALL_SCAN_DIRS} )
893
+ list (APPEND parse_syscalls_scan_args
894
+ --scan ${d}
895
+ )
896
+ endforeach ()
883
897
884
898
foreach (d ${SYSCALL_INCLUDE_DIRS} )
885
899
list (APPEND parse_syscalls_include_args
@@ -894,9 +908,7 @@ add_custom_command(
894
908
COMMAND
895
909
${PYTHON_EXECUTABLE}
896
910
${ZEPHYR_BASE} /scripts/build /parse_syscalls.py
897
- --scan ${ZEPHYR_BASE} /include # Read files from this dir
898
- --scan ${ZEPHYR_BASE} /drivers # For net sockets
899
- --scan ${ZEPHYR_BASE} /subsys/net # More net sockets
911
+ ${parse_syscalls_scan_args} # Search for syscall declarations in these dirs
900
912
${parse_syscalls_include_args} # Read files from these dirs also
901
913
--json-file ${syscalls_json} # Write this file
902
914
--tag-struct-file ${struct_tags_json} # Write subsystem list to this file
0 commit comments