Ejemplo n.º 1
0
    def generate(self):
        generated = """
build """ + self.output.relative() + """: CompileC """ + self.path.relative(
        ) + self.generate_dependencies() + """
    flags = """
        generated += " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative()
        generated += " -I" + Configuration.current.build_directory.relative()
        generated += " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative(
            ) + self.product.ROOT_HEADERS_FOLDER_PATH
        generated += " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative(
            ) + self.product.PUBLIC_HEADERS_FOLDER_PATH
        generated += " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative(
            ) + self.product.PRIVATE_HEADERS_FOLDER_PATH
        generated += " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative(
            ) + self.product.PROJECT_HEADERS_FOLDER_PATH
        cflags = TargetConditional.value(self.product.CFLAGS)
        if cflags is not None:
            generated += " " + cflags
        prefix = TargetConditional.value(self.product.GCC_PREFIX_HEADER)
        if prefix is not None:
            generated += " -include " + prefix
        generated += "\n"
        if self.path.extension() == ".m" or "-x objective-c" in generated:
            self.product.needs_objc = True
        return generated
Ejemplo n.º 2
0
    def generate(self):
        generated = (
            """
build """
            + self.output.relative()
            + """: CompileCxx """
            + self.path.relative()
            + self.generate_dependencies()
            + """
    flags = """
        )
        generated += (
            "-I"
            + Configuration.current.build_directory.path_by_appending(self.product.name).relative()
            + " -I"
            + Configuration.current.build_directory.relative()
        )
        cflags = TargetConditional.value(self.product.CFLAGS)
        if cflags is not None:
            generated += " " + cflags
        cxxflags = TargetConditional.value(self.product.CXXFLAGS)
        if cxxflags is not None:
            generated += " " + cxxflags
        prefix = TargetConditional.value(self.product.GCC_PREFIX_HEADER)
        if prefix is not None:
            generated += " -include " + prefix
        generated += "\n"
        if self.path.extension() == ".mm" or "-x objective-c" in generated:
            self.product.needs_objc = True
        self.product.needs_stdcxx = True
        return generated
Ejemplo n.º 3
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        module = Path.path(TargetConditional.value(self._module))
        if module is not None:
            action = Cp(module, self.product.public_module_path.path_by_appending("module.modulemap"))
            self.actions.append(action)
            action.set_product(product)

        for value in self._public:
            header = Path.path(TargetConditional.value(value))
            if header is None:
                continue
            action = Cp(header, self.product.public_headers_path.path_by_appending(header.basename()))
            self.actions.append(action)
            action.set_product(product)

        for value in self._private:
            header = Path.path(TargetConditional.value(value))
            if header is None:
                continue
            action = Cp(header, self.product.private_headers_path.path_by_appending(header.basename()))
            self.actions.append(action)
            action.set_product(product)

        for value in self._project:
            header = Path.path(TargetConditional.value(value))
            if header is None:
                continue
            action = Cp(header, self.product.project_headers_path.path_by_appending(header.basename()))
            self.actions.append(action)
            action.set_product(product)
Ejemplo n.º 4
0
    def generate(self):
        appName = Configuration.current.build_directory.relative(
        ) + """/""" + self.executableName + """/""" + self.executableName
        libDependencyName = self.product.product_name
        swiftSources = ""
        for value in self.sources:
            resource = Path.path(TargetConditional.value(value))
            if resource is None:
                continue
            swiftSources += " " + resource.relative()

        return """
build """ + appName + """: SwiftExecutable """ + swiftSources + self.generate_dependencies(
            libDependencyName
        ) + """
    flags = -I""" + Configuration.current.build_directory.path_by_appending(
            self.product.name
        ).relative(
        ) + self.product.ROOT_HEADERS_FOLDER_PATH + " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name
        ).relative(
        ) + " -L" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative() + " " + TargetConditional.value(
                self.product.SWIFTCFLAGS) + """
build """ + self.executableName + """: phony | """ + appName + """
Ejemplo n.º 5
0
    def generate(self):
        generated = BuildPhase.generate(self)
        generated += "\n\n"
        objects = ""
        partial_modules = ""
        partial_docs = ""
        for value in self._sources:
            path = Path.path(value)
            compiled = Configuration.current.build_directory.path_by_appending(
                self.product.name).path_by_appending(path.relative() + ".o")
            objects += compiled.relative() + " "
            partial_modules += compiled.relative() + ".~partial.swiftmodule "
            partial_docs += compiled.relative() + ".~partial.swiftdoc "

        generated += """
build """ + self._module.relative() + ": MergeSwiftModule " + objects + """
    partials = """ + partial_modules + """
    module_name = """ + self.product.name + """
    flags = -I""" + self.product.public_module_path.relative(
        ) + """ """ + TargetConditional.value(
            self.product.
            SWIFTCFLAGS) + """ -emit-module-doc-path """ + self._module.parent(
            ).path_by_appending(self.product.name).relative() + """.swiftdoc 
"""
        return generated
Ejemplo n.º 6
0
    def generate(self):
        generated = (
            """
build """
            + self.output.relative()
            + """: CompileSwift """
            + self.path.relative()
            + self.generate_dependencies()
            + """
    module_sources = """
            + self.module_sources
            + """
    module_name = """
            + self.product.name
            + """
    flags = """
        )
        generated += " -I" + Configuration.current.build_directory.path_by_appending(self.product.name).relative()
        generated += (
            " -I"
            + Configuration.current.build_directory.path_by_appending(self.product.name).relative()
            + self.product.ROOT_HEADERS_FOLDER_PATH
        )
        generated += " -I" + Configuration.current.build_directory.relative()
        swiftflags = TargetConditional.value(self.product.SWIFTCFLAGS)
        if swiftflags is not None:
            generated += " " + swiftflags
        return generated
Ejemplo n.º 7
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        module = Path.path(TargetConditional.value(self._module))
        if module is not None:
            action = Cp(
                module,
                self.product.public_module_path.path_by_appending(
                    "module.modulemap"))
            self.actions.append(action)
            action.set_product(product)

        for value in self._public:
            header = Path.path(TargetConditional.value(value))
            if header is None:
                continue
            action = Cp(
                header,
                self.product.public_headers_path.path_by_appending(
                    header.basename()))
            self.actions.append(action)
            action.set_product(product)

        for value in self._private:
            header = Path.path(TargetConditional.value(value))
            if header is None:
                continue
            action = Cp(
                header,
                self.product.private_headers_path.path_by_appending(
                    header.basename()))
            self.actions.append(action)
            action.set_product(product)

        for value in self._project:
            header = Path.path(TargetConditional.value(value))
            if header is None:
                continue
            action = Cp(
                header,
                self.product.project_headers_path.path_by_appending(
                    header.basename()))
            self.actions.append(action)
            action.set_product(product)
Ejemplo n.º 8
0
    def generate(self):
        generated = """
build """ + self.output.relative() + """: Assemble """ + self.path.relative(
        ) + self.generate_dependencies() + """
    flags = """
        asflags = TargetConditional.value(self.product.ASFLAGS)
        if asflags is not None:
            generated += " " + asflags
        return generated
Ejemplo n.º 9
0
    def generate(self):
        appName = (
            Configuration.current.build_directory.relative()
            + """/"""
            + self.executableName
            + """/"""
            + self.executableName
        )
        libDependencyName = self.product.product_name
        swiftSources = ""
        for value in self.sources:
            resource = Path.path(TargetConditional.value(value))
            if resource is None:
                continue
            swiftSources += " " + resource.relative()

        return (
            """
build """
            + appName
            + """: SwiftExecutable """
            + swiftSources
            + self.generate_dependencies(libDependencyName)
            + """
    flags = -I"""
            + Configuration.current.build_directory.path_by_appending(self.product.name).relative()
            + self.product.ROOT_HEADERS_FOLDER_PATH
            + " -I"
            + Configuration.current.build_directory.path_by_appending(self.product.name).relative()
            + " -L"
            + Configuration.current.build_directory.path_by_appending(self.product.name).relative()
            + " "
            + TargetConditional.value(self.product.SWIFTCFLAGS)
            + """
build """
            + self.executableName
            + """: phony | """
            + appName
            + """
"""
        )
Ejemplo n.º 10
0
 def module_sources(self, primary):
     modules = []
     for value in self._sources:
         source = Path.path(TargetConditional.value(value))
         if source is None:
             continue
         if source.absolute() != primary:
             modules.append(source.relative())
         else:
             modules.append("-primary-file")
             modules.append(source.relative())
     return modules
Ejemplo n.º 11
0
 def module_sources(self, primary):
     modules = []
     for value in self._sources:
         source = Path.path(TargetConditional.value(value))
         if source is None:
             continue
         if source.absolute() != primary:
             modules.append(source.relative())
         else:
             modules.append("-primary-file")
             modules.append(source.relative())
     return modules
Ejemplo n.º 12
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        for value in self._sources:
            source = Path.path(TargetConditional.value(value))
            if source is None:
                continue
            action = CompileSource.compile(source, self)
            if action is None:
                print("Unable to compile source " + source.absolute())
                assert action is not None
            self.actions.append(action)
            action.set_product(product)
Ejemplo n.º 13
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        for value in self._sources:
            source = Path.path(TargetConditional.value(value))
            if source is None:
                continue
            action = CompileSource.compile(source, self)
            if action is None:
                print("Unable to compile source " + source.absolute())
                assert action is not None
            self.actions.append(action)
            action.set_product(product)
Ejemplo n.º 14
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        for value in self._resources:
            resource = Path.path(TargetConditional.value(value))
            if resource is None:
                continue

            action = Cp(
                resource,
                Configuration.current.build_directory.path_by_appending(
                    self._resourcesDir).path_by_appending(resource.basename()))
            self.actions.append(action)
            action.set_product(product)
Ejemplo n.º 15
0
    def generate(self):
        generated = (
            """
build """
            + self.output.relative()
            + """: Assemble """
            + self.path.relative()
            + self.generate_dependencies()
            + """
    flags = """
        )
        asflags = TargetConditional.value(self.product.ASFLAGS)
        if asflags is not None:
            generated += " " + asflags
        return generated
Ejemplo n.º 16
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        for value in self._resources:
            resource = Path.path(TargetConditional.value(value))
            if resource is None:
                continue

            action = Cp(
                resource,
                Configuration.current.build_directory.path_by_appending(self._resourcesDir).path_by_appending(
                    resource.basename()
                ),
            )
            self.actions.append(action)
            action.set_product(product)
Ejemplo n.º 17
0
    def generate(self):
        generated = """
build """ + self.output.relative(
        ) + """: CompileSwift """ + self.path.relative(
        ) + self.generate_dependencies() + """
    module_sources = """ + self.module_sources + """
    module_name = """ + self.product.name + """
    flags = """
        generated += " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative()
        generated += " -I" + Configuration.current.build_directory.path_by_appending(
            self.product.name).relative(
            ) + self.product.ROOT_HEADERS_FOLDER_PATH
        generated += " -I" + Configuration.current.build_directory.relative()
        swiftflags = TargetConditional.value(self.product.SWIFTCFLAGS)
        if swiftflags is not None:
            generated += " " + swiftflags
        return generated
Ejemplo n.º 18
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        for value in self._sources:
            source = Path.path(TargetConditional.value(value))
            if source is None:
                continue
            action = CompileSource.compile(source, self)
            if action is None:
                print("Unable to compile source " + source.absolute())
                assert action is not None
            self.actions.append(action)
            action.set_product(product)
        self._module = Configuration.current.build_directory.path_by_appending(
            self.product.name).path_by_appending(self.product.name +
                                                 ".swiftmodule")
        product.add_dependency(MergeSwiftModule(self._module.relative()))
Ejemplo n.º 19
0
    def set_product(self, product):
        BuildAction.set_product(self, product)
        self.actions = []

        for value in self._sources:
            source = Path.path(TargetConditional.value(value))
            if source is None:
                continue
            action = CompileSource.compile(source, self)
            if action is None:
                print("Unable to compile source " + source.absolute())
                assert action is not None
            self.actions.append(action)
            action.set_product(product)
        self._module = Configuration.current.build_directory.path_by_appending(self.product.name).path_by_appending(
            self.product.name + ".swiftmodule"
        )
        product.add_dependency(MergeSwiftModule(self._module.relative()))
Ejemplo n.º 20
0
    def generate(self):
        generated = BuildPhase.generate(self)
        generated += "\n\n"
        objects = ""
        partial_modules = ""
        partial_docs = ""
        for value in self._sources:
            path = Path.path(value)
            compiled = Configuration.current.build_directory.path_by_appending(self.product.name).path_by_appending(
                path.relative() + ".o"
            )
            objects += compiled.relative() + " "
            partial_modules += compiled.relative() + ".~partial.swiftmodule "
            partial_docs += compiled.relative() + ".~partial.swiftdoc "

        generated += (
            """
build """
            + self._module.relative()
            + ": MergeSwiftModule "
            + objects
            + """
    partials = """
            + partial_modules
            + """
    module_name = """
            + self.product.name
            + """
    flags = -I"""
            + self.product.public_module_path.relative()
            + """ """
            + TargetConditional.value(self.product.SWIFTCFLAGS)
            + """ -emit-module-doc-path """
            + self._module.parent().path_by_appending(self.product.name).relative()
            + """.swiftdoc 
"""
        )
        return generated