Skip to content

Commit 3a867f4

Browse files
committed
mavsdk_server: simplify linking
On Windows, the mavsdk_server unit tests don't link properly when building with shared libs. For whatever reason the transitive dependencies didn't get tracked from the protobu/grpc components all the way into the mavsdk_server unit tests. I suspect that either some symbols get stripped too early, or it has to do with the export visibility in MSVC. I couldn't quite get to the bottom of it but I realized that we could just simplify it by avoiding the little libraries and just adding all sources to the mavsdk_server library in the first place. Let's see if it works... Signed-off-by: Julian Oes <[email protected]>
1 parent 3cd9aa9 commit 3a867f4

File tree

1 file changed

+8
-21
lines changed

1 file changed

+8
-21
lines changed

src/mavsdk_server/src/CMakeLists.txt

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,23 @@
11
cmake_minimum_required(VERSION 3.10.2)
22

3+
list(APPEND MAVSDK_SERVER_SOURCES
4+
mavsdk_server_api.h
5+
mavsdk_server_api.cpp
6+
mavsdk_server.cpp
7+
grpc_server.cpp
8+
)
9+
310
set(COMPONENTS_LIST ${ENABLED_PLUGINS})
411
list(APPEND COMPONENTS_LIST core)
5-
612
foreach(COMPONENT_NAME ${COMPONENTS_LIST})
7-
add_library(${COMPONENT_NAME}_proto_gens STATIC
13+
list(APPEND MAVSDK_SERVER_SOURCES
814
${CMAKE_CURRENT_SOURCE_DIR}/generated/${COMPONENT_NAME}/${COMPONENT_NAME}.grpc.pb.cc
915
${CMAKE_CURRENT_SOURCE_DIR}/generated/${COMPONENT_NAME}/${COMPONENT_NAME}.pb.cc
1016
${CMAKE_CURRENT_SOURCE_DIR}/generated/mavsdk_options.grpc.pb.cc
1117
${CMAKE_CURRENT_SOURCE_DIR}/generated/mavsdk_options.pb.cc
1218
)
13-
14-
target_link_libraries(${COMPONENT_NAME}_proto_gens
15-
gRPC::grpc++
16-
)
17-
18-
target_include_directories(${COMPONENT_NAME}_proto_gens
19-
PRIVATE
20-
${PROJECT_SOURCE_DIR}/mavsdk_server/src/generated
21-
)
22-
23-
list(APPEND COMPONENTS_PROTOGENS ${COMPONENT_NAME}_proto_gens)
2419
endforeach()
2520

26-
set(MAVSDK_SERVER_SOURCES
27-
mavsdk_server_api.h
28-
mavsdk_server_api.cpp
29-
mavsdk_server.cpp
30-
grpc_server.cpp
31-
)
32-
3321
if(IOS OR (APPLE AND MACOS_FRAMEWORK))
3422
set_property(SOURCE module.modulemap
3523
PROPERTY MACOSX_PACKAGE_LOCATION "Modules")
@@ -47,7 +35,6 @@ target_link_libraries(mavsdk_server
4735
PRIVATE
4836
mavsdk
4937
gRPC::grpc++
50-
${COMPONENTS_PROTOGENS}
5138
)
5239

5340
if(BUILD_WITH_PROTO_REFLECTION)

0 commit comments

Comments
 (0)