Exemple #1
0
	def prebuild_commands_for_dependency(self, architecture, configuration, target_platform, product_context, dependency_context):
		prebuild_commands = []

		dc = VariableContext()
		dc.inherit(dependency_context)
		dc.update(architecture="${arch}", configuration="${config}")
		dc.dependency_product_root = dependency_context.get("abs_product_root", expand=False)

		tc = VariableContext()
		tc.inherit(product_context)
		tc.update(architecture="${arch}", configuration="${config}")
		tc.toplevel_product_root = product_context.get("abs_product_root", expand=False)

		dependency_path = os.path.join(dc.dependency_product_root, target_platform.get_full_product_path(dependency_context.product))
		output_root = os.path.dirname(os.path.join(tc.toplevel_product_root, target_platform.get_full_product_path(product_context.product)))

		expected_types = [ProductType.Application, ProductType.Commandline, ProductType.DynamicLibrary]
		if dependency_context.product.output == ProductType.DynamicLibrary \
			and (product_context.product.output in expected_types):
				# Copy the .so to top-level Application's product_root.
				cp = Copy(src=dependency_path, dst=output_root)
				prebuild_commands.append(cp.commandline())
		elif dependency_context.product.output == ProductType.StaticLibrary:
			pass
		elif dependency_context.product.output == ProductType.DynamicLibrary \
			and (product_context.product.output == ProductType.StaticLibrary):
				pass
		else:
			raise Exception("GNUMake: prebuild_commands_for_dependency\
			I'm not sure what to do here.\
			type is: %s" % product_context.product.output)

		return prebuild_commands
Exemple #2
0
	def prebuild_commands_for_dependency(self, architecture, configuration, target_platform, product_context, dependency_context):
		prebuild_commands = []

		dc = VariableContext()
		dc.inherit(dependency_context)
		dc.update(architecture="${CURRENT_ARCH}")
		dc.dependency_product_root = dependency_context.get("abs_product_root", expand=False)

		tc = VariableContext()
		tc.inherit(product_context)
		tc.update(architecture="${CURRENT_ARCH}")
		tc.toplevel_product_root = product_context.get("abs_product_root", expand=False)

		dependency_path = os.path.join(dc.dependency_product_root, target_platform.get_full_product_path(dependency_context.product))
		#logging.info("dependency_path = %s" % dependency_path)

		output_root = os.path.dirname(os.path.join(tc.toplevel_product_root, target_platform.get_full_product_path(product_context.product)))
		#logging.info("output_root = %s" % output_root)

		product = dependency_context.product
		if product.output == ProductType.DynamicLibrary:
			# 1. Must copy the dylib to application's bundle path
			# 2. Must run install_name_tool to fix rpath

			frameworks_path = Path.absolute(os.path.join(output_root, os.path.pardir, "Frameworks"))
			#logging.info("frameworks_path = %s" % frameworks_path)

			# Assume this was already created.
			md = Makedirs(path=frameworks_path)
			prebuild_commands.append(md.commandline())

			# copy the dynamic library to the Frameworks path for the toplevel product.
			cp = Copy(src=dependency_path, dst=frameworks_path)
			prebuild_commands.append(cp.commandline())

			dependency_basename = os.path.basename(dependency_path)
			new_output_path = os.path.join(frameworks_path, dependency_basename)
			#logging.info("new_output_path: %s" % new_output_path)

		#else:
		#	logging.info("Unknown product: %s, %s" % (product.output, product.name))

		#logging.info("COMMANDS: ")
		#logging.info("\n".join(prebuild_commands))

		return prebuild_commands