mehrdadh commented on code in PR #13885:
URL: https://github.com/apache/tvm/pull/13885#discussion_r1102140081


##########
apps/microtvm/zephyr/template_project/microtvm_api_server.py:
##########
@@ -658,13 +673,31 @@ def generate_project(self, model_library_format_path, 
standalone_crt_dir, projec
             API_SERVER_DIR / "crt_config" / "crt_config.h", crt_config_dir / 
"crt_config.h"
         )
 
-        # Populate src/
+        # Populate src and include
         src_dir = project_dir / "src"
-        if project_type != "host_driven" or self._is_fvp(zephyr_board, 
use_fvp):
-            shutil.copytree(API_SERVER_DIR / "src" / project_type, src_dir)
-        else:
-            src_dir.mkdir()
-            shutil.copy2(API_SERVER_DIR / "src" / project_type / "main.c", 
src_dir)
+        src_dir.mkdir()
+        include_dir = project_dir / "include" / "tvm"
+        include_dir.mkdir(parents=True)
+        src_project_type_dir = API_SERVER_DIR / "src" / project_type
+        for file in os.listdir(src_project_type_dir):
+            file = pathlib.Path(src_project_type_dir / file)
+            if file.is_file():
+                if file.suffix in [".cc", ".c"]:
+                    shutil.copy2(file, src_dir)
+                elif file.suffix in [".h"]:
+                    shutil.copy2(file, include_dir)
+
+        if self._is_fvp(zephyr_board, use_fvp):
+            for file in os.listdir(src_project_type_dir / "fvp"):
+                file = pathlib.Path(src_project_type_dir / "fvp" / file)
+                if file.is_file():
+                    if file.suffix in [".cc", ".c"]:
+                        shutil.copy2(file, src_dir)
+                    elif file.suffix in [".h"]:
+                        shutil.copy2(file, include_dir)

Review Comment:
   done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to