Skip to content

Commit ded09c2

Browse files
leoparenteclaude
andcommitted
fix: resolve all Corrade cci.20250327 compatibility issues for macOS build
- pluginSearchPaths() must return non-empty Array<String> (at least one entry) when dynamic plugin support is enabled; use Array<String>{1} to match the old std::vector<std::string>{""} behavior - Add CORRADE_AUTOMATIC_INITIALIZER include in static_plugins.h headers (macro moved to Corrade/Utility/Macros.h in new version) - Fix CoreRegistry.cpp: use try_emplace instead of insert for std::unique_ptr values; include PointerStl.h for Corrade Pointer to std::unique_ptr conversion - Override CMAKE_OSX_SYSROOT after Conan toolchain re-include to fix '-isysroot macosx' invalid path issue on non-Xcode generators All 18 unit tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 95e2c1c commit ded09c2

7 files changed

Lines changed: 30 additions & 5 deletions

File tree

CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,24 @@ if(_conan_generators AND EXISTS "${_conan_generators}/conan_toolchain.cmake")
7373
endif()
7474
unset(_conan_generators)
7575

76+
# On macOS with non-Xcode generators (e.g. Unix Makefiles), Conan sets
77+
# CMAKE_OSX_SYSROOT to the shortname 'macosx' which only Xcode resolves.
78+
# Clang requires the full SDK path. We override here, after the conan toolchain
79+
# re-include above (which resets the value via FORCE).
80+
if(APPLE AND NOT CMAKE_GENERATOR MATCHES "Xcode")
81+
execute_process(
82+
COMMAND xcrun --sdk macosx --show-sdk-path
83+
OUTPUT_VARIABLE _VISOR_MACOS_SDK_PATH
84+
OUTPUT_STRIP_TRAILING_WHITESPACE
85+
ERROR_QUIET
86+
)
87+
if(_VISOR_MACOS_SDK_PATH)
88+
set(CMAKE_OSX_SYSROOT "${_VISOR_MACOS_SDK_PATH}" CACHE STRING "macOS SDK path" FORCE)
89+
message(STATUS "visor: macOS SDK path: ${CMAKE_OSX_SYSROOT}")
90+
endif()
91+
unset(_VISOR_MACOS_SDK_PATH)
92+
endif()
93+
7694
include(sanitizer)
7795
if(CODE_COVERAGE)
7896
include(CodeCoverage)

src/AbstractPlugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class AbstractPlugin : public Corrade::PluginManager::AbstractPlugin
7373
public:
7474
static Corrade::Containers::Array<Corrade::Containers::String> pluginSearchPaths()
7575
{
76-
return {};
76+
return Corrade::Containers::Array<Corrade::Containers::String>{1};
7777
}
7878

7979
explicit AbstractPlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin)

src/CoreRegistry.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "Policies.h"
1010
#include "Taps.h"
1111
#include "CorradeCompat.h"
12+
#include <Corrade/Containers/PointerStl.h>
1213
#include <Corrade/Utility/ConfigurationGroup.h>
1314
#include <spdlog/sinks/stdout_color_sinks.h>
1415
#include <spdlog/spdlog.h>
@@ -63,7 +64,7 @@ void CoreRegistry::start(HttpServer *svr)
6364
InputPluginPtr mod = _input_registry.instantiate(alias);
6465
_logger->info("Load input stream plugin: {} version {} interface {}", alias, version, mod->pluginInterface());
6566
mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN());
66-
auto result = _input_plugins.insert({std::make_pair(corrade_to_std_string(alias), version), std::move(mod)});
67+
auto result = _input_plugins.try_emplace(std::make_pair(corrade_to_std_string(alias), version), std::move(mod));
6768
if (!result.second) {
6869
throw std::runtime_error(fmt::format("Input alias '{}' with version '{}' was already loaded.", alias, version));
6970
}
@@ -93,7 +94,7 @@ void CoreRegistry::start(HttpServer *svr)
9394
HandlerPluginPtr mod = _handler_registry.instantiate(s);
9495
_logger->info("Load stream handler plugin: {} version {} interface {}", alias, version, mod->pluginInterface());
9596
mod->init_plugin(this, svr, &geo::GeoIP(), &geo::GeoASN());
96-
auto result = _handler_plugins.insert({std::make_pair(corrade_to_std_string(alias), version), std::move(mod)});
97+
auto result = _handler_plugins.try_emplace(std::make_pair(corrade_to_std_string(alias), version), std::move(mod));
9798
if (!result.second) {
9899
throw std::runtime_error(fmt::format("Handler alias '{}' with version '{}' was already loaded.", alias, version));
99100
}

src/HandlerModulePlugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class HandlerModulePlugin : public AbstractPlugin
2929

3030
static Corrade::Containers::Array<Corrade::Containers::String> pluginSearchPaths()
3131
{
32-
return {};
32+
return Corrade::Containers::Array<Corrade::Containers::String>{1};
3333
}
3434

3535
explicit HandlerModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin)

src/InputModulePlugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class InputModulePlugin : public AbstractPlugin
2626

2727
static Corrade::Containers::Array<Corrade::Containers::String> pluginSearchPaths()
2828
{
29-
return {};
29+
return Corrade::Containers::Array<Corrade::Containers::String>{1};
3030
}
3131

3232
explicit InputModulePlugin(Corrade::PluginManager::AbstractManager &manager, const std::string &plugin)

src/handlers/static_plugins.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#pragma once
22

3+
#include <Corrade/PluginManager/AbstractManager.h>
4+
#include <Corrade/Utility/Macros.h>
5+
36
static int import_handler_plugins()
47
{
58
CORRADE_PLUGIN_IMPORT(VisorHandlerNet);

src/inputs/static_plugins.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#pragma once
22

3+
#include <Corrade/PluginManager/AbstractManager.h>
4+
#include <Corrade/Utility/Macros.h>
5+
36
static int import_input_plugins()
47
{
58
CORRADE_PLUGIN_IMPORT(VisorInputMock);

0 commit comments

Comments
 (0)