forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlcm-create-cps.py
50 lines (45 loc) · 1.12 KB
/
lcm-create-cps.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
import re
import sys
def_re = re.compile("#define LCM_(VERSION[^\s]+)\s+([^\s]+)")
defs = {}
with open(sys.argv[1]) as h:
for l in h:
m = def_re.match(l)
if m is not None:
defs[m.group(1)] = m.group(2)
content = """
{
"Cps-Version": "0.8.0",
"Name": "lcm",
"Description": "Lightweight Communications and Marshaling library",
"License": "LGPL-2.1+",
"Version": "%(VERSION_MAJOR)s.%(VERSION_MINOR)s.%(VERSION_PATCH)s",
"Default-Components": [ ":lcm" ],
"Components": {
"lcm-coretypes": {
"Type": "interface",
"Includes": [ "@prefix@/include" ]
},
"lcm": {
"Type": "dylib",
"Location": "@prefix@/lib/liblcm.so",
"Requires": [ ":lcm-coretypes" ]
},
"lcm-gen": {
"Type": "exe",
"Location": "@prefix@/bin/lcm-gen"
},
"lcm-java": {
"Type": "jar",
"Location": "@prefix@/share/java/lcm.jar"
}
},
"X-CMake-Variables": {
"LCM_NAMESPACE": "lcm::",
"LCM_VERSION": "${lcm_VERSION}",
"LCM_USE_FILE": "${CMAKE_CURRENT_LIST_DIR}/lcmUtilities.cmake"
}
}
""" % defs
print(content[1:])