| 945 | |
| 946 | class InstallContext: |
| 947 | def __init__(self, args): |
| 948 | # Assume the Aurora source directory is in the parent directory of this build script |
| 949 | self.auroraSrcDir = os.path.normpath( |
| 950 | os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) |
| 951 | |
| 952 | # Directory where external dependencies will be installed |
| 953 | self.externalsInstDir = os.path.abspath(args.install_dir) |
| 954 | |
| 955 | # Directory where external dependencies will be downloaded and extracted |
| 956 | self.externalsSrcDir = (os.path.abspath(args.src) if args.src |
| 957 | else os.path.join(self.externalsInstDir, "src")) |
| 958 | |
| 959 | # Directory where externals of Aurora will be built |
| 960 | self.buildDir = (os.path.abspath(args.build) if args.build |
| 961 | else os.path.join(self.externalsInstDir, "build")) |
| 962 | |
| 963 | self.downloader = DownloadFileWithUrllib |
| 964 | self.downloaderName = "built-in" |
| 965 | |
| 966 | # CMake generator and toolset |
| 967 | self.cmakeGenerator = args.generator |
| 968 | self.cmakeToolset = args.toolset |
| 969 | |
| 970 | # Number of jobs |
| 971 | self.numJobs = args.jobs |
| 972 | if self.numJobs <= 0: |
| 973 | raise ValueError("Number of jobs must be greater than 0") |
| 974 | |
| 975 | # Build arguments |
| 976 | self.buildArgs = dict() |
| 977 | for a in args.build_args: |
| 978 | (depName, _, arg) = a.partition(",") |
| 979 | if not depName or not arg: |
| 980 | raise ValueError("Invalid argument for --build-args: {}" |
| 981 | .format(a)) |
| 982 | if depName.lower() not in AllDependenciesByName: |
| 983 | raise ValueError("Invalid library for --build-args: {}" |
| 984 | .format(depName)) |
| 985 | |
| 986 | self.buildArgs.setdefault(depName.lower(), []).append(arg) |
| 987 | |
| 988 | self.buildConfigs = [] |
| 989 | |
| 990 | # Build python info |
| 991 | self.build_python_info = dict() |
| 992 | if args.build_python_info: |
| 993 | self.build_python_info['PYTHON_EXECUTABLE'] = args.build_python_info[0] |
| 994 | self.build_python_info['PYTHON_INCLUDE_DIR'] = args.build_python_info[1] |
| 995 | self.build_python_info['PYTHON_LIBRARY'] = args.build_python_info[2] |
| 996 | self.build_python_info['PYTHON_VERSION'] = args.build_python_info[3] |
| 997 | |
| 998 | # Build type |
| 999 | self.buildDebug = (args.build_variant == BUILD_DEBUG) or (args.build_variant == BUILD_DEBUG_AND_RELEASE) |
| 1000 | self.buildRelease = (args.build_variant == BUILD_RELEASE) or (args.build_variant == BUILD_DEBUG_AND_RELEASE) |
| 1001 | self.buildRelWithDebInfo = (args.build_variant == BUILD_RELWITHDEBINFO) |
| 1002 | |
| 1003 | if self.buildRelease: |
| 1004 | self.buildConfigs.append("Release") |