Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bazel build support for macOS #40

Open
srmainwaring opened this issue Jan 7, 2022 · 1 comment
Open

Add Bazel build support for macOS #40

srmainwaring opened this issue Jan 7, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@srmainwaring
Copy link

Desired behaviour

Build the ignition libraries with Bazel on macOS.

Alternatives considered

Not applicable

Implementation suggestion

Prototype changes to Bazel build files in the following forks - these are macOS only at present.

The Bazel build for these libraries do not require changes

The libraries will build up to ignition-physics. To build ign-rendering and the libraries that depend on it needs a larger number of changes to the Bazel build files for ogre2, and to be useful this will need to be updated to ogrev2.2 with Metal support.

Additional context

See https://community.gazebosim.org/t/python-bindings-for-gazebo-ignition/360/12?u=srmainwaring

@srmainwaring srmainwaring added the enhancement New feature or request label Jan 7, 2022
@srmainwaring
Copy link
Author

srmainwaring commented Jan 7, 2022

Hi @mjcarroll, bindings for publishing using ign-transport are working (on macOS) on this branch https://github.com/srmainwaring/python-ignition/tree/bazel-macos/python-ignition.

For example the publisher from the ign-transport Messages tutorial looks like this in Python:

import time

from ignition.msgs.stringmsg_pb2 import StringMsg

from python_ignition.ignition_transport import AdvertiseMessageOptions
from python_ignition.ignition_transport import Node
from python_ignition.ignition_transport import Publisher

def main():
    # Create a transport node and advertise a topic
    node = Node()
    topic = "/foo"
    msg_type_name = StringMsg.DESCRIPTOR.full_name
    pub_options = AdvertiseMessageOptions()
    pub = node.advertise(topic, msg_type_name, pub_options)
    if pub.valid():
        print("Advertising {} on topic[{}]".format(msg_type_name, topic))
    else:
        print("Error advertising topic [{}]".format(topic))

    # Prepare the message
    msg = StringMsg()
    msg.data = "hello"

    try:
        while True:
          if not pub.publish(msg):
              break

          print("Publishing hello on topic[{}]".format(topic))
          time.sleep(1.0)

    except KeyboardInterrupt:
        pass

if __name__ == "__main__":
    main()

It's a bit fiddly to assemble at present because I have not updated the bazel.repos file which is required from macOS. On Ubuntu you should only need the external build file ign-msgs9.BUILD, but I have not tested on that platform.

The message build files need a clean up and macros to generate the protobuf binding rules, but at this stage I'm trying to scope the tasks to get the other libraries working and finish the transport bindings, so will get back to that later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant