simbit18 commented on code in PR #9782:
URL: https://github.com/apache/nuttx/pull/9782#discussion_r2068158264


##########
tools/nxmake2cmake.py:
##########
@@ -0,0 +1,241 @@
+#!/usr/bin/env python3
+############################################################################
+# tools/nxmake2cmake.py
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+import argparse
+import os
+import sys
+from string import Template
+
+if sys.version_info[0] < 3:
+    raise Exception("Must be using Python 3")
+
+
+def board_cmakelist_get(path):
+    template = """# 
##############################################################################
+# $board_path/CMakeLists.txt
+#
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more 
contributor
+# license agreements.  See the NOTICE file distributed with this work for
+# additional information regarding copyright ownership.  The ASF licenses this
+# file to you under the Apache License, Version 2.0 (the "License"); you may 
not
+# use this file except in compliance with the License.  You may obtain a copy 
of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+# 
##############################################################################
+
+add_subdirectory(src)
+"""
+    temp_obj = Template(template)
+    return temp_obj.substitute(board_path=path)
+
+
+def add_board_cmakelist(path):
+    cmpath = os.path.join(path, "CMakeLists.txt")
+
+    print("Add", cmpath)
+
+    with open(cmpath, "w") as f:
+        content = board_cmakelist_get(path)
+        content = board_cmakelist_get(path)
+        f.write(content)
+
+
+def file_update_path(s, oldpath, newpath):
+    return s.replace(oldpath, newpath)
+
+
+def convert_make_conditional(content):
+    content = content.replace(",y)", "")
+    content = content.replace("ifeq ($", "if")
+    content = content.replace("ifneq ($(", "if(NOT ")
+    content = content.replace("else", "else()")
+    content = content.replace("endif", "endif()")

Review Comment:
   ```
       content = content.replace("else ifeq ($", "elseif")   
       content = content.replace("ifeq ($", "if")
       content = content.replace("ifneq ($(", "if(NOT ")
   ```
   
   added “else ifeq”
   
   ```
       content = content.replace("else\n", "else()\n")
       content = content.replace("endif\n", "endif()\n")
   ```
   Need to add \n to not replace “else ifeq”
   
   
   
   



-- 
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...@nuttx.apache.org

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

Reply via email to