@@ -48,54 +48,76 @@ env.EnsureSConsVersion(0, 98, 1)
48
48
# Customizable compile variables
49
49
vars = Variables ('sconsvars.py' )
50
50
51
- # TODO: also amend paths when VIRTUAL_ENV variable exists,
52
- # if CONDA_PREFIX does not exist ?
53
- if 'CONDA_PREFIX' in os .environ :
51
+ # Set PREFIX for installation and linking
52
+ # TODO: also amend paths when VIRTUAL_ENV variable exists ?
53
+ if 'PREFIX' in os .environ :
54
+ # building with a set prefix
55
+ vars .Add (PathVariable (
56
+ 'prefix' ,
57
+ 'installation prefix directory' ,
58
+ os .environ ['PREFIX' ]))
59
+ vars .Update (env )
60
+ elif 'CONDA_PREFIX' in os .environ :
54
61
# building for a conda environment
55
62
vars .Add (PathVariable (
56
63
'prefix' ,
57
64
'installation prefix directory' ,
58
65
os .environ ['CONDA_PREFIX' ]))
59
66
vars .Update (env )
60
- if platform .system ().lower () == "windows" :
61
- vars .Add (PathVariable (
62
- 'libdir' ,
63
- 'installation directory for compiled library [prefix/Library/lib]' ,
64
- pjoin (env ['prefix' ], 'Library' , 'Lib' ),
65
- PathVariable .PathAccept ))
66
- vars .Add (PathVariable (
67
- 'includedir' ,
68
- 'installation directory for C++ header files [prefix/Library/include]' ,
69
- pjoin (env ['prefix' ], 'Library' , 'include' ),
70
- PathVariable .PathAccept ))
71
- else :
72
- vars .Add (PathVariable (
73
- 'libdir' ,
74
- 'installation directory for compiled library [prefix/lib]' ,
75
- pjoin (env ['prefix' ], 'lib' ),
76
- PathVariable .PathAccept ))
77
- vars .Add (PathVariable (
78
- 'includedir' ,
79
- 'installation directory for C++ header files [prefix/include]' ,
80
- pjoin (env ['prefix' ], 'include' ),
81
- PathVariable .PathAccept ))
82
67
else :
68
+ # Default: install in /usr/local
83
69
vars .Add (PathVariable (
84
70
'prefix' ,
85
71
'installation prefix directory' ,
86
72
'/usr/local' ))
87
- vars .Update (env )
73
+
74
+ if platform .system ().lower () == "windows" :
75
+ # Installation paths
76
+ vars .Add (PathVariable (
77
+ 'libdir' ,
78
+ 'installation directory for compiled library [prefix/Library/lib]' ,
79
+ pjoin (env ['prefix' ], 'Library' , 'Lib' ),
80
+ PathVariable .PathAccept ))
81
+ vars .Add (PathVariable (
82
+ 'includedir' ,
83
+ 'installation directory for C++ header files [prefix/Library/include]' ,
84
+ pjoin (env ['prefix' ], 'Library' , 'include' ),
85
+ PathVariable .PathAccept ))
86
+
87
+ # See https://scons.org/faq.html#Linking_on_Windows_gives_me_an_error
88
+ env ['ENV' ]['TMP' ] = os .environ ['TMP' ]
89
+ # Prevent the generation of an import lib (.lib) in addition to the dll
90
+ # Unused as we are using as static library for windows
91
+ # env.AppendUnique(no_import_lib=1)
92
+
93
+ # Compilation and linking paths
94
+ env .Append (CPPPATH = [pjoin (env ['prefix' ], 'include' )])
95
+ env .Append (CPPPATH = [pjoin (env ['prefix' ], 'Library' , 'include' )])
96
+ env .Append (LIBPATH = pjoin (env ['prefix' ], 'Library' , 'lib' ))
97
+ else :
98
+ # Installation paths
88
99
vars .Add (PathVariable (
89
100
'libdir' ,
90
101
'installation directory for compiled library [prefix/lib]' ,
91
- env ['prefix' ] + '/ lib' ,
102
+ pjoin ( env ['prefix' ], ' lib') ,
92
103
PathVariable .PathAccept ))
93
104
vars .Add (PathVariable (
94
105
'includedir' ,
95
106
'installation directory for C++ header files [prefix/include]' ,
96
- env ['prefix' ] + '/ include' ,
107
+ pjoin ( env ['prefix' ], ' include') ,
97
108
PathVariable .PathAccept ))
98
109
110
+ # Compilation and linking paths
111
+ env .Append (CPPPATH = [pjoin (env ['prefix' ], 'include' )])
112
+ env .Append (LIBPATH = [pjoin (env ['prefix' ], 'lib' )])
113
+
114
+ # Specify minimum C++ standard. Allow later standard from sconscript.local.
115
+ # In case of multiple `-std` options the last option holds.
116
+ env .PrependUnique (CXXFLAGS = '-std=c++11' , delete_existing = 1 )
117
+
118
+ # for k, v in env.Dictionary().items():
119
+ # print(k, v)
120
+
99
121
vars .Add (EnumVariable (
100
122
'build' ,
101
123
'compiler settings' ,
@@ -114,24 +136,6 @@ vars.Add(BoolVariable(
114
136
vars .Update (env )
115
137
env .Help (MY_SCONS_HELP % vars .GenerateHelpText (env ))
116
138
117
- if platform .system ().lower () == "windows" :
118
- # See https://scons.org/faq.html#Linking_on_Windows_gives_me_an_error
119
- env ['ENV' ]['TMP' ] = os .environ ['TMP' ]
120
- # Prevent the generation of an import lib (.lib) in addition to the dll
121
- # Unused as we are using as static library for windows
122
- # env.AppendUnique(no_import_lib=1)
123
- if 'CONDA_PREFIX' in os .environ :
124
- env .Append (CPPPATH = [pjoin (os .environ ['CONDA_PREFIX' ], 'include' )])
125
- env .Append (CPPPATH = [pjoin (os .environ ['CONDA_PREFIX' ], 'Library' , 'include' )])
126
- env .Append (LIBPATH = pjoin (os .environ ['CONDA_PREFIX' ], 'Library' , 'lib' ))
127
- else :
128
- if 'CONDA_PREFIX' in os .environ :
129
- env .Append (CPPPATH = pjoin (os .environ ['CONDA_PREFIX' ], 'include' ))
130
- env .Append (LIBPATH = pjoin (os .environ ['CONDA_PREFIX' ], 'lib' ))
131
- # Specify minimum C++ standard. Allow later standard from sconscript.local.
132
- # In case of multiple `-std` options the last option holds.
133
- env .PrependUnique (CXXFLAGS = '-std=c++11' , delete_existing = 1 )
134
-
135
139
# the CPPPATH directories are checked by scons dependency scanner
136
140
cpppath = getsyspaths ('CPLUS_INCLUDE_PATH' , 'CPATH' )
137
141
env .AppendUnique (CPPPATH = cpppath )
0 commit comments