bioweb  0.09.92
C++/Python(django)/JavaScript(angularJS) framework
SConscript
Go to the documentation of this file.
1 # -*- mode: Python; -*-
2 
3 ## @file calc/SConscript
4 # @brief scons build for calc C++ library
5 
6 import os, platform, shutil
7 
8 Import('env')
9 
10 Import('MYAPP_VER_MAJOR')
11 Import('MYAPP_VER_MINOR')
12 Import('MYAPP_VER_COMPILATION')
13 
14 def copyLibBuilder( target, source, env):
15  '''kopiuje biblioteke'''
16  shutil.copy( str(source[0]), str(target[0]) )
17  return
18 
19 #sciezki
20 env.Append( ENV = {'PATH' : os.environ['PATH'] })
21 
22 if(platform.system() == "Linux"):
23  env.Append( CPPPATH = ['/usr/include/python2.7'] )
24  env.Append( LIBPATH = [Dir('/usr/lib/python2.7'),
25  Dir('.') ] )
26 
27  env.Append( CPPFLAGS = '-Wall -pedantic -pthread --std=c++11 ' )
28  env.Append( LINKFLAGS = '-Wall -pthread --std=c++11 ' )
29 
30  env.Append( LIBS = [ 'boost_python', 'boost_thread', 'boost_chrono', 'boost_system' ] )
31 elif(platform.system() == "Windows"):
32  env.Append( CPPPATH = [ Dir('C:/Boost/include/boost-1_59'), #path to boost include
33  Dir('C:/Python27/include'), #path to python include
34  Dir('C:/usr/local/include') ] ) #path to mt4cpp include
35  env.Append( LIBPATH = [ Dir('C:/Boost/lib'), #path to boost libs
36  Dir('C:/Python27/libs'),
37  Dir('.') ] ) #path to python libs
38 
39  env.Append( CPPFLAGS = ' /EHsc /MD /D "WIN32" /D "_CONSOLE" /W4 ' )
40  env.Append( LINKFLAGS = ' /SUBSYSTEM:CONSOLE ' )
41 else:
42  print platform.system() + " not supported"
43 
44 #add export flag to DLL build environment
45 env_dll = env.Clone()
46 if(platform.system() == "Linux"):
47  pass
48 elif(platform.system() == "Windows"):
49  env_dll.Append( CPPFLAGS = ' /D "CALC_EXPORTS" ')
50 
51 #build C++ library
52 cpplib = env_dll.SharedLibrary( target = 'calc', source = ['../calc/src/calc.cpp', '../calc/src/calcpy.cpp'])
53 if(platform.system() == "Linux"):
54  target = '../build_web/calcpy/calc.so'
55 elif(platform.system() == "Windows"):
56  target = '../build_web/calcpy/calc.pyd'
57 env_dll.Command(target, cpplib, copyLibBuilder )
58 
59 #build tests
60 env_test = env.Clone()
61 
62 if(platform.system() == "Linux"):
63  env_test.Append( LIBS = [ 'python2.7', 'boost_unit_test_framework' ] )
64  env_test.Prepend( LIBS = 'calc' )
65 elif(platform.system() == "Windows"):
66  env_test.Prepend( LIBS = 'calc' )
67 env_test.Program( target = "calc_test", source = 'tests/calc_test.cpp')
68