Debian Codegraph @

cmake/tribits/examples/TribitsExampleProject/packages/wrap_external/external_func/configure.py

raw
1 #!/usr/bin/env python3
2
3 import sys
4 import os
5 import subprocess
6
7 from optparse import OptionParser
8
9
10 #
11 # A) Get commandline options
12 #
13
14 clp = OptionParser()
15
16 clp.add_option(
17 "--cxx", dest="cxx", type="string",
18 default=""
19 )
20
21 clp.add_option(
22 "--cxx-flags", dest="cxxFlags", type="string",
23 default=""
24 )
25
26 clp.add_option(
27 "--ar", dest="ar", type="string",
28 default=""
29 )
30
31 clp.add_option(
32 "--include-dirs", dest="includeDirs", type="string",
33 default=""
34 )
35
36 clp.add_option(
37 "--src-dir", dest="srcDir", type="string",
38 default=""
39 )
40
41 clp.add_option(
42 "--build-dir", dest="buildDir", type="string",
43 default=""
44 )
45
46 (options, args) = clp.parse_args(sys.argv)
47
48 #
49 # B) Generate the makefile in the build tree!
50 #
51
52 generatedMakefile = \
53 "all: libexternal_func.a\n" \
54 "\n" \
55 "external_func.o: "+options.srcDir+"/external_func.hpp "+options.srcDir+"/external_func.cpp\n" \
56 "\t"+options.cxx+" "+options.cxxFlags+"" \
57 " -I. "+options.includeDirs+" -o external_func.o -c "+options.srcDir+"/external_func.cpp\n" \
58 "\n" \
59 "libexternal_func.a: external_func.o\n" \
60 "\t"+options.ar+" cr libexternal_func.a external_func.o\n" \
61 "\n"
62
63 open(options.buildDir+"/Makefile", 'w').write(generatedMakefile)