Skip to content
This repository was archived by the owner on Dec 9, 2021. It is now read-only.

Commit

Permalink
add option to idlpp to maintain the include file namespace (#20)
Browse files Browse the repository at this point in the history
* add option to idlpp to maintain the include file namespace

* remove warnings

* combine identical code parts

* simplify return logic

* update opensplice version check

* import order, escape sequence
  • Loading branch information
MarcelJordense authored and dirk-thomas committed Feb 28, 2019
1 parent fa42234 commit f815e38
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import os
import re
import subprocess

from rosidl_cmake import convert_camel_case_to_lower_case_underscore
Expand All @@ -24,6 +25,25 @@
from rosidl_parser import validate_field_types


def check_idlpp_supports_include_namespaces(idl_pp):
version = 0
build = 0

r = subprocess.getstatusoutput(idl_pp + ' -v')
ospl_version = r[1].split(':')[1].strip()
m = re.search(r'([1-9][0-9]*)\.([0-9]+)\.([0-9]*)', ospl_version)
if m and m.lastindex == 3:
major = int(m.group(1))
minor = int(m.group(2))
build = int(m.group(3))
version = major * 100 + minor

if ospl_version.endswith('OSS'):
return version > 609 or (version == 609 and build > 190226)
else:
return version > 610 or (version == 610 and build > 1)


def generate_dds_opensplice_cpp(
pkg_name, dds_interface_files, dds_interface_base_path, deps, output_basepath, idl_pp
):
Expand Down Expand Up @@ -61,6 +81,11 @@ def generate_dds_opensplice_cpp(
cmd = [idl_pp]
for include_dir in include_dirs:
cmd += ['-I', include_dir]
if check_idlpp_supports_include_namespaces(idl_pp):
cmd += [
'-o',
'maintain-include-namespace'
]
cmd += [
'-S',
'-l', 'cpp',
Expand Down

0 comments on commit f815e38

Please sign in to comment.