From 02e42c0c299531882ef35b2d4ed5a851a32aaeb2 Mon Sep 17 00:00:00 2001 From: Alexander Couzens Date: Sat, 9 Mar 2024 19:57:08 +0100 Subject: [PATCH] reorganize source code in common and uqmi specific parts In preparation to add support for uqmid. Move uqmi specific parts into directory uqmi/. Move common parts used by both uqmid and uqmi into common/ directory. Signed-off-by: Alexander Couzens --- .gitignore | 1 - CMakeLists.txt | 16 +++++----------- common/CMakeLists.txt | 6 ++++++ mbim.c => common/mbim.c | 0 mbim.h => common/mbim.h | 0 qmi-enums-dms.h => common/qmi-enums-dms.h | 0 qmi-enums-nas.h => common/qmi-enums-nas.h | 0 qmi-enums-pds.h => common/qmi-enums-pds.h | 0 .../qmi-enums-private.h | 0 qmi-enums-uim.h => common/qmi-enums-uim.h | 0 qmi-enums-wda.h => common/qmi-enums-wda.h | 0 qmi-enums-wds.h => common/qmi-enums-wds.h | 0 qmi-enums-wms.h => common/qmi-enums-wms.h | 0 qmi-enums.h => common/qmi-enums.h | 0 qmi-flags64-dms.h => common/qmi-flags64-dms.h | 0 qmi-flags64-nas.h => common/qmi-flags64-nas.h | 0 qmi-message.c => common/qmi-message.c | 0 qmi-message.h => common/qmi-message.h | 0 qmi-struct.h => common/qmi-struct.h | 0 utils.c => common/utils.c | 0 utils.h => common/utils.h | 0 uqmi/CMakeLists.txt | 13 +++++++++++++ commands-dms.c => uqmi/commands-dms.c | 0 commands-dms.h => uqmi/commands-dms.h | 0 commands-nas.c => uqmi/commands-nas.c | 0 commands-nas.h => uqmi/commands-nas.h | 0 commands-uim.c => uqmi/commands-uim.c | 0 commands-uim.h => uqmi/commands-uim.h | 0 commands-wda.c => uqmi/commands-wda.c | 0 commands-wda.h => uqmi/commands-wda.h | 0 commands-wds.c => uqmi/commands-wds.c | 0 commands-wds.h => uqmi/commands-wds.h | 0 commands-wms.c => uqmi/commands-wms.c | 0 commands-wms.h => uqmi/commands-wms.h | 0 commands.c => uqmi/commands.c | 0 commands.h => uqmi/commands.h | 0 dev.c => uqmi/dev.c | 0 uqmi.c => uqmi/uqmi.c | 0 uqmi.h => uqmi/uqmi.h | 0 39 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 common/CMakeLists.txt rename mbim.c => common/mbim.c (100%) rename mbim.h => common/mbim.h (100%) rename qmi-enums-dms.h => common/qmi-enums-dms.h (100%) rename qmi-enums-nas.h => common/qmi-enums-nas.h (100%) rename qmi-enums-pds.h => common/qmi-enums-pds.h (100%) rename qmi-enums-private.h => common/qmi-enums-private.h (100%) rename qmi-enums-uim.h => common/qmi-enums-uim.h (100%) rename qmi-enums-wda.h => common/qmi-enums-wda.h (100%) rename qmi-enums-wds.h => common/qmi-enums-wds.h (100%) rename qmi-enums-wms.h => common/qmi-enums-wms.h (100%) rename qmi-enums.h => common/qmi-enums.h (100%) rename qmi-flags64-dms.h => common/qmi-flags64-dms.h (100%) rename qmi-flags64-nas.h => common/qmi-flags64-nas.h (100%) rename qmi-message.c => common/qmi-message.c (100%) rename qmi-message.h => common/qmi-message.h (100%) rename qmi-struct.h => common/qmi-struct.h (100%) rename utils.c => common/utils.c (100%) rename utils.h => common/utils.h (100%) create mode 100644 uqmi/CMakeLists.txt rename commands-dms.c => uqmi/commands-dms.c (100%) rename commands-dms.h => uqmi/commands-dms.h (100%) rename commands-nas.c => uqmi/commands-nas.c (100%) rename commands-nas.h => uqmi/commands-nas.h (100%) rename commands-uim.c => uqmi/commands-uim.c (100%) rename commands-uim.h => uqmi/commands-uim.h (100%) rename commands-wda.c => uqmi/commands-wda.c (100%) rename commands-wda.h => uqmi/commands-wda.h (100%) rename commands-wds.c => uqmi/commands-wds.c (100%) rename commands-wds.h => uqmi/commands-wds.h (100%) rename commands-wms.c => uqmi/commands-wms.c (100%) rename commands-wms.h => uqmi/commands-wms.h (100%) rename commands.c => uqmi/commands.c (100%) rename commands.h => uqmi/commands.h (100%) rename dev.c => uqmi/dev.c (100%) rename uqmi.c => uqmi/uqmi.c (100%) rename uqmi.h => uqmi/uqmi.h (100%) diff --git a/.gitignore b/.gitignore index 2de654f..97e5c5a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -uqmi build/ .* Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index e449b88..3b2e7b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,9 +8,6 @@ ADD_DEFINITIONS(-Os -ggdb -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno- SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -SET(SOURCES qmi-message.c mbim.c utils.c) -SET(UQMI uqmi.c dev.c commands.c ${SOURCES}) - FIND_PATH(ubox_include_dir libubox/usock.h) FIND_PATH(blobmsg_json_include_dir libubox/blobmsg_json.h) FIND_PATH(json_include_dir json-c/json.h json/json.h json.h) @@ -67,12 +64,9 @@ SET_SOURCE_FILES_PROPERTIES(qmi-errors.c PROPERTIES GENERATED 1) ADD_CUSTOM_TARGET(gen-errors DEPENDS qmi-errors.c) ADD_CUSTOM_TARGET(gen-headers DEPENDS ${service_headers}) -ADD_EXECUTABLE(uqmi ${UQMI} ${service_sources}) -ADD_DEPENDENCIES(uqmi gen-headers gen-errors) - -TARGET_LINK_LIBRARIES(uqmi ${LIBS}) -TARGET_INCLUDE_DIRECTORIES(uqmi PRIVATE ${ubox_include_dir} ${blobmsg_json_include_dir} ${json_include_dir} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) +INCLUDE_DIRECTORIES(common ${CMAKE_BINARY_DIR}) +ADD_LIBRARY(qmigen ${service_sources}) +ADD_DEPENDENCIES(qmigen gen-headers gen-errors) -INSTALL(TARGETS uqmi - RUNTIME DESTINATION sbin -) +ADD_SUBDIRECTORY(common) +ADD_SUBDIRECTORY(uqmi) diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt new file mode 100644 index 0000000..a0d2318 --- /dev/null +++ b/common/CMakeLists.txt @@ -0,0 +1,6 @@ + +SET(COMMON_SOURCES qmi-message.c mbim.c utils.c) + +ADD_LIBRARY(common ${COMMON_SOURCES}) +ADD_DEPENDENCIES(common gen-headers gen-errors) +TARGET_INCLUDE_DIRECTORIES(common PRIVATE ${ubox_include_dir} ${blobmsg_json_include_dir} ${json_include_dir} ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}) diff --git a/mbim.c b/common/mbim.c similarity index 100% rename from mbim.c rename to common/mbim.c diff --git a/mbim.h b/common/mbim.h similarity index 100% rename from mbim.h rename to common/mbim.h diff --git a/qmi-enums-dms.h b/common/qmi-enums-dms.h similarity index 100% rename from qmi-enums-dms.h rename to common/qmi-enums-dms.h diff --git a/qmi-enums-nas.h b/common/qmi-enums-nas.h similarity index 100% rename from qmi-enums-nas.h rename to common/qmi-enums-nas.h diff --git a/qmi-enums-pds.h b/common/qmi-enums-pds.h similarity index 100% rename from qmi-enums-pds.h rename to common/qmi-enums-pds.h diff --git a/qmi-enums-private.h b/common/qmi-enums-private.h similarity index 100% rename from qmi-enums-private.h rename to common/qmi-enums-private.h diff --git a/qmi-enums-uim.h b/common/qmi-enums-uim.h similarity index 100% rename from qmi-enums-uim.h rename to common/qmi-enums-uim.h diff --git a/qmi-enums-wda.h b/common/qmi-enums-wda.h similarity index 100% rename from qmi-enums-wda.h rename to common/qmi-enums-wda.h diff --git a/qmi-enums-wds.h b/common/qmi-enums-wds.h similarity index 100% rename from qmi-enums-wds.h rename to common/qmi-enums-wds.h diff --git a/qmi-enums-wms.h b/common/qmi-enums-wms.h similarity index 100% rename from qmi-enums-wms.h rename to common/qmi-enums-wms.h diff --git a/qmi-enums.h b/common/qmi-enums.h similarity index 100% rename from qmi-enums.h rename to common/qmi-enums.h diff --git a/qmi-flags64-dms.h b/common/qmi-flags64-dms.h similarity index 100% rename from qmi-flags64-dms.h rename to common/qmi-flags64-dms.h diff --git a/qmi-flags64-nas.h b/common/qmi-flags64-nas.h similarity index 100% rename from qmi-flags64-nas.h rename to common/qmi-flags64-nas.h diff --git a/qmi-message.c b/common/qmi-message.c similarity index 100% rename from qmi-message.c rename to common/qmi-message.c diff --git a/qmi-message.h b/common/qmi-message.h similarity index 100% rename from qmi-message.h rename to common/qmi-message.h diff --git a/qmi-struct.h b/common/qmi-struct.h similarity index 100% rename from qmi-struct.h rename to common/qmi-struct.h diff --git a/utils.c b/common/utils.c similarity index 100% rename from utils.c rename to common/utils.c diff --git a/utils.h b/common/utils.h similarity index 100% rename from utils.h rename to common/utils.h diff --git a/uqmi/CMakeLists.txt b/uqmi/CMakeLists.txt new file mode 100644 index 0000000..5703187 --- /dev/null +++ b/uqmi/CMakeLists.txt @@ -0,0 +1,13 @@ + + +SET(UQMI uqmi.c dev.c commands.c ${SOURCES}) + +ADD_EXECUTABLE(uqmi ${UQMI}) +ADD_DEPENDENCIES(uqmi gen-headers gen-errors) + +TARGET_LINK_LIBRARIES(uqmi ${LIBS} common qmigen) +TARGET_INCLUDE_DIRECTORIES(uqmi PRIVATE ${ubox_include_dir} ${blobmsg_json_include_dir} ${json_include_dir} ${CMAKE_SOURCE_DIR}) + +INSTALL(TARGETS uqmi + RUNTIME DESTINATION sbin +) diff --git a/commands-dms.c b/uqmi/commands-dms.c similarity index 100% rename from commands-dms.c rename to uqmi/commands-dms.c diff --git a/commands-dms.h b/uqmi/commands-dms.h similarity index 100% rename from commands-dms.h rename to uqmi/commands-dms.h diff --git a/commands-nas.c b/uqmi/commands-nas.c similarity index 100% rename from commands-nas.c rename to uqmi/commands-nas.c diff --git a/commands-nas.h b/uqmi/commands-nas.h similarity index 100% rename from commands-nas.h rename to uqmi/commands-nas.h diff --git a/commands-uim.c b/uqmi/commands-uim.c similarity index 100% rename from commands-uim.c rename to uqmi/commands-uim.c diff --git a/commands-uim.h b/uqmi/commands-uim.h similarity index 100% rename from commands-uim.h rename to uqmi/commands-uim.h diff --git a/commands-wda.c b/uqmi/commands-wda.c similarity index 100% rename from commands-wda.c rename to uqmi/commands-wda.c diff --git a/commands-wda.h b/uqmi/commands-wda.h similarity index 100% rename from commands-wda.h rename to uqmi/commands-wda.h diff --git a/commands-wds.c b/uqmi/commands-wds.c similarity index 100% rename from commands-wds.c rename to uqmi/commands-wds.c diff --git a/commands-wds.h b/uqmi/commands-wds.h similarity index 100% rename from commands-wds.h rename to uqmi/commands-wds.h diff --git a/commands-wms.c b/uqmi/commands-wms.c similarity index 100% rename from commands-wms.c rename to uqmi/commands-wms.c diff --git a/commands-wms.h b/uqmi/commands-wms.h similarity index 100% rename from commands-wms.h rename to uqmi/commands-wms.h diff --git a/commands.c b/uqmi/commands.c similarity index 100% rename from commands.c rename to uqmi/commands.c diff --git a/commands.h b/uqmi/commands.h similarity index 100% rename from commands.h rename to uqmi/commands.h diff --git a/dev.c b/uqmi/dev.c similarity index 100% rename from dev.c rename to uqmi/dev.c diff --git a/uqmi.c b/uqmi/uqmi.c similarity index 100% rename from uqmi.c rename to uqmi/uqmi.c diff --git a/uqmi.h b/uqmi/uqmi.h similarity index 100% rename from uqmi.h rename to uqmi/uqmi.h -- 2.30.2