Skip to content

Commit 493deda

Browse files
authored
Merge pull request #3 from bringauto/BAF-790/install-module
BAF-790 use fleet-protocol package, install and package configuration
2 parents 1173a91 + 5464c9d commit 493deda

8 files changed

Lines changed: 71 additions & 32 deletions

File tree

.gitmodules

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "lib/fleet-protocol"]
2-
path = lib/fleet-protocol
3-
url = https://github.com/bringauto/fleet-protocol.git
41
[submodule "python_client/lib/internal_client"]
52
path = python_client/lib/internal_client
63
url = https://github.com/bringauto/internal-client-python.git

CMakeLists.txt

Lines changed: 57 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ PROJECT(example_module CXX)
33

44
SET(CMAKE_CXX_STANDARD 20)
55

6+
SET(EXAMPLE_MODULE_VERSION 1.1.0)
67

7-
OPTION(BRINGAUTO_TESTS "Disable tests" OFF)
88
OPTION(BRINGAUTO_PACKAGE "Package creation" OFF)
99
OPTION(BRINGAUTO_INSTALL "Disable install" OFF)
1010
OPTION(BRINGAUTO_SYSTEM_DEP "Enable system dependencies" OFF)
11-
OPTION(BRINGAUTO_SAMPLES "Enable build of sample app, not used in project" OFF)
12-
OPTION(STATE_SMURF "Enables state smurf" OFF)
1311

1412
FIND_PACKAGE(CMLIB
1513
COMPONENTS CMDEF CMUTIL STORAGE
@@ -20,24 +18,66 @@ IF (NOT BRINGAUTO_SYSTEM_DEP)
2018
INCLUDE(cmake/Dependencies.cmake)
2119
ENDIF ()
2220

23-
IF (NOT TARGET common_headers)
24-
ADD_SUBDIRECTORY("lib/fleet-protocol")
25-
ENDIF ()
21+
FIND_PACKAGE(fleet-protocol-interface REQUIRED 2.0.0)
2622

2723
FILE(GLOB_RECURSE MODULE_GATEWAY_SOURCES "source/module_gateway/*")
2824
FILE(GLOB_RECURSE EXTERNAL_SERVER_SOURCES "source/external_server/*")
2925
FILE(GLOB_RECURSE COMMON_SOURCES "source/common/*")
3026

31-
ADD_LIBRARY(example_module_gateway SHARED ${MODULE_GATEWAY_SOURCES} ${COMMON_SOURCES})
32-
TARGET_INCLUDE_DIRECTORIES(example_module_gateway PRIVATE "include/common/")
33-
TARGET_LINK_LIBRARIES(example_module_gateway PRIVATE
34-
common_headers
35-
module_gateway_maintainer
27+
CMDEF_ADD_LIBRARY(
28+
LIBRARY_GROUP example-module-gateway
29+
TYPE SHARED
30+
SOURCES ${MODULE_GATEWAY_SOURCES} ${COMMON_SOURCES}
31+
VERSION ${EXAMPLE_MODULE_VERSION}
32+
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/include/common/"
33+
)
34+
TARGET_LINK_LIBRARIES(example-module-gateway-shared PRIVATE
35+
fleet-protocol-interface::common-headers-interface
36+
fleet-protocol-interface::module-maintainer-module-gateway-interface
37+
)
38+
39+
CMDEF_ADD_LIBRARY(
40+
LIBRARY_GROUP example-external-server
41+
TYPE SHARED
42+
SOURCES ${EXTERNAL_SERVER_SOURCES} ${COMMON_SOURCES}
43+
VERSION ${EXAMPLE_MODULE_VERSION}
44+
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/include/common/"
45+
)
46+
TARGET_LINK_LIBRARIES(example-external-server-shared PRIVATE
47+
fleet-protocol-interface::common-headers-interface
48+
fleet-protocol-interface::module-maintainer-external-server-interface
3649
)
3750

38-
ADD_LIBRARY(example_external_server SHARED ${EXTERNAL_SERVER_SOURCES} ${COMMON_SOURCES})
39-
TARGET_INCLUDE_DIRECTORIES(example_external_server PRIVATE "include/common/")
40-
TARGET_LINK_LIBRARIES(example_external_server PRIVATE
41-
common_headers
42-
external_server
43-
)
51+
CMDEF_ADD_LIBRARY(
52+
LIBRARY_GROUP example-module
53+
TYPE INTERFACE
54+
VERSION ${EXAMPLE_MODULE_VERSION}
55+
)
56+
TARGET_LINK_LIBRARIES(example-module-interface INTERFACE
57+
example-module-gateway-shared
58+
example-external-server-shared
59+
)
60+
IF (BRINGAUTO_INSTALL)
61+
CMDEF_INSTALL(
62+
TARGET example-module-gateway-shared
63+
NAMESPACE example-module-interface::
64+
)
65+
CMDEF_INSTALL(
66+
TARGET example-external-server-shared
67+
NAMESPACE example-module-interface::
68+
)
69+
CMDEF_INSTALL(
70+
TARGET example-module-interface
71+
NAMESPACE example-module-interface::
72+
)
73+
ENDIF ()
74+
75+
IF (BRINGAUTO_PACKAGE)
76+
CMDEF_PACKAGE(
77+
MAIN_TARGET example-module-interface
78+
VERSION ${EXAMPLE_MODULE_VERSION}
79+
)
80+
SET(CPACK_GENERATOR ZIP)
81+
SET(CPACK_PACKAGE_CONTACT "BringAuto s.r.o. <maintainers@bringauto.com>")
82+
INCLUDE(CPack)
83+
ENDIF ()

cmake/Dependencies.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SET(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE)
2+
3+
BA_PACKAGE_LIBRARY(fleet-protocol-interface v2.0.0 PLATFORM_STRING_MODE any_machine NO_DEBUG ON)

lib/fleet-protocol

Lines changed: 0 additions & 1 deletion
This file was deleted.

source/common/device_management.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include <device_management.h>
2-
#include <general_error_codes.h>
1+
#include <fleet_protocol/common_headers/device_management.h>
2+
#include <fleet_protocol/common_headers/general_error_codes.h>
33

44
#include <example_module.hpp>
55

source/common/memory_management.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <new>
22
#include <cstdint>
33

4-
#include <memory_management.h>
5-
#include <general_error_codes.h>
4+
#include <fleet_protocol/common_headers/memory_management.h>
5+
#include <fleet_protocol/common_headers/general_error_codes.h>
66

77

88
int allocate(struct buffer *buffer_pointer, size_t size_in_bytes){

source/external_server/external_server.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#include <string>
55
#include <sstream>
66

7-
#include <external_server_interface.h>
7+
#include <fleet_protocol/module_maintainer/external_server/external_server_interface.h>
8+
#include <fleet_protocol/common_headers/device_management.h>
89
#include <cstring>
910

1011

source/module_gateway/module_manager.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
#include <string>
2-
#include <cstring>
3-
4-
#include <device_management.h>
5-
#include <module_manager.h>
6-
#include <memory_management.h>
71
#include <example_module.hpp>
82

3+
#include <fleet_protocol/common_headers/device_management.h>
4+
#include <fleet_protocol/module_maintainer/module_gateway/module_manager.h>
5+
#include <fleet_protocol/common_headers/memory_management.h>
96

7+
#include <string>
8+
#include <cstring>
109

1110

1211
void pressed_true(struct buffer *buffer) {

0 commit comments

Comments
 (0)