From a8e9989383565c63a24fbe9468c1e790429c5f4a Mon Sep 17 00:00:00 2001 From: Georgy Krivoruchko Date: Fri, 24 Nov 2023 01:16:10 -0800 Subject: [PATCH] [CMAKE] Keep frontend's folder structure for Visual Studio (#21222) --- .../frontends/frontends.cmake | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cmake/developer_package/frontends/frontends.cmake b/cmake/developer_package/frontends/frontends.cmake index 49c5b881030..1a037c5ab72 100644 --- a/cmake/developer_package/frontends/frontends.cmake +++ b/cmake/developer_package/frontends/frontends.cmake @@ -80,6 +80,25 @@ endfunction() unset(protobuf_lite_installed CACHE) unset(protobuf_installed CACHE) +# +# ov_frontend_group_files( # Root path for scanning +# # Relative path (in ROOT_DIR) is used for scanning +# ) # File extension for grouping +# +macro(ov_frontend_group_files root_dir rel_path file_mask) + file(GLOB items RELATIVE ${root_dir}/${rel_path} ${root_dir}/${rel_path}/*) + foreach(item ${items}) + if(IS_DIRECTORY ${root_dir}/${rel_path}/${item}) + ov_frontend_group_files(${root_dir} ${rel_path}/${item} ${file_mask}) + else() + if(${item} MATCHES ".*\.${file_mask}$") + string(REPLACE "/" "\\" groupname ${rel_path}) + source_group(${groupname} FILES ${root_dir}/${rel_path}/${item}) + endif() + endif() + endforeach() +endmacro() + # # ov_add_frontend(NAME # FILEDESCRIPTION # used on Windows to describe DLL file @@ -121,7 +140,8 @@ macro(ov_add_frontend) # Create named folders for the sources within the .vcproj # Empty name lists them directly under the .vcproj - source_group("src" FILES ${LIBRARY_SRC}) + ov_frontend_group_files(${frontend_root_dir}/ "src" "cpp") + ov_frontend_group_files(${frontend_root_dir}/ "src" "proto") source_group("include" FILES ${LIBRARY_HEADERS}) source_group("public include" FILES ${LIBRARY_PUBLIC_HEADERS})