Replace __attribute__((constructor)) with C++ constructor.
The use of __attribute__((constructor)) made the previous commit fail to build in MSVC. PiperOrigin-RevId: 474891117 Change-Id: I86a71bb8f3226ee49a8b5e8c07adc613623042b3
This commit is contained in:
committed by
Copybara-Service
parent
1e2a9a53bc
commit
26bdb7c8b8
@@ -17,6 +17,7 @@ on:
|
||||
jobs:
|
||||
mujoco:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-22.04
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
namespace mujoco {
|
||||
namespace {
|
||||
using PluginTest = MujocoTest;
|
||||
using ::testing::HasSubstr;
|
||||
using ::testing::NotNull;
|
||||
|
||||
@@ -271,19 +270,23 @@ int RegisterActuatorPlugin() {
|
||||
return mjp_registerPlugin(&plugin);
|
||||
}
|
||||
|
||||
__attribute__((constructor)) void RegisterAllPlugins() {
|
||||
RegisterSensorPlugin();
|
||||
class PluginTest : public MujocoTest {
|
||||
public:
|
||||
// register all plugins
|
||||
PluginTest() : MujocoTest() {
|
||||
RegisterSensorPlugin();
|
||||
|
||||
for (int i = 1; i <= kNumFakePlugins; ++i) {
|
||||
mjpPlugin plugin;
|
||||
mjp_defaultPlugin(&plugin);
|
||||
std::string name = absl::StrFormat("mujoco.test.fake%u", i);
|
||||
plugin.name = name.c_str();
|
||||
mjp_registerPlugin(&plugin);
|
||||
for (int i = 1; i <= kNumFakePlugins; ++i) {
|
||||
mjpPlugin plugin;
|
||||
mjp_defaultPlugin(&plugin);
|
||||
std::string name = absl::StrFormat("mujoco.test.fake%u", i);
|
||||
plugin.name = name.c_str();
|
||||
mjp_registerPlugin(&plugin);
|
||||
}
|
||||
|
||||
RegisterActuatorPlugin();
|
||||
}
|
||||
|
||||
RegisterActuatorPlugin();
|
||||
}
|
||||
};
|
||||
|
||||
constexpr char xml[] = R"(
|
||||
<mujoco>
|
||||
|
||||
Reference in New Issue
Block a user