Skip to content

Commit

Permalink
[cmake]: Fix usage after install when built with `BUILD_SHARED_LIBS=O…
Browse files Browse the repository at this point in the history
…N` (#2016)

* Force tcp_pubsub submodule to build static

* Allow ecal-utils to be static or shared

ecal-utils is used by other exported libraries (eg: ecalhdf5) which may
be static or shared so there is no need to constrain ecal-utils, it
should be consistent with other libraries

* Force ThreadingUtils to be static implementation

ThreadingUtils is only used internally by applications so it can be static and
not exported/installed

* Force EcalParser and QEcalParser to be static implementation libraries

Both are only used by executables and aren't exported so they can be
forced static

* Force CustomQt to be static implementation library

It is only used in applications and monitor plugins so it can be static

* Bump tcp_pubsub submodule to get TCP_PUBSUB_LIBRARY_TYPE

* Fail installer signing gracefully
  • Loading branch information
DownerCase authored Feb 13, 2025
1 parent 91a1454 commit c18fd66
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ jobs:
working-directory: ${{ runner.workspace }}/_build/complete/_deploy

- name: Determine name of the installer for zip file
if: env.IS_DOWNLOAD_AVAILABLE == 'true'
shell: powershell
run: |
$INSTALLER_NAME = "${{ env.ASSET_NAME }}"
Expand Down
6 changes: 4 additions & 2 deletions lib/CustomQt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ set(custom_qt_src
src/QToolTipMenu.cpp
)

add_library (${PROJECT_NAME}
# CustomQt is only used for the implementation of the GUI applications and
# monitor plugins so it can always be static and never installed/exported
ecal_add_static_library(${PROJECT_NAME}
${custom_qt_includes}
${custom_qt_src}
)
Expand All @@ -75,7 +77,7 @@ target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

target_link_libraries(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME} PUBLIC
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Widgets
)
Expand Down
4 changes: 3 additions & 1 deletion lib/EcalParser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ set(sources
src/functions/username.h
)

add_library (${PROJECT_NAME}
# QEcalParser is an internal implementation detail for applications so it can
# always be static and not installed/exported
ecal_add_static_library(${PROJECT_NAME}
${includes}
${sources}
)
Expand Down
4 changes: 3 additions & 1 deletion lib/QEcalParser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ else()
endif()


add_library (${PROJECT_NAME}
# QEcalParser is an internal implementation detail for applications so it can
# always be static and not installed/exported
ecal_add_static_library(${PROJECT_NAME}
${qecalparser_includes}
${qecalparser_src}
${qecalparser_ui}
Expand Down
5 changes: 4 additions & 1 deletion lib/ThreadingUtils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ set(threading_utils_src
src/dummy.cpp # Workaround to make this project generate an output. Header only librarys do not work well with Visual Studio
)

add_library (${PROJECT_NAME}
# WARNING: This is only used for the play and recorder applications (CLI and GUI)
# so it is never needed by the SDK portion of the codebase and thus can be:
# Internal implementation - not exported/installed
ecal_add_static_library(${PROJECT_NAME}
${threading_utils_includes}
${threading_utils_src}
)
Expand Down
2 changes: 1 addition & 1 deletion lib/ecal_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set(ecal_utils_src
src/win_cp_changer.cpp
)

ecal_add_static_library(${PROJECT_NAME}
ecal_add_library(${PROJECT_NAME}
${ecal_utils_includes}
${ecal_utils_src}
)
Expand Down
8 changes: 7 additions & 1 deletion thirdparty/tcp_pubsub/build-tcp_pubsub.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
include_guard(GLOBAL)

# Build as static library
set(TCP_PUBSUB_LIBRARY_TYPE STATIC)
set(TCP_PUBSUB_USE_BUILTIN_ASIO OFF)
set(TCP_PUBSUB_USE_BUILTIN_RECYCLE OFF)
set(TCP_PUBSUB_BUILD_TESTS OFF)

add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/tcp_pubsub/tcp_pubsub thirdparty/tcp_pubsub EXCLUDE_FROM_ALL SYSTEM)

set_property(TARGET tcp_pubsub PROPERTY FOLDER thirdparty/tcp_pubsub)
set_property(TARGET tcp_pubsub PROPERTY FOLDER thirdparty/tcp_pubsub)

0 comments on commit c18fd66

Please sign in to comment.