54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| # -*- coding: utf-8 -*-
 | |
| # SConstrunct for dtl test
 | |
| 
 | |
| import os
 | |
| 
 | |
| def path_chomp(path):
 | |
|     if path[-1] == '/':
 | |
|         return path[:-1]
 | |
|     return path
 | |
| 
 | |
| if not 'GTEST_ROOT' in os.environ:
 | |
|     print "set environment variable 'GTEST_ROOT'"
 | |
|     Exit(1)
 | |
| 
 | |
| gtest_root = path_chomp(os.environ['GTEST_ROOT'])
 | |
| if gtest_root[-1] == '/':
 | |
|     gtest_root     = gtest_root[:-1]
 | |
| 
 | |
| gtest_includes = gtest_root + '/include'
 | |
| gtest_libs     = gtest_root + '/lib/.libs'
 | |
| 
 | |
| flags    = ['-Wall', '-O2']
 | |
| libs     = ['stdc++', 'pthread']
 | |
| includes = ['..', gtest_includes]
 | |
| target   = 'dtl_test'
 | |
| 
 | |
| env  = Environment(CPPFLAGS=flags,
 | |
|                    CPPPATH=includes,
 | |
|                    LIBPATH=[gtest_libs],
 | |
|                    )
 | |
| 
 | |
| conf = Configure(env);
 | |
| 
 | |
| if not conf.CheckCXX():
 | |
|     print "c++ compiler is not installed!"
 | |
|     Exit(1)
 | |
| 
 | |
| for lib in libs:
 | |
|     if not conf.CheckLib(lib):
 | |
|         print "library " + lib + " not installed!"
 | |
|         Exit(1)
 | |
| 
 | |
| conf.Finish()
 | |
| 
 | |
| test = env.Program(target,
 | |
|                    [Glob('*.cpp'), gtest_libs + '/libgtest.a']
 | |
|                    )
 | |
| 
 | |
| test_alias = env.Alias('check',
 | |
|                        test,
 | |
|                        test[0].abspath)
 | |
| 
 | |
| env.AlwaysBuild(test_alias)
 |