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:
|
jobs:
|
||||||
mujoco:
|
mujoco:
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: ubuntu-22.04
|
- os: ubuntu-22.04
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
namespace mujoco {
|
namespace mujoco {
|
||||||
namespace {
|
namespace {
|
||||||
using PluginTest = MujocoTest;
|
|
||||||
using ::testing::HasSubstr;
|
using ::testing::HasSubstr;
|
||||||
using ::testing::NotNull;
|
using ::testing::NotNull;
|
||||||
|
|
||||||
@@ -271,19 +270,23 @@ int RegisterActuatorPlugin() {
|
|||||||
return mjp_registerPlugin(&plugin);
|
return mjp_registerPlugin(&plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((constructor)) void RegisterAllPlugins() {
|
class PluginTest : public MujocoTest {
|
||||||
RegisterSensorPlugin();
|
public:
|
||||||
|
// register all plugins
|
||||||
|
PluginTest() : MujocoTest() {
|
||||||
|
RegisterSensorPlugin();
|
||||||
|
|
||||||
for (int i = 1; i <= kNumFakePlugins; ++i) {
|
for (int i = 1; i <= kNumFakePlugins; ++i) {
|
||||||
mjpPlugin plugin;
|
mjpPlugin plugin;
|
||||||
mjp_defaultPlugin(&plugin);
|
mjp_defaultPlugin(&plugin);
|
||||||
std::string name = absl::StrFormat("mujoco.test.fake%u", i);
|
std::string name = absl::StrFormat("mujoco.test.fake%u", i);
|
||||||
plugin.name = name.c_str();
|
plugin.name = name.c_str();
|
||||||
mjp_registerPlugin(&plugin);
|
mjp_registerPlugin(&plugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
RegisterActuatorPlugin();
|
||||||
}
|
}
|
||||||
|
};
|
||||||
RegisterActuatorPlugin();
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr char xml[] = R"(
|
constexpr char xml[] = R"(
|
||||||
<mujoco>
|
<mujoco>
|
||||||
|
|||||||
Reference in New Issue
Block a user