Salome HOME
Testing the use of field profile. MEDCoupling generates an error
[tools/solverlab.git] / CDMATH / configure
1 #!/usr/bin/env python
2 # -*-coding:utf-8 -*
3
4 import errno
5 import getopt
6 import os
7 import subprocess
8 import sys
9
10
11 def mkdir_p(path):
12     try:
13         os.makedirs(path)
14     except OSError as exc:  # Python >2.5
15         if exc.errno == errno.EEXIST and os.path.isdir(path):
16             pass
17         else:
18             raise
19
20
21 def main(argv):
22     """The main function treats the arguments given to our script."""
23
24     src_directory = os.getcwd()
25     #build_directory = """./build"""
26     install_directory = """/usr"""
27     mpi_option = """"""
28
29     try:
30         opts, args = getopt.getopt(argv, """h""",
31                                    ["""help""", """prefix=""", """MPI_ROOT_DIR=""", """make"""])
32     except getopt.GetoptError:
33         print("""You gave incorrect arguments.""")
34         sys.exit(2)
35     for opt, arg in opts:
36         if opt in ("-h", "--help"):
37             print("""Possible options: h, help, prefix, MPI_ROOT_DIR.""")
38             # Notice that the make option is hidden.
39             sys.exit()
40         elif opt in ("""--prefix"""):
41             install_directory = str(arg)
42         elif opt in ("""--MPI_ROOT_DIR"""):
43             mpi_directory = str(arg)
44             mpi_option = """-DMPI_ROOT_DIR=""" + mpi_directory
45
46     # mkdir_p(build_directory)
47     # os.chdir(build_directory)
48     subprocess.call(["""cmake""",
49                      """-DCMAKE_INSTALL_PREFIX=""" + install_directory,
50                      """-DCMAKE_BUILD_TYPE=Release""",
51                      mpi_option,
52                      src_directory])
53
54
55 if __name__ == """__main__""":
56     main(sys.argv[1:])