/
CMakeAndroidGenerator.class.st
151 lines (105 loc) · 3.46 KB
/
CMakeAndroidGenerator.class.st
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
"
This class inherits from CMakeGenerator and provides the same generation facilities as its parent, but output is more adjusted to the Android NDK requirements.
"
Class {
#name : #CMakeAndroidGenerator,
#superclass : #CMakeVMGenerator,
#category : #'CMakeVMMaker-Android'
}
{ #category : #'gmake commands' }
CMakeAndroidGenerator >> addDefinitions: aString [
output
nextPutAll: ('COG_CFLAGS += ', aString);
cr
]
{ #category : #'gmake commands' }
CMakeAndroidGenerator >> addSubdirectory: aDir [
^ self include: ('$(buildDir)/', aDir, '/', self outputFileName).
]
{ #category : #'gmake commands' }
CMakeAndroidGenerator >> append: variableName with: aValueString [
output
nextPutAll: (variableName, ' += ', aValueString);
cr
]
{ #category : #'code generation' }
CMakeAndroidGenerator >> generate [
"override this method to produce gmake syntax"
output := String new writeStream.
self printHeader.
config setupDirectories: self.
config preferredIncludes
do: [ :each | self includeDirectories: each ].
self includeDirectories: self includeDirs.
config standardIncludes
do: [:each | self includeDirectories: each ].
self addDefinitions: config compilerFlags.
config extraVMSettings: self.
self append: #LOCAL_SRC_FILES with: self sources.
self processInternalPlugins.
config setExtraTargetProperties: self.
self saveFile.
]
{ #category : #plugins }
CMakeAndroidGenerator >> generatePlugin: aPlugin internal: aBoolean extraRules: aBlock [
" this method called back from plugin"
^ CMakeAndroidPluginGenerator new
generate: aPlugin for: self internal: aBoolean extraRules: aBlock
]
{ #category : #'gmake commands' }
CMakeAndroidGenerator >> include: aFileName [
output
nextPutAll: ('include ', aFileName);
cr
]
{ #category : #'gmake commands' }
CMakeAndroidGenerator >> includeDirectories: aString [
output
nextPutAll: ('COG_INCLUDE_DIRS += ', aString);
cr
]
{ #category : #'sources management' }
CMakeAndroidGenerator >> includeDirs [
^ '-I$(crossDir)/vm -I$(srcVMDir) -I$(targetPlatform)/vm -I$(buildDir)'.
]
{ #category : #accessing }
CMakeAndroidGenerator >> outputFileName [
"override this to set the file name to create"
^ 'cogsources.mk'
]
{ #category : #'submakefile creation' }
CMakeAndroidGenerator >> printHeader [
self puts: '# This is automatically generated file using ', self configurationName, ' on ',
Date current asString, ' ' , Time current asString.
]
{ #category : #plugins }
CMakeAndroidGenerator >> processInternalPlugins [
| libs |
libs := OrderedCollection new.
config internalPlugins collect: [:each | | plugin gen |
plugin := Smalltalk at: each.
gen := plugin generateFor: self internal: true.
gen doNotGenerate ifFalse: [
libs add: plugin moduleName.
self addSubdirectory: plugin moduleName.
].
].
self generateExportsH: libs.
]
{ #category : #'gmake commands' }
CMakeAndroidGenerator >> set: variableName to: aValueString [
output
nextPutAll: (variableName, ' := ', aValueString);
cr
]
{ #category : #accessing }
CMakeAndroidGenerator >> sources [
self set: #coreSources to:
(self append: '$(srcVMDir)/' toAll: config coreSources).
self set: #platformVMSources to:
(self append: '$(targetPlatform)/vm/' toAll: config platformSources).
self set: #crossVMSources to:
(self append: '$(crossDir)/vm/' toAll: config crossSources).
self set: #extraSources to: config extraSources.
^ '$(coreSources) $(crossVMSources) $(platformVMSources) $(extraSources)'
]