@@ -39,6 +39,7 @@ vars = Variables("scons")
3939vars .AddVariables (
4040 BoolVariable ("debug" , "Debug" , False ),
4141 BoolVariable ("asserts" , "Enable asserts (this flag is forced to 1 for debug=1)" , False ),
42+ BoolVariable ("logging" , "Logging (this flag is forced to 1 for debug=1)" , False ),
4243 EnumVariable ("arch" , "Target Architecture" , "armv7a" , allowed_values = ("armv7a" , "arm64-v8a" , "arm64-v8.2-a" , "x86_32" , "x86_64" )),
4344 EnumVariable ("os" , "Target OS" , "linux" , allowed_values = ("linux" , "android" , "bare_metal" )),
4445 EnumVariable ("build" , "Build type" , "cross_compile" , allowed_values = ("native" , "cross_compile" )),
@@ -47,7 +48,8 @@ vars.AddVariables(
4748 BoolVariable ("standalone" , "Builds the tests as standalone executables, links statically with libgcc, libstdc++ and libarm_compute" , False ),
4849 BoolVariable ("opencl" , "Enable OpenCL support" , True ),
4950 BoolVariable ("neon" , "Enable Neon support" , False ),
50- BoolVariable ("embed_kernels" , "Embed OpenCL kernels in library binary" , False ),
51+ BoolVariable ("gles_compute" , "Enable OpenGL ES Compute Shader support" , False ),
52+ BoolVariable ("embed_kernels" , "Embed OpenCL kernels and OpenGL ES compute shaders in library binary" , False ),
5153 BoolVariable ("set_soname" , "Set the library's soname and shlibversion (requires SCons 2.4 or above)" , False ),
5254 BoolVariable ("openmp" , "Enable OpenMP backend" , False ),
5355 BoolVariable ("cppthreads" , "Enable C++11 threads backend" , True ),
@@ -81,6 +83,7 @@ env.Append(CXXFLAGS = ['-Wno-deprecated-declarations','-Wall','-DARCH_ARM',
8183 '-Winit-self' ,'-Wstrict-overflow=2' ,'-Wswitch-default' ,
8284 '-fpermissive' ,'-std=gnu++11' ,'-Wno-vla' ,'-Woverloaded-virtual' ,
8385 '-Wctor-dtor-privacy' ,'-Wsign-promo' ,'-Weffc++' ,'-Wno-format-nonliteral' ,'-Wno-overlength-strings' ,'-Wno-strict-overflow' ])
86+
8487env .Append (CPPDEFINES = ['_GLIBCXX_USE_NANOSLEEP' ])
8588
8689if os .environ .get ('CXX' , 'g++' ) == 'clang++' :
@@ -115,16 +118,19 @@ if env['arch'] == 'armv7a':
115118 env .Append (CXXFLAGS = ['-mfloat-abi=softfp' ])
116119elif env ['arch' ] == 'arm64-v8a' :
117120 env .Append (CXXFLAGS = ['-march=armv8-a' ])
118-
121+ env . Append ( CPPDEFINES = [ 'ARM_COMPUTE_AARCH64_V8A' ])
119122 if env ['os' ] == 'linux' :
120123 prefix = "aarch64-linux-gnu-"
121124 elif env ['os' ] == 'bare_metal' :
122125 prefix = "aarch64-elf-"
123126 elif env ['os' ] == 'android' :
124127 prefix = "aarch64-linux-android-"
125128elif env ['arch' ] == 'arm64-v8.2-a' :
126- env .Append (CXXFLAGS = ['-march=armv8.2-a+fp16+simd' ])
127- env .Append (CPPDEFINES = ['ARM_COMPUTE_ENABLE_FP16' ])
129+ env .Append (CPPDEFINES = ['ARM_COMPUTE_AARCH64_V8_2' ])
130+
131+ if os .environ .get ('CXX' , 'g++' ) == 'clang++' :
132+ env .Append (CXXFLAGS = ['-fno-integrated-as' ])
133+
128134 if env ['os' ] == 'linux' :
129135 prefix = "aarch64-linux-gnu-"
130136 elif env ['os' ] == 'bare_metal' :
@@ -172,6 +178,8 @@ if not GetOption("help"):
172178if env ['standalone' ]:
173179 env .Append (CXXFLAGS = ['-fPIC' ])
174180 env .Append (LINKFLAGS = ['-static-libgcc' ,'-static-libstdc++' ])
181+ if env ['cppthreads' ]:
182+ env .Append (LINKFLAGS = ['-lpthread' ])
175183
176184if env ['Werror' ]:
177185 env .Append (CXXFLAGS = ['-Werror' ])
@@ -187,15 +195,17 @@ elif env['os'] == 'bare_metal':
187195 env .Append (CPPDEFINES = ['BARE_METAL' ])
188196
189197if env ['opencl' ]:
190- if env ['os' ] == 'bare_metal' :
198+ if env ['os' ] in [ 'bare_metal' ] or env [ 'standalone' ] :
191199 print ("Cannot link OpenCL statically, which is required on bare metal" )
192200 Exit (1 )
193201
202+ if env ['opencl' ] or env ['gles_compute' ]:
194203 if env ['embed_kernels' ]:
195204 env .Append (CPPDEFINES = ['EMBEDDED_KERNELS' ])
196205
197206if env ['debug' ]:
198207 env ['asserts' ] = True
208+ env ['logging' ] = True
199209 env .Append (CXXFLAGS = ['-O0' ,'-g' ,'-gdwarf-2' ])
200210 env .Append (CPPDEFINES = ['ARM_COMPUTE_DEBUG_ENABLED' ])
201211else :
@@ -205,18 +215,26 @@ if env['asserts']:
205215 env .Append (CPPDEFINES = ['ARM_COMPUTE_ASSERTS_ENABLED' ])
206216 env .Append (CXXFLAGS = ['-fstack-protector-strong' ])
207217
218+ if env ['logging' ]:
219+ env .Append (CPPDEFINES = ['ARM_COMPUTE_LOGGING_ENABLED' ])
220+
208221env .Append (CPPPATH = ['#/include' , "#" ])
209222env .Append (CXXFLAGS = env ['extra_cxx_flags' ])
210223
211224Export ('vars' )
212225Export ('env' )
213226Export ('version_at_least' )
214227
215- SConscript ('./SConscript' , variant_dir = '#build/%s' % env ['build_dir' ], duplicate = 0 )
216-
217228if env ['opencl' ]:
218229 SConscript ("./opencl-1.2-stubs/SConscript" , variant_dir = "build/%s/opencl-1.2-stubs" % env ['build_dir' ], duplicate = 0 )
219230
231+ if env ['gles_compute' ] and env ['os' ] != 'android' :
232+ env .Append (CPPPATH = ['#/include/linux' ])
233+ env .Append (LIBPATH = ["#build/%s/opengles-3.1-stubs" % env ['build_dir' ]])
234+ SConscript ("./opengles-3.1-stubs/SConscript" , variant_dir = "build/%s/opengles-3.1-stubs" % env ['build_dir' ], duplicate = 0 )
235+
236+ SConscript ('./SConscript' , variant_dir = '#build/%s' % env ['build_dir' ], duplicate = 0 )
237+
220238if env ['examples' ] and env ['os' ] != 'bare_metal' :
221239 SConscript ('./examples/SConscript' , variant_dir = '#build/%s/examples' % env ['build_dir' ], duplicate = 0 )
222240
0 commit comments