From 24319beed3e6bbcde21a51c3cf9942526e29c9ad Mon Sep 17 00:00:00 2001 From: xuxin19 Date: Wed, 9 Aug 2023 20:15:20 +0800 Subject: [PATCH] cmake:migrate apps CMakeLists for canutils Signed-off-by: xuxin19 --- canutils/CMakeLists.txt | 2 ++ canutils/candump/CMakeLists.txt | 37 +++++++++++++++++++++++++++++ canutils/canlib/CMakeLists.txt | 26 ++++++++++++++++++++ canutils/cansend/CMakeLists.txt | 37 +++++++++++++++++++++++++++++ canutils/libcanutils/CMakeLists.txt | 25 +++++++++++++++++++ canutils/libobd2/CMakeLists.txt | 26 ++++++++++++++++++++ canutils/slcan/CMakeLists.txt | 33 +++++++++++++++++++++++++ 7 files changed, 186 insertions(+) create mode 100644 canutils/candump/CMakeLists.txt create mode 100644 canutils/canlib/CMakeLists.txt create mode 100644 canutils/cansend/CMakeLists.txt create mode 100644 canutils/libcanutils/CMakeLists.txt create mode 100644 canutils/libobd2/CMakeLists.txt create mode 100644 canutils/slcan/CMakeLists.txt diff --git a/canutils/CMakeLists.txt b/canutils/CMakeLists.txt index 1c0d9bb563..238b40af20 100644 --- a/canutils/CMakeLists.txt +++ b/canutils/CMakeLists.txt @@ -18,4 +18,6 @@ # # ############################################################################## +nuttx_add_subdirectory() + nuttx_generate_kconfig(MENUDESC "CAN Utilities") diff --git a/canutils/candump/CMakeLists.txt b/canutils/candump/CMakeLists.txt new file mode 100644 index 0000000000..590f7897bd --- /dev/null +++ b/canutils/candump/CMakeLists.txt @@ -0,0 +1,37 @@ +# ############################################################################## +# apps/canutils/candump/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_CANUTILS_CANDUMP) + + set(LIBCANUTILS_DIR ${NUTTX_APPS_DIR}/canutils/libcanutils) + + nuttx_add_application( + NAME + candump + STACKSIZE + ${CONFIG_CANUTILS_CANDUMP_STACKSIZE} + MODULE + ${CONFIG_CANUTILS_CANDUMP} + SRCS + candump.c + INCLUDE_DIRECTORIES + ${LIBCANUTILS_DIR}) + +endif() diff --git a/canutils/canlib/CMakeLists.txt b/canutils/canlib/CMakeLists.txt new file mode 100644 index 0000000000..9cdfb31288 --- /dev/null +++ b/canutils/canlib/CMakeLists.txt @@ -0,0 +1,26 @@ +# ############################################################################## +# apps/canutils/canlib/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_CANUTILS_CANLIB) + + target_sources( + apps PRIVATE canlib_getbaud.c canlib_setbaud.c canlib_getloopback.c + canlib_setloopback.c canlib_getsilent.c canlib_setsilent.c) + +endif() diff --git a/canutils/cansend/CMakeLists.txt b/canutils/cansend/CMakeLists.txt new file mode 100644 index 0000000000..207911f657 --- /dev/null +++ b/canutils/cansend/CMakeLists.txt @@ -0,0 +1,37 @@ +# ############################################################################## +# apps/canutils/cansend/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_CANUTILS_CANSEND) + + set(LIBCANUTILS_DIR ${NUTTX_APPS_DIR}/canutils/libcanutils) + + nuttx_add_application( + NAME + cansend + STACKSIZE + ${CONFIG_CANUTILS_CANSEND_STACKSIZE} + MODULE + ${CONFIG_CANUTILS_CANSEND} + SRCS + cansend.c + INCLUDE_DIRECTORIES + ${LIBCANUTILS_DIR}) + +endif() diff --git a/canutils/libcanutils/CMakeLists.txt b/canutils/libcanutils/CMakeLists.txt new file mode 100644 index 0000000000..62943e924c --- /dev/null +++ b/canutils/libcanutils/CMakeLists.txt @@ -0,0 +1,25 @@ +# ############################################################################## +# apps/canutils/libcanutils/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_CANUTILS_LIBCANUTILS) + + target_sources(apps PRIVATE lib.c) + +endif() diff --git a/canutils/libobd2/CMakeLists.txt b/canutils/libobd2/CMakeLists.txt new file mode 100644 index 0000000000..ee9515a8ac --- /dev/null +++ b/canutils/libobd2/CMakeLists.txt @@ -0,0 +1,26 @@ +# ############################################################################## +# apps/canutils/libobd2/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_CANUTILS_LIBOBD2) + + target_sources(apps PRIVATE obd2.c obd_sendrequest.c obd_waitresponse.c + obd_decodepid.c) + +endif() diff --git a/canutils/slcan/CMakeLists.txt b/canutils/slcan/CMakeLists.txt new file mode 100644 index 0000000000..3dd7ddeacd --- /dev/null +++ b/canutils/slcan/CMakeLists.txt @@ -0,0 +1,33 @@ +# ############################################################################## +# apps/canutils/slcan/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_CANUTILS_SLCAN) + + nuttx_add_application( + NAME + slcan + STACKSIZE + ${CONFIG_CANUTILS_SLCAN_STACKSIZE} + MODULE + ${CONFIG_CANUTILS_SLCAN} + SRCS + slcan.c) + +endif()