Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions .github/workflows/cppcmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ jobs:
matrix:
config:
# x86_64 Linux builds
- {name: "ubuntu-22.04-x64", os: "ubuntu-22.04", arch: "x86_64", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF" }
- {name: "ubuntu-24.04-x64", os: "ubuntu-24.04", arch: "x86_64", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF" }
- {name: "ubuntu-22.04-x64", os: "ubuntu-22.04", arch: "x86_64" }
- {name: "ubuntu-24.04-x64", os: "ubuntu-24.04", arch: "x86_64" }

# ARM Linux builds - cross-compiled with QEMU testing (Jetson, Raspberry Pi compatible)
# SHLIBDEPS must be disabled for cross-compiled packages as the host system
# does not have the target architecture libraries installed
- {name: "ubuntu-22.04-arm64", os: "ubuntu-22.04", arch: "aarch64", cross_compile: true, cmake_extra: "-DLSL_BUNDLED_PUGIXML=ON -DLSL_DISABLE_PACKAGE_SHLIBDEPS=ON" }
- {name: "ubuntu-22.04-armhf", os: "ubuntu-22.04", arch: "armv7", cross_compile: true, cmake_extra: "-DLSL_BUNDLED_PUGIXML=ON -DLSL_DISABLE_PACKAGE_SHLIBDEPS=ON" }
- {name: "ubuntu-22.04-arm64", os: "ubuntu-22.04", arch: "aarch64", cross_compile: true, cmake_extra: "-DLSL_DISABLE_PACKAGE_SHLIBDEPS=ON" }
- {name: "ubuntu-22.04-armhf", os: "ubuntu-22.04", arch: "armv7", cross_compile: true, cmake_extra: "-DLSL_DISABLE_PACKAGE_SHLIBDEPS=ON" }

# Native ARM build
# - {name: "ubuntu-24.04-arm64-native", os: "ubuntu-24.04-arm", arch: "aarch64", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF" }
# - {name: "ubuntu-24.04-arm64-native", os: "ubuntu-24.04-arm", arch: "aarch64" }

# Windows builds
- {name: "windows-x64", os: "windows-latest", arch: "x86_64", cmake_extra: "-T v142,host=x86"}
Expand Down Expand Up @@ -114,13 +114,6 @@ jobs:
ccache --max-size=500M
ccache --set-config=compression=true

- name: Install dependencies
if: runner.os == 'Linux'
run: |
if [[ "${{ matrix.config.cross_compile }}" != "true" ]]; then
sudo apt-get install -y --no-install-recommends libpugixml-dev
fi

- name: Configure CMake
run: |
# Set up ccache as compiler wrapper (skip for cross-compilation)
Expand Down
40 changes: 30 additions & 10 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,37 @@ find_package(Threads REQUIRED)
# Git version information
include(cmake/GitVersion.cmake)

# PugiXML dependency
if(LSL_BUNDLED_PUGIXML)
message(STATUS "Using bundled pugixml")
# We will later add the pugixml source files to the lslobj target
else()
message(STATUS "Using system pugixml")
find_package(pugixml REQUIRED)
if(NOT TARGET pugixml::pugixml)
add_library(pugixml::pugixml ALIAS pugixml)
endif()
# PugiXML dependency via FetchContent
# Always use static pugixml to avoid symbol visibility issues
# Note: We use features of pugixml >= 1.15. Once that is available
# on target platforms' package managers, then we can allow using
# system pugixml.
include(FetchContent)
set(PUGIXML_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(PUGIXML_NO_EXCEPTIONS OFF CACHE BOOL "" FORCE)
set(PUGIXML_INSTALL OFF CACHE BOOL "" FORCE)
# Force static library even if parent project sets BUILD_SHARED_LIBS
set(PUGIXML_BUILD_SHARED_AND_STATIC_LIBS OFF CACHE BOOL "" FORCE)
set(_lsl_saved_build_shared_libs ${BUILD_SHARED_LIBS})
set(BUILD_SHARED_LIBS OFF)
FetchContent_Declare(
pugixml
GIT_REPOSITORY https://github.com/zeux/pugixml.git
GIT_TAG v1.15
GIT_SHALLOW TRUE
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(pugixml)
set(BUILD_SHARED_LIBS ${_lsl_saved_build_shared_libs})
unset(_lsl_saved_build_shared_libs)
if(TARGET pugixml AND NOT TARGET pugixml::pugixml)
add_library(pugixml::pugixml ALIAS pugixml)
endif()
# Hide pugixml symbols - apply hidden visibility to the pugixml target
set_target_properties(pugixml PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
)

# Create lslboost target
add_library(lslboost INTERFACE)
Expand Down
5 changes: 2 additions & 3 deletions cmake/Installation.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ write_basic_package_version_file(
)

# Define installation targets
# Note: We only export the final 'lsl' library, not intermediate targets like lslobj.
# Consumers should link to LSL::lsl, not internal object libraries.
set(LSLTargets lsl)
if(LSL_BUILD_STATIC)
list(APPEND LSLTargets lslobj lslboost)
endif()

# Install the targets and store configuration information.
install(TARGETS ${LSLTargets}
Expand Down
1 change: 0 additions & 1 deletion cmake/ProjectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ option(LSL_FRAMEWORK "Build LSL as an Apple Framework (Mac only)" ON)
option(LSL_LEGACY_CPP_ABI "Build legacy C++ ABI into lsl-static" OFF)
option(LSL_OPTIMIZATIONS "Enable some more compiler optimizations" ON)
option(LSL_BUNDLED_BOOST "Use the bundled Boost by default" ON)
option(LSL_BUNDLED_PUGIXML "Use the bundled pugixml by default" ON)
cmake_dependent_option(LSL_TOOLS "Build some experimental tools for in-depth tests" OFF "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
cmake_dependent_option(LSL_UNITTESTS "Build LSL library unit tests" OFF "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
cmake_dependent_option(LSL_INSTALL "Generate install targets" ON "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
Expand Down
4 changes: 3 additions & 1 deletion cmake/TargetLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ endif()
# Link dependencies. The only dependency is lslobj, which contains the bulk of the library code and linkages.
# Note: We link PRIVATE because lslobj exposes extra symbols that are not part of the public API
# but are used by the internal tests.
target_link_libraries(lsl PRIVATE lslobj)
# Note: We use BUILD_INTERFACE to avoid requiring lslobj in the export set - the object library's
# objects are linked directly into lsl, so consumers don't need lslobj.
target_link_libraries(lsl PRIVATE $<BUILD_INTERFACE:lslobj>)

# Set the include directories for the lsl target.
# Note: We had to link lslobj as a PRIVATE dependency, therefore we must manually expose the include directories
Expand Down
17 changes: 7 additions & 10 deletions cmake/TargetObjLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,11 @@ if(NOT LSL_OPTIMIZATIONS)
target_compile_definitions(lslobj PUBLIC ASIO_SEPARATE_COMPILATION)
endif()

# - pugixml
# Note: We use `PUBLIC` because 'internal tests' import individual source files and link lslobj.
if(LSL_BUNDLED_PUGIXML)
target_sources(lslobj PRIVATE thirdparty/pugixml/pugixml.cpp)
target_include_directories(lslobj
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml>
)
else()
target_link_libraries(lslobj PUBLIC pugixml::pugixml)
# - pugixml (fetched via FetchContent, linked statically and privately)
# Use BUILD_INTERFACE to avoid requiring pugixml in the export set - the static
# library objects are linked into lsl directly, so consumers don't need pugixml.
target_link_libraries(lslobj PRIVATE $<BUILD_INTERFACE:pugixml::pugixml>)
# Hide pugixml symbols from the shared library on Linux
if(UNIX AND NOT APPLE)
target_link_options(lslobj PRIVATE "LINKER:--exclude-libs,libpugixml.a")
endif()
16 changes: 8 additions & 8 deletions src/stream_info_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ template <typename T> void append_text_node(xml_node &node, const char *name, co
}

template <> void append_text_node(xml_node &node, const char *name, const std::string &value) {
node.append_child(name).append_child(node_pcdata).set_value(value.c_str());
node.append_child(name).append_child(node_pcdata).set_value(value);
}

void stream_info_impl::write_xml(xml_document &doc) {
Expand Down Expand Up @@ -264,17 +264,17 @@ uint32_t lsl::stream_info_impl::calc_transport_buf_samples(

void stream_info_impl::version(int v) {
version_ = v;
doc_.child("info").child("version").first_child().set_value(to_string(version_ / 100.).c_str());
doc_.child("info").child("version").first_child().set_value(to_string(version_ / 100.));
}

void stream_info_impl::created_at(double v) {
created_at_ = v;
doc_.child("info").child("created_at").first_child().set_value(to_string(created_at_).c_str());
doc_.child("info").child("created_at").first_child().set_value(to_string(created_at_));
}

void stream_info_impl::uid(const std::string &v) {
uid_ = v;
doc_.child("info").child("uid").first_child().set_value(uid_.c_str());
doc_.child("info").child("uid").first_child().set_value(uid_);
}

const std::string& stream_info_impl::reset_uid()
Expand All @@ -285,17 +285,17 @@ const std::string& stream_info_impl::reset_uid()

void stream_info_impl::session_id(const std::string &v) {
session_id_ = v;
doc_.child("info").child("session_id").first_child().set_value(session_id_.c_str());
doc_.child("info").child("session_id").first_child().set_value(session_id_);
}

void stream_info_impl::hostname(const std::string &v) {
hostname_ = v;
doc_.child("info").child("hostname").first_child().set_value(hostname_.c_str());
doc_.child("info").child("hostname").first_child().set_value(hostname_);
}

void stream_info_impl::v4address(const std::string &v) {
v4address_ = v;
doc_.child("info").child("v4address").first_child().set_value(v4address_.c_str());
doc_.child("info").child("v4address").first_child().set_value(v4address_);
}

void stream_info_impl::v4data_port(uint16_t v) {
Expand All @@ -310,7 +310,7 @@ void stream_info_impl::v4service_port(uint16_t v) {

void stream_info_impl::v6address(const std::string &v) {
v6address_ = v;
doc_.child("info").child("v6address").first_child().set_value(v6address_.c_str());
doc_.child("info").child("v6address").first_child().set_value(v6address_);
}

void stream_info_impl::v6data_port(uint16_t v) {
Expand Down
2 changes: 2 additions & 0 deletions testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ endif()
message(STATUS ${LSL_TEST_INTERNAL_SRCS})
add_executable(lsl_test_internal ${LSL_TEST_INTERNAL_SRCS})
target_link_libraries(lsl_test_internal PRIVATE lslobj lslboost common catch_main)
# Internal tests need pugixml headers (lslobj links pugixml privately)
target_include_directories(lsl_test_internal PRIVATE ${pugixml_SOURCE_DIR}/src)
# Pretend that lsl_test_internal is part of a shared lib so that it can use the __export symbols lslobj. REQ by MinGW.
target_compile_definitions(lsl_test_internal PRIVATE LIBLSL_EXPORTS)

Expand Down
80 changes: 0 additions & 80 deletions thirdparty/pugixml/pugiconfig.hpp

This file was deleted.

Loading
Loading