-
Notifications
You must be signed in to change notification settings - Fork 0
/
converters_detcommon.go
121 lines (107 loc) · 3.13 KB
/
converters_detcommon.go
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package main
import (
"fmt"
"path/filepath"
//"strings"
"github.com/hwaf/hwaf/hlib"
)
func cnv_detcommon_shared_library(wscript *hlib.Wscript_t, stmt Stmt) error {
x := stmt.(*ApplyPattern)
margs := cmt_arg_map(x.Args)
libname := ""
if _, ok := margs["library"]; ok {
libname = margs["library"]
} else {
libname = filepath.Base(wscript.Package.Name)
}
source := []string{"src/*.cxx"}
if _, ok := margs["files"]; ok {
source = []string{margs["files"]}
}
if libname == "" {
return fmt.Errorf(
"cmt2yml: empty atlas_library name (package=%s, args=%v)",
wscript.Package.Name,
x.Args,
)
}
itgt, tgt := find_tgt(wscript, libname)
if itgt < 0 {
wscript.Build.Targets = append(
wscript.Build.Targets,
hlib.Target_t{Name: libname},
)
itgt, tgt = find_tgt(wscript, libname)
}
tgt.Features = []string{"detcommon_library"}
uses := use_list(wscript)
if len(uses) > 0 {
tgt.Use = []hlib.Value{hlib.DefaultValue("uses", uses)}
}
tgt.Source = []hlib.Value{hlib.DefaultValue("source", source)}
return nil
}
func cnv_detcommon_install_headers(wscript *hlib.Wscript_t, stmt Stmt) error {
pkgname := filepath.Base(wscript.Package.Name)
tgt := hlib.Target_t{Name: pkgname + "-install-headers"}
tgt.Features = []string{"detcommon_install_headers"}
wscript.Build.Targets = append(wscript.Build.Targets, tgt)
return nil
}
func cnv_trigconf_application(wscript *hlib.Wscript_t, stmt Stmt) error {
x := stmt.(*ApplyPattern)
margs := cmt_arg_map(x.Args)
appname := margs["name"]
if appname == "" {
return fmt.Errorf(
"cmt2yml: empty trigconf_application name (package=%s, args=%v)",
wscript.Package.Name,
x.Args,
)
}
tgtname := "TrigConf" + appname
itgt, tgt := find_tgt(wscript, tgtname)
if itgt < 0 {
wscript.Build.Targets = append(
wscript.Build.Targets,
hlib.Target_t{Name: tgtname},
)
itgt, tgt = find_tgt(wscript, tgtname)
}
tgt.Features = []string{"trigconf_application"}
source := []string{fmt.Sprintf("src/test/%s.cxx", appname)}
tgt.Source = []hlib.Value{hlib.DefaultValue("source", source)}
uses := []string{filepath.Base(wscript.Package.Name), "boost-thread"}
uses = append(uses, use_list(wscript)...)
tgt.Use = []hlib.Value{hlib.DefaultValue("uses", uses)}
//fmt.Printf(">>> [%v] \n", *tgt)
return nil
}
func cnv_detcommon_generic_install(wscript *hlib.Wscript_t, stmt Stmt) error {
x := stmt.(*ApplyPattern)
margs := cmt_arg_map(x.Args)
name := margs["name"]
source := margs["files"]
kind := margs["kind"]
prefix := margs["prefix"]
pkgname := filepath.Base(wscript.Package.Name)
tgtname := fmt.Sprintf("%s-generic-install-%s-%s", pkgname, name, kind)
itgt, tgt := find_tgt(wscript, tgtname)
if itgt < 0 {
wscript.Build.Targets = append(
wscript.Build.Targets,
hlib.Target_t{Name: tgtname},
)
itgt, tgt = find_tgt(wscript, tgtname)
}
tgt.Features = []string{"detcommon_generic_install"}
tgt.Source = []hlib.Value{hlib.DefaultValue("source", []string{source})}
if prefix != "" {
if tgt.KwArgs == nil {
tgt.KwArgs = make(map[string][]hlib.Value)
}
tgt.KwArgs["install_prefix"] = []hlib.Value{hlib.DefaultValue("prefix", []string{prefix})}
}
return nil
}
// EOF