4 prefix = ARGUMENTS.get ('prefix', "/usr/local")
5 usr_local_include = os.path.join (prefix, "include")
6 usr_local_lib = os.path.join (prefix, "lib")
7 usr_local_bin = os.path.join (prefix, "bin")
9 current_directory = Dir ('.').abspath
12 target_usr_local_include = os.path.join (usr_local_include, "anna")
13 target_usr_local_lib = os.path.join (usr_local_lib, "anna")
14 #target_usr_local_bin = usr_local_bin
15 target_opt_bin = os.path.join (opt_bin, "anna")
18 release = ARGUMENTS.get ('release', 0)
21 source_include = os.path.join (current_directory, "include")
23 "/usr/include/oracle/11.2/client",
24 "/usr/include/libxml2",
25 #"/usr/include/mysql",
26 #"/usr/include/openssl",
34 # CPPPATH will be relative to src/<target>
35 env.Append (CPPPATH = [source_include, usr_local_include, usr_include ])
36 env.Append (CCFLAGS = '-std=c++0x')
37 env.Append (LIBS = [''])
41 env.Append (CCFLAGS = '-O3')
42 env.Append (VARIANT = variant)
45 env.Append (CCFLAGS = '-g -O0 -D_DEBUG')
46 env.Append (LIBPATH = os.path.join (current_directory, variant))
47 env.Append (VARIANT = variant)
50 source = os.path.join (current_directory, "source")
51 sources = Glob(source + '/*')
52 for source in sources:
55 compile_library = SConscript (ss, exports='env')
56 libraries.extend (compile_library)
58 env.Default (libraries)
61 ## Run 'scons example' to compile examples
64 example = os.path.join (current_directory, "example")
65 examples = Glob(example + '/*/*')
66 for example in examples:
68 bn_ss = os.path.basename(ss)
69 noExtension = (len(bn_ss.split('.')) == 1)
72 example_program = SConscript (ss, exports='env')
73 example_list.extend (example_program)
74 print example_program [0]
76 #Depends (example_list, compile_library)
78 # In order to remove examples objects with 'scons -c' we need to default them at built ('scons') procedure:
79 env.Default (example_list)
80 #env.Alias ('example', example_list)
84 # Run 'scons test' to compile unit-tests
89 test = os.path.join (current_directory, "test")
90 tests = Glob(test + '/*')
94 test_unit_program = SConscript (ss, exports='env')
95 test_unit_list.extend (test_unit_program)
96 print test_unit_program [0]
97 test_unit = Builder (action = '%s --report_level=short > $TARGET' % test_unit_program [0])
98 env ['BUILDERS']['RunTestUnit'] = test_unit
99 test_unit_result = env.RunTestUnit ('%s.output' % test_unit_program [0], 'SConstruct')
100 run_tests.extend (test_unit_result)
101 Depends (test_unit_result, test_unit_program)
103 env.Alias ('test', run_tests)
104 # In order to remove test objects with 'scons -c' we need to default them at built ('scons') procedure:
105 env.Default (test_unit_list)
108 # Run 'scons doc' to generate documentation
110 # Doxygen Builder does not work properly at the moment. We will use an alias/action
111 #env = Environment(tools = ["default", "doxygen"], toolpath = './docs/doxygen')
112 #env.Doxygen("./docs/doxygen/Doxyfile")
113 # Finally, is enough to execute doxygen which will solve dependences and work for
114 # only modified files:
115 env.Alias('doc', env.Command('doc.dummy', [], 'cd docs/doxygen; doxygen'))
118 # Run 'sudo scons install' to install the suite:
120 # 'sudo scons install-include' for only headers
121 # 'sudo scons install-lib' for only libraries
122 # 'sudo scons install-bin' for only binaries
124 # Run 'sudo scons uninstall' to uninstall the suite
126 # See http://www.scons.org/wiki/InstallTargets and http://www.scons.org/doc/production/HTML/scons-user/c2938.html
127 install_include = env.Install (target_usr_local_include, Glob("include/anna/*"))
128 install_lib = env.Install (target_usr_local_lib, Glob("source/*/" + variant + "/*.a"))
129 install_example = env.Install (target_opt_bin, Glob("example/*/*/" + variant + "/example_*"))
131 Depends (install_include, test_unit_result)
132 Depends (install_lib, test_unit_result)
133 Depends (install_example, test_unit_result)
135 iil = env.Alias('install-include-and-lib', [target_usr_local_include, target_usr_local_lib])
136 iex = env.Alias('install-example', target_opt_bin)
137 env.Alias('install', [iil, iex])
139 env.Command ("uninstall", None, [ Delete(target_usr_local_include), Delete(target_usr_local_lib), Delete(target_opt_bin) ])