/*
 * Copyright (C) 2018 Open Source Robotics Foundation
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
*/
#ifndef IGNITION_GAZEBO_TEST_CONFIG_HH_
#define IGNITION_GAZEBO_TEST_CONFIG_HH_

#include <stdlib.h>
#include <ignition/gazebo/config.hh>

#define PROJECT_SOURCE_PATH "${PROJECT_SOURCE_DIR}"
#define PROJECT_BINARY_PATH "${CMAKE_BINARY_DIR}"
#define CMAKE_VERSION "${CMAKE_VERSION}"

#define IGN_CONFIG_PATH "@CMAKE_BINARY_DIR@/test/conf"

#ifdef _MSC_VER
#    define popen _popen
#    define pclose _pclose
#endif

namespace ignition
{
namespace gazebo
{
// Create a special test world that doesn't use physics to avoid some issues
// where ODE doesn't initialize properly in multiple physics instances in the
// same process.
// \TODO(anyone) Remove this if ODE issues are corrected.
struct TestWorldSansPhysics
{
  /// \brief Return the SDF world string.
  /// \return Get the SDF world string.
  public: static std::string &World()
  {
    static std::string world = std::string("<?xml version='1.0'?>"
    "<sdf version='1.6'>"
      "<world name='default'>"
        "<plugin filename='libignition-gazebo") +
        IGNITION_GAZEBO_MAJOR_VERSION_STR + "-scene-broadcaster-system.so'"
        "  name='ignition::gazebo::systems::SceneBroadcaster'>"
        "</plugin>"
        "<plugin"
        "  filename='libignition-gazebo" +
        IGNITION_GAZEBO_MAJOR_VERSION_STR + "-user-commands-system.so'"
        "  name='ignition::gazebo::systems::UserCommands'>"
        "</plugin>"
      "</world>"
    "</sdf>";
    return world;
  }
};
}
}

#endif
