Esempio n. 1
0
	def startup():
		# setup the environment
		Core.set_install_path()

		# initialize logging
		Core.init_logging(None)

		# load the config file
		Core.load_config("config.json")

		Path.set_hostplatform(HostPlatform)

		Attributes.load_attributes(Core.config)
Esempio n. 2
0
	def register_classes(args):
		logging.info("--------Registering Host Platforms--------")
		Core.host_classes = Factory.register_subclasses(HostPlatform, os.path.join(Core.install_path, HOST_PLATFORMS_CLASSPATH))
		logging.info("-> Registered %i platform(s)---------" % len(Core.host_classes))


		# pick the hostplatform that matches this machine
		HostPlatform.create_platform(Core.host_classes)

		logging.info("--------Registering Target Platforms--------")
		Core.target_classes = Factory.register_subclasses(TargetPlatform, os.path.join(Core.install_path, TARGET_PLATFORMS_CLASSPATH))
		logging.info("-> Registered %i platform(s)---------" % len(Core.target_classes))

		logging.info("--------Registering Compilers--------")
		Core.compiler_classes = Factory.register_subclasses(Compiler, os.path.join(Core.install_path, COMPILERS_CLASSPATH))
		logging.info("-> Registered %i driver(s)---------" % len(Core.compiler_classes))

		# instance the target platform
		TargetPlatform.create(args, Core.target_classes, Core.compiler_classes, HostPlatform.instance)


		logging.info("--------Registering Drivers--------")
		Core.driver_classes = Factory.register_subclasses(Driver, os.path.join(Core.install_path, DRIVERS_CLASSPATH))
		logging.info("-> Registered %i driver(s)---------" % len(Core.driver_classes))

		# pick which driver to use
		Driver.create_driver_for_platform(args, TargetPlatform.instance, Core.driver_classes)

		# after classes have been registered and the TargetPlatform, Driver are instanced
		# load the Attributes config
		Attributes.load_schema(Core.config, TargetPlatform.instance)

		if Core.config.has_key("driver_data"):
			Driver.instance.post_load_driver_schema(Core.config["driver_data"])

		logging.info("--------Registering Serializable classes--------")
		for subclass in Serializable.__subclasses__():
			Serializable.register_class(subclass)


		Core.supported_architectures = []
		for architecture in Architecture.enum_keys:
			if TargetPlatform.compiler.supports_build_architecture(Language.CPP, architecture):
				Core.supported_architectures.append(architecture)
			else:
				logging.info('Does not support arch: {}'.format(architecture))