This is an automated email from the ASF dual-hosted git repository.

raiden00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git

commit c0707b5fc30d8c84ee79eb3a42f4eabb04efdf9f
Author: chao an <[email protected]>
AuthorDate: Tue Jul 25 11:41:04 2023 +0800

    system/artable3: add cmake build support
    
    Signed-off-by: chao an <[email protected]>
---
 system/argtable3/CMakeLists.txt | 91 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 91 insertions(+)

diff --git a/system/argtable3/CMakeLists.txt b/system/argtable3/CMakeLists.txt
new file mode 100644
index 000000000..659fb3e51
--- /dev/null
+++ b/system/argtable3/CMakeLists.txt
@@ -0,0 +1,91 @@
+# 
##############################################################################
+# apps/system/argtable3/CMakeLists.txt
+#
+# 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.
+#
+# 
##############################################################################
+
+if(CONFIG_SYSTEM_ARGTABLE3)
+  nuttx_add_library(argtable3)
+
+  if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/argtable3/.git)
+
+    if(NOT CONFIG_SYSTEM_ARGTABLE3_URL)
+      set(CONFIG_SYSTEM_ARGTABLE3_URL
+          "https://github.com/argtable/argtable3/archive";)
+    endif()
+
+    if(NOT CONFIG_SYSTEM_ARGTABLE3_VERSION)
+      set(CONFIG_SYSTEM_ARGTABLE3_VERSION "3.2.0.7402e6e")
+    endif()
+
+    FetchContent_Declare(
+      argtable3
+      DOWNLOAD_NAME "v${CONFIG_SYSTEM_ARGTABLE3_VERSION}.tar.gz"
+      DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}
+      URL 
"${CONFIG_SYSTEM_ARGTABLE3_URL}/v${CONFIG_SYSTEM_ARGTABLE3_VERSION}.tar.gz"
+          SOURCE_DIR
+          ${CMAKE_CURRENT_LIST_DIR}/argtable3
+          BINARY_DIR
+          ${CMAKE_BINARY_DIR}/apps/system/argtable3/argtable3
+          CONFIGURE_COMMAND
+          ""
+          BUILD_COMMAND
+          ""
+          INSTALL_COMMAND
+          ""
+          TEST_COMMAND
+          ""
+      DOWNLOAD_NO_PROGRESS true
+      TIMEOUT 30)
+
+    FetchContent_GetProperties(argtable3)
+
+    if(NOT argtable3_POPULATED)
+      FetchContent_Populate(argtable3)
+    endif()
+  endif()
+
+  set(SRCS)
+  file(GLOB SRCS ${CMAKE_CURRENT_LIST_DIR}/argtable3/src/*.c)
+
+  if(CONFIG_SYSTEM_ARGTABLE3_TEST)
+    file(GLOB testsrcs ${CMAKE_CURRENT_LIST_DIR}/argtable3/tests/*.c)
+
+    nuttx_add_application(
+      NAME
+      ${CONFIG_SYSTEM_ARGTABLE3_TEST_PROGNAME}
+      SRCS
+      ${CMAKE_CURRENT_LIST_DIR}/argtable3/tests/testall.c
+      ${testsrcs}
+      INCLUDE_DIRECTORIES
+      ${CMAKE_CURRENT_LIST_DIR}/argtable3/src
+      STACKSIZE
+      ${CONFIG_SYSTEM_ARGTABLE3_TEST_STACKSIZE}
+      PRIORITY
+      ${CONFIG_SYSTEM_ARGTABLE3_TEST_PRIORITY})
+  endif()
+
+  target_sources(argtable3 PRIVATE ${SRCS})
+
+  if(NOT EXISTS ${CMAKE_BINARY_DIR}/apps/include/argtable3.h)
+    file(CREATE_LINK ${CMAKE_CURRENT_LIST_DIR}/argtable3/src/argtable3.h
+         ${CMAKE_BINARY_DIR}/apps/include/argtable3.h SYMBOLIC)
+  endif()
+
+  target_compile_options(argtable3 PRIVATE -DARG_REPLACE_GETOPT=0)
+
+endif()

Reply via email to