|
| 1 | +# ############################################################################## |
| 2 | +# apps/netutils/rtptools/CMakeLists.txt |
| 3 | +# |
| 4 | +# Licensed to the Apache Software Foundation (ASF) under one or more contributor |
| 5 | +# license agreements. See the NOTICE file distributed with this work for |
| 6 | +# additional information regarding copyright ownership. The ASF licenses this |
| 7 | +# file to you under the Apache License, Version 2.0 (the "License"); you may not |
| 8 | +# use this file except in compliance with the License. You may obtain a copy of |
| 9 | +# the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, software |
| 14 | +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 | +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 16 | +# License for the specific language governing permissions and limitations under |
| 17 | +# the License. |
| 18 | +# |
| 19 | +# ############################################################################## |
| 20 | + |
| 21 | +if(CONFIG_NETUTILS_RTPTOOLS) |
| 22 | + |
| 23 | + # ############################################################################ |
| 24 | + # Config and Fetch rtptools lib |
| 25 | + # ############################################################################ |
| 26 | + |
| 27 | + set(RTPTOOLS_DIR ${CMAKE_CURRENT_LIST_DIR}/rtptools) |
| 28 | + |
| 29 | + if(NOT EXISTS ${RTPTOOLS_DIR}) |
| 30 | + set(RTPTOOLS_URL https://github.com/irtlab/rtptools/archive) |
| 31 | + FetchContent_Declare( |
| 32 | + rtptools_fetch |
| 33 | + URL ${RTPTOOLS_URL}/${CONFIG_NETUTILS_RTPTOOLS_VERSION}.tar.gz SOURCE_DIR |
| 34 | + ${CMAKE_CURRENT_LIST_DIR}/rtptools BINARY_DIR |
| 35 | + ${CMAKE_BINARY_DIR}/netutils/rtptools/rtptools |
| 36 | + DOWNLOAD_NO_PROGRESS true |
| 37 | + TIMEOUT 30) |
| 38 | + |
| 39 | + FetchContent_GetProperties(rtptools_fetch) |
| 40 | + |
| 41 | + if(NOT rtptools_fetch_POPULATED) |
| 42 | + FetchContent_Populate(rtptools_fetch) |
| 43 | + endif() |
| 44 | + |
| 45 | + configure_file(config.h ${RTPTOOLS_DIR}/config.h COPYONLY) |
| 46 | + endif() |
| 47 | + |
| 48 | + # ############################################################################ |
| 49 | + # Flags |
| 50 | + # ############################################################################ |
| 51 | + |
| 52 | + set(CFLAGS -Wno-strict-prototypes -Wno-unused-function -Wno-format |
| 53 | + -Wno-shadow) |
| 54 | + |
| 55 | + if("${CMAKE_C_COMPILER}" MATCHES "clang") |
| 56 | + list(APPEND CFLAGS -Wno-uninitialized) |
| 57 | + else() |
| 58 | + list(APPEND CFLAGS -Wno-maybe-uninitialized) |
| 59 | + endif() |
| 60 | + |
| 61 | + # ############################################################################ |
| 62 | + # Sources |
| 63 | + # ############################################################################ |
| 64 | + |
| 65 | + list( |
| 66 | + APPEND |
| 67 | + CSRCS |
| 68 | + ${RTPTOOLS_DIR}/multimer.c |
| 69 | + ${RTPTOOLS_DIR}/notify.c |
| 70 | + ${RTPTOOLS_DIR}/payload.c |
| 71 | + ${RTPTOOLS_DIR}/rd.c |
| 72 | + ${RTPTOOLS_DIR}/utils.c) |
| 73 | + |
| 74 | + # ############################################################################ |
| 75 | + # Include Directory |
| 76 | + # ############################################################################ |
| 77 | + |
| 78 | + set(INCDIR ${RTPTOOLS_DIR}/include) |
| 79 | + |
| 80 | + nuttx_add_library(rtptools STATIC) |
| 81 | + target_sources(rtptools PRIVATE ${CSRCS}) |
| 82 | + target_include_directories(rtptools PRIVATE ${INCDIR}) |
| 83 | + target_compile_options(rtptools PRIVATE ${CFLAGS}) |
| 84 | + |
| 85 | + # ############################################################################ |
| 86 | + # Applications Configuration |
| 87 | + # ############################################################################ |
| 88 | + |
| 89 | + if(CONFIG_RTPTOOLS_APPS) |
| 90 | + |
| 91 | + if(CONFIG_NETUTILS_RTPTOOLS_RTPPLAY) |
| 92 | + nuttx_add_application( |
| 93 | + MODULE |
| 94 | + ${CONFIG_RTPTOOLS_APPS} |
| 95 | + NAME |
| 96 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPPLAY_PROGNAME} |
| 97 | + STACKSIZE |
| 98 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPPLAY_STACKSIZE} |
| 99 | + PRIORITY |
| 100 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPPLAY_PRIORITY} |
| 101 | + SRCS |
| 102 | + ${RTPTOOLS_DIR}/rtpplay.c |
| 103 | + DEPENDS |
| 104 | + rtptools) |
| 105 | + endif() |
| 106 | + |
| 107 | + if(CONFIG_NETUTILS_RTPTOOLS_RTPSEND) |
| 108 | + nuttx_add_application( |
| 109 | + MODULE |
| 110 | + ${CONFIG_RTPTOOLS_APPS} |
| 111 | + NAME |
| 112 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPSEND_PROGNAME} |
| 113 | + STACKSIZE |
| 114 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPSEND_STACKSIZE} |
| 115 | + PRIORITY |
| 116 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPSEND_PRIORITY} |
| 117 | + SRCS |
| 118 | + ${RTPTOOLS_DIR}/rtpsend.c |
| 119 | + DEPENDS |
| 120 | + rtptools) |
| 121 | + endif() |
| 122 | + |
| 123 | + if(CONFIG_NETUTILS_RTPTOOLS_RTPDUMP) |
| 124 | + nuttx_add_application( |
| 125 | + MODULE |
| 126 | + ${CONFIG_RTPTOOLS_APPS} |
| 127 | + NAME |
| 128 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPDUMP_PROGNAME} |
| 129 | + STACKSIZE |
| 130 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPDUMP_STACKSIZE} |
| 131 | + PRIORITY |
| 132 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPDUMP_PRIORITY} |
| 133 | + SRCS |
| 134 | + ${RTPTOOLS_DIR}/rtpdump.c |
| 135 | + DEPENDS |
| 136 | + rtptools) |
| 137 | + endif() |
| 138 | + |
| 139 | + if(CONFIG_NETUTILS_RTPTOOLS_RTPTRANS) |
| 140 | + nuttx_add_application( |
| 141 | + MODULE |
| 142 | + ${CONFIG_RTPTOOLS_APPS} |
| 143 | + NAME |
| 144 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPTRANS_PROGNAME} |
| 145 | + STACKSIZE |
| 146 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPTRANS_STACKSIZE} |
| 147 | + PRIORITY |
| 148 | + ${CONFIG_NETUTILS_RTPTOOLS_RTPTRANS_PRIORITY} |
| 149 | + SRCS |
| 150 | + ${RTPTOOLS_DIR}/rtptrans.c |
| 151 | + DEPENDS |
| 152 | + rtptools) |
| 153 | + endif() |
| 154 | + |
| 155 | + endif() |
| 156 | + |
| 157 | +endif() |
0 commit comments