3 # Expand The Visual Studio Files from their templates
9 from msvcfiles
import parent_dir
10 from msvcfiles
import check_output_type
11 from msvcfiles
import generate_src_list
12 from msvcfiles
import gen_vs9_project
13 from msvcfiles
import gen_vs10_project
14 from msvcfiles
import generate_nmake_makefiles
15 from msvcfiles
import gen_vs_inst_list
18 parser
= optparse
.OptionParser()
19 parser
.add_option('-t', '--type', dest
='output_type', metavar
='string', action
='store', help='Visual Studio output build file type to generate ("nmake-exe","vs9","vs10")')
20 opt
, args
= parser
.parse_args(argv
)
22 srcroot
= parent_dir(__file__
)
23 output_type
= check_output_type (opt
.output_type
)
24 if (output_type
== -1):
27 elif (output_type
== 3):
28 # Generate the executable list from tests/
29 test_filters_progs
= ['noinst_PROGRAMS']
30 test_filters_conds
= {}
31 test_src_dir
= os
.path
.join(srcroot
, 'tests')
32 test_progs
= generate_src_list (srcroot
, test_src_dir
, test_filters_progs
, test_filters_conds
, False, None)
33 generate_nmake_makefiles(srcroot
, test_src_dir
, "test", "testatk_vc.mak", test_progs
)
35 elif (output_type
== 1 or output_type
== 2):
36 # Generate the ATK MSVC 2008 or 2010 project files
37 atk_filters_src
= ['libatk_1_0_la_SOURCES']
38 atk_filters_conds
= {}
39 atk_src_dir
= os
.path
.join(srcroot
, 'atk')
40 atk_src_files
= generate_src_list (srcroot
, atk_src_dir
, atk_filters_src
, atk_filters_conds
, True, None)
41 if (output_type
== 1):
42 gen_vs9_project ('atk', srcroot
, 'atk', atk_src_files
)
44 gen_vs10_project ('atk', srcroot
, 'atk', atk_src_files
)
47 # Generate the ATK headers list to "install" for MSVC 2008/2010
48 atk_filters_h_conds
= {}
49 atk_filters_h
= ['libatkinclude_HEADERS']
50 atk_h_files_raw
= generate_src_list (srcroot
, atk_src_dir
, atk_filters_h
, atk_filters_h_conds
, False, None)
51 atk_h_files
= [files
.replace('/atk/', '') for files
in atk_h_files_raw
]
55 inst_h_lists
= [atk_h_files
]
57 inst_h_dirs
= ['include\\atk-$(ApiVersion)\\atk']
59 if (output_type
== 1):
60 gen_vs_inst_list ('atk', srcroot
, srcdirs
, inst_h_lists
, inst_h_dirs
, True)
62 gen_vs_inst_list ('atk', srcroot
, srcdirs
, inst_h_lists
, inst_h_dirs
, False)
65 raise Exception ("Somehow your output_type is wrong.\nShould not have seen this message!")
67 if __name__
== '__main__':
68 sys
.exit(main(sys
.argv
))