-
Notifications
You must be signed in to change notification settings - Fork 65
/
CMakeSqConfigH.class.st
116 lines (82 loc) · 2.39 KB
/
CMakeSqConfigH.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
"
I am the outermost wrapper on config.cmake
IF (NOT DEFINED __sq_config_h)
rest of config.cmake here
ENDIF (NOT DEFINED __sq_config_h)
View me with:
Transcript show: ((Linux64x86w32BitSqueakCogV3Config new) configureForBuildType: #build) contentForVmConfigCmake
"
Class {
#name : #CMakeSqConfigH,
#superclass : #CMakeTemplate,
#instVars : [
'config',
'templates'
],
#category : #'CMakeVMMakerSqueak-CMakeCompositeTemplates'
}
{ #category : #accessing }
CMakeSqConfigH >> config [
^ config
]
{ #category : #accessing }
CMakeSqConfigH >> config: anObject [
config := anObject
]
{ #category : #'code generation' }
CMakeSqConfigH >> contentFor [
"
IF (NOT DEFINED __sq_config_h)
rest of config.cmake here
ENDIF (NOT DEFINED __sq_config_h)"
templates do: [:each | self puts: each content].
self puts: 'ENDIF (NOT DEFINED __sq_config_h)'. "close the IF/ENDIF and write"
^output contents
]
{ #category : #'code generation' }
CMakeSqConfigH >> contentFor: aConfigOrClass [
config := aConfigOrClass isBehavior ifTrue: [ aConfigOrClass new ] ifFalse: [aConfigOrClass].
^ self contentFor
]
{ #category : #'code generation' }
CMakeSqConfigH >> generate [
"
IF (NOT DEFINED __sq_config_h)
rest of config.cmake here
ENDIF (NOT DEFINED __sq_config_h)"
templates do: [:each | self puts: each content].
self puts: 'ENDIF (NOT DEFINED __sq_config_h)'. "close the IF/ENDIF and write"
config write: output contents toFile: (self outputFileName)
]
{ #category : #'code generation' }
CMakeSqConfigH >> generate: aConfigOrClass [
config := aConfigOrClass isBehavior ifTrue: [ aConfigOrClass new ] ifFalse: [aConfigOrClass].
^ self generate
]
{ #category : #'initialize-release' }
CMakeSqConfigH >> initialize [
" See class comment"
content:='should not get here. writestream is used instead of content. this is a hack for tests to pass.'.
templates := OrderedCollection new.
output := String new writeStream.
self puts: 'IF (NOT DEFINED __sq_config_h)
SET(__sq_config_h 1)
CONFIG_DEFINE(__sq_config_h)
'.
]
{ #category : #accessing }
CMakeSqConfigH >> outputFileName [
^ 'config.cmake'
]
{ #category : #'code generation' }
CMakeSqConfigH >> saveFile [
config write: output contents toFile: (self outputFileName).
]
{ #category : #accessing }
CMakeSqConfigH >> templates [
^ templates
]
{ #category : #accessing }
CMakeSqConfigH >> templates: anObject [
templates := anObject
]