Skip to content
Merged
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
22 changes: 2 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,13 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Restore Conan Cache
id: conan-cache-restore
uses: actions/cache/restore@v4
with:
path: |
/home/runner/.conan2
/home/runner/work/spectator-cpp/spectator-cpp/cmake-build
key: ${{ runner.os }}-conan

- name: Install System Dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update && sudo apt-get install -y binutils-dev g++-13 libiberty-dev
sudo apt-get update && sudo apt-get install -y binutils-dev g++-15 libiberty-dev

- name: Build
run: |
./setup-venv.sh
source venv/bin/activate
./build.sh

- name: Save Conan Cache
id: conan-cache-save
uses: actions/cache/save@v4
with:
path: |
/home/runner/.conan2
/home/runner/work/spectator-cpp/spectator-cpp/cmake-build
key: ${{ steps.conan-cache-restore.outputs.cache-primary-key }}
./build.sh
22 changes: 18 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ if [[ -z "$BUILD_TYPE" ]]; then
fi

BLUE="\033[0;34m"
RED="\033[0;31m"
NC="\033[0m"

if [[ "$1" == "clean" ]]; then
Expand All @@ -26,11 +27,16 @@ if [[ "$1" == "clean" ]]; then
fi

if [[ "$OSTYPE" == "linux-gnu"* ]]; then
source /etc/os-release
if [[ "$NAME" == "Ubuntu" ]]; then
if [[ -z "$CC" ]]; then export CC=gcc-13; fi
if [[ -z "$CXX" ]]; then export CXX=g++-13; fi
if ! command -v gcc-15 &> /dev/null; then
echo -e "${RED}ERROR: gcc-15 is required but not found${NC}"
exit 1
fi
if ! command -v g++-15 &> /dev/null; then
echo -e "${RED}ERROR: g++-15 is required but not found${NC}"
exit 1
fi
export CC=gcc-15
export CXX=g++-15
fi

echo -e "${BLUE}==== env configuration ====${NC}"
Expand All @@ -44,6 +50,14 @@ if [[ ! -f "$HOME/.conan2/profiles/default" ]]; then
conan profile detect
fi

## Modify the default profile to set the compiler version and C++ standard
DEFAULT_PROFILE="$HOME/.conan2/profiles/default"
sed -i.bak -E \
-e 's/^compiler\.version=.*/compiler.version=15.2/' \
-e 's/^compiler\.cppstd=.*/compiler.cppstd=23/' \
"$DEFAULT_PROFILE"
rm -f "$DEFAULT_PROFILE.bak"

if [[ ! -d $BUILD_DIR ]]; then
echo -e "${BLUE}==== install required dependencies ====${NC}"
conan install . --output-folder="$BUILD_DIR" --build="*" --settings=build_type="$BUILD_TYPE"
Expand Down
15 changes: 12 additions & 3 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@
class SpectatorCppConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = (
"spdlog/1.15.0",
"gtest/1.14.0",
"boost/1.83.0",
"spdlog/1.17.0",
"gtest/1.17.0",
"boost/1.90.0",
)
# Boost.Cobalt is disabled because b2 builds an extra boost_cobalt_io_ssl library
# whenever it can find OpenSSL, but the boost/1.90.0 recipe does not list that library,
# so package_info() aborts with "built, but were not used in any boost module". The
# failure depends on whether OpenSSL headers happen to be visible on the build machine,
# which is why it broke CI but not local Linux builds. We do not use Cobalt, and
# disabling it stops b2 from building cobalt/cobalt_io/cobalt_io_ssl at all.
default_options = {
"boost/*:without_cobalt": True,
}
tool_requires = ()
generators = "CMakeDeps", "CMakeToolchain"
1 change: 0 additions & 1 deletion libs/writer/writer_types/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ target_link_libraries(spectator-writer-types
PUBLIC
spectator-logger
Boost::boost
Boost::system
)

set(TEST_SOURCES
Expand Down
2 changes: 1 addition & 1 deletion libs/writer/writer_types/src/udp_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool UDPWriter::CreateSocket() try
return false;
}

m_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(m_host), m_port);
m_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::make_address(m_host), m_port);
m_socketEstablished = true;
Logger::info("UDPWriter: Socket created for {}:{}", m_host, m_port);
return true;
Expand Down
4 changes: 2 additions & 2 deletions libs/writer/writer_types/test_utils/udp_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_compile_definitions(udp_server_lib
)
target_link_libraries(udp_server_lib
PUBLIC
Boost::system
Boost::boost
pthread
)

Expand All @@ -27,5 +27,5 @@ target_include_directories(udp_server

target_link_libraries(udp_server
PUBLIC
Boost::system
Boost::boost
)
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ try
boost::asio::io_context io_context;

// Create an IPv4 socket bound to localhost (127.0.0.1) and port 1234
const boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string("127.0.0.1"), port);
const boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::make_address("127.0.0.1"), port);
boost::asio::ip::udp::socket socket(io_context, boost::asio::ip::udp::v4());

try
Expand Down
4 changes: 2 additions & 2 deletions libs/writer/writer_types/test_utils/uds_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target_compile_definitions(uds_server_lib
)
target_link_libraries(uds_server_lib
PUBLIC
Boost::system
Boost::boost
pthread
)

Expand All @@ -27,5 +27,5 @@ target_include_directories(uds_server

target_link_libraries(uds_server
PUBLIC
Boost::system
Boost::boost
)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
conan==2.17.1
conan==2.29.0
1 change: 0 additions & 1 deletion spectator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ target_link_libraries(spectator-registry
PUBLIC
spdlog::spdlog
Boost::boost
Boost::system
)
add_executable(registry-test test_registry.cpp)
target_link_libraries(registry-test PRIVATE
Expand Down
Loading